This is part of the MolSSI Molecular Mechanics Interoperable Components (MMIC) project. This package provides translators between MMSchema and OpenFF toolkit.
mmic_openff provides 2 classes of translators for: molecules and forcefields.
from mmic_openff.models import OpenFFMol
# Convert MMSchema to OpenFF molecule
off_mol = OpenFFMol.from_schema(mm_mol) ->
# Convert OpenFF to MMSchema molecule
mm_mol = OpenFFMol.to_schema(off_mol) -> mmelemental.models.Molecule
One could do similar conversions for the ForceField
model as well.
The from_schema
and to_schema
methods in the OpenFFMol
model use translation components provided by mmic_openff and MMElemental to convert between MMSchema and OpenFF representations.
from mmic_openff.components import OpenFFToMolComponent, MolToOpenFFComponent
from mmic_openff.models.import OpenFFMol
from mmelemental.models import Molecule
# Create MMSchema molecule
mm_mol = Molecule.from_file(path_to_file)
# Create translation input
inp = {
"schema_object": mm_mol,
"schema_version": 1,
"schema_name": "mmschema",
}
# Run translator compute
outp = MolToOpenFFComponent.compute(inp)
# Extract OpenFF molecule object
mol = outp.data_object.data
from simtk.openmm import app
# Create OpenFF input
...
# Create translation input
inp = {
"data_object": ommol,
"schema_version": 1,
"schema_name": "mmschema",
}
# Running translator compute
outp = Translator.compute(inp)
# Extract MMSchema molecule
mm_mol = outp.schema_object
One could do similar conversions with the force field component as well.
Copyright (c) 2021, MolSSI
Project based on the Computational Molecular Science Python Cookiecutter version 1.5.