Build Interface Systems for Molecular Dynamics Simulations
Project description
mdinterface: Build Interface Systems for Molecular Dynamics Simulations
mdinterface is a Python package for building systems for Molecular Dynamics (MD) simulations. Initially developed for electrolyte/electrode solid-liquid interfaces, it is equally suited for pure solvent boxes, mixed-solvent electrolytes, and polymer networks.
Features
- Layer-by-layer
SimCellbuilder: add slabs, solvent regions, and vacuum gaps one step at a time; call.build()when done. - ASE & MDAnalysis integration: the assembled box converts to
ase.Atomsormda.Universewith a single call, ready for any downstream tool. - Multi-solvent support: mix solvents by molar ratio + density, ratio + total count, or explicit per-species molecule counts.
- Ion placement: dissolve ions by count, molar concentration, or a spatially-varying concentration profile.
- PACKMOL integration: handles molecular packing automatically; tolerance and dilation are tunable per layer.
- Configurable stacking axis: build along Z (default) and permute to X or Y at the end.
- Polymer builder: generate chains of arbitrary length from a monomer
Specie. - AIMD with FAIRChem: run ML-potential dynamics via FAIRChem (optional).
- RESP charges: estimate partial charges with PySCF / gpu4pyscf (optional).
- Force-field database: pre-defined parameters for common metals, noble gases, water models, and ions; or generate OPLS-AA parameters on the fly with LigParGen.
- LAMMPS output: writes data files and force-field coefficient blocks ready to run.
- GROMACS output (experimental): write
.gro,.top, and per-species.itpfiles directly fromSimCell.write_gromacs()orSpecie.write_gromacs_itp().
Requirements
Check requirements.txt for mandatory dependencies. pip install mdinterface handles them automatically.
You also need packmol installed and on your PATH:
conda install -c conda-forge packmol
Optional packages
LigParGen (automatic OPLS-AA parameters)
Follow the instructions on the LigParGen GitHub (or try this fork if you hit installation issues). Point mdinterface to your BOSS backend via config.ini:
# ~/.config/mdinterface/config.ini (path is OS-dependent)
[settings]
BOSSdir = /path/to/boss # native directory
# BOSSdir = /path/to/boss.sif # Apptainer/Singularity container
# BOSSdir = boss-container:latest # Docker image
BOSS is a 32-bit binary that can be awkward to run on modern systems. The boss-container repo provides a ready-to-build Docker/Apptainer image that handles the 32-bit library setup.
RESP charges with PySCF
Install PySCF and PyMBXAS. RESP fitting currently requires gpu4pyscf.
AIMD with FAIRChem
pip install fairchem-core
Installation
- Python 3.8+
- PACKMOL (see above)
# Stable release
pip install mdinterface
# Development version
git clone https://github.com/roncofaber/mdinterface.git
cd mdinterface
pip install -e .
Optional extras:
pip install mdinterface[resp] # RESP charge analysis
pip install mdinterface[aimd] # FAIRChem AIMD
pip install mdinterface[all] # everything
Quick start
from mdinterface import SimCell
from mdinterface.database import Water, Metal111
water = Water()
gold = Metal111("Au")
simbox = SimCell(xysize=[15, 15])
simbox.add_slab(gold, nlayers=3)
simbox.add_solvent(water, zdim=20, density=1.0)
simbox.build()
atoms = simbox.to_ase() # ase.Atoms — ready for AIMD, ML-MD, or any other tool
For LAMMPS, add ions and call write_lammps() instead:
from mdinterface.database import Ion
na = Ion("Na", ffield="Cheatham")
cl = Ion("Cl", ffield="Cheatham")
simbox = SimCell(xysize=[15, 15], verbose=True)
simbox.add_slab(gold, nlayers=3)
simbox.add_solvent(water, solute=[na, cl], nsolute=[5, 5], zdim=25, density=1.0)
simbox.add_slab(gold, nlayers=3)
simbox.build(padding=0.5)
simbox.write_lammps("data.lammps", atom_style="full", write_coeff=True)
More complete scripts are in the examples/ directory:
| Script | What it shows |
|---|---|
electrode_interface.py |
Au / NaCl electrolyte / Au sandwich |
solvent_box.py |
Pure solvent + dissolved species |
multisolvent_box.py |
Mixed-solvent box with ratio/density/count modes |
multilayer.py |
Five-layer multi-slab system |
sandwich_from_traj.py |
Electrode / membrane / electrode sandwich from an equilibrated MD trajectory |
polymer/polymer_piperion.py |
Co-polymer membrane box with explicit hydration number |
Full API reference and user guide: roncofaber.github.io/mdinterface
The legacy SimulationBox API is still available and unchanged; see examples/legacy/.
Roadmap
Since the original idea was to make a package to build MD boxes layer by layer, I am strongly debating renaming everything as "Workflow for Easy Molecular DYnamics Simulations", aka WEMDYS.
Questions & Issues
Sir, this is a WEMDY'S. Please contact me or open an issue, glad to talk about ideas and improvements!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdinterface-1.5.1.tar.gz.
File metadata
- Download URL: mdinterface-1.5.1.tar.gz
- Upload date:
- Size: 219.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9401138a52ad4ccc974d6fdd554827c332f860988ce8a8bc362574ca8ed362f7
|
|
| MD5 |
6e9ba825b71b36e4369d3db4d02e08ec
|
|
| BLAKE2b-256 |
0bf624e27ddb8e0993aaec34b1fd1ef71a22e40762746d4136e8fc55f3857f9b
|
Provenance
The following attestation bundles were made for mdinterface-1.5.1.tar.gz:
Publisher:
publish.yml on roncofaber/mdinterface
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdinterface-1.5.1.tar.gz -
Subject digest:
9401138a52ad4ccc974d6fdd554827c332f860988ce8a8bc362574ca8ed362f7 - Sigstore transparency entry: 1204013459
- Sigstore integration time:
-
Permalink:
roncofaber/mdinterface@1883f5767d9e55e9983a2cf9ef6bc008d235875f -
Branch / Tag:
refs/tags/v1.5.1 - Owner: https://github.com/roncofaber
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1883f5767d9e55e9983a2cf9ef6bc008d235875f -
Trigger Event:
push
-
Statement type:
File details
Details for the file mdinterface-1.5.1-py3-none-any.whl.
File metadata
- Download URL: mdinterface-1.5.1-py3-none-any.whl
- Upload date:
- Size: 245.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ee6007e831d860a04a99204bcdf346fe68ada7a752e4a5f3bdfa17302495e46
|
|
| MD5 |
dab94f55dccee07155cd735573a41ca8
|
|
| BLAKE2b-256 |
9bba87f23d964f8b9a9d5dde534152260e1ee7b835e428ef868258c4a360164a
|
Provenance
The following attestation bundles were made for mdinterface-1.5.1-py3-none-any.whl:
Publisher:
publish.yml on roncofaber/mdinterface
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdinterface-1.5.1-py3-none-any.whl -
Subject digest:
7ee6007e831d860a04a99204bcdf346fe68ada7a752e4a5f3bdfa17302495e46 - Sigstore transparency entry: 1204013472
- Sigstore integration time:
-
Permalink:
roncofaber/mdinterface@1883f5767d9e55e9983a2cf9ef6bc008d235875f -
Branch / Tag:
refs/tags/v1.5.1 - Owner: https://github.com/roncofaber
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1883f5767d9e55e9983a2cf9ef6bc008d235875f -
Trigger Event:
push
-
Statement type: