use of ffx.numerics.Potential in project ffx by mjschnie.
the class TitrationUtils method titratingMultiresidueFactory.
/**
* Create a MultiResidue from the given Residue by adding its alternated
* protonation state(s) as alternate possibilities.
*/
public static MultiResidue titratingMultiresidueFactory(MolecularAssembly mola, Residue res) {
ForceField ff = mola.getForceField();
Potential potential = mola.getPotentialEnergy();
if (!(potential instanceof ForceFieldEnergy)) {
logger.warning(String.format("TitrationFactory only supported by ForceFieldEnergy potentials."));
throw new IllegalStateException();
}
ForceFieldEnergy ffe = (ForceFieldEnergy) potential;
/* Create new titration state. */
Titration titration = Titration.lookup(res);
String targetName = (titration.protForm != res.getAminoAcid3()) ? titration.protForm.toString() : titration.deprotForm.toString();
int resNumber = res.getResidueNumber();
Residue.ResidueType resType = res.getResidueType();
Residue newRes = new Residue(targetName, resNumber, resType);
/* Wrap both states in a MultiResidue. */
MultiResidue multiRes = new MultiResidue(res, ff, ffe);
Polymer polymer = findResiduePolymer(res, mola);
polymer.addMultiResidue(multiRes);
multiRes.addResidue(newRes);
/* Begin in protonated state by default. */
multiRes.setActiveResidue(titration.protForm);
propagateInactiveResidues(multiRes, false);
ffe.reInit();
return multiRes;
}
use of ffx.numerics.Potential in project ffx by mjschnie.
the class AlgorithmUtils method minimize.
/**
* Minimizes a MolecularAssembly using AMOEBA potential energy.
*
* @param assembly Assembly to minimize
* @param eps Convergence criterion
* @return A Potential.
*/
@Override
public Potential minimize(MolecularAssembly assembly, double eps) {
if (assembly == null) {
logger.info(" No active system to minimize.");
return null;
} else {
Minimize minimize = new Minimize(assembly, null);
Potential potential = minimize.minimize(eps);
return potential;
}
}
use of ffx.numerics.Potential in project ffx by mjschnie.
the class ModelingShell method minimize.
/**
* <p>
* minimize</p>
*
* @param eps a double.
* @return a {@link ffx.numerics.Potential} object.
*/
public Potential minimize(double eps) {
if (interrupted) {
logger.info(" Algorithm interrupted - skipping minimization.");
return null;
}
if (terminatableAlgorithm != null) {
logger.info(" Algorithm already running - skipping minimization.");
return null;
}
MolecularAssembly active = mainPanel.getHierarchy().getActive();
if (active != null) {
Minimize minimize = new Minimize(active, this);
terminatableAlgorithm = minimize;
Potential potential = minimize.minimize(eps);
terminatableAlgorithm = null;
return potential;
} else {
logger.info(" No active system to minimize.");
}
return null;
}
use of ffx.numerics.Potential in project ffx by mjschnie.
the class UIUtils method minimize.
@Override
public Potential minimize(MolecularAssembly assembly, double eps) {
Optional<FFXSystem> origSys = switchTo(assembly);
Potential pot = modelingShell.minimize(eps);
switchBack(origSys);
return pot;
}
Aggregations