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);
}
Aggregations