Coder Social home page Coder Social logo

molssi / mmic_parmed Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 2.0 4.62 MB

Tactic MMIC translator for ParmEd/MMSchema

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

Shell 0.46% Python 99.54%
standards molecular-dynamics molecular-mechanics interoperability mmelemental mmschema parmed

mmic_parmed's Introduction

GitHub Actions Build Status codecov Language grade: Python

ParmEd translator for MMSchema

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

image

mmic_parmed provides 4 classes of translators for: molecules, forcefields, trajectories (incomplete), and simulation (incomplete).

Models

from mmic_parmed.models import ParmedMol

# Convert MMSchema to ParmEd molecule
pa_mol = ParmedMol.from_schema(mm_mol) -> parmed.structure.Structure

# Convert ParmEd to MMSchema molecule
mm_mol = ParmedMol.to_schema(pa_mol) -> mmelemental.models.molecule.Molecule

Components

The from_schema and to_schema methods in the ParmedMol model use translation components provided by mmic_parmed and MMElemental to convert between MMSchema and ParmEd.

from mmic_parmed.components import ParmedToMolComponent, MolToParmedComponent
from mmic_parmed.models.import ParmedMol
from mmelemental.models.molecule import Molecule

MMSchema to ParmEd molecule

# Create MMSchema molecule
mm_mol = Molecule.from_file(path_to_file)

# Create translation input
inp = {
    "schema_object": mm_mol,
    "schema_version": 1,
}

# Run translator compute
outp = MolToParmedComponent.compute(inp)

# Extract parmed structure
pa_mol = outp.data_object.data

ParmEd to MMSchema molecule

# Create ParmEd input
pa_struct = parmed.load_file(path_to_file)
pa_mol = mmic_parmed.models.ParmedMol(mol=pa_struct)

# Create translation input
inp = {
    "data_object": pa_mol
}

# Running translator compute
outp = Translator.compute(inp)

# Extract MMSchema molecule
mm_mol = outp.schema_object

Copyright

Copyright (c) 2021, MolSSI

Acknowledgements

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

mmic_parmed's People

Contributors

anabiman avatar rlyehad avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

mmic_parmed's Issues

PSF files not working with PDB/XYZ files

Investigate the underlying problem with this behavior:

>>> parmed.load_file(mm_data.ffs["dialanine.psf"], xyz=mm_data.mols["dialanine.pdb"]) 
... TypeError: parse() got an unexpected keyword argument 'xyz'

Inconsistent hashing [unspecified velocity_units]

Inconsistent hash found in model reconstruction when using the mmic_parmed molecule converter.

Code snippet

import mmelemental

mol = mmelemental.models.Molecule.from_file(some_file, translator="mmic_parmed")
mol2 = mmelemental.models.Molecule(**mol.dict())

returns

Model data inconsistent with stored hash code! (type=assertion_error)

Expected behaviour

mol.get_hash() == mol2.get_hash()
False

For some reason, the generated hash code is inconsistent with the original model hash code.

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.