Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Create a SMIRNOFF template generator for a single molecule (benzene, created fro
from openff.toolkit import Molecule

molecule = Molecule.from_smiles("c1ccccc1")
# Create the SMIRNOFF template generator with the default installed force field (openff-2.1.0)
# Create the SMIRNOFF template generator with the default installed force field (openff-2.2.1)
from openmmforcefields.generators import (
SMIRNOFFTemplateGenerator,
)
Expand All @@ -215,12 +215,12 @@ system = forcefield.createSystem(
)
```

The latest official Open Force Field Initiative release ([`openff-2.1.0`](https://github.com/openforcefield/openff-forcefields) of the ["Sage" small molecule force field](https://openforcefield.org/community/news/general/sage2.1.0-release/)) is used if none is specified.
The latest official Open Force Field Initiative release ([`openff-2.2.1`](https://github.com/openforcefield/openff-forcefields) of the ["Sage" small molecule force field](https://openforcefield.org/force-fields/force-fields/)) is used if none is specified.
You can check which SMIRNOFF force field is in use with

```pycon
>>> smirnoff.smirnoff_filename
'/Users/mattthompson/mambaforge/envs/openmmforcefields/lib/python3.11/site-packages/openforcefields/offxml/openff-2.1.0.offxml'
'/Users/mattthompson/mambaforge/envs/openmmforcefields/lib/python3.11/site-packages/openforcefields/offxml/openff-2.2.1.offxml'
```

Create a template generator for a specific SMIRNOFF force field for multiple molecules read from an SDF file:
Expand All @@ -247,15 +247,15 @@ To check which SMIRNOFF force fields are automatically installed, examine the `I

```pycon
>>> print(SMIRNOFFTemplateGenerator.INSTALLED_FORCEFIELDS)
['ff14sb_off_impropers_0.0.2', 'ff14sb_off_impropers_0.0.1', 'ff14sb_off_impropers_0.0.3', 'tip3p_fb-1.1.0', 'tip3p_fb-1.0.0', 'openff-1.0.1', 'openff-1.1.1', 'openff-1.0.0-RC1', 'opc3', 'opc3-1.0.0', 'openff-2.1.0-rc.1', 'openff-1.2.0', 'openff-1.3.0', 'tip3p-1.0.0', 'opc-1.0.2', 'openff-2.0.0-rc.2', 'opc-1.0.0', 'openff-2.1.0', 'openff-2.0.0', 'tip4p_fb-1.0.1', 'tip3p', 'opc3-1.0.1', 'opc', 'tip3p_fb-1.1.1', 'openff-1.1.0', 'openff-1.0.0', 'openff-1.0.0-RC2', 'tip3p-1.0.1', 'openff-1.3.1', 'openff-1.2.1', 'openff-1.3.1-alpha.1', 'tip4p_fb', 'tip3p_fb', 'tip4p_fb-1.0.0', 'openff-2.0.0-rc.1', 'opc-1.0.1']
['ff14sb_off_impropers_0.0.2', 'ff14sb_off_impropers_0.0.4', 'ff14sb_off_impropers_0.0.1', 'ff14sb_off_impropers_0.0.3', 'tip3p_fb-1.1.0', 'tip3p_fb-1.0.0', 'openff-2.2.1-rc1', 'openff-1.0.1', 'openff-1.1.1', 'spce-1.0.0', 'openff_no_water-3.0.0-alpha0', 'openff-1.0.0-RC1', 'opc3', 'opc3-1.0.0', 'openff-2.1.0-rc.1', 'openff-2.3.0-rc2', 'openff-1.2.0', 'openff-1.3.0', 'tip3p-1.0.0', 'opc-1.0.2', 'openff-2.2.1', 'openff-2.0.0-rc.2', 'opc-1.0.0', 'openff-2.1.0', 'openff-2.0.0', 'tip4p_fb-1.0.1', 'tip3p', 'tip4p_ew', 'opc3-1.0.1', 'opc', 'openff-2.3.0-rc1', 'tip3p_fb-1.1.1', 'openff-1.1.0', 'openff-1.0.0', 'openff-1.0.0-RC2', 'openff-2.2.0-rc1', 'tip3p-1.0.1', 'openff-1.3.1', 'openff-1.2.1', 'tip4p_ew-1.0.0', 'openff-1.3.1-alpha.1', 'tip4p_fb', 'tip3p_fb', 'openff-2.2.0', 'spce', 'tip5p', 'tip4p_fb-1.0.0', 'openff-2.1.1', 'openff-2.0.0-rc.1', 'tip5p-1.0.0', 'opc-1.0.1']
```

You can optionally specify a file that contains a cache of pre-parameterized molecules:

```python
smirnoff = SMIRNOFFTemplateGenerator(
cache="smirnoff-molecules.json",
forcefield="openff-2.1.0",
forcefield="openff-2.2.1",
)
```

Expand Down Expand Up @@ -381,7 +381,7 @@ system_generator = SystemGenerator(
)
```

To use the [OpenFF's Sage `openff-2.1.0`](https://github.com/openforcefield/openff-forcefields) or a newer version, an update of the [Open Force Field ("Parsley") small molecule force field](https://openforcefield.org/news/introducing-openforcefield-1.0/) instead of GAFF 2.2.20, we would have instead specified `small_molecule_forcefield='openff-2.1.0'`.
To use the [OpenFF's Sage `openff-2.2.1`](https://github.com/openforcefield/openff-forcefields) or a newer version, an update of the [Open Force Field ("Parsley") small molecule force field](https://openforcefield.org/news/introducing-openforcefield-1.0/) instead of GAFF 2.2.20, we would have instead specified `small_molecule_forcefield='openff-2.2.1'`.

To use [espaloma](https://github.com/choderalab/espaloma) for assigning small molecule parameters, for example with the [`espaloma-0.3.2` model](https://github.com/choderalab/espaloma/releases/tag/0.3.2) released with the [espaloma preprint](https://arxiv.org/abs/2307.07085), you can specify `small_molecule_forcefield='espaloma-0.3.2'`.

Expand Down
19 changes: 9 additions & 10 deletions openmmforcefields/generators/template_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,18 +1326,18 @@ def __init__(self, molecules=None, cache=None, forcefield=None, template_generat
The latest Open Force Field Initiative release is used if none is specified.

>>> smirnoff.forcefield
'openff-2.1.0'
'openff-2.2.1'

You can check which SMIRNOFF force field filename is in use with

>>> smirnoff.smirnoff_filename # doctest:+ELLIPSIS
'/.../openff-2.1.0.offxml'
'/.../openff-2.2.1.offxml'

Create a template generator for a specific SMIRNOFF force field for multiple
molecules read from an SDF file:

>>> molecules = Molecule.from_file('molecules.sdf') # doctest: +SKIP
>>> smirnoff = SMIRNOFFTemplateGenerator(molecules=molecules, forcefield='openff-2.1.0') # doctest: +SKIP
>>> smirnoff = SMIRNOFFTemplateGenerator(molecules=molecules, forcefield='openff-2.2.1') # doctest: +SKIP

You can also add molecules later on after the generator has been registered:

Expand All @@ -1350,7 +1350,7 @@ def __init__(self, molecules=None, cache=None, forcefield=None, template_generat

You can optionally create or use a cache of pre-parameterized molecules:

>>> smirnoff = SMIRNOFFTemplateGenerator(cache='smirnoff.json', forcefield='openff-2.1.0') # doctest: +SKIP
>>> smirnoff = SMIRNOFFTemplateGenerator(cache='smirnoff.json', forcefield='openff-2.2.1') # doctest: +SKIP

Newly parameterized molecules will be written to the cache, saving time next time!
""" # noqa
Expand All @@ -1363,7 +1363,7 @@ def __init__(self, molecules=None, cache=None, forcefield=None, template_generat

if forcefield is None:
# Use latest supported Open Force Field Initiative release if none is specified
forcefield = "openff-2.1.0"
forcefield = "openff-2.2.1"
# TODO: After toolkit provides date-ranked force fields,
# use latest dated version if we can sort by date, such as self.INSTALLED_FORCEFIELDS[-1]
self._forcefield = forcefield
Expand Down Expand Up @@ -1654,7 +1654,7 @@ def __init__(
without .offxml extension}
{"charge_method": str, Charge method supported by espaloma ['nn', 'am1-bcc', 'gasteiger', 'from-molecule']}

Default behavior is to use ``openff_unconstrained-2.0.0`` for ``reference_forcefield`` and
Default behavior is to use ``openff_unconstrained-2.2.1`` for ``reference_forcefield`` and
`nn` for `charge_method`.
User defined charges can be assigned by setting the ``charge_method`` to ``from_molecule``
if charges are assigned to openff.toolkit.Molecule.
Expand Down Expand Up @@ -1699,7 +1699,7 @@ def __init__(

You can also pass a template_generator_kwargs to specify the reference_forcefield and/or charge_method in EspalomaTemplateGenerator:

>>> template_generator_kwargs = {"reference_forcefield": "openff_unconstrained-2.0.0", "charge_method": "nn"}
>>> template_generator_kwargs = {"reference_forcefield": "openff_unconstrained-2.2.1", "charge_method": "nn"}
>>> espaloma_generator = EspalomaTemplateGenerator(cache='smirnoff.json', forcefield='espaloma-0.3.2', template_generator_kwargs=template_generator_kwargs)
""" # noqa

Expand Down Expand Up @@ -1727,12 +1727,11 @@ def __init__(
# Check reference forcefield and charge method
if template_generator_kwargs is not None:
self._reference_forcefield = template_generator_kwargs.get(
"reference_forcefield", "openff_unconstrained-2.0.0"
"reference_forcefield", "openff_unconstrained-2.2.1"
)
self._charge_method = template_generator_kwargs.get("charge_method", "nn")
else:
# Consider upgrading to 2.1.0, the recommended small moleucle force field for general use
self._reference_forcefield = "openff_unconstrained-2.0.0"
self._reference_forcefield = "openff_unconstrained-2.2.1"
self._charge_method = "from-molecule"

# Check to make sure dependencies are installed
Expand Down
6 changes: 3 additions & 3 deletions openmmforcefields/tests/test_template_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ def test_partial_charges_are_none(self):

def test_keyword_arguments_default(self):
"""
Test the default behavior for the keyword arguments, which is using "openff_unconstrained-2.0.0"
Test the default behavior for the keyword arguments, which is using "openff_unconstrained-2.2.1"
as the reference forcefield and "from-molecule" as the charge method.

Check charges are the same as the input, after passing through the template generator.
Expand All @@ -1280,8 +1280,8 @@ def test_keyword_arguments_default(self):
system = forcefield.createSystem(molecule.to_topology().to_openmm(), nonbondedMethod=NoCutoff)
# Make sure passing through the EspalomaGenerator didn't change the charges
assert self.charges_are_equal(system, molecule), "Expected equal charges."
# Assert the reference forcefield is the default "openff_unconstrained-2.0.0"
default_ref_ff = "openff_unconstrained-2.0.0"
# Assert the reference forcefield is the default "openff_unconstrained-2.2.1"
default_ref_ff = "openff_unconstrained-2.2.1"
generator_ref_ff = generator._reference_forcefield
assert generator_ref_ff == default_ref_ff, f"Expected {default_ref_ff}, received {generator_ref_ff}."

Expand Down
Loading