use of simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaAngleForce_addAngle in project ffx by mjschnie.
the class ForceFieldEnergyOpenMM method addAngleForce.
private void addAngleForce() {
Angle[] angles = super.getAngles();
if (angles == null || angles.length < 1) {
return;
}
int nAngles = angles.length;
List<Angle> normalAngles = new ArrayList<>();
// Sort all normal angles from in-plane angles
for (int i = 0; i < nAngles; i++) {
if (angles[i].getAngleMode() == Angle.AngleMode.NORMAL) {
normalAngles.add(angles[i]);
}
}
nAngles = normalAngles.size();
if (nAngles < 1) {
return;
}
amoebaAngleForce = OpenMM_AmoebaAngleForce_create();
for (int i = 0; i < nAngles; i++) {
Angle angle = normalAngles.get(i);
int i1 = angle.getAtom(0).getXyzIndex() - 1;
int i2 = angle.getAtom(1).getXyzIndex() - 1;
int i3 = angle.getAtom(2).getXyzIndex() - 1;
int nh = angle.nh;
OpenMM_AmoebaAngleForce_addAngle(amoebaAngleForce, i1, i2, i3, angle.angleType.angle[nh], OpenMM_KJPerKcal * AngleType.units * angle.angleType.forceConstant);
}
if (angles[0].angleType.angleFunction == AngleFunction.SEXTIC) {
OpenMM_AmoebaAngleForce_setAmoebaGlobalAngleCubic(amoebaAngleForce, AngleType.cubic);
OpenMM_AmoebaAngleForce_setAmoebaGlobalAngleQuartic(amoebaAngleForce, AngleType.quartic);
OpenMM_AmoebaAngleForce_setAmoebaGlobalAnglePentic(amoebaAngleForce, AngleType.quintic);
OpenMM_AmoebaAngleForce_setAmoebaGlobalAngleSextic(amoebaAngleForce, AngleType.sextic);
}
OpenMM_System_addForce(system, amoebaAngleForce);
logger.log(Level.INFO, " Added angles ({0})", nAngles);
}
Aggregations