/openff-interchange

A project (and object) for storing, manipulating, and converting molecular mechanics data.

Primary LanguagePythonMIT LicenseMIT

OpenFF Interchange

CI Status Documentation Status Codecov coverage LGTM analysis pre-commit pre-commit.ci status

A project (and object) for storing, manipulating, and converting molecular mechanics data.

Please note that this software in an early and experimental state and unsuitable for production.

Installation

$ conda install openff-interchange -c conda-forge

Getting started

The OpenFF Iterchange object serves primarily as a container object for parametrized data. It can currently take in force fields and chemical topologies via objects in the OpenFF Toolkit and produce an object storing parametrized data.

# Use the OpenFF Toolkit to generate a minimal chemical topology
from openff.toolkit.topology import Molecule
molecule = Molecule.from_smiles("CCO")
molecule.generate_conformers(n_conformers=1)
topology = molecule.to_topology()

# Load OpenFF 2.0.0 "Sage"
from openff.toolkit.typing.engines.smirnoff import ForceField
sage = ForceField("openff-2.0.0.offxml")

# Create an Interchange object
from openff.interchange.components.interchange import Interchange
out = Interchange.from_smirnoff(force_field=sage, topology=topology)

# Define box vectors and assign atomic positions
import numpy as np
out.box = [4, 4, 4] * np.eye(3)
out.positions = molecule.conformers[0]

# Convert the Interchnage object to an OpenMM System
omm_sys = out.to_openmm(combine_nonbonded_forces=True)

# or write to GROMACS files
out.to_gro("out.gro")
out.to_top("out.top")

Future releases will include improved support for other file formats such as those used by AMBER, CHARMM, and LAMMPS.

Other examples are available via binder, executable in a web browser without installing anyting on your computer.

For more information, please consult the full documentation.

Copyright

Copyright (c) 2020-2021, Open Force Field Initiative

Acknowledgements

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