use of ffx.potential.extended.TitrationESV in project ffx by mjschnie.
the class PhMD method readyup.
private void readyup() {
// Create MultiTerminus objects to wrap termini.
if (config.titrateTermini) {
for (Residue res : mola.getResidueList()) {
if (res.getPreviousResidue() == null || res.getNextResidue() == null) {
MultiTerminus multiTerminus = new MultiTerminus(res, ff, ffe, mola);
Polymer polymer = findResiduePolymer(res, mola);
polymer.addMultiTerminus(res, multiTerminus);
reInitialize(true, false);
titratingTermini.add(multiTerminus);
logger.info(String.format(" Titrating: %s", multiTerminus));
}
}
}
/* Create containers for titratables: MultiResidues for discrete, ExtendedVariables for continuous. */
if (distribution == Distribution.CONTINUOUS) {
esvSystem = new ExtendedSystem(mola);
esvSystem.setConstantPh(pH);
for (Residue res : chosenResidues) {
MultiResidue multi = TitrationUtils.titratingMultiresidueFactory(mola, res);
TitrationESV esv = new TitrationESV(esvSystem, multi);
titratingESVs.add(esv);
for (Residue background : multi.getInactive()) {
inactivateResidue(background);
}
esvSystem.addVariable(esv);
}
ffe.attachExtendedSystem(esvSystem);
logger.info(format(" Continuous pHMD readied with %d residues.", titratingESVs.size()));
} else {
for (Residue res : chosenResidues) {
// Create MultiResidue objects to wrap titratables.
MultiResidue multiRes = new MultiResidue(res, ff, ffe);
Polymer polymer = findResiduePolymer(res, mola);
polymer.addMultiResidue(multiRes);
recursiveMap(res, multiRes);
// Switch back to the original form and ready the ForceFieldEnergy.
multiRes.setActiveResidue(res);
reInitialize(true, false);
titratingMultis.add(multiRes);
logger.info(String.format(" Titrating: %s", multiRes));
}
logger.info(format(" Discrete MCMD readied with %d residues.", titratingMultis.size()));
}
switch(distribution) {
default:
case DISCRETE:
molDyn.setMonteCarloListener(this, MonteCarloNotification.EACH_STEP);
break;
case CONTINUOUS:
ffe.attachExtendedSystem(esvSystem);
molDyn.attachExtendedSystem(esvSystem, 100);
break;
}
}
Aggregations