Foyer is an open-source Python tool for defining and applying force field atom-typing rules in a format that is both human- and machine-readable. It parametrizes chemical topologies, generating, syntactically correct input files for various simulation engines. Foyer provides a framework for force field dissemination, helping to eliminate ambiguity in atom-typing and improving reproducibility (for more information, see our paper or its corresponding pre-print).
About the name: foyer was inspired by the antechamber tool in the Amber ecosystem. Foyer plays a similar role to antechamber, hence the tongue-in-cheek, shared vestibular reference.
Foyer defines force fields in an XML format, where SMARTS strings are used to define the chemical context of a particular atom type and “overrides” are used to set rule precedence, rather than a rigid hierarchical scheme. Foyer builds upon the OpenMM .xml force field file, annotated with SMARTS-based atomtypes, e.g.:
<ForceField>
<AtomTypes>
<Type name="opls_135" class="CT" element="C" mass="12.01100" def="[C;X4](C)(H)(H)H" desc="alkane CH3"/>
<Type name="opls_140" class="HC" element="H" mass="1.00800" def="H[C;X4]" desc="alkane H"/>
</AtomTypes>
</ForceField>
Foyer can apply the forcefield to arbitrary chemical topologies. We currently support:
Application of a force field can be as simple as:
from foyer import Forcefield
import parmed as pmd
untyped_ethane = pmd.load_file('ethane.mol2', structure=True)
oplsaa = Forcefield(forcefield_files='oplsaa.xml')
ethane = oplsaa.apply(untyped_ethane)
# Save to any format supported by ParmEd
ethane.save('ethane.top')
ethane.save('ethane.gro')
The Foyer
package is part of the Molecular Simulation Design Framework (MoSDeF) project.
Libraries in the MoSDeF ecosystem are designed to provide utilities necessary to streamline
a researcher's simulation workflow. When setting up simulation studies,
we also recommend users to follow the TRUE
(Transparent, Reproducible, Usable-by-others, and Extensible) standard, which is a set of common
practices meant to improve the reproducibility of computational simulation research.
To use foyer
in a jupyter-notebook that runs from a docker container with all the dependencies installed use the following command:
$ docker pull mosdef/foyer:latest
$ docker run -it --name foyer -p 8888:8888 mosdef/foyer:latest\
/opt/conda/envs/foyer-docker/bin/jupyter notebook --ip="*"
Alternatively, you can also start a Bourne shell directly:
$ docker run -it --name foyer mosdef/foyer:latest
To learn more about using foyer
with docker, please refer to the documentation here .
Foyer currently includes a subset of the OPLS AA and TraPPE forcefields, currently part of the source distribution:
Additional example force field XML files:
- https://github.com/chrisiacovella/OPLSaa_perfluoroalkanes
- https://github.com/mosdef-hub/forcefield_perfluoroethers
- https://github.com/summeraz/OPLSaa_alkylsilanes
Example template for disseminating force fields:
- Basic usage examples
- Detailed Jupyter notebook tutorials, including integration with mBuild
- Jupyter notebook tutorials, from our paper
- Documentation website: http://foyer.mosdef.org
-
If you use this package, please cite our paper published in Computational Materials Science.
-
This manuscript is also available in its pre-print form on arxiv
-
The paper and examples in this work were developed for tag paper_COMMAT_2019
-
Please also cite the github repository, https://github.com/mosdef-hub/foyer
Various sub-portions of this library may be independently distributed under different licenses. See those files for their specific terms.
This material is based upon work supported by the National Science Foundation under grants NSF ACI-1047828 and NSF ACI-1535150. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.