moldesign.models package

Submodules

moldesign.models.amber module

class moldesign.models.amber.GAFF(**kwargs)[source]

Bases: moldesign.models.models.ForceField

Model the energy using the GAFF forcefield

This is implemented as a special case of the ForceField energy model; it automates small parameterization process

PARAMETERS = [<Parameter "partial_charges", type: str>, <Parameter "gaff_version", type: str>, <Parameter "cutoff", type: float, units: nanometer>, <Parameter "nonbonded", type: str>, <Parameter "implicit_solvent", type: str>, <Parameter "solute_dielectric", type: float>, <Parameter "solvent_dielectric", type: float>, <Parameter "ewald_error", type: float>, <<class 'moldesign.parameters.Parameter'> at 111bbd790 - exc in __repr__>]
prep(force=False)[source]

moldesign.models.base module

class moldesign.models.base.EnergyModelBase(**params)[source]

Bases: moldesign.method.Method

Base class for all energy models

ALL_PROPERTIES = ['potential_energy', 'forces']

List[str] – List of all the properties that this model can calculate

DEFAULT_PROPERTIES = ['potential_energy', 'forces']

List[str] – list of the properties that are always calculated by this method

PARAMETERS = []
calculate(requests)[source]

Calculate the the default properties and any additiona requests

Parameters:requests (List[str]) – the requested properties to calculate
Returns:A dict of calculated properties (or a job object that will return them)
Return type:utils.DotDict
finite_difference_force(direction=0, stepsize=<Quantity(0.025, 'ang')>)[source]

Compute force using a finite difference with the given step size.

Parameters:
  • direction (int) – EITHER +1, -1, (for one-sided finite differences) or 0 (for central difference - better but twice as expensive)
  • step (u.Scalar[lenght]) – step size to take in each direction
Returns:

force vector, len= self.mol.ndims

Return type:

u.Vector[force]

get_formal_charge()[source]

Determine the formal charge of the molecular system. This can be set either as a molecular attribute OR in the parameters of the energy model.

Returns:the formal charge used for this model
Return type:u.Scalar[charge]
minimize(method='bfgs', **kwargs)[source]

If the energy model provides its own minimizer, it should be hooked up here

prep()[source]

Prepare to run. Possibly do a test to ensure that the model is ready.

class moldesign.models.base.MMBase(*args, **kwargs)[source]

Bases: moldesign.models.base.EnergyModelBase

Common interface for molecular mechanics

PARAMETERS = [<Parameter "cutoff", type: float, units: nanometer>, <Parameter "nonbonded", type: str>, <Parameter "implicit_solvent", type: str>, <Parameter "solute_dielectric", type: float>, <Parameter "solvent_dielectric", type: float>, <Parameter "ewald_error", type: float>, <<class 'moldesign.parameters.Parameter'> at 111bbd790 - exc in __repr__>]
class moldesign.models.base.QMBase(**params)[source]

Bases: moldesign.models.base.EnergyModelBase

Common interface for quantum mechanics

ALL_PROPERTIES = ['potential_energy', 'nuclear_repulsion', 'dipole_moment', 'orbitals', 'orbital_energies']
DEFAULT_PROPERTIES = ['potential_energy', 'nuclear_repulsion', 'dipole_moment', 'orbitals', 'orbital_energies']
PARAMETERS = [<<class 'moldesign.parameters.Parameter'> at 111bbd7d0 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bbd850 - exc in __repr__>, <Parameter "active_electrons", type: int>, <Parameter "active_orbitals", type: int>, <Parameter "state_average", type: int>, <<class 'moldesign.parameters.Parameter'> at 111bbdb90 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bbdbd0 - exc in __repr__>, <Parameter "store_orb_guesses", type: bool>, <Parameter "multiplicity", type: int>, <<class 'moldesign.parameters.Parameter'> at 111bc4390 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bc4410 - exc in __repr__>]
set_wfn_guess()[source]
class moldesign.models.base.QMMMBase(**params)[source]

Bases: moldesign.models.base.EnergyModelBase

ALL_PROPERTIES = ['potential_energy', 'qm_energy', 'mm_energy', 'interaction_energyqm_dipole_moment', 'orbitals', 'orbital_energies']
DEFAULT_PROPERTIES = ['potential_energy', 'qm_energy', 'mm_energy', 'interaction_energyqm_dipole_moment', 'orbitals', 'orbital_energies']
PARAMETERS = [<Parameter "cutoff", type: float, units: nanometer>, <Parameter "nonbonded", type: str>, <Parameter "implicit_solvent", type: str>, <Parameter "solute_dielectric", type: float>, <Parameter "solvent_dielectric", type: float>, <Parameter "ewald_error", type: float>, <<class 'moldesign.parameters.Parameter'> at 111bbd790 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bbd7d0 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bbd850 - exc in __repr__>, <Parameter "active_electrons", type: int>, <Parameter "active_orbitals", type: int>, <Parameter "state_average", type: int>, <<class 'moldesign.parameters.Parameter'> at 111bbdb90 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bbdbd0 - exc in __repr__>, <Parameter "store_orb_guesses", type: bool>, <Parameter "multiplicity", type: int>, <<class 'moldesign.parameters.Parameter'> at 111bc4390 - exc in __repr__>, <<class 'moldesign.parameters.Parameter'> at 111bc4410 - exc in __repr__>]

moldesign.models.models module

“Generic” energy models - models that can be specified directly by name, without worrying about which specific implementation is used.

Currently, everything here is an alias. However, more complicated logic (including runtime dispatch) may be used to determine the best implementation in a given situation

class moldesign.models.models.ForceField(**kwargs)[source]

Bases: moldesign.models.openmm.OpenMMPotential

class moldesign.models.models.RHF(*args, **kwargs)[source]

Bases: moldesign.models.pyscf.PySCFPotential

class moldesign.models.models.DFT(*args, **kwargs)[source]

Bases: moldesign.models.pyscf.PySCFPotential

class moldesign.models.models.B3LYP(*args, **kwargs)[source]

Bases: moldesign.models.pyscf.PySCFPotential

class moldesign.models.models.MP2(*args, **kwargs)[source]

Bases: moldesign.models.pyscf.PySCFPotential

class moldesign.models.models.CASSCF(*args, **kwargs)[source]

Bases: moldesign.models.pyscf.PySCFPotential

moldesign.models.openmm module

class moldesign.models.openmm.OpenMMPotential(**kwargs)[source]

Bases: moldesign.models.base.MMBase, moldesign.interfaces.openmm.OpenMMPickleMixin

Creates an OpenMM “context” to drive energy calculations. Note that, while a dummy integrator is assigned, a different context will be created for any MD calculations.

Variables:sim – openmm simulation object
DEFAULT_PROPERTIES = ['potential_energy', 'forces']
calculate(self, requests=None, wait=True)[source]

Drive a calculation and, when finished, update the parent molecule with the results. TODO: this update is SYNCHRONOUS, unlike other calculate methods that run remotely. TODO: Probably need to update DummyJob (call it localjob, syncjob?) to handle this :param requests: list of quantities to calculate :return: PythonJob-like object

get_forcefield(self, wait=True)[source]

Get the force field parameters for this molecule.

Note

The returned object is for introspection only; it can’t be used (yet) to modify the energy model, and
it doesn’t include the entire force field (most notably missing are periodic replicate forces, 1-4 nonbonded attenuation, and implicit solvent effects)
Returns:moldesign.forcefield.ForceField
get_openmm_simulation()[source]
minimize(**kwargs)[source]
prep(force=False)[source]

Drive the construction of the openmm simulation This will rebuild this OpenMM simulation if: A) it’s not built yet, or B) there’s a new integrator

reset_constraints()[source]

moldesign.models.pyscf module

class moldesign.models.pyscf.PySCFPotential(**kwargs)[source]

Bases: moldesign.models.base.QMBase

ALL_PROPERTIES = ['potential_energy', 'wfn', 'mulliken', 'eri_tensor', 'forces', 'nuclear_forces', 'electronic_forces']
DEFAULT_PROPERTIES = ['potential_energy', 'wfn', 'mulliken']
FORCE_UNITS = <Unit('hartree / bohr')>
PARAM_SUPPORT = {'theory': ['rhf', 'rks', 'mp2'], 'functional': ['b3lyp', 'blyp', 'pbe0', 'x3lyp', 'MPW3LYP5']}
calculate(self, requests=None, wait=True)[source]
prep(force=False)[source]
theoryname

moldesign.models.sqm module

class moldesign.models.sqm.SQMPotential(**kwargs)[source]

Bases: moldesign.models.base.QMBase

ALL_PROPERTIES = ['potential_energy', 'wfn', 'mulliken']
DEFAULT_PROPERTIES = ['potential_energy', 'wfn', 'mulliken']
FORCE_UNITS = <Unit('hartree / bohr')>
THEORIES = ['MNDO', 'MNDO/d', 'AM1', 'AM1/d', 'PM3', 'PDDG', 'PDDG/MNDO', 'PDDG/PM3', 'RM1', 'PM3CARB1', 'PM3-MAIS', 'PM6', 'DFTB']
calculate(requests=None, guess=None, wait=True)[source]

moldesign.models.toys module

class moldesign.models.toys.Spring(**params)[source]

Bases: moldesign.models.base.EnergyModelBase

Two atoms attached by a spring

ALL_PROPERTIES = ['potential_energy', 'force']
DEFAULT_PROPERTIES = ['potential_energy', 'force']
PARAMETERS = [<Parameter "k", type: float, units: eV / ang ** 2>, <Parameter "d0", type: float, units: ang>]
calculate(requests)[source]
prep()[source]
class moldesign.models.toys.HarmonicOscillator(**params)[source]

Bases: moldesign.models.base.EnergyModelBase

Applies a harmonic potential (centered at 0) to the x-component of every atom

PARAMETERS = [<Parameter "k", type: float, units: eV / ang ** 2>]
calculate(requests)[source]