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
- Set up solvation free energy simulation
- 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 pymbar-core
pip install mstk
Quick Example
Example 1 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, Typer
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 = Typer.open('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.
Example 2 Calculate the hydration free energy of benzene in water
-
2.1 Build a system containing 1 benzene in 1000 water, following the above example
-
2.2 Use the
mstk sfe runcommand to perform alchemical simulation under different lambda windows
mstk sfe run -p _namd-top.psf -c _gmx-conf.gro -f primitive.zff --molid 0 -i %WINDOW% --nwindow 16
Run at 16 different windows by change %WINDOW% from 0 to 15. A series of dU values will be saved in dU_%WINDOW%.csv
- 2.3 Use the
mstk sfe mbarcommand to analyse free energy change
mstk sfe mbar *.csv
Documentation
https://mstk.readthedocs.io/en/latest/index.html
TODO
- Refactor algorithms across
topologyandanalyzermodules - Separate
ommhelpermodule into its own package - Remove
analyzermodule - Revise the implementation of Drude polarization and virtual sites
Metadata
Release files for mstk 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mstk-0.4.2.tar.gz | 248.8 kB | With provenance | Details for mstk-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mstk-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for mstk-0.4.2-py3-none-any.whl |
Total release size: 544.7 kB
Release files / mstk-0.4.2.tar.gz
| Download URL | mstk-0.4.2.tar.gz |
|---|---|
| Size | 248.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
448c5cda516514b20c526473234b0483e90d7adbb4563b13ca2c63edbdeaf1b1
|
|
BLAKE2b-256 checksum How to use checksums |
d913896c62e5c63411d40679e1c1efebd93c54512ca981a569e84fa409a747f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logRelease files / mstk-0.4.2-py3-none-any.whl
| Download URL | mstk-0.4.2-py3-none-any.whl |
|---|---|
| Size | 295.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56b06f82d084f39d72eb40dafa4ef33c585d6883b01bdb0e5c1e4f74c1bb45a4
|
|
BLAKE2b-256 checksum How to use checksums |
f07c3224bc355f231b5f126668f6e91de479866eba3d2aa65ceb59a3db327407
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logSecurity for mstk 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mstk-0.4.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.