use of simtk.openmm.OpenMMLibrary.OpenMM_PeriodicTorsionForce_addTorsion in project ffx by mjschnie.
the class ForceFieldEnergyOpenMM method addTorsionForce.
private void addTorsionForce() {
Torsion[] torsions = super.getTorsions();
if (torsions == null || torsions.length < 1) {
return;
}
int nTorsions = torsions.length;
amoebaTorsionForce = OpenMM_PeriodicTorsionForce_create();
for (int i = 0; i < nTorsions; i++) {
Torsion torsion = torsions[i];
int a1 = torsion.getAtom(0).getXyzIndex() - 1;
int a2 = torsion.getAtom(1).getXyzIndex() - 1;
int a3 = torsion.getAtom(2).getXyzIndex() - 1;
int a4 = torsion.getAtom(3).getXyzIndex() - 1;
TorsionType torsionType = torsion.torsionType;
int nTerms = torsionType.phase.length;
for (int j = 0; j < nTerms; j++) {
OpenMM_PeriodicTorsionForce_addTorsion(amoebaTorsionForce, a1, a2, a3, a4, j + 1, torsionType.phase[j] * OpenMM_RadiansPerDegree, OpenMM_KJPerKcal * torsion.units * torsionType.amplitude[j]);
}
}
OpenMM_System_addForce(system, amoebaTorsionForce);
logger.log(Level.INFO, " Added Torsions ({0})", nTorsions);
}
Aggregations