Skip to content
A package for atom-typing as well as applying and disseminating forcefields
Python Shell Batchfile TeX
Branch: master
Clone or download
mattwthompson Merge pull request #298 from mattwthompson/ff-version-number
Add version and name attributes to force field XML and class
Latest commit 05898c0 Dec 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github merging with mosdef-hub/foyer Sep 20, 2019
docs Merge pull request #266 from daico007/update_docs Oct 9, 2019
foyer Warn for missing name/version Dec 6, 2019
.gitignore Ignore VSCode project and setup files Dec 18, 2018
.landscape.yaml Final cleanup Mar 16, 2017
.travis.yml merging with mosdef-hub/foyer Sep 20, 2019
LICENSE.rst Remove coveralls badge from README Oct 31, 2019
azure-pipelines.yml Add Azure Pipelines CI (#273) Oct 18, 2019
codecov.yaml merging with mosdef-hub/foyer Sep 20, 2019
requirements.txt merging with mosdef-hub/foyer Sep 20, 2019

Foyer: A package for atom-typing as well as applying and disseminating forcefields

Gitter chat Linux Build Status Build Status Windows Build status PyPI Version Anaconda Badge codecov DOI


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

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

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

Example template for disseminating force fields:

Using Foyer to perform atom typing:


Installation instructions

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

You can’t perform that action at this time.