use of ffx.potential.nonbonded.COMRestraint in project ffx by mjschnie.
the class ForceFieldEnergy method setLambda.
/**
* {@inheritDoc}
*/
@Override
public void setLambda(double lambda) {
if (lambdaTerm) {
if (lambda <= 1.0 && lambda >= 0.0) {
this.lambda = lambda;
if (vanderWaalsTerm) {
vanderWaals.setLambda(lambda);
}
if (multipoleTerm) {
particleMeshEwald.setLambda(lambda);
}
if (restraintBondTerm && restraintBonds != null) {
for (int i = 0; i < restraintBonds.length; i++) {
restraintBonds[i].setLambda(lambda);
}
}
if (ncsTerm && ncsRestraint != null) {
ncsRestraint.setLambda(lambda);
}
if (restrainTerm && !coordRestraints.isEmpty()) {
// autoCoordRestraint.setLambda(lambda);
for (CoordRestraint restraint : coordRestraints) {
restraint.setLambda(lambda);
}
}
if (comTerm && comRestraint != null) {
comRestraint.setLambda(lambda);
}
if (lambdaTorsions) {
for (int i = 0; i < nTorsions; i++) {
torsions[i].setLambda(lambda);
}
for (int i = 0; i < nPiOrbitalTorsions; i++) {
piOrbitalTorsions[i].setLambda(lambda);
}
for (int i = 0; i < nTorsionTorsions; i++) {
torsionTorsions[i].setLambda(lambda);
}
}
} else {
String message = String.format("Lambda value %8.3f is not in the range [0..1].", lambda);
logger.warning(message);
}
} else {
logger.fine(" Attempting to set a lambda value on a ForceFieldEnergy with lambdaterm false.");
}
}
use of ffx.potential.nonbonded.COMRestraint in project ffx by mjschnie.
the class ForceFieldEnergy method getdEdXdL.
/**
* {@inheritDoc}
*
* @param gradients
*/
@Override
public void getdEdXdL(double[] gradients) {
if (!lambdaBondedTerms) {
if (vanderWaalsTerm) {
vanderWaals.getdEdXdL(gradients);
}
if (multipoleTerm) {
particleMeshEwald.getdEdXdL(gradients);
}
if (restraintBondTerm) {
for (int i = 0; i < nRestraintBonds; i++) {
restraintBonds[i].getdEdXdL(gradients);
}
}
if (ncsTerm && ncsRestraint != null) {
ncsRestraint.getdEdXdL(gradients);
}
if (restrainTerm && !coordRestraints.isEmpty()) {
for (CoordRestraint restraint : coordRestraints) {
restraint.getdEdXdL(gradients);
}
// autoCoordRestraint.getdEdXdL(gradients);
}
if (comTerm && comRestraint != null) {
comRestraint.getdEdXdL(gradients);
}
if (lambdaTorsions) {
double[] grad = new double[3];
int index = 0;
for (int i = 0; i < nAtoms; i++) {
Atom a = atoms[i];
if (a.isActive()) {
a.getLambdaXYZGradient(grad);
gradients[index++] += grad[0];
gradients[index++] += grad[1];
gradients[index++] += grad[2];
}
}
}
}
}
Aggregations