9. Force field selection

The mdpow.forcefields module contains settings for selecting different force fields and the corresponding solvent topologies.

The OPLS-AA, CHARMM/CGENFF and the AMBER/GAFF force field are directly supported. It is possible to use a different forcefield by implementing a Forcefield with the correct files and supplying suitable .mdp files. For an example of how to do this, look at the martini-example.ipynb under doc/examples/martini-example.

mdpow.forcefields.DEFAULT_FORCEFIELD = 'OPLS-AA'

Default force field. At the moment, OPLS-AA, CHARMM/CGENFF, and AMBER/GAFF are directly supported. However, it is not recommended to change the default here as this behavior is not tested.

9.1. Solvent models

Different water models are already supported

mdpow.forcefields.GROMACS_WATER_MODELS = {'m24': <M24 water: identifier=m24, ff=OPLS-AA>, 'spc': <SPC water: identifier=spc, ff=OPLS-AA>, 'spce': <SPC/E water: identifier=spce, ff=OPLS-AA>, 'tip3p': <TIP3P water: identifier=tip3p, ff=OPLS-AA>, 'tip4p': <TIP4P water: identifier=tip4p, ff=OPLS-AA>, 'tip4pd': <TIP4P-D water: identifier=tip4pd, ff=OPLS-AA>, 'tip4pew': <TIP4PEW water: identifier=tip4pew, ff=OPLS-AA>, 'tip5p': <TIP5P water: identifier=tip5p, ff=OPLS-AA>}

Dictionary of GromacsSolventModel instances, one for each Gromacs water model available under the force field directory. The keys are the water model identifiers. For OPLS-AA the following ones are available.

as well as different general solvent models

mdpow.forcefields.GROMACS_SOLVENT_MODELS = {'AMBER': {'cyclohexane': <CYCLOHEXANE water: identifier=cyclohexane, ff=OPLS-AA>, 'octanol': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'toluene': <TOLUENE water: identifier=toluene, ff=OPLS-AA>, 'wetoctanol': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>}, 'CHARMM': {'cyclohexane': <CYCLOHEXANE water: identifier=cyclohexane, ff=OPLS-AA>, 'octanol': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'toluene': <TOLUENE water: identifier=toluene, ff=OPLS-AA>, 'wetoctanol': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>}, 'OPLS-AA': {'cyclohexane': <CYCLOHEXANE water: identifier=cyclohexane, ff=OPLS-AA>, 'octanol': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'octanolnew': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'toluene': <TOLUENE water: identifier=toluene, ff=OPLS-AA>, 'wetoctanol': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>, 'wetoctanolnew': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>}}

Solvents available in GROMACS; the keys of the dictionary are the forcefields.

9.2. Internal data

mdpow.forcefields.SPECIAL_WATER_COORDINATE_FILES = {'m24': 'spc216.gro', 'spc': 'spc216.gro', 'spce': 'spc216.gro', 'tip3p': 'spc216.gro', 'tip4p': None, 'tip4pd': 'tip4p.gro', 'tip4pew': 'tip4p.gro', 'tip5p': None}

For some water models we cannot derive the filename for the equilibrated box so we supply them explicitly.

mdpow.forcefields.GROMACS_WATER_MODELS = {'m24': <M24 water: identifier=m24, ff=OPLS-AA>, 'spc': <SPC water: identifier=spc, ff=OPLS-AA>, 'spce': <SPC/E water: identifier=spce, ff=OPLS-AA>, 'tip3p': <TIP3P water: identifier=tip3p, ff=OPLS-AA>, 'tip4p': <TIP4P water: identifier=tip4p, ff=OPLS-AA>, 'tip4pd': <TIP4P-D water: identifier=tip4pd, ff=OPLS-AA>, 'tip4pew': <TIP4PEW water: identifier=tip4pew, ff=OPLS-AA>, 'tip5p': <TIP5P water: identifier=tip5p, ff=OPLS-AA>}

Dictionary of GromacsSolventModel instances, one for each Gromacs water model available under the force field directory. The keys are the water model identifiers. For OPLS-AA the following ones are available.

mdpow.forcefields.GROMACS_SOLVENT_MODELS = {'AMBER': {'cyclohexane': <CYCLOHEXANE water: identifier=cyclohexane, ff=OPLS-AA>, 'octanol': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'toluene': <TOLUENE water: identifier=toluene, ff=OPLS-AA>, 'wetoctanol': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>}, 'CHARMM': {'cyclohexane': <CYCLOHEXANE water: identifier=cyclohexane, ff=OPLS-AA>, 'octanol': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'toluene': <TOLUENE water: identifier=toluene, ff=OPLS-AA>, 'wetoctanol': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>}, 'OPLS-AA': {'cyclohexane': <CYCLOHEXANE water: identifier=cyclohexane, ff=OPLS-AA>, 'octanol': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'octanolnew': <OCTANOL water: identifier=octanol, ff=OPLS-AA>, 'toluene': <TOLUENE water: identifier=toluene, ff=OPLS-AA>, 'wetoctanol': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>, 'wetoctanolnew': <WETOCTANOL water: identifier=wetoctanol, ff=OPLS-AA>}}

Solvents available in GROMACS; the keys of the dictionary are the forcefields.

mdpow.forcefields.ALL_FORCEFIELDS = {'AMBER': AMBER, 'CHARMM': CHARMM, 'OPLS-AA': OPLS-AA}

The builtin forcefields’ names and the corresponding Forcefield instance

9.3. Internal classes and functions

class mdpow.forcefields.GromacsSolventModel(identifier: str, name: Optional[str] = None, itp: Union[str, os.PathLike, None] = None, coordinates: Union[str, os.PathLike, None] = None, description: Optional[str] = None, forcefield: str = 'OPLS-AA')[source]

Data for a solvent model in Gromacs.

guess_filename(extension)[source]

Guess the filename for the model and add extension

class mdpow.forcefields.Forcefield(name: str, solvent_models: Dict[str, mdpow.forcefields.GromacsSolventModel], forcefield_dir: pathlib.Path, ions_itp: pathlib.Path, default_water_itp: pathlib.Path, default_water_model: str = 'tip4p', water_models: Optional[Dict[str, mdpow.forcefields.GromacsSolventModel]] = None)[source]

Contains information about files corresponding to a forcefield.

New in version 0.9.0.

ff_paths

Get the path to the forcefield directory and the ITP files for the ions and default water model.

mdpow.forcefields.get_water_model(watermodel='tip4p')[source]

Return a GromacsSolventModel corresponding to identifier watermodel

mdpow.forcefields.get_solvent_identifier(solvent_type, model=None, forcefield: Union[mdpow.forcefields.Forcefield, str] = OPLS-AA)[source]

Get the identifier for a solvent model.

The identifier is needed to access a water model (i.e., a GromacsSolventModel) through get_solvent_model(). Because we have multiple water models but only limited other solvents, the organization of these models is a bit convoluted and it is best to obtain the desired water model in these two steps:

identifier = get_solvent_identifier("water", model="tip3p")
model = get_solvent_model(identifier)

For solvent_type water: either provide None or “water” for the specific model (and the default water model for the Forcefield will be selected, or a specific water model such as “tip3p” or “spce” (see GROMACS_WATER_MODELS). For other “octanol” or “wetoctanol” of OPLS-AA forcefield, the model is used to select a specific model. For other solvents and forcefields, “model” is not required.

Raises ValueError:
 If there is no identifier found for the combination.
Returns:An identifier

Changed in version 0.9.0: Raises ValueError instead of returning None.

mdpow.forcefields.get_solvent_model(identifier, forcefield: Union[mdpow.forcefields.Forcefield, str] = OPLS-AA)[source]

Return a GromacsSolventModel corresponding to identifier identifier.

If identifier is “water” then the default water model for the Forcefield is assumed.

Changed in version 0.9.0: Function can now also accept a Forcefield for the forcefield argument.