The Open Forcefield Toolkit can create parametrized openmm.System
objects that can be natively simulated with OpenMM. This example shows the Interchange project can enable parallel workflows using Amber and GROMACS.
We start by loading a PDB file containing one copy of ethanol and cyclohexane. Our goal is to create an OpenFF Topology
object describing this system that we can parametrize with the SMIRNOFF-format "Sage" force field.
The two Molecule
objects created from the SMILES strings can contain information such as partial charges and stereochemistry that is not included in an OpenMM topology. In this example, partial charges are not explicitly given, and ForceField
will assign AM1/BCC charges as specified by the "Sage" force field. Note that the OpenFF Toolkit produces partial charges that do not depend on the input conformation of parameterized molecules. See the FAQ for more information.
from openmm import app
from openff.toolkit import ForceField, Molecule, Topology
ethanol = Molecule.from_smiles("CCO")
cyclohexane = Molecule.from_smiles("C1CCCCC1")
# Load the PDB file using OpenMM and save the OpenMM Topology
pdbfile = app.PDBFile("1_cyclohexane_1_ethanol.pdb")
omm_topology = pdbfile.topology
# Create the OpenFF Topology.
off_topology = Topology.from_openmm(
omm_topology, unique_molecules=[ethanol, cyclohexane]
)
off_topology
<openff.toolkit.topology.topology.Topology at 0x7ff0baf89940>
Once the ForceField
class is imported, the only decision to make is which force field to use. An exhaustive list of force fields released by the Open Force Field Initiative can be found [here](from openff.toolkit.typing.engines.smirnoff import ForceField
).
Here we will use force field from the "Sage" line.
forcefield = ForceField("openff-2.0.0.offxml")
forcefield
<openff.toolkit.typing.engines.smirnoff.forcefield.ForceField at 0x7ff0baf89bb0>
Once a force field and topology have been loaded, an openmm.System
can be generated natively with the OpenFF Toolkit.
omm_system = forcefield.create_openmm_system(off_topology)
omm_system
<openmm.openmm.System; proxy of <Swig Object of type 'OpenMM::System *' at 0x7ff0bb9f6ba0> >
To exports to engines other than OpenMM, we will make use of the Interchange project. There is a high-level Interchange.from_smirnoff
function that consumes OpenFF Toolkit and ForceField objects and produces an Interchange
object which can then be exported to formats understood by other molecular simulation engines. This extra step is needed to provide a clean interface between applied parameters and engines. Note also that this step does not require an OpenMM System to be generated; ForceField.create_openmm_system
does not need to be called to use Amber and GROMACS.
from openff.interchange import Interchange
interchange = Interchange.from_smirnoff(
force_field=forcefield,
topology=off_topology,
)
interchange.positions = pdbfile.positions
interchange
Interchange with 27 atoms, periodic topology
Once an Interchange
object has been constructed, its API can be used to export to files understood by GROMACS, Amber, and more.
# Export AMBER files.
interchange.to_prmtop("system.prmtop")
interchange.to_inpcrd("system.inpcrd")
# Export GROMACS files.
interchange.to_top("system.top")
interchange.to_gro("system.gro")
The Interchange project includes functions that take in an Interchange
object and call out to simulation engines to run single-point energy calculations (with no minimization or dynamics) for the purpose of validating the export layer with each engine. Under the hood, each of these functions calls API points like those used above while converting to files understood by each engine. These rely on having each engine installed and accessible in the current $PATH
.
from openff.interchange.drivers import get_amber_energies, get_openmm_energies
openmm_energies = get_openmm_energies(interchange)
openmm_energies.energies
{'Bond': 0.2952878475189209 <Unit('kilojoule / mole')>, 'Angle': 155.7012939453125 <Unit('kilojoule / mole')>, 'Torsion': 19.563228607177734 <Unit('kilojoule / mole')>, 'vdW': 9.6586229795419 <Unit('kilojoule / mole')>, 'Electrostatics': -15.220786403489484 <Unit('kilojoule / mole')>}
!cat system.inpcrd
!cat system.prmtop
!cat system.top
!cat system.gro
amber_energies = get_amber_energies(interchange)
amber_energies.energies
27 0.0000000e+00 12.5320000 10.8130000 10.3860000 12.3480000 10.3390000 11.8250000 10.8800000 10.3650000 12.2440000 10.2560000 11.7390000 12.0200000 10.4390000 12.2130000 10.5810000 11.9070000 12.1870000 10.1620000 12.0720000 10.0880000 9.7030000 13.6000000 10.8490000 10.1430000 12.7450000 9.3240000 11.9320000 12.9300000 10.9820000 12.4970000 10.3240000 9.6140000 11.6690000 10.7930000 10.0880000 13.3000000 9.1880000 11.7030000 12.2640000 10.7160000 12.4640000 12.7040000 9.8580000 11.5710000 9.9090000 10.0430000 13.2300000 10.4740000 11.9940000 12.4650000 9.1050000 12.4630000 12.9380000 10.7370000 10.1720000 31.2760000 27.8660000 8.7460000 30.9610000 27.4710000 8.7520000 30.2640000 26.2340000 10.2040000 31.8150000 28.8180000 10.7580000 30.3560000 27.9620000 10.6610000 31.8860000 27.0990000 8.1690000 31.8830000 27.3520000 8.2670000 30.3330000 28.2280000 7.8260000 30.0790000 26.0110000 31.8850000 31.8850000 31.8850000 90.0000000 90.0000000 90.0000000 %VERSION VERSION_STAMP = V0001.000 DATE = 03/25/22 16:03:26 %FLAG TITLE %FORMAT(20a4) %FLAG POINTERS %FORMAT(10I8) 27 5 18 8 42 7 64 18 0 0 140 1 8 7 18 4 3 10 1 0 0 0 0 0 0 0 0 1 27 0 0 0 %FLAG ATOM_NAME %FORMAT(20a4) C1 C2 C3 C4 C5 C6 H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 C7 C8 O1 H13 H14 H15 H16 H17 H18 %FLAG CHARGE %FORMAT(5E16.8) -1.37596591E+00 -1.37487258E+00 -1.37487258E+00 -1.37487258E+00 -1.37487258E+00 -1.37487258E+00 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 6.87527403E-01 -1.76938530E+00 2.39495687E+00 -1.09577978E+01 8.15630125E-01 8.15630125E-01 8.15630125E-01 3.15610207E-01 3.15610207E-01 7.25411547E+00 %FLAG ATOMIC_NUMBER %FORMAT(10I8) 6 6 6 6 6 6 1 1 1 1 1 1 1 1 1 1 1 1 6 6 8 1 1 1 1 1 1 %FLAG MASS %FORMAT(5E16.8) 1.20107800E+01 1.20107800E+01 1.20107800E+01 1.20107800E+01 1.20107800E+01 1.20107800E+01 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.20107800E+01 1.20107800E+01 1.59994300E+01 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 1.00794700E+00 %FLAG ATOM_TYPE_INDEX %FORMAT(10I8) 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 3 2 2 2 4 4 5 %FLAG NUMBER_EXCLUDED_ATOMS %FORMAT(10I8) 15 14 13 12 11 10 5 4 3 2 3 2 3 2 3 2 1 1 8 7 6 4 3 2 2 1 1 %FLAG NONBONDED_PARM_INDEX %FORMAT(10I8) 1 2 4 7 11 2 3 5 8 12 4 5 6 9 13 7 8 9 10 14 11 12 13 14 15 %FLAG RESIDUE_LABEL %FORMAT(20a4) RES %FLAG RESIDUE_POINTER %FORMAT(10I8) 2 %FLAG BOND_FORCE_CONSTANT %FORMAT(5E16.8) 2.64621486E+02 3.70046707E+02 3.29969981E+02 5.43526783E+02 %FLAG BOND_EQUIL_VALUE %FORMAT(5E16.8) 1.52190126E+00 1.09389949E+00 1.42734396E+00 9.71676331E-01 %FLAG ANGLE_FORCE_CONSTANT %FORMAT(5E16.8) 5.32053163E+01 4.87764926E+01 6.50906161E+01 %FLAG ANGLE_EQUIL_VALUE %FORMAT(5E16.8) 2.03413912E+00 2.01765472E+00 1.92603856E+00 %FLAG DIHEDRAL_FORCE_CONSTANT %FORMAT(5E16.8) 9.22387404E-02 3.15993592E-01 3.24779681E-01 1.04066385E-01 1.91192672E-01 3.44538215E-01 1.36455637E-01 1.11552567E-01 3.43249022E-01 3.02639017E-01 %FLAG DIHEDRAL_PERIODICITY %FORMAT(5E16.8) 3.00000000E+00 2.00000000E+00 1.00000000E+00 3.00000000E+00 3.00000000E+00 3.00000000E+00 1.00000000E+00 3.00000000E+00 1.00000000E+00 3.00000000E+00 %FLAG DIHEDRAL_PHASE %FORMAT(5E16.8) 0.00000000E+00 3.14159265E+00 3.14159265E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 %FLAG SCEE_SCALE_FACTOR %FORMAT(5E16.8) 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 1.20000000E+00 %FLAG SCNB_SCALE_FACTOR %FORMAT(5E16.8) 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 %FLAG SOLTY %FORMAT(5E16.8) 0.00000000E+00 %FLAG LENNARD_JONES_ACOEF %FORMAT(5E16.8) 9.66338652E+05 9.24328843E+04 7.38518138E+03 6.66507729E+05 5.83759564E+04 4.40259018E+05 8.33691908E+04 6.54768129E+03 5.22131072E+04 5.79557957E+03 1.46234885E+01 4.58964736E-01 5.90854038E+00 3.70489465E-01 2.68310183E-08 %FLAG LENNARD_JONES_BCOEF %FORMAT(5E16.8) 6.48619732E+02 1.23783906E+02 2.15902147E+01 6.34472236E+02 1.15865057E+02 6.07363521E+02 1.18714205E+02 2.05290621E+01 1.10655807E+02 1.95039576E+01 2.60290771E-01 2.84543313E-02 1.94875807E-01 2.58163965E-02 1.15016368E-06 %FLAG BONDS_INC_HYDROGEN %FORMAT(10I8) 0 18 2 0 21 2 3 24 2 3 27 2 6 30 2 6 33 2 9 36 2 9 39 2 12 42 2 12 45 2 15 48 2 15 51 2 54 63 2 54 66 2 54 69 2 57 72 2 57 75 2 60 78 4 %FLAG BONDS_WITHOUT_HYDROGEN %FORMAT(10I8) 0 3 1 0 15 1 3 6 1 6 9 1 9 12 1 12 15 1 54 57 1 57 60 3 %FLAG ANGLES_INC_HYDROGEN %FORMAT(10I8) 0 3 24 1 0 3 27 1 0 15 48 1 0 15 51 1 3 0 18 1 3 0 21 1 3 6 30 1 3 6 33 1 6 3 24 1 6 3 27 1 6 9 36 1 6 9 39 1 9 6 30 1 9 6 33 1 9 12 42 1 9 12 45 1 12 9 36 1 12 9 39 1 12 15 48 1 12 15 51 1 15 0 18 1 15 0 21 1 15 12 42 1 15 12 45 1 18 0 21 2 24 3 27 2 30 6 33 2 36 9 39 2 42 12 45 2 48 15 51 2 54 57 72 1 54 57 75 1 57 54 63 1 57 54 66 1 57 54 69 1 57 60 78 3 60 57 72 1 60 57 75 1 63 54 66 2 63 54 69 2 66 54 69 2 72 57 75 2 %FLAG ANGLES_WITHOUT_HYDROGEN %FORMAT(10I8) 0 3 6 1 0 15 12 1 3 0 15 1 3 6 9 1 6 9 12 1 9 12 15 1 54 57 60 1 %FLAG DIHEDRALS_INC_HYDROGEN %FORMAT(10I8) 0 3 6 30 4 0 3 6 33 4 0 15 12 42 4 0 15 12 45 4 3 0 15 48 4 3 0 15 51 4 3 6 9 36 4 3 6 9 39 4 18 0 3 6 4 21 0 3 6 4 6 9 12 42 4 6 9 12 45 4 9 6 3 24 4 9 6 3 27 4 9 12 15 48 4 9 12 15 51 4 12 9 6 30 4 12 9 6 33 4 18 0 15 12 4 21 0 15 12 4 15 0 3 24 4 15 0 3 27 4 15 12 9 36 4 15 12 9 39 4 18 0 3 24 5 18 0 3 27 5 18 0 15 48 5 18 0 15 51 5 21 0 3 24 5 21 0 3 27 5 21 0 15 48 5 21 0 15 51 5 24 3 6 30 5 24 3 6 33 5 27 3 6 30 5 27 3 6 33 5 30 6 9 36 5 30 6 9 39 5 33 6 9 36 5 33 6 9 39 5 36 9 12 42 5 36 9 12 45 5 39 9 12 42 5 39 9 12 45 5 42 12 15 48 5 42 12 15 51 5 45 12 15 48 5 45 12 15 51 5 54 57 60 78 6 54 57 -60 78 7 60 57 54 63 8 60 57 -54 63 9 60 57 54 66 8 60 57 -54 66 9 60 57 54 69 8 60 57 -54 69 9 63 54 57 72 5 63 54 57 75 5 66 54 57 72 5 66 54 57 75 5 69 54 57 72 5 69 54 57 75 5 72 57 60 78 10 75 57 60 78 10 %FLAG DIHEDRALS_WITHOUT_HYDROGEN %FORMAT(10I8) 0 3 6 9 1 0 3 -6 9 2 0 3 -6 9 3 0 15 -12 9 1 0 15 -12 9 2 0 15 -12 9 3 3 0 15 12 1 3 0 -15 12 2 3 0 -15 12 3 3 6 -9 12 1 3 6 -9 12 2 3 6 -9 12 3 15 0 3 6 1 15 0 -3 6 2 15 0 -3 6 3 6 9 -12 15 1 6 9 -12 15 2 6 9 -12 15 3 %FLAG EXCLUDED_ATOMS_LIST %FORMAT(10I8) 2 6 7 8 3 4 11 12 9 10 5 15 16 17 18 3 9 10 6 5 17 18 7 8 4 13 14 11 12 6 7 8 4 11 12 9 10 5 15 16 13 14 9 10 5 13 14 11 12 6 17 18 15 16 11 12 6 15 16 13 14 7 8 17 18 9 10 17 18 7 8 13 14 15 16 9 10 17 18 8 9 10 17 18 11 12 10 11 12 13 14 12 13 14 15 16 14 15 16 17 18 16 17 18 18 0 20 22 23 24 21 27 25 26 21 25 26 22 23 24 27 22 23 24 27 25 26 25 26 23 24 25 26 24 25 26 27 26 27 0 %FLAG HBOND_ACOEF %FORMAT(5E16.8) %FLAG HBOND_BCOEF %FORMAT(5E16.8) %FLAG HBCUT %FORMAT(5E16.8) %FLAG AMBER_ATOM_TYPE %FORMAT(20a4) C1 C2 C3 C4 C5 C6 H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 C7 C8 O1 H13 H14 H15 H16 H17 H18 %FLAG TREE_CHAIN_CLASSIFICATION %FORMAT(20a4) BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA %FLAG JOIN_ARRAY %FORMAT(10I8) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 %FLAG IROTAT %FORMAT(10I8) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 %FLAG SOLVENT_POINTERS %FORMAT(3I8) 1 1 2 %FLAG ATOMS_PER_MOLECULE %FORMAT(10I8) 27 %FLAG BOX_DIMENSIONS %FORMAT(5E16.8) 9.00000000E+01 3.18850000E+01 3.18850000E+01 3.18850000E+01 %FLAG RADIUS_SET %FORMAT(1a80) 0 %FLAG RADII %FORMAT(5E16.8) 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 %FLAG SCREEN %FORMAT(5E16.8) 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 %FLAG IPOL %FORMAT(1I8) 0 ; Generated by Interchange [ defaults ] ; nbfunc comb-rule gen-pairs fudgeLJ fudgeQQ 1 2 no 0.500000 0.833333 [ atomtypes ] ;type, bondingtype, mass, charge, ptype, sigma, epsilon C1 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 C2 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 C3 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 C4 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 C5 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 C6 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 H1 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H2 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H3 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H4 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H5 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H6 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H7 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H8 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H9 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H10 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H11 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H12 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 C7 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 C8 6 12.01078 0.0000000000000000 A 0.337953176162662 0.4553891161106184 O1 8 15.99943 0.0000000000000000 A 0.2997159987248637 0.8764372596155737 H13 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H14 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H15 1 1.007947 0.0000000000000000 A 0.2644543413268124 0.06602135607582665 H16 1 1.007947 0.0000000000000000 A 0.2583225710839196 0.068656285380106 H17 1 1.007947 0.0000000000000000 A 0.2583225710839196 0.068656285380106 H18 1 1.007947 0.0000000000000000 A 0.0534539230883669 5.157198260534728e-05 [ moleculetype ] ; Name nrexcl x0 3 [ atoms ] ;num, type, resnum, resname, atomname, cgnr, q, m 1 C1 1 ZBE C1 1 -0.07551000 12.01078000 2 C2 1 ZBE C2 2 -0.07545000 12.01078000 3 C3 1 ZBE C3 3 -0.07545000 12.01078000 4 C4 1 ZBE C4 4 -0.07545000 12.01078000 5 C5 1 ZBE C5 5 -0.07545000 12.01078000 6 C6 1 ZBE C6 6 -0.07545000 12.01078000 7 H1 1 ZBE H1 7 0.03773000 1.00794700 8 H2 1 ZBE H2 8 0.03773000 1.00794700 9 H3 1 ZBE H3 9 0.03773000 1.00794700 10 H4 1 ZBE H4 10 0.03773000 1.00794700 11 H5 1 ZBE H5 11 0.03773000 1.00794700 12 H6 1 ZBE H6 12 0.03773000 1.00794700 13 H7 1 ZBE H7 13 0.03773000 1.00794700 14 H8 1 ZBE H8 14 0.03773000 1.00794700 15 H9 1 ZBE H9 15 0.03773000 1.00794700 16 H10 1 ZBE H10 16 0.03773000 1.00794700 17 H11 1 ZBE H11 17 0.03773000 1.00794700 18 H12 1 ZBE H12 18 0.03773000 1.00794700 [ pairs ] ; ai aj funct 2 5 1 0.337953 0.227695 8 18 1 0.264454 0.0330107 10 11 1 0.264454 0.0330107 4 17 1 0.301204 0.0866969 5 11 1 0.301204 0.0866969 10 12 1 0.264454 0.0330107 11 13 1 0.264454 0.0330107 6 9 1 0.301204 0.0866969 4 18 1 0.301204 0.0866969 5 12 1 0.301204 0.0866969 7 9 1 0.264454 0.0330107 13 15 1 0.264454 0.0330107 6 10 1 0.301204 0.0866969 12 13 1 0.264454 0.0330107 6 13 1 0.301204 0.0866969 11 14 1 0.264454 0.0330107 6 14 1 0.301204 0.0866969 14 15 1 0.264454 0.0330107 7 10 1 0.264454 0.0330107 13 16 1 0.264454 0.0330107 12 14 1 0.264454 0.0330107 1 11 1 0.301204 0.0866969 3 6 1 0.337953 0.227695 14 16 1 0.264454 0.0330107 1 15 1 0.301204 0.0866969 3 7 1 0.301204 0.0866969 1 12 1 0.301204 0.0866969 2 13 1 0.301204 0.0866969 1 16 1 0.301204 0.0866969 3 8 1 0.301204 0.0866969 2 14 1 0.301204 0.0866969 7 17 1 0.264454 0.0330107 8 9 1 0.264454 0.0330107 15 17 1 0.264454 0.0330107 8 10 1 0.264454 0.0330107 7 18 1 0.264454 0.0330107 4 9 1 0.301204 0.0866969 1 4 1 0.337953 0.227695 5 7 1 0.301204 0.0866969 15 18 1 0.264454 0.0330107 4 10 1 0.301204 0.0866969 2 17 1 0.301204 0.0866969 3 15 1 0.301204 0.0866969 5 8 1 0.301204 0.0866969 9 11 1 0.264454 0.0330107 2 18 1 0.301204 0.0866969 16 17 1 0.264454 0.0330107 9 12 1 0.264454 0.0330107 3 16 1 0.301204 0.0866969 8 17 1 0.264454 0.0330107 16 18 1 0.264454 0.0330107 [ bonds ] ; ai aj func r k 1 2 1 0.152190126495 221435.2592902858 1 6 1 0.152190126495 221435.2592902858 1 7 1 0.1093899492634 309655.084322414 1 8 1 0.1093899492634 309655.084322414 2 3 1 0.152190126495 221435.2592902858 2 9 1 0.1093899492634 309655.084322414 2 10 1 0.1093899492634 309655.084322414 3 4 1 0.152190126495 221435.2592902858 3 11 1 0.1093899492634 309655.084322414 3 12 1 0.1093899492634 309655.084322414 4 5 1 0.152190126495 221435.2592902858 4 13 1 0.1093899492634 309655.084322414 4 14 1 0.1093899492634 309655.084322414 5 6 1 0.152190126495 221435.2592902858 5 15 1 0.1093899492634 309655.084322414 5 16 1 0.1093899492634 309655.084322414 6 17 1 0.1093899492634 309655.084322414 6 18 1 0.1093899492634 309655.084322414 [ angles ] ; ai aj ak func r k 2 3 12 1 116.5475862634 445.2220865092856 9 2 10 1 115.6030999533 408.161690475075 11 3 12 1 115.6030999533 408.161690475075 3 2 9 1 116.5475862634 445.2220865092856 7 1 8 1 115.6030999533 408.161690475075 3 2 10 1 116.5475862634 445.2220865092856 5 6 17 1 116.5475862634 445.2220865092856 6 1 7 1 116.5475862634 445.2220865092856 13 4 14 1 115.6030999533 408.161690475075 3 4 5 1 116.5475862634 445.2220865092856 4 5 6 1 116.5475862634 445.2220865092856 5 6 18 1 116.5475862634 445.2220865092856 17 6 18 1 115.6030999533 408.161690475075 6 1 8 1 116.5475862634 445.2220865092856 2 3 4 1 116.5475862634 445.2220865092856 2 1 6 1 116.5475862634 445.2220865092856 6 5 15 1 116.5475862634 445.2220865092856 4 3 11 1 116.5475862634 445.2220865092856 6 5 16 1 116.5475862634 445.2220865092856 4 3 12 1 116.5475862634 445.2220865092856 2 1 7 1 116.5475862634 445.2220865092856 1 2 9 1 116.5475862634 445.2220865092856 2 1 8 1 116.5475862634 445.2220865092856 5 4 13 1 116.5475862634 445.2220865092856 15 5 16 1 115.6030999533 408.161690475075 1 2 10 1 116.5475862634 445.2220865092856 3 4 13 1 116.5475862634 445.2220865092856 1 6 17 1 116.5475862634 445.2220865092856 5 4 14 1 116.5475862634 445.2220865092856 1 6 18 1 116.5475862634 445.2220865092856 3 4 14 1 116.5475862634 445.2220865092856 4 5 15 1 116.5475862634 445.2220865092856 4 5 16 1 116.5475862634 445.2220865092856 1 6 5 1 116.5475862634 445.2220865092856 2 3 11 1 116.5475862634 445.2220865092856 1 2 3 1 116.5475862634 445.2220865092856 [ dihedrals ] ; i j k l func 4 3 2 10 1 0 0.435414 3 8 1 6 17 1 0 0.79995 3 15 5 6 17 1 0 0.79995 3 15 5 6 18 1 0 0.79995 3 5 4 3 11 1 0 0.435414 3 6 1 2 9 1 0 0.435414 3 12 3 4 13 1 0 0.79995 3 8 1 6 18 1 0 0.79995 3 5 4 3 12 1 0 0.435414 3 6 1 2 10 1 0 0.435414 3 1 6 5 15 1 0 0.435414 3 12 3 4 14 1 0 0.79995 3 3 4 5 6 1 0 0.385927 3 3 4 5 6 1 180 1.32212 2 3 4 5 6 1 180 1.35888 1 1 6 5 16 1 0 0.435414 3 1 2 3 4 1 0 0.385927 3 1 2 3 4 1 180 1.32212 2 1 2 3 4 1 180 1.35888 1 4 5 6 17 1 0 0.435414 3 8 1 2 9 1 0 0.79995 3 13 4 5 15 1 0 0.79995 3 2 3 4 5 1 0 0.385927 3 2 3 4 5 1 180 1.32212 2 2 3 4 5 1 180 1.35888 1 4 5 6 18 1 0 0.435414 3 10 2 3 11 1 0 0.79995 3 13 4 5 16 1 0 0.79995 3 1 6 5 4 1 0 0.385927 3 1 6 5 4 1 180 1.32212 2 1 6 5 4 1 180 1.35888 1 6 5 4 13 1 0 0.435414 3 10 2 3 12 1 0 0.79995 3 6 5 4 14 1 0 0.435414 3 9 2 3 11 1 0 0.79995 3 7 1 2 9 1 0 0.79995 3 3 4 5 15 1 0 0.435414 3 2 1 6 17 1 0 0.435414 3 7 1 6 17 1 0 0.79995 3 9 2 3 12 1 0 0.79995 3 7 1 6 18 1 0 0.79995 3 2 1 6 18 1 0 0.435414 3 11 3 4 13 1 0 0.79995 3 7 1 2 10 1 0 0.79995 3 2 3 4 13 1 0 0.435414 3 3 4 5 16 1 0 0.435414 3 16 5 6 17 1 0 0.79995 3 5 6 1 7 1 0 0.435414 3 11 3 4 14 1 0 0.79995 3 16 5 6 18 1 0 0.79995 3 5 6 1 8 1 0 0.435414 3 3 2 1 6 1 0 0.385927 3 3 2 1 6 1 180 1.32212 2 3 2 1 6 1 180 1.35888 1 14 4 5 15 1 0 0.79995 3 2 3 4 14 1 0 0.435414 3 1 2 3 11 1 0 0.435414 3 14 4 5 16 1 0 0.79995 3 8 1 2 10 1 0 0.79995 3 2 1 6 5 1 0 0.385927 3 2 1 6 5 1 180 1.32212 2 2 1 6 5 1 180 1.35888 1 4 3 2 9 1 0 0.435414 3 3 2 1 7 1 0 0.435414 3 1 2 3 12 1 0 0.435414 3 3 2 1 8 1 0 0.435414 3 [ moleculetype ] ; Name nrexcl x1 3 [ atoms ] ;num, type, resnum, resname, atomname, cgnr, q, m 1 C7 1 ZXQ C7 1 -0.09710000 12.01078000 2 C8 1 ZXQ C8 2 0.13143000 12.01078000 3 O1 1 ZXQ O1 3 -0.60134000 15.99943000 4 H13 1 ZXQ H13 4 0.04476000 1.00794700 5 H14 1 ZXQ H14 5 0.04476000 1.00794700 6 H15 1 ZXQ H15 6 0.04476000 1.00794700 7 H16 1 ZXQ H16 7 0.01732000 1.00794700 8 H17 1 ZXQ H17 8 0.01732000 1.00794700 9 H18 1 ZXQ H18 9 0.39809000 1.00794700 [ pairs ] ; ai aj funct 8 9 1 0.155888 0.000940843 4 8 1 0.261388 0.033663 3 6 1 0.282085 0.120274 1 9 1 0.195704 0.00242308 3 4 1 0.282085 0.120274 5 8 1 0.261388 0.033663 7 9 1 0.155888 0.000940843 6 7 1 0.261388 0.033663 5 7 1 0.261388 0.033663 6 8 1 0.261388 0.033663 4 7 1 0.261388 0.033663 3 5 1 0.282085 0.120274 [ bonds ] ; ai aj func r k 1 2 1 0.152190126495 221435.2592902858 1 4 1 0.1093899492634 309655.084322414 1 5 1 0.1093899492634 309655.084322414 1 6 1 0.1093899492634 309655.084322414 2 3 1 0.1427343958716 276118.8797485491 2 7 1 0.1093899492634 309655.084322414 2 8 1 0.1093899492634 309655.084322414 3 9 1 0.09716763312559 454823.2121721368 [ angles ] ; ai aj ak func r k 1 2 7 1 116.5475862634 445.2220865092856 3 2 8 1 116.5475862634 445.2220865092856 2 1 5 1 116.5475862634 445.2220865092856 1 2 8 1 116.5475862634 445.2220865092856 4 1 5 1 115.6030999533 408.161690475075 2 3 9 1 110.3538806181 544.678275491328 2 1 6 1 116.5475862634 445.2220865092856 5 1 6 1 115.6030999533 408.161690475075 7 2 8 1 115.6030999533 408.161690475075 1 2 3 1 116.5475862634 445.2220865092856 3 2 7 1 116.5475862634 445.2220865092856 4 1 6 1 115.6030999533 408.161690475075 2 1 4 1 116.5475862634 445.2220865092856 [ dihedrals ] ; i j k l func 3 2 1 6 1 0 0.466736 3 3 2 1 6 1 0 1.43615 1 7 2 3 9 1 0 1.26624 3 6 1 2 7 1 0 0.79995 3 5 1 2 8 1 0 0.79995 3 4 1 2 7 1 0 0.79995 3 3 2 1 4 1 0 0.466736 3 3 2 1 4 1 0 1.43615 1 3 2 1 5 1 0 0.466736 3 3 2 1 5 1 0 1.43615 1 6 1 2 8 1 0 0.79995 3 4 1 2 8 1 0 0.79995 3 8 2 3 9 1 0 1.26624 3 1 2 3 9 1 0 1.44155 3 1 2 3 9 1 0 0.57093 1 5 1 2 7 1 0 0.79995 3 [ system ] ; name System name [ molecules ] ; Compound nmols x0 1 x1 1 Generated by Interchange 27 1ZBE C1 1 1.25320000 1.08130000 1.03860000 1ZBE C2 2 1.23480000 1.03390000 1.18250000 1ZBE C3 3 1.08800000 1.03650000 1.22440000 1ZBE C4 4 1.02560000 1.17390000 1.20200000 1ZBE C5 5 1.04390000 1.22130000 1.05810000 1ZBE C6 6 1.19070000 1.21870000 1.01620000 1ZBE H1 7 1.20720000 1.00880000 0.97030000 1ZBE H2 8 1.36000000 1.08490000 1.01430000 1ZBE H3 9 1.27450000 0.93240000 1.19320000 1ZBE H4 10 1.29300000 1.09820000 1.24970000 1ZBE H5 11 1.03240000 0.96140000 1.16690000 1ZBE H6 12 1.07930000 1.00880000 1.33000000 1ZBE H7 13 0.91880000 1.17030000 1.22640000 1ZBE H8 14 1.07160000 1.24640000 1.27040000 1ZBE H9 15 0.98580000 1.15710000 0.99090000 1ZBE H10 16 1.00430000 1.32300000 1.04740000 1ZBE H11 17 1.19940000 1.24650000 0.91050000 1ZBE H12 18 1.24630000 1.29380000 1.07370000 1ZXQ C7 19 1.01720000 3.12760000 2.78660000 1ZXQ C8 20 0.87460000 3.09610000 2.74710000 1ZXQ O1 21 0.87520000 3.02640000 2.62340000 1ZXQ H13 22 1.02040000 3.18150000 2.88180000 1ZXQ H14 23 1.07580000 3.03560000 2.79620000 1ZXQ H15 24 1.06610000 3.18860000 2.70990000 1ZXQ H16 25 0.81690000 3.18830000 2.73520000 1ZXQ H17 26 0.82670000 3.03330000 2.82280000 1ZXQ H18 27 0.78260000 3.00790000 2.60110000 3.1885000 3.1885000 3.1885000
{'Bond': 0.0741 <Unit('kilocalories_per_mole')>, 'Angle': 37.2023 <Unit('kilocalories_per_mole')>, 'Torsion': 4.6778 <Unit('kilocalories_per_mole')>, 'vdW': 9.7231976 <Unit('kilojoule_per_mole')>, 'Electrostatics': -15.217207999999996 <Unit('kilojoule_per_mole')>}
If GROMACS and/or LAMMPS are installed on your machine, the same comparisons can also take place with those engines. They are available via conda
by running a command like:
conda install "gromacs >=2021=nompi*" lammps -c conda-forge
from distutils.spawn import find_executable
from pprint import pprint
from openff.interchange.drivers import get_gromacs_energies, get_lammps_energies
if find_executable("lmp_serial"):
pprint(get_lammps_energies(interchange).energies)
{'Angle': <Quantity(37.213514, 'kilocalorie_per_mole')>, 'Bond': <Quantity(0.10526246, 'kilocalorie_per_mole')>, 'Electrostatics': <Quantity(-3.638788, 'kilocalorie_per_mole')>, 'Torsion': <Quantity(4.675725, 'kilocalorie_per_mole')>, 'vdW': <Quantity(2.30186395, 'kilocalorie_per_mole')>}
if find_executable("gmx"):
pprint(get_gromacs_energies(interchange).energies)
Finally, there is a helper function get_summary_data
that will attempt to run drivers of each engine. A summary reported is prepared as a Pandas DataFrame
.
from openff.interchange.drivers.all import get_summary_data
get_summary_data(interchange)
Bond | Angle | Torsion | vdW | Electrostatics | |
---|---|---|---|---|---|
OpenMM | 0.295288 | 155.701294 | 19.563229 | 9.658623 | -15.220786 |
Amber | 0.310034 | 155.654423 | 19.571915 | 9.723198 | -15.217208 |
LAMMPS | 0.440418 | 155.701343 | 19.563233 | 9.630999 | -15.224689 |