Search in sources :

Example 1 with OpenMM_AmoebaBondForce_addBond

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

the class ForceFieldEnergyOpenMM method addBondForce.

private void addBondForce() {
    Bond[] bonds = super.getBonds();
    if (bonds == null || bonds.length < 1) {
        return;
    }
    int nBonds = bonds.length;
    amoebaBondForce = OpenMM_AmoebaBondForce_create();
    double kParameterConversion = OpenMM_KJPerKcal / (OpenMM_NmPerAngstrom * OpenMM_NmPerAngstrom);
    for (int i = 0; i < nBonds; i++) {
        Bond bond = bonds[i];
        int i1 = bond.getAtom(0).getXyzIndex() - 1;
        int i2 = bond.getAtom(1).getXyzIndex() - 1;
        BondType bondType = bond.bondType;
        OpenMM_AmoebaBondForce_addBond(amoebaBondForce, i1, i2, bond.bondType.distance * OpenMM_NmPerAngstrom, kParameterConversion * bondType.forceConstant * BondType.units);
    }
    if (bonds[0].bondType.bondFunction == BondFunction.QUARTIC) {
        OpenMM_AmoebaBondForce_setAmoebaGlobalBondCubic(amoebaBondForce, BondType.cubic / OpenMM_NmPerAngstrom);
        OpenMM_AmoebaBondForce_setAmoebaGlobalBondQuartic(amoebaBondForce, BondType.quartic / (OpenMM_NmPerAngstrom * OpenMM_NmPerAngstrom));
    }
    OpenMM_System_addForce(system, amoebaBondForce);
    logger.log(Level.INFO, " Added bonds ({0})", nBonds);
}
Also used : BondType(ffx.potential.parameters.BondType) Bond(ffx.potential.bonded.Bond) OpenMM_AmoebaBondForce_addBond(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaBondForce_addBond) RestraintBond(ffx.potential.bonded.RestraintBond) OpenMM_CustomBondForce_addBond(simtk.openmm.OpenMMLibrary.OpenMM_CustomBondForce_addBond) OpenMM_HarmonicBondForce_addBond(simtk.openmm.OpenMMLibrary.OpenMM_HarmonicBondForce_addBond) OpenMM_System_addConstraint(simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint) CoordRestraint(ffx.potential.nonbonded.CoordRestraint)

Aggregations

Bond (ffx.potential.bonded.Bond)1 RestraintBond (ffx.potential.bonded.RestraintBond)1 CoordRestraint (ffx.potential.nonbonded.CoordRestraint)1 BondType (ffx.potential.parameters.BondType)1 OpenMM_AmoebaBondForce_addBond (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaBondForce_addBond)1 OpenMM_CustomBondForce_addBond (simtk.openmm.OpenMMLibrary.OpenMM_CustomBondForce_addBond)1 OpenMM_HarmonicBondForce_addBond (simtk.openmm.OpenMMLibrary.OpenMM_HarmonicBondForce_addBond)1 OpenMM_System_addConstraint (simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint)1