use of simtk.openmm.OpenMM_Vec3 in project ffx by mjschnie.
the class ForceFieldEnergyOpenMM method setOpenMMPositions.
/**
* setOpenMMPositions takes in an array of doubles generated by the DYN
* reader method and appends these values to a Vec3Array. Finally this
* method sets the created Vec3Array as the positions of the context.
*
* @param x
* @param numberOfVariables
*/
public void setOpenMMPositions(double[] x, int numberOfVariables) {
assert numberOfVariables == getNumberOfVariables();
if (positions == null) {
positions = OpenMM_Vec3Array_create(0);
} else {
OpenMM_Vec3Array_resize(positions, 0);
}
OpenMM_Vec3.ByValue pos = new OpenMM_Vec3.ByValue();
for (int i = 0; i < numberOfVariables; i = i + 3) {
pos.x = x[i] * OpenMM_NmPerAngstrom;
pos.y = x[i + 1] * OpenMM_NmPerAngstrom;
pos.z = x[i + 2] * OpenMM_NmPerAngstrom;
OpenMM_Vec3Array_append(positions, pos);
}
OpenMM_Context_setPositions(context, positions);
}
use of simtk.openmm.OpenMM_Vec3 in project ffx by mjschnie.
the class ForceFieldEnergyOpenMM method setDefaultPeriodicBoxVectors.
private void setDefaultPeriodicBoxVectors() {
OpenMM_Vec3 a = new OpenMM_Vec3();
OpenMM_Vec3 b = new OpenMM_Vec3();
OpenMM_Vec3 c = new OpenMM_Vec3();
Crystal crystal = super.getCrystal();
if (!crystal.aperiodic()) {
a.x = crystal.a * OpenMM_NmPerAngstrom;
a.y = 0.0 * OpenMM_NmPerAngstrom;
a.z = 0.0 * OpenMM_NmPerAngstrom;
b.x = 0.0 * OpenMM_NmPerAngstrom;
b.y = crystal.b * OpenMM_NmPerAngstrom;
b.z = 0.0 * OpenMM_NmPerAngstrom;
c.x = 0.0 * OpenMM_NmPerAngstrom;
c.y = 0.0 * OpenMM_NmPerAngstrom;
c.z = crystal.c * OpenMM_NmPerAngstrom;
OpenMM_System_setDefaultPeriodicBoxVectors(system, a, b, c);
}
}
Aggregations