项目作者: MolSSI

项目描述 :
Tactic MMIC translator for OpenFF/MMSchema
高级语言: Python
项目地址: git://github.com/MolSSI/mmic_openff.git
创建时间: 2021-09-07T17:06:37Z
项目社区:https://github.com/MolSSI/mmic_openff

开源协议:BSD 3-Clause "New" or "Revised" License

下载


GitHub Actions Build Status
codecov
Language grade: Python

OpenFF translator for MMSchema

This is part of the MolSSI Molecular Mechanics Interoperable Components (MMIC) project. This package provides translators between MMSchema and OpenFF toolkit.

image

mmic_openff provides 2 classes of translators for: molecules and forcefields.

Models

  1. from mmic_openff.models import OpenFFMol
  2. # Convert MMSchema to OpenFF molecule
  3. off_mol = OpenFFMol.from_schema(mm_mol) ->
  4. # Convert OpenFF to MMSchema molecule
  5. mm_mol = OpenFFMol.to_schema(off_mol) -> mmelemental.models.Molecule

One could do similar conversions for the ForceField model as well.

Components

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.

  1. from mmic_openff.components import OpenFFToMolComponent, MolToOpenFFComponent
  2. from mmic_openff.models.import OpenFFMol
  3. from mmelemental.models import Molecule

MMSchema to OpenFF molecule

  1. # Create MMSchema molecule
  2. mm_mol = Molecule.from_file(path_to_file)
  3. # Create translation input
  4. inp = {
  5. "schema_object": mm_mol,
  6. "schema_version": 1,
  7. "schema_name": "mmschema",
  8. }
  9. # Run translator compute
  10. outp = MolToOpenFFComponent.compute(inp)
  11. # Extract OpenFF molecule object
  12. mol = outp.data_object.data

OpenFF to MMSchema molecule

  1. from simtk.openmm import app
  2. # Create OpenFF input
  3. ...
  4. # Create translation input
  5. inp = {
  6. "data_object": ommol,
  7. "schema_version": 1,
  8. "schema_name": "mmschema",
  9. }
  10. # Running translator compute
  11. outp = Translator.compute(inp)
  12. # Extract MMSchema molecule
  13. mm_mol = outp.schema_object

One could do similar conversions with the force field component as well.

Copyright (c) 2021, MolSSI

Acknowledgements

Project based on the
Computational Molecular Science Python Cookiecutter version 1.5.