Skip to main content

Molecular simulation toolkit

Project description

mstk

A toolkit to make molecular simulation less painful

mstk is a Python toolkit designed to streamline the setup and management of molecular simulations, particularly geared towards non-biological applications in material science and chemical engineering. It simplifies atom typing, force field parameter assignment, and input file generation for major simulation engines.

Features

  • Assign atom types and force field parameters based on local chemical environment
  • Generate input files for LAMMPS, GROMACS, NAMD and OpenMM
  • Support Drude polarizable model, coarse-grained model, virtual site, linear angle...
  • Read/write common topology (PSF, ZMAT, PDB, LAMMPS, ...) and trajectory (GRO, XTC, DCD, LAMMPS, ...) files
  • Access local and remote job schedulers like Slurm

Installation

conda install -c conda-forge numpy pandas rdkit openmm chemfiles packmol
pip install mstk

Quick Example

Build a liquid mixture of 100 benzene and 1000 water molecules, ready for simulation.

from mstk.topology import Molecule, Topology
from mstk.forcefield import ForceField, SmartsTyper
from mstk.simsys import System
from mstk.wrapper import Packmol

# Create topology from SMILES
benzene = Molecule.from_smiles('c1ccccc1')
water = Molecule.from_smiles('O')
top = Topology([benzene, water])

# Assign atom types as defined in `data/forcefield/primitive.smt`
typer = SmartsTyper('primitive.smt')
typer.type(top)

# Build a bulk liquid simulation box with Packmol
packmol = Packmol('packmol')
top.cell.set_box([4.0, 4.0, 4.0])
top.scale_with_packmol([100, 1000], packmol=packmol)

# Assign force field parameters as defined in `data/forcefield/primitive.zff`
ff = ForceField.open('primitive.zff')
ff.assign_charge(top)
system = System(top, ff)

# Generate input files for LAMMPS, GROMACS and NAMD
system.export_lammps()
system.export_gromacs()
system.export_namd()

# Generate OpenMM system and topology
omm_sys = system.to_omm_system()
omm_top = top.to_omm_topology()

Important Note: The primitive atom typing and force field used above are for demonstration purpose only and are not well optimized for production use. For reliable simulation, please prepare you own smt and zff files or get them from a validated source.

Documentation

https://mstk.readthedocs.io/en/latest/index.html

TODO

  • Take bond order into consideration for force field assignment
  • Refactor algorithms across topology and analyzer modules
  • Separate ommhelper module into its own package
  • Remove analyzer module
  • Revise the implementation of Drude polarization and virtual sites

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mstk-0.3.19.tar.gz (240.4 kB view details)

Uploaded Source

Built Distribution

mstk-0.3.19-py3-none-any.whl (285.6 kB view details)

Uploaded Python 3

File details

Details for the file mstk-0.3.19.tar.gz.

File metadata

  • Download URL: mstk-0.3.19.tar.gz
  • Upload date:
  • Size: 240.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for mstk-0.3.19.tar.gz
Algorithm Hash digest
SHA256 5e98fbef4a62fa7a3009dcd14cfa0bd9635c34d5175516b97b352ac936cda030
MD5 cabeb990dfd3d7b791cd54d8c831c9a1
BLAKE2b-256 946e837b8b25899d7234fe8939cf4d8e6df8da0d14a94cf15367d13ed0b0617a

See more details on using hashes here.

File details

Details for the file mstk-0.3.19-py3-none-any.whl.

File metadata

  • Download URL: mstk-0.3.19-py3-none-any.whl
  • Upload date:
  • Size: 285.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for mstk-0.3.19-py3-none-any.whl
Algorithm Hash digest
SHA256 f65e919f13ffa57dbd6dac15a1d6d2ec86a858b44df9dfca66a387a516954b3a
MD5 be95816793c04f9cc8038ec870e317d1
BLAKE2b-256 f1af497a4976743f8b066047c6bf09e60fff45bef3d802f5132c59275b9a7fce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page