Foyer: A package for atom-typing as well as applying and disseminating forcefields
Overview
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).
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')
Getting started
Getting started with SMARTS-based atom-typing
Defining force fields:
Example foyer force field files:
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:
Using Foyer to perform atom typing:
- Basic usage examples
- Detailed Jupyter notebook tutorials, including integration with mBuild
- Jupyter notebook tutorials, from our paper
Documentation:
- Documentation website: http://mosdef-hub.github.io/foyer/
Installation instructions
Citing Foyer:
-
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.