Search in sources :

Example 1 with Potential

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;
}
Also used : MultiResidue(ffx.potential.bonded.MultiResidue) Residue(ffx.potential.bonded.Residue) Polymer(ffx.potential.bonded.Polymer) ForceField(ffx.potential.parameters.ForceField) ForceFieldEnergy(ffx.potential.ForceFieldEnergy) Potential(ffx.numerics.Potential) MultiResidue(ffx.potential.bonded.MultiResidue)

Example 2 with Potential

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;
    }
}
Also used : Potential(ffx.numerics.Potential)

Example 3 with 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;
}
Also used : MolecularAssembly(ffx.potential.MolecularAssembly) Minimize(ffx.algorithms.Minimize) Potential(ffx.numerics.Potential)

Example 4 with Potential

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;
}
Also used : Potential(ffx.numerics.Potential)

Aggregations

Potential (ffx.numerics.Potential)4 Minimize (ffx.algorithms.Minimize)1 ForceFieldEnergy (ffx.potential.ForceFieldEnergy)1 MolecularAssembly (ffx.potential.MolecularAssembly)1 MultiResidue (ffx.potential.bonded.MultiResidue)1 Polymer (ffx.potential.bonded.Polymer)1 Residue (ffx.potential.bonded.Residue)1 ForceField (ffx.potential.parameters.ForceField)1