Coder Social home page Coder Social logo

molssi / mmic_openff Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 882 KB

Tactic MMIC translator for OpenFF/MMSchema

License: BSD 3-Clause "New" or "Revised" License

Shell 0.46% Python 99.54%
mmschema standards openforcefield smirnoff-force-field forcefield-parameterization interoperability molecular-mechanics mmic

mmic_openff's Introduction

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

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.

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.

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

MMSchema to OpenFF 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

OpenFF to MMSchema molecule

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

Copyright (c) 2021, MolSSI

Acknowledgements

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

mmic_openff's People

Contributors

anabiman avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

mmic_openff's Issues

Dynamic/static units

The mol and ff converters assume that any unit used for a particular variable in the OpenFF schema remains constant throughout. This assumption is made for the sake of code clarity and better performance. Also MMSchema does not support dynamic units for the same field. Should it?

Example:

>>> smirnoff_data["ProperTorsions"]["Proper"][0]["k1"]
    '0.1703506220295 * mole**-1 * kilocalorie'
>>> smirnoff_data["ProperTorsions"]["Proper"][-1]["k1"]
    '0.0 * mole**-1 * kilocalorie'

The converters extract the units for k1 in this case from smirnoff_data["ProperTorsions"]["Proper"][0] and assume it is the same for the [-1] entry.

Multiple conformers

Currently MMSchema does not handle multi-conformers (whereas OpenFF toolkit does). What is the best way to handle this disrepancy?

1 - Add another dimension to Molecule.geometry ? This would make Molecule overlap with Trajectory to some degree but would make Molecule a relevant output to equilibrium MM computations as well. It seems like a neat solution.
2 - Have mmic_translator optionally return multiple Molecule objects? This would make the process of translation between MMSchema and other codes/specs a bit awkward and less rigorous.
3 - Populate the Molecule.extras field with any extra conformers? This is a temporary solution but may last a while as long as every MM code does things in its own way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.