Atom-typing Options¶
The primary data structure in foyer is the Forcefield
class, which inherits
from the OpenMM class of the same name. The primary operation on this class is
the .apply()
function, which takes a chemical topology and returns a
parametrized ParmEd
Structure
. The user may pass some otions to this
function based on a particular use case.
Forcefield¶
-
class
foyer.forcefield.
Forcefield
(forcefield_files=None, name=None, validation=True, debug=False)[source]¶ Specialization of OpenMM’s Forcefield allowing SMARTS based atomtyping.
- Parameters
forcefield_files (list of str, optional, default=None) – List of forcefield files to load.
name (str, optional, default=None) – Name of a forcefield to load that is packaged within foyer.
-
apply
(structure, references_file=None, use_residue_map=True, assert_bond_params=True, assert_angle_params=True, assert_dihedral_params=True, assert_improper_params=False, combining_rule='geometric', verbose=False, *args, **kwargs)[source]¶ Apply the force field to a molecular structure
- Parameters
structure (parmed.Structure or mbuild.Compound) – Molecular structure to apply the force field to
references_file (str, optional, default=None) – Name of file where force field references will be written (in Bibtex format)
use_residue_map (boolean, optional, default=True) – Store atomtyped topologies of residues to a dictionary that maps them to residue names. Each topology, including atomtypes, will be copied to other residues with the same name. This avoids repeatedly calling the subgraph isomorphism on idential residues and should result in better performance for systems with many identical residues, i.e. a box of water. Note that for this to be applied to independent molecules, they must each be saved as different residues in the topology.
assert_bond_params (bool, optional, default=True) – If True, Foyer will exit if parameters are not found for all system bonds.
assert_angle_params (bool, optional, default=True) – If True, Foyer will exit if parameters are not found for all system angles.
assert_dihedral_params (bool, optional, default=True) – If True, Foyer will exit if parameters are not found for all system proper dihedrals.
assert_improper_params (bool, optional, default=False) – If True, Foyer will exit if parameters are not found for all system improper dihedrals.
combining_rule (str, optional, default=’geometric’) – The combining rule of the system, stored as an attribute of the ParmEd structure. Accepted arguments are geometric and lorentz.
verbose (bool, optional, default=False) – If True, Foyer will print debug-level information about notable or potentially problematic details it encounters.
-
createSystem
(topology, nonbondedMethod=NoCutoff, nonbondedCutoff=Quantity(value=1.0, unit=nanometer), constraints=None, rigidWater=True, removeCMMotion=True, hydrogenMass=None, switchDistance=None, **args)[source]¶ Construct an OpenMM System representing a Topology with this force field.
- Parameters
topology (Topology) – The Topology for which to create a System
nonbondedMethod (object=NoCutoff) – The method to use for nonbonded interactions. Allowed values are NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, or PME.
nonbondedCutoff (distance=1*nanometer) – The cutoff distance to use for nonbonded interactions
constraints (object=None) – Specifies which bonds and angles should be implemented with constraints. Allowed values are None, HBonds, AllBonds, or HAngles.
rigidWater (boolean=True) – If true, water molecules will be fully rigid regardless of the value passed for the constraints argument
removeCMMotion (boolean=True) – If true, a CMMotionRemover will be added to the System
hydrogenMass (mass=None) – The mass to use for hydrogen atoms bound to heavy atoms. Any mass added to a hydrogen is subtracted from the heavy atom to keep their total mass the same.
switchDistance (float=None) – The distance at which the potential energy switching function is turned on for
args – Arbitrary additional keyword arguments may also be specified. This allows extra parameters to be specified that are specific to particular force fields.
- Returns
the newly created System
- Return type
system
-
run_atomtyping
(structure, use_residue_map=True, **kwargs)[source]¶ Atomtype the topology
- Parameters
structure (parmed.structure.Structure) – Molecular structure to find atom types of
use_residue_map (boolean, optional, default=True) – Store atomtyped topologies of residues to a dictionary that maps them to residue names. Each topology, including atomtypes, will be copied to other residues with the same name. This avoids repeatedly calling the subgraph isomorphism on idential residues and should result in better performance for systems with many identical residues, i.e. a box of water. Note that for this to be applied to independent molecules, they must each be saved as different residues in the topology.