OpenMMForceFields

repository·main·Indexed 18 days ago

https://github.com/openmm/openmmforcefields

Provides extended support for AMBER, CHARMM, OpenFF, and Espaloma force fields within the OpenMM ecosystem. It includes tools for the seamless parameterization of biomolecular systems and small molecules using GAFF, Espaloma, and the Open Force Field Toolkit, as well as scripts like convert_amber.py and convert_charmm.py to convert force fields to OpenMM XML format.

Tokens
8.1K
Snippets
25
Records
39
Agent score
63%

What's inside openmmforcefields

  1. Overview of MiniDrugBank data

    main

    The openmmforcefields repository includes data retrieved from MiniDrugBank (as of March 15, 2019). This dataset is used for molecular modeling and force field testing.

    The available files in the data/minidrugbank/ directory are:

    • MiniDrugBank.sdf: The original SDF file containing the full dataset.
    • MiniDrugBank-without-unspecifie-stereochemistry.sdf: A filtered version of the dataset where molecules without specified stereochemistry have been removed.
  2. Overview of OpenMMForceFields supported force fields

    main

    OpenMMForceFields provides support for several major force field families within OpenMM, enabling parameterization for biopolymers and small molecules.

    Supported force fields include:

    • AMBER: Includes major AMBER force fields distributed with AmberTools 19.9 (excluding ff19SB), and GAFF (General AMBER Force Field) versions 1.x (up to 1.81) and 2.x (up to 2.11).
    • CHARMM: Supports non-polarizable protein, nucleic acid, and pre-parameterized small molecule force fields from the Aug 2015 CHARMM36 release. Note: This conversion has not yet been fully validated.
    • Open Force Field Initiative: Supports all distributed Open Force Field Initiative force fields, including the smirnoff99Frosst series and openforcefield-1.0.0 (also known as "Parsley").
  3. Access prepared JACS test systems

    main

    The perses_jacs_systems directory provides prepared .pdb and .sdf input files for OpenMM. These files are derived from the supplementary material of the JACS publication: 'Accurate and Reliable Prediction of Relative Ligand Binding Potency in Prospective Drug Discovery by Way of a Modern Free-Energy Calculation Protocol and Force Field'.

    These systems are useful for testing OpenMM force field applications against established benchmarks. The files are adapted from:

    • Input_TI (Lin Frank Song)
    • perses_jacs_systems (Bryce Allen)
  4. Supported force fields in OpenMMForceFields

    main

    OpenMMForceFields provides support for several major force field families for use with OpenMM:

    • AMBER: Includes major AMBER force fields from AmberTools 19.9 (excluding ff19SB) and GAFF small molecule force fields (GAFF 1.x through 1.81 and GAFF 2.x through 2.11).
    • CHARMM: Includes non-polarizable protein, nucleic acid, and pre-parameterized small molecule force fields from the August 2015 CHARMM36 release. Note: This conversion has not yet been fully validated.
    • Open Force Field Initiative: Includes all distributed OpenFF force fields, such as the smirnoff99Frosst series and openff-1.0.0 ("Parsley"). Note: This support is experimental and requires a development version of OpenMM 7.5.0.

    Additionally, the project provides residue template generators for GAFF (GAFFTemplateGenerator) and SMIRNOFF (SMIRNOFFTemplateGenerator).

  5. Use the experimental SystemGenerator for unified force field management

    main
    The project includes an experimental SystemGenerator designed to manage the creation of OpenMM System objects for both biopolymers and small molecules through a single, unified API.
  6. Manage partial charges for small molecules

    main

    When using GAFFTemplateGenerator, partial charges are handled as follows:

    1. User-specified charges: If the openff.toolkit.topology.Molecule object has nonzero partial charges stored in its Molecule.partial_charges attribute, those charges are used.
    2. Automatic generation: If no charges are provided, the toolkit uses Antechamber (from AmberTools) to assign AM1-BCC charges (antechamber -c bcc). Conformers for charge assignment are generated by RDKit.

    Important Requirements:

    • The Molecule object must have all protons and stereochemistry explicitly specified.
    • It must match the exact protonation and tautomeric state of the molecule in the OpenMM Topology.
    • Atom ordering does not need to match.
    • Caching behavior: Once charges are generated or specified, they are cached. Re-adding the same molecule with different charges will not update the assigned charges.
  7. Generate residue templates for small molecules

    main

    To handle small molecules in OpenMM, you can use residue template generators. These generators create the necessary templates to describe small molecule residues within a larger system. The two primary generators available in openmmforcefields.generators are:

    • GAFFTemplateGenerator: Used for generating templates based on the General AMBER Force Field (GAFF).
    • SMIRNOFFTemplateGenerator: Used for generating templates based on the SMIRNOFF force field (often used with OpenFF).
    from openmmforcefields.generators import GAFFTemplateGenerator, SMIRNOFFTemplateGenerator
  8. Use SystemGenerator to build OpenMM systems

    main

    The SystemGenerator class in openmmforcefields.generators is the high-level interface used to create OpenMM System objects. It orchestrates the application of force fields (like AMBER, CHARMM, or OpenFF) and integrates residue template generators to ensure both biopolymers and small molecules are correctly parameterized in the resulting system.

    from openmmforcefields.generators import SystemGenerator
  9. How the Amber YAML input format works

    main

    The conversion script uses YAML files to define conversion tasks. The structure depends on the MODE selected.

    Required Header

    The first entry in the YAML must define the source package:

    - sourcePackage: AmberTools
      sourcePackageVersion: 15

    LEAPRC Mode

    Used for protein and nucleic acid force fields. It converts the contents of a leaprc file.

    - MODE: LEAPRC
    - Source: leaprc.ff14SB
      Reference:
        - "Reference text..."
      Test:
        - protein
        - nucleic

    RECIPE Mode

    Used for water and ion conversions. It uses a mix of .dat, frcmod, and .lib files instead of a leaprc file.

    - MODE: RECIPE
    - sourcePackage2: OpenMM
      sourcePackageVersion2: 7.5.0
    - Source:
        - parm/frcmod.ionsjc_tip3p
        - lib/atomic_ions.lib
      Solvent_source: tip3p.xml
      Solvent: tip3p
      Name: tip3p_standard
    - sourcePackage: AmberTools
      sourcePackageVersion: 15
    - MODE: LEAPRC
    - Source: leaprc.ff14SB
      Reference:
      - >- 
        Maier, J.A., et al. (2015). ff14SB...
      Test:
      - protein
      - nucleic
  10. Understand Versioneer auto-versioning

    main

    The project uses Versioneer to automatically infer the installed version based on git tags and commit distance. The version follows PEP 440.

    Version Formats:

    • If the current commit matches a git tag: openmmforcefields-X.Y.Z (e.g., openmmforcefields-0.1.2).
    • If the current commit is ahead of a tag: X.Y.Z+N-hash, where N is the number of commits ahead and hash is the git commit hash.

    Regex Pattern: \d+.\d+.\d+(?\+\d+-[a-z0-9]+)

  11. Configure water and ion conversions using RECIPE mode

    main

    Water and ion force fields are converted using MODE: RECIPE. Because water models are converted manually, they are provided as XML files in the files/ directory. To create a water-ion combination, you must specify the Solvent_source (the XML file or the name of a previously defined 'standard' XML) and the Solvent name.

    Key YAML fields for RECIPE mode:

    • Source: List of AMBER input files (.frcmod, .lib, etc.).
    • Solvent_source: The water XML file in files/ OR the Name of a standard XML set.
    • Solvent: The name of the solvent (e.g., tip3p).
    • Name: The desired name for the resulting .xml file.
    • Standard: (Optional) Used in 'overloading' sets to reference a base standard XML for energy testing.
    - MODE: RECIPE
    - Source:
      - parm/frcmod.ionsjc_tip3p
      - lib/atomic_ions.lib
      Solvent_source: tip3p.xml
      Solvent: tip3p
      Name: tip3p_standard
      Test:
      - water_ion
  12. Convert CHARMM forcefields to OpenMM FFXML

    main

    To convert CHARMM forcefield parameters to OpenMM ffxml format, you must first download and unpack the official CHARMM TOPPAR files, then run the conversion script.

    Note on ParmEd: Due to known issues in the standard ParmEd repository, you cannot use a prepackaged version of ParmEd for this conversion. You must use a custom patched version of ParmEd (available in the patched-for-charmm-conversion branch of the epretti/ParmEd repository) to ensure the conversion works correctly.

    Warning: It is strongly advised to review the input conversion specification files (.yaml) and all warning messages produced during conversion. If warnings regarding inconsistent parameter values appear, review the TOPPAR files to locate and potentially exclude the offending parameters to ensure force field correctness.

    # Retrieve and unpack the CHARMM files
    wget -O toppar.tgz http://mackerell.umaryland.edu/download.php?filename=CHARMM_ff_params_files/toppar_c36_jul24.tgz
    tar -xzf toppar.tgz
    (cd toppar/drude; tar -xzf drude_toppar_2023.tgz)
    
    # Convert force fields
    ./convert_charmm.sh
    
    # Test force fields
    ./test_charmm.sh