Search in sources :

Example 1 with OpenMM_PeriodicTorsionForce_addTorsion

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);
}
Also used : TorsionTorsionType(ffx.potential.parameters.TorsionTorsionType) ImproperTorsionType(ffx.potential.parameters.ImproperTorsionType) PiTorsionType(ffx.potential.parameters.PiTorsionType) TorsionType(ffx.potential.parameters.TorsionType) Torsion(ffx.potential.bonded.Torsion) OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion) TorsionTorsion(ffx.potential.bonded.TorsionTorsion) OpenMM_PeriodicTorsionForce_addTorsion(simtk.openmm.OpenMMLibrary.OpenMM_PeriodicTorsionForce_addTorsion) PiOrbitalTorsion(ffx.potential.bonded.PiOrbitalTorsion) OpenMM_AmoebaPiTorsionForce_addPiTorsion(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaPiTorsionForce_addPiTorsion) 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 PiOrbitalTorsion (ffx.potential.bonded.PiOrbitalTorsion)1 Torsion (ffx.potential.bonded.Torsion)1 TorsionTorsion (ffx.potential.bonded.TorsionTorsion)1 CoordRestraint (ffx.potential.nonbonded.CoordRestraint)1 ImproperTorsionType (ffx.potential.parameters.ImproperTorsionType)1 PiTorsionType (ffx.potential.parameters.PiTorsionType)1 TorsionTorsionType (ffx.potential.parameters.TorsionTorsionType)1 TorsionType (ffx.potential.parameters.TorsionType)1 OpenMM_AmoebaPiTorsionForce_addPiTorsion (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaPiTorsionForce_addPiTorsion)1 OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion)1 OpenMM_PeriodicTorsionForce_addTorsion (simtk.openmm.OpenMMLibrary.OpenMM_PeriodicTorsionForce_addTorsion)1 OpenMM_System_addConstraint (simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint)1