Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
dc6c191a
Commit
dc6c191a
authored
Mar 29, 2021
by
John Chodera
Browse files
Update openforcefield namespace to new conda-forge namespace (openforcefield -> openff.toolkit)
parent
be19e022
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+16
-14
No files found.
docs-source/usersguide/application.rst
View file @
dc6c191a
...
@@ -817,14 +817,14 @@ Field Initiative small molecule force fields using the following example:
...
@@ -817,14 +817,14 @@ Field Initiative small molecule force fields using the following example:
::
::
# Create an
o
pen
forcefield
Molecule object for benzene from SMILES
# Create an
O
pen
FF
Molecule object for benzene from SMILES
from openf
orcefield
.topology import Molecule
from openf
f.toolkit
.topology import Molecule
molecule = Molecule.from_smiles('
c1ccccc1
')
molecule = Molecule.from_smiles('
c1ccccc1
')
# Create the SMIRNOFF template generator with the
most up to date Open Force Field Initiative force field
# Create the SMIRNOFF template generator with the
default installed force field (openff-1.0.0)
from openmmforcefields.generators import SMIRNOFFTemplateGenerator
from openmmforcefields.generators import SMIRNOFFTemplateGenerator
smirnoff = SMIRNOFFTemplateGenerator(molecules=molecule)
smirnoff = SMIRNOFFTemplateGenerator(molecules=molecule)
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
from openmm.app import ForceField
from
simtk.
openmm.app import ForceField
forcefield = ForceField('
amber
/
protein
.
ff14SB
.
xml
', '
amber
/
tip3p_standard
.
xml
', '
amber
/
tip3p_HFE_multivalent
.
xml
')
forcefield = ForceField('
amber
/
protein
.
ff14SB
.
xml
', '
amber
/
tip3p_standard
.
xml
', '
amber
/
tip3p_HFE_multivalent
.
xml
')
# Register the SMIRNOFF template generator
# Register the SMIRNOFF template generator
forcefield.registerTemplateGenerator(smirnoff.generator)
forcefield.registerTemplateGenerator(smirnoff.generator)
...
@@ -833,21 +833,21 @@ Alternatively, you can use the older `AMBER GAFF small molecule force field <htt
...
@@ -833,21 +833,21 @@ Alternatively, you can use the older `AMBER GAFF small molecule force field <htt
::
::
# Create an
o
pen
forcefield
Molecule object for benzene from SMILES
# Create an
O
pen
FF
Molecule object for benzene from SMILES
from openf
orcefield
.topology import Molecule
from openf
f.toolkit
.topology import Molecule
molecule = Molecule.from_smiles('
c1ccccc1
')
molecule = Molecule.from_smiles('
c1ccccc1
')
# Create the GAFF template generator
# Create the GAFF template generator
from openmmforcefields.generators import GAFFTemplateGenerator
from openmmforcefields.generators import GAFFTemplateGenerator
gaff = GAFFTemplateGenerator(molecules=molecule)
gaff = GAFFTemplateGenerator(molecules=molecule)
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
from openmm.app import ForceField
from
simtk.
openmm.app import ForceField
forcefield = ForceField('
amber
/
protein
.
ff14SB
.
xml
', '
amber
/
tip3p_standard
.
xml
', '
amber
/
tip3p_HFE_multivalent
.
xml
')
forcefield = ForceField('
amber
/
protein
.
ff14SB
.
xml
', '
amber
/
tip3p_standard
.
xml
', '
amber
/
tip3p_HFE_multivalent
.
xml
')
# Register the GAFF template generator
# Register the GAFF template generator
forcefield.registerTemplateGenerator(gaff.generator)
forcefield.registerTemplateGenerator(gaff.generator)
# You can now parameterize an OpenMM Topology object that contains the specified molecule.
# You can now parameterize an OpenMM Topology object that contains the specified molecule.
# forcefield will load the appropriate GAFF parameters when needed, and antechamber
# forcefield will load the appropriate GAFF parameters when needed, and antechamber
# will be used to generate small molecule parameters on the fly.
# will be used to generate small molecule parameters on the fly.
from openmm.app import PDBFile
from
simtk.
openmm.app import PDBFile
pdbfile = PDBFile('
t4
-
lysozyme
-
L99A
-
with
-
benzene
.
pdb
')
pdbfile = PDBFile('
t4
-
lysozyme
-
L99A
-
with
-
benzene
.
pdb
')
system = forcefield.createSystem(pdbfile.topology)
system = forcefield.createSystem(pdbfile.topology)
...
@@ -864,15 +864,17 @@ small molecule force field you want to use:
...
@@ -864,15 +864,17 @@ small molecule force field you want to use:
::
::
# Define the keyword arguments to feed to ForceField
# Define the keyword arguments to feed to ForceField
from
openmm
import unit
from
simtk
import unit
from openmm import app
from
simtk.
openmm import app
forcefield_kwargs = { '
constraints
' : app.HBonds, '
rigidWater
' : True, '
removeCMMotion
' : False, '
hydrogenMass
' : 4*unit.amu }
forcefield_kwargs = { '
constraints
' : app.HBonds, '
rigidWater
' : True, '
removeCMMotion
' : False, '
hydrogenMass
' : 4*unit.amu }
# Initialize a SystemGenerator using
the Open Force Field Initiative 1.2.0 force field (openff-1.2.0)
# Initialize a SystemGenerator using
GAFF
from openmmforcefields.generators import SystemGenerator
from openmmforcefields.generators import SystemGenerator
system_generator = SystemGenerator(forcefields=['
amber
/
ff14SB
.
xml
', '
amber
/
tip3p_standard
.
xml
'], small_molecule_forcefield='
openff
-
1.2.0
', forcefield_kwargs=forcefield_kwargs, cache='
db
.
json
')
system_generator = SystemGenerator(forcefields=['
amber
/
ff14SB
.
xml
', '
amber
/
tip3p_standard
.
xml
'], small_molecule_forcefield='
gaff
-
2.11
', forcefield_kwargs=forcefield_kwargs, cache='
db
.
json
')
# Create an OpenMM System from an OpenMM Topology object and a list of openforcefield Molecule objects
# Create an OpenMM System from an OpenMM Topology object
system = system_generator.create_system(openmm_topology)
# Alternatively, create an OpenMM System from an OpenMM Topology object and a list of OpenFF Molecule objects
molecules = Molecule.from_file('
molecules
.
sdf
', file_format='
sdf
')
molecules = Molecule.from_file('
molecules
.
sdf
', file_format='
sdf
')
system = system_generator.create_system(topology, molecules=molecules)
system = system_generator.create_system(
openmm_
topology, molecules=molecules)
The ``SystemGenerator`` will match any instances of the molecules found in ``molecules.sdf`` to those that appear in ``topology``.
The ``SystemGenerator`` will match any instances of the molecules found in ``molecules.sdf`` to those that appear in ``topology``.
Note that the protonation and tautomeric states must match exactly between the ``molecules`` read and those appearing in the Topology.
Note that the protonation and tautomeric states must match exactly between the ``molecules`` read and those appearing in the Topology.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment