Skip to content

Commit

Permalink
Merge pull request #101 from openforcefield/add_hydrogen_radii
Browse files Browse the repository at this point in the history
Remove generics, add hydrogen radii, rename ffxml files
  • Loading branch information
davidlmobley committed Mar 1, 2018
2 parents 88d0c4e + 0105183 commit 32ad91a
Show file tree
Hide file tree
Showing 43 changed files with 1,334 additions and 1,328 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ __pycache__/
# C extensions
*.so

# OS X extra files
*.DS_Store

# Distribution / packaging
.Python
env/
Expand Down Expand Up @@ -66,4 +69,3 @@ target/
examples/testing/test_system_conversion/out.*
examples/testing/test_system_conversion/out2.*
examples/testing/test_system_conversion/system.*

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ conda install --yes -c conda-forge -c omnia openforcefield

## `SMIRNOFF`: SMIRks Native Open Force Field

This repository houses the SMIRNOFF SMIRKS-based force field format, along with classes to parameterize OpenMM systems given [SMIRNOFF `.ffxml` format files](https://github.com/openforcefield/openforcefield/blob/master/The-SMIRNOFF-force-field-format.md).
This repository houses the SMIRNOFF SMIRKS-based force field format, along with classes to parameterize OpenMM systems given [SMIRNOFF `.offxml` format files](https://github.com/openforcefield/openforcefield/blob/master/The-SMIRNOFF-force-field-format.md).

The SMIRNOFF force field format is documented [here](https://github.com/openforcefield/smirnoff/blob/master/The-SMIRNOFF-force-field-format.md).

The SMIRNOFF forcefield format is available in sample form under `data/forcefield`, and is handled by `forcefield.py`.
An example comparing SMIRNOFF versus AMBER energies for the parm@frosst forcefield is provided under
examples/SMIRNOFF_comparison, where two scripts can compare energies for a single molecule or for the entire AlkEthOH set.
Note that two forcefields are currently available in this format, `Frosst_AlkEthOH.ffxml`,
the parm@frosst forcefield as it should have been for this set, and `Frosst_AlkEthOH_parmAtFrosst.ffxml`,
Note that two forcefields are currently available in this format, `Frosst_AlkEthOH.offxml`,
the parm@frosst forcefield as it should have been for this set, and `Frosst_AlkEthOH_parmAtFrosst.offxml`,
the forcefield as it was actually implemented (containing several bugs as noted in the file itself).

It can also be of interest to know what SMIRNOFF parameters would be applied to particular molecules. Utility functionality for this is provided under `forcefield_labeler.py`, which has generally similar structure to `forcefield.py` but instead of providing OpenMM systems with parameters, it can be applied to specific molecules and returns information about what parameters would be applied.
Expand All @@ -61,7 +61,7 @@ mols = read_molecules('benzene.mol2')
topology = generateTopologyFromOEMol(mols[0])

# Load a SMIRNOFF small molecule forcefield for alkanes, ethers, and alcohols
FF_filename = get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.ffxml')
FF_filename = get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.offxml')
forcefield = ForceField(FF_filename)

# Create the OpenMM system, additionally specifying a list of OEMol objects for the unique molecules in the system
Expand Down
6 changes: 3 additions & 3 deletions The-SMIRNOFF-force-field-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ While designed for [`OpenMM`](http://openmm.org), parameters encoded in this for

The SMIRNOFF format provides XML `ffxml` files that are parseable by the `ForceField` class of the `openforcefield.typing.smirnoff` module.
These encode parameters for a force field based on a SMIRKS-based specification of the chemical environment the parameters are to be applied to.
The file has tags corresponding to OpenMM force terms (`HarmonicBondForce`, `HarmonicAngleForce`, `PeriodicTorsionForce`, etc., as discussed in more detail below); these specify units used for the different constants provided for individual force terms, for example (see the [AlkEthOH example ffxml](https://github.com/openforcefield/openforcefield/blob/master/openforcefield/data/forcefield/Frosst_AlkEthOH.ffxml)):
The file has tags corresponding to OpenMM force terms (`HarmonicBondForce`, `HarmonicAngleForce`, `PeriodicTorsionForce`, etc., as discussed in more detail below); these specify units used for the different constants provided for individual force terms, for example (see the [AlkEthOH example ffxml](https://github.com/openforcefield/openforcefield/blob/master/openforcefield/data/forcefield/Frosst_AlkEthOH.offxml)):
```XML
<HarmonicAngleForce angle_unit="degrees" k_unit="kilocalories_per_mole/radian**2">
```
Expand Down Expand Up @@ -38,7 +38,7 @@ This means that specific forces are generally implemented as discussed in the [O

## Parameter sections

For this section it will help to have on hand an example SMIRNOFF file, such as that the [AlkEthOH example ffxml](https://github.com/openforcefield/openforcefield/blob/master/openforcefield/data/forcefield/Frosst_AlkEthOH.ffxml) or the larger prototype [SMIRNOFF99Frosst ffxml](https://github.com/openforcefield/SMIRNOFF99Frosst/blob/master/SMIRNOFF99Frosst.ffxml).
For this section it will help to have on hand an example SMIRNOFF file, such as that the [AlkEthOH example ffxml](https://github.com/openforcefield/openforcefield/blob/master/openforcefield/data/forcefield/Frosst_AlkEthOH.offxml) or the larger prototype [SMIRNOFF99Frosst ffxml](https://github.com/openforcefield/SMIRNOFF99Frosst/blob/master/SMIRNOFF99Frosst.offxml).

Before getting in to individual sections, it's worth noting that the XML parser ignores attributes in the XML that it does not understand, so providing a parameter line for an angle that specifies (for example) a second force constant `k2` will lead to no effect.

Expand Down Expand Up @@ -296,7 +296,7 @@ oechem.OETriposAtomNames(mol)
# Load forcefield
from openforcefield.typing import smirnoff
from openforcefield.utils import get_data_filename
forcefield = smirnoff.ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.ffxml'))
forcefield = smirnoff.ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.offxml'))

# Generate an OpenMM Topology and create an OpenMM System
import openforcefield.tools
Expand Down
2 changes: 1 addition & 1 deletion examples/SMIRNOFF_comparison/compare_molecule_energies.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
oechem.OETriposAtomNames(mol)

# Load forcefield
forcefield = ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.ffxml'))
forcefield = ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.offxml'))

# Compare energies
prmtop = os.path.join( datapath, molname+'.top')
Expand Down
2 changes: 1 addition & 1 deletion examples/SMIRNOFF_comparison/compare_set_energies.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
oechem.OETriposAtomNames(mol)

# Load forcefield
forcefield = ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.ffxml'))
forcefield = ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.offxml'))

# Compare energies
prmtop = os.path.join( datapath, molname+'.top')
Expand Down
2 changes: 1 addition & 1 deletion examples/SMIRNOFF_simulation/run_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
positions = extractPositionsFromOEMol(mol)

# Load a SMIRNOFF small molecule forcefield for alkanes, ethers, and alcohols
forcefield = ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.ffxml'))
forcefield = ForceField(get_data_filename('forcefield/Frosst_AlkEthOH_parmAtFrosst.offxml'))

# Create the OpenMM system
topology = generateTopologyFromOEMol(mol)
Expand Down
4 changes: 2 additions & 2 deletions examples/forcefield_modification/ManipulateParameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"positions = unit.Quantity(positions, unit.angstroms)\n",
"\n",
"# Load forcefield file\n",
"ffxml = get_data_filename('forcefield/Frosst_AlkEthOH.ffxml')\n",
"ffxml = get_data_filename('forcefield/Frosst_AlkEthOH.offxml')\n",
"ff = ForceField(ffxml)\n",
"\n",
"# Generate a topology\n",
Expand Down Expand Up @@ -153,7 +153,7 @@
],
"source": [
"# Load forcefield file\n",
"ffxml = get_data_filename('forcefield/Frosst_AlkEthOH.ffxml')\n",
"ffxml = get_data_filename('forcefield/Frosst_AlkEthOH.offxml')\n",
"ff = ForceField(ffxml)\n",
"\n",
"# Get a parameter by parameter id\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/host_guest_simulation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Example provided by David Mobley (UCI)

## Manifest
- smirnoff_host_guest.ipynb
- hbonds.ffxml: Force field XML file for constraining hbonds (from https://github.com/MobleyLab/SMIRNOFF_paper_code/blob/master/scripts/hbonds.ffxml, courtesy Andrea Rizzi )
- OA.mol2: mol2 file of Octa Acid with AM1-BCC charges, as distributed with SAMPL5 (where it was labeled OAH.mol2). Atom types converted from GAFF to SYBYL via Antechember.
- hbonds.offxml: Force field XML file for constraining hbonds (from https://github.com/MobleyLab/SMIRNOFF_paper_code/blob/master/scripts/hbonds.offxml, courtesy Andrea Rizzi )
- OA.mol2: mol2 file of Octa Acid with AM1-BCC charges, as distributed with SAMPL5 (where it was labeled OAH.mol2). Atom types converted from GAFF to SYBYL via Antechember.
2 changes: 1 addition & 1 deletion examples/host_guest_simulation/smirnoff_host_guest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
"source": [
"# Load force fields for small molecules (plus default ions), water, and (temporarily) hydrogen bonds.\n",
"# TODO add HBonds constraint through createSystem when openforcefield#32 is implemented, alleviating need for constraints here\n",
"ff = ForceField('forcefield/smirnoff99Frosst.ffxml', 'hbonds.ffxml', 'forcefield/tip3p.ffxml') \n",
"ff = ForceField('forcefield/smirnoff99Frosst.offxml', 'hbonds.offxml', 'forcefield/tip3p.offxml') \n",
"\n",
"# Set up system\n",
"# This draws to some extent on Andrea Rizzi's code at https://github.com/MobleyLab/SMIRNOFF_paper_code/blob/master/scripts/create_input_files.py\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/label_molecule/get_parameter_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from openforcefield.typing.engines.smirnoff import get_molecule_parameterIDs

oemols = read_molecules(get_data_filename('molecules/AlkEthOH-tripos.mol2.gz'))
ffxml = get_data_filename('forcefield/Frosst_AlkEthOH.ffxml')
ffxml = get_data_filename('forcefield/Frosst_AlkEthOH.offxml')

parameters_by_molecule, parameters_by_ID = get_molecule_parameterIDs( oemols, ffxml)

Expand Down
2 changes: 1 addition & 1 deletion examples/label_molecule/label_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
OEAddExplicitHydrogens(mol)


ff = ForceField( get_data_filename('forcefield/Frosst_AlkEthOH.ffxml') )
ff = ForceField( get_data_filename('forcefield/Frosst_AlkEthOH.offxml') )

labels= ff.labelMolecules( [mol], verbose = True )
print labels
Expand Down
2 changes: 1 addition & 1 deletion examples/partial_bondorder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


## Manifest
* `Frosst_AlkEthOH_extracarbons.ffxml`: SMIRNOFF FFXML file adding extra carbon parameters to cover benzene (adapted from work by Christopher Bayly, and using partial bond orders to compress the [#6X3]-[#6X3], [#6X3]:[#6X3] and [#6X3]=[#6X3] bond parameters to a single line.
* `Frosst_AlkEthOH_extracarbons.offxml`: SMIRNOFF FFXML file adding extra carbon parameters to cover benzene (adapted from work by Christopher Bayly, and using partial bond orders to compress the [#6X3]-[#6X3], [#6X3]:[#6X3] and [#6X3]=[#6X3] bond parameters to a single line.
* `test_partialbondorder.ipynb`: Apply these parameters to benzene and print info about the bonded parameters which are assigned.
2 changes: 1 addition & 1 deletion examples/partial_bondorder/test_partialbondorder.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"source": [
"# Load our forcefield from this directory. Use of partial bond orders here means there is only one [#6X3]~[#6X3] \n",
"# bond parameter line rather than three which otherwise would be required\n",
"ffxml = 'Frosst_AlkEthOH_extracarbons.ffxml'\n",
"ffxml = 'Frosst_AlkEthOH_extracarbons.offxml'\n",
"ff = ForceField(ffxml)"
]
},
Expand Down
2 changes: 1 addition & 1 deletion examples/testing/test_impropers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ This directory tests whether impropers are properly (heh) implemented by looking
- `tleap_tools.py` from `openforcefield/utilities/SMIRNOFF_vs_frosst/`, which provides functionality for parameterizing using AMBER
- test_impropers.ipynb for comparing energies of impropers; tests on several molecules including one which uses steric strain to make the improper energy for a ring system be nontrivial.
- `parm_Frosst.frcmod` from `openforcefield/utilities/SMIRNOFF_vs_frosst/parm_at_Frosst.tgz`
- `smirnoff99Frosst_modified.ffxml`: `openforcefield/utilities/convert_frosst/smirnoff99Frosst.ffxml` but modified to make a CA-CA-CA specific angle parameter (unimportant since it is intra-ring, but important for energy) match AMBER
- `smirnoff99Frosst_modified.offxml`: `openforcefield/utilities/convert_frosst/smirnoff99Frosst.offxml` but modified to make a CA-CA-CA specific angle parameter (unimportant since it is intra-ring, but important for energy) match AMBER
- Miscellaneous molecule files - mol2 files and AMBER format coordinate/parameter files generated by the ipython notebook
4 changes: 2 additions & 2 deletions examples/testing/test_impropers/test_impropers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"outputs": [],
"source": [
"# Load our forcefield \n",
"#ffxml = 'forcefield/smirnoff99Frosst.ffxml'\n",
"ffxml = 'smirnoff99Frosst_modified.ffxml'\n",
"#ffxml = 'forcefield/smirnoff99Frosst.offxml'\n",
"ffxml = 'smirnoff99Frosst_modified.offxml'\n",
"ff = forcefield.ForceField(ffxml)"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"outputs": [],
"source": [
"pdbfile = PDBFile('cyclohexane_ethanol_0.4_0.6.pdb')\n",
"ff = forcefield.ForceField('forcefield/Frosst_AlkEthOH.ffxml')\n",
"ff = forcefield.ForceField('forcefield/Frosst_AlkEthOH.offxml')\n",
"\n",
"mols = []\n",
"flavor = oechem.OEIFlavor_Generic_Default | oechem.OEIFlavor_MOL2_Default | oechem.OEIFlavor_MOL2_Forcefield\n",
Expand Down
11 changes: 6 additions & 5 deletions openforcefield/data/forcefield/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# SMIRNOFF FFXML files for openforcefield.typing.engines.smirnoff.forcefield

## Manifest
- `Frosst_AlkEthOH.ffxml`: Original FFXML file for the AlkEthOH region of chemical space/set as hand created by Christopher Bayly
- `Frosst_AlkEthOH_parmAtFrosst.ffxml`: Same as the above but with additional "bugs" introduced (see comments in the FFXML) in order to reproduce problems introduced by atom typing in the AMBER forcefields, typically missing torsions which resulted in specialized torsions instead being given the default. In other words, this forcefield file can reproduce erroneous AMBER energies.
- `Frosst_AlkEthOH_MDL.ffxml`: Same as Frosst_AlkEthOH.ffxml but uses the MDL aromaticity model for bond perception. No functional difference for this region of chemical space, but illustrates how to invoke that model.
- `Frosst_AlkEthOH_withIDs`: Adds parameter IDs to Frosst_AlkEthOH.ffxml for use by the forcefield labeler to show which parameters are used in which places. Otherwise identical.
- `benzene_minimal.ffxml`: Minimal ffxml file for benzene constructed from smirnoff99Frosst 9/22/16 (dx.doi.org/10.5281/zenodo.154235), intended for use in testing impropers.
- `Frosst_AlkEthOH.offxml`: Original OFFXML file for the AlkEthOH region of chemical space/set as hand created by Christopher Bayly
- `Frosst_AlkEthOH_parmAtFrosst.offxml`: Same as the above but with additional "bugs" introduced (see comments in the FFXML) in order to reproduce problems introduced by atom typing in the AMBER forcefields, typically missing torsions which resulted in specialized torsions instead being given the default. In other words, this forcefield file can reproduce erroneous AMBER energies.
- `Frosst_AlkEthOH_MDL.offxml`: Same as Frosst_AlkEthOH.offxml but uses the MDL aromaticity model for bond perception. No functional difference for this region of chemical space, but illustrates how to invoke that model.
- `Frosst_AlkEthOH_withIDs`: Adds parameter IDs to Frosst_AlkEthOH.offxml for use by the forcefield labeler to show which parameters are used in which places. Otherwise identical.
- `benzene_minimal.offxml`: Minimal offxml file for benzene constructed from smirnoff99Frosst 9/22/16 (dx.doi.org/10.5281/zenodo.154235), intended for use in testing impropers.
- `smirnoff99Frosst.offxml`: SMIRNOFF99Frosst force field as generated in `utilities/convert_frosst` from `smirnoffishFrcmod.parm99Frosst.txt` as per the README.md there. Also maintained as a separate package on GitHub at https://github.com/openforcefield/smirnoff99frosst .
Loading

0 comments on commit 32ad91a

Please sign in to comment.