Foyer

A package for atom-typing as well as applying and disseminating force fields

License Citing Anaconda Codecov Azure

Overview

Foyer is an open-source Python tool that provides a framework for the application and dissemination of classical molecular modeling force fields. Importantly, it enables users to define and apply atom-typing rules in a format that is simultaneously human- and machine-readable. A primary goal of foyer is to eliminate ambiguity in the atom-typing and force field application steps of molecular simulations in order to improve reproducibility. Foyer force fields are defined in an XML format derived from the OpenMM XML specification. SMARTS strings are used to define the chemical context of each atom type and “overrides” are used to define clear precedence of different atom types. Foyer is designed to be compatible with the other tools in the Molecular Simulation Design Framework (MoSDeF) ecosystem.

Resources

Citation

If you use foyer in your research, please cite the foyer paper. See here for details.

Installation

Complete installation instructions are here. A conda installation is available:

conda create --name foyer foyer -c conda-forge

Example

Annotate an OpenMM .xml force field file with SMARTS-based atomtypes:

<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>

Apply the forcefield to arbitrary chemical topologies. We currently support:

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?

Check out our example template for disseminating force fields: https://github.com/mosdef-hub/forcefield_template

Credits

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.

Table of Contents