Search in sources :

Example 1 with ImproperTorsion

use of ffx.potential.bonded.ImproperTorsion in project ffx by mjschnie.

the class ForceFieldEnergyOpenMM method addImproperTorsionForce.

private void addImproperTorsionForce() {
    ImproperTorsion[] impropers = super.getImproperTorsions();
    if (impropers == null || impropers.length < 1) {
        return;
    }
    int nImpropers = impropers.length;
    amoebaImproperTorsionForce = OpenMM_PeriodicTorsionForce_create();
    for (int i = 0; i < nImpropers; i++) {
        ImproperTorsion improperTorsion = impropers[i];
        int a1 = improperTorsion.getAtom(0).getXyzIndex() - 1;
        int a2 = improperTorsion.getAtom(1).getXyzIndex() - 1;
        int a3 = improperTorsion.getAtom(2).getXyzIndex() - 1;
        int a4 = improperTorsion.getAtom(3).getXyzIndex() - 1;
        ImproperTorsionType improperTorsionType = improperTorsion.improperType;
        OpenMM_PeriodicTorsionForce_addTorsion(amoebaImproperTorsionForce, a1, a2, a3, a4, improperTorsionType.periodicity, improperTorsionType.phase * OpenMM_RadiansPerDegree, OpenMM_KJPerKcal * improperTorsion.units * improperTorsion.scaleFactor * improperTorsionType.k);
    }
    OpenMM_System_addForce(system, amoebaImproperTorsionForce);
    logger.log(Level.INFO, " Added improper torsions ({0})", nImpropers);
}
Also used : ImproperTorsionType(ffx.potential.parameters.ImproperTorsionType) ImproperTorsion(ffx.potential.bonded.ImproperTorsion) OpenMM_System_addConstraint(simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint) CoordRestraint(ffx.potential.nonbonded.CoordRestraint)

Aggregations

ImproperTorsion (ffx.potential.bonded.ImproperTorsion)1 CoordRestraint (ffx.potential.nonbonded.CoordRestraint)1 ImproperTorsionType (ffx.potential.parameters.ImproperTorsionType)1 OpenMM_System_addConstraint (simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint)1