Search in sources :

Example 1 with OpenMM_AmoebaInPlaneAngleForce_addAngle

use of simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaInPlaneAngleForce_addAngle in project ffx by mjschnie.

the class ForceFieldEnergyOpenMM method addInPlaneAngleForce.

private void addInPlaneAngleForce() {
    Angle[] angles = super.getAngles();
    if (angles == null || angles.length < 1) {
        return;
    }
    int nAngles = angles.length;
    List<Angle> inPlaneAngles = new ArrayList<>();
    // Sort all in-plane angles from normal angles
    for (int i = 0; i < nAngles; i++) {
        if (angles[i].getAngleMode() == Angle.AngleMode.IN_PLANE) {
            inPlaneAngles.add(angles[i]);
        }
    }
    nAngles = inPlaneAngles.size();
    if (nAngles < 1) {
        return;
    }
    amoebaInPlaneAngleForce = OpenMM_AmoebaInPlaneAngleForce_create();
    for (int i = 0; i < nAngles; i++) {
        Angle angle = inPlaneAngles.get(i);
        int i1 = angle.getAtom(0).getXyzIndex() - 1;
        int i2 = angle.getAtom(1).getXyzIndex() - 1;
        int i3 = angle.getAtom(2).getXyzIndex() - 1;
        int i4 = angle.getAtom4().getXyzIndex() - 1;
        int nh = angle.nh;
        OpenMM_AmoebaInPlaneAngleForce_addAngle(amoebaInPlaneAngleForce, i1, i2, i3, i4, angle.angleType.angle[nh], OpenMM_KJPerKcal * AngleType.units * angle.angleType.forceConstant);
    }
    OpenMM_AmoebaInPlaneAngleForce_setAmoebaGlobalInPlaneAngleCubic(amoebaInPlaneAngleForce, AngleType.cubic);
    OpenMM_AmoebaInPlaneAngleForce_setAmoebaGlobalInPlaneAngleQuartic(amoebaInPlaneAngleForce, AngleType.quartic);
    OpenMM_AmoebaInPlaneAngleForce_setAmoebaGlobalInPlaneAnglePentic(amoebaInPlaneAngleForce, AngleType.quintic);
    OpenMM_AmoebaInPlaneAngleForce_setAmoebaGlobalInPlaneAngleSextic(amoebaInPlaneAngleForce, AngleType.sextic);
    OpenMM_System_addForce(system, amoebaInPlaneAngleForce);
    logger.log(Level.INFO, " Added in-plane angles ({0})", nAngles);
}
Also used : Angle(ffx.potential.bonded.Angle) OpenMM_AmoebaAngleForce_addAngle(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaAngleForce_addAngle) OpenMM_AmoebaInPlaneAngleForce_addAngle(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaInPlaneAngleForce_addAngle) ArrayList(java.util.ArrayList) OpenMM_System_addConstraint(simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint) CoordRestraint(ffx.potential.nonbonded.CoordRestraint)

Aggregations

Angle (ffx.potential.bonded.Angle)1 CoordRestraint (ffx.potential.nonbonded.CoordRestraint)1 ArrayList (java.util.ArrayList)1 OpenMM_AmoebaAngleForce_addAngle (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaAngleForce_addAngle)1 OpenMM_AmoebaInPlaneAngleForce_addAngle (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaInPlaneAngleForce_addAngle)1 OpenMM_System_addConstraint (simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint)1