mdinterface 1.4.0__tar.gz → 1.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mdinterface-1.5.1/PKG-INFO +183 -0
- mdinterface-1.5.1/README.md +140 -0
- mdinterface-1.5.1/docs/api/database.md +23 -0
- mdinterface-1.5.1/docs/api/externals.md +19 -0
- mdinterface-1.5.1/docs/api/io.md +27 -0
- mdinterface-1.5.1/docs/api/polymer.md +3 -0
- mdinterface-1.5.1/docs/api/simcell.md +3 -0
- mdinterface-1.5.1/docs/api/specie.md +3 -0
- mdinterface-1.5.1/docs/assets/mdinterface.png +0 -0
- mdinterface-1.5.1/docs/guide/database.md +86 -0
- mdinterface-1.5.1/docs/guide/logging.md +52 -0
- mdinterface-1.5.1/docs/guide/polymer.md +176 -0
- mdinterface-1.5.1/docs/guide/simcell.md +170 -0
- mdinterface-1.5.1/docs/guide/specie.md +60 -0
- mdinterface-1.5.1/docs/index.md +50 -0
- mdinterface-1.5.1/docs/installation.md +86 -0
- mdinterface-1.5.1/docs/quickstart.md +108 -0
- mdinterface-1.5.1/docs/requirements.txt +2 -0
- mdinterface-1.5.1/examples/electrode_interface.py +71 -0
- mdinterface-1.5.1/examples/legacy/make_POSCAR.py +67 -0
- mdinterface-1.5.1/examples/multilayer.py +67 -0
- mdinterface-1.5.1/examples/multisolvent_box.py +83 -0
- mdinterface-1.5.1/examples/polymer/polymer_piperion.py +156 -0
- mdinterface-1.5.1/examples/sandwich_from_traj.py +111 -0
- mdinterface-1.5.1/examples/solvent_box.py +50 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/__init__.py +5 -3
- mdinterface-1.5.1/mdinterface/build/__init__.py +16 -0
- mdinterface-1.5.1/mdinterface/build/box.py +232 -0
- mdinterface-1.5.1/mdinterface/build/builder.py +974 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/build/continuum2sim.py +11 -2
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/build/polymerize.py +25 -55
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/build/snippets.py +7 -3
- mdinterface-1.5.1/mdinterface/build/solvent.py +324 -0
- mdinterface-1.5.1/mdinterface/core/__init__.py +9 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/core/polymer.py +82 -13
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/core/specie.py +319 -129
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/core/topology.py +11 -6
- mdinterface-1.5.1/mdinterface/database/__init__.py +16 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/database/graphene.py +24 -2
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/database/ions.py +89 -11
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/database/metals.py +29 -3
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/database/molecules.py +35 -3
- mdinterface-1.5.1/mdinterface/database/nobles.py +112 -0
- mdinterface-1.5.1/mdinterface/externals/__init__.py +22 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/externals/aimd.py +18 -6
- mdinterface-1.5.1/mdinterface/externals/ase.py +79 -0
- mdinterface-1.5.1/mdinterface/externals/ligpargen.py +462 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/externals/obabel.py +19 -15
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/externals/optimization.py +14 -18
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/externals/pyscf.py +18 -15
- mdinterface-1.5.1/mdinterface/io/__init__.py +10 -0
- mdinterface-1.5.1/mdinterface/io/gromacswriter.py +269 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/io/lammpswriter.py +9 -4
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/io/packmol.py +5 -3
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/io/read.py +115 -4
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/read/trajectory.py +7 -4
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/simulationbox.py +10 -6
- mdinterface-1.5.1/mdinterface/utils/__init__.py +17 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/utils/auxiliary.py +5 -4
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/utils/graphs.py +5 -3
- mdinterface-1.5.1/mdinterface/utils/logger.py +190 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/utils/map.py +53 -21
- mdinterface-1.5.1/mdinterface/utils/rings.py +59 -0
- mdinterface-1.5.1/mdinterface.egg-info/PKG-INFO +183 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface.egg-info/SOURCES.txt +42 -6
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface.egg-info/requires.txt +0 -1
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface.egg-info/top_level.txt +3 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/pyproject.toml +7 -2
- mdinterface-1.5.1/tests/__init__.py +0 -0
- mdinterface-1.5.1/tests/test_auxiliary.py +157 -0
- mdinterface-1.5.1/tests/test_builder.py +393 -0
- mdinterface-1.5.1/tests/test_database.py +175 -0
- mdinterface-1.5.1/tests/test_solvent.py +129 -0
- mdinterface-1.5.1/tests/test_specie.py +138 -0
- mdinterface-1.5.1/tests/test_topology.py +101 -0
- mdinterface-1.4.0/PKG-INFO +0 -237
- mdinterface-1.4.0/README.md +0 -193
- mdinterface-1.4.0/mdinterface/build/__init__.py +0 -3
- mdinterface-1.4.0/mdinterface/build/box.py +0 -381
- mdinterface-1.4.0/mdinterface/build/charges.py +0 -8
- mdinterface-1.4.0/mdinterface/core/__init__.py +0 -9
- mdinterface-1.4.0/mdinterface/database/__init__.py +0 -12
- mdinterface-1.4.0/mdinterface/externals/__init__.py +0 -19
- mdinterface-1.4.0/mdinterface/externals/ligpargen.py +0 -109
- mdinterface-1.4.0/mdinterface/io/__init__.py +0 -8
- mdinterface-1.4.0/mdinterface/utils/__init__.py +0 -9
- mdinterface-1.4.0/mdinterface.egg-info/PKG-INFO +0 -237
- {mdinterface-1.4.0 → mdinterface-1.5.1}/LICENSE +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/MANIFEST.in +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/assets/mdinterface.png +0 -0
- {mdinterface-1.4.0/mdinterface/examples → mdinterface-1.5.1/examples/legacy}/make_box.py +0 -0
- {mdinterface-1.4.0/mdinterface/examples → mdinterface-1.5.1/examples/legacy}/make_polymer.py +0 -0
- {mdinterface-1.4.0/mdinterface/examples → mdinterface-1.5.1/examples/legacy}/make_solvent_box.py +0 -0
- {mdinterface-1.4.0/mdinterface/examples → mdinterface-1.5.1/examples/legacy}/make_specie_ligpargen_resp.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/config.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/read/cp2ktraj.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/read/lammpstraj.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/read/read.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/read/xyztraj.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/utils/draw.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/utils/poisson.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface/utils/units.py +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/mdinterface.egg-info/dependency_links.txt +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/requirements.txt +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/setup.cfg +0 -0
- {mdinterface-1.4.0 → mdinterface-1.5.1}/setup.py +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mdinterface
|
|
3
|
+
Version: 1.5.1
|
|
4
|
+
Summary: Build Interface Systems for Molecular Dynamics Simulations
|
|
5
|
+
Author-email: Fabrice Roncoroni <fabrice.roncoroni@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/roncofaber/mdinterface
|
|
8
|
+
Project-URL: Repository, https://gitlab.com/roncofaber/mdinterface.git
|
|
9
|
+
Project-URL: Documentation, https://gitlab.com/roncofaber/mdinterface
|
|
10
|
+
Project-URL: Bug Tracker, https://gitlab.com/roncofaber/mdinterface/-/issues
|
|
11
|
+
Keywords: molecular dynamics,simulation,interface,chemistry,materials science
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: mdanalysis>=2.0.0
|
|
28
|
+
Requires-Dist: ase>=3.22.0
|
|
29
|
+
Requires-Dist: numpy>=1.20.0
|
|
30
|
+
Requires-Dist: networkx>=2.5
|
|
31
|
+
Requires-Dist: platformdirs>=2.0.0
|
|
32
|
+
Requires-Dist: configparser>=5.0.0
|
|
33
|
+
Provides-Extra: resp
|
|
34
|
+
Requires-Dist: pyscf>=2.0.0; extra == "resp"
|
|
35
|
+
Requires-Dist: pymbxas; extra == "resp"
|
|
36
|
+
Provides-Extra: aimd
|
|
37
|
+
Requires-Dist: fairchem-core; extra == "aimd"
|
|
38
|
+
Provides-Extra: all
|
|
39
|
+
Requires-Dist: pyscf>=2.0.0; extra == "all"
|
|
40
|
+
Requires-Dist: pymbxas; extra == "all"
|
|
41
|
+
Requires-Dist: fairchem-core; extra == "all"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
<div style="display: flex; align-items: center;">
|
|
45
|
+
<img src="./assets/mdinterface.png" alt="Logo" width="80" style="margin-right: 10px;">
|
|
46
|
+
<div style="display: flex; flex-direction: column;">
|
|
47
|
+
<h1 style="margin: 0;">mdinterface: Build Interface Systems for Molecular Dynamics Simulations</h1>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
[](https://pypi.org/project/mdinterface/) [](https://github.com/roncofaber/mdinterface) [](https://roncofaber.github.io/mdinterface)
|
|
52
|
+
|
|
53
|
+
`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.
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
|
|
57
|
+
- **Layer-by-layer `SimCell` builder**: add slabs, solvent regions, and vacuum gaps one step at a time; call `.build()` when done.
|
|
58
|
+
- **ASE & MDAnalysis integration**: the assembled box converts to `ase.Atoms` or `mda.Universe` with a single call, ready for any downstream tool.
|
|
59
|
+
- **Multi-solvent support**: mix solvents by molar ratio + density, ratio + total count, or explicit per-species molecule counts.
|
|
60
|
+
- **Ion placement**: dissolve ions by count, molar concentration, or a spatially-varying concentration profile.
|
|
61
|
+
- **PACKMOL integration**: handles molecular packing automatically; tolerance and dilation are tunable per layer.
|
|
62
|
+
- **Configurable stacking axis**: build along Z (default) and permute to X or Y at the end.
|
|
63
|
+
- **Polymer builder**: generate chains of arbitrary length from a monomer `Specie`.
|
|
64
|
+
- **AIMD with FAIRChem**: run ML-potential dynamics via FAIRChem (optional).
|
|
65
|
+
- **RESP charges**: estimate partial charges with PySCF / gpu4pyscf (optional).
|
|
66
|
+
- **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.
|
|
67
|
+
- **LAMMPS output**: writes data files and force-field coefficient blocks ready to run.
|
|
68
|
+
- **GROMACS output** *(experimental)*: write `.gro`, `.top`, and per-species `.itp` files directly from `SimCell.write_gromacs()` or `Specie.write_gromacs_itp()`.
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
|
|
72
|
+
Check [requirements.txt](requirements.txt) for mandatory dependencies. `pip install mdinterface` handles them automatically.
|
|
73
|
+
|
|
74
|
+
You also need `packmol` installed and on your `PATH`:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
conda install -c conda-forge packmol
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Optional packages
|
|
81
|
+
|
|
82
|
+
#### LigParGen (automatic OPLS-AA parameters)
|
|
83
|
+
|
|
84
|
+
Follow the instructions on the [LigParGen GitHub](https://github.com/Isra3l/ligpargen) (or try [this fork](https://github.com/roncofaber/ligpargen) if you hit installation issues). Point `mdinterface` to your BOSS backend via `config.ini`:
|
|
85
|
+
|
|
86
|
+
```ini
|
|
87
|
+
# ~/.config/mdinterface/config.ini (path is OS-dependent)
|
|
88
|
+
[settings]
|
|
89
|
+
BOSSdir = /path/to/boss # native directory
|
|
90
|
+
# BOSSdir = /path/to/boss.sif # Apptainer/Singularity container
|
|
91
|
+
# BOSSdir = boss-container:latest # Docker image
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
BOSS is a 32-bit binary that can be awkward to run on modern systems. The [boss-container](https://github.com/roncofaber/boss-container) repo provides a ready-to-build Docker/Apptainer image that handles the 32-bit library setup.
|
|
95
|
+
|
|
96
|
+
#### RESP charges with PySCF
|
|
97
|
+
|
|
98
|
+
Install [PySCF](https://github.com/pyscf/pyscf) and [PyMBXAS](https://gitlab.com/roncofaber/pymbxas). RESP fitting currently requires [gpu4pyscf](https://github.com/pyscf/gpu4pyscf).
|
|
99
|
+
|
|
100
|
+
#### AIMD with FAIRChem
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install fairchem-core
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Installation
|
|
107
|
+
|
|
108
|
+
- **Python** 3.8+
|
|
109
|
+
- **PACKMOL** (see above)
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Stable release
|
|
113
|
+
pip install mdinterface
|
|
114
|
+
|
|
115
|
+
# Development version
|
|
116
|
+
git clone https://github.com/roncofaber/mdinterface.git
|
|
117
|
+
cd mdinterface
|
|
118
|
+
pip install -e .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Optional extras:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pip install mdinterface[resp] # RESP charge analysis
|
|
125
|
+
pip install mdinterface[aimd] # FAIRChem AIMD
|
|
126
|
+
pip install mdinterface[all] # everything
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Quick start
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from mdinterface import SimCell
|
|
133
|
+
from mdinterface.database import Water, Metal111
|
|
134
|
+
|
|
135
|
+
water = Water()
|
|
136
|
+
gold = Metal111("Au")
|
|
137
|
+
|
|
138
|
+
simbox = SimCell(xysize=[15, 15])
|
|
139
|
+
simbox.add_slab(gold, nlayers=3)
|
|
140
|
+
simbox.add_solvent(water, zdim=20, density=1.0)
|
|
141
|
+
simbox.build()
|
|
142
|
+
|
|
143
|
+
atoms = simbox.to_ase() # ase.Atoms — ready for AIMD, ML-MD, or any other tool
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
For LAMMPS, add ions and call `write_lammps()` instead:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from mdinterface.database import Ion
|
|
150
|
+
|
|
151
|
+
na = Ion("Na", ffield="Cheatham")
|
|
152
|
+
cl = Ion("Cl", ffield="Cheatham")
|
|
153
|
+
|
|
154
|
+
simbox = SimCell(xysize=[15, 15], verbose=True)
|
|
155
|
+
simbox.add_slab(gold, nlayers=3)
|
|
156
|
+
simbox.add_solvent(water, solute=[na, cl], nsolute=[5, 5], zdim=25, density=1.0)
|
|
157
|
+
simbox.add_slab(gold, nlayers=3)
|
|
158
|
+
simbox.build(padding=0.5)
|
|
159
|
+
simbox.write_lammps("data.lammps", atom_style="full", write_coeff=True)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
More complete scripts are in the [examples/](examples/) directory:
|
|
163
|
+
|
|
164
|
+
| Script | What it shows |
|
|
165
|
+
|--------|--------------|
|
|
166
|
+
| `electrode_interface.py` | Au / NaCl electrolyte / Au sandwich |
|
|
167
|
+
| `solvent_box.py` | Pure solvent + dissolved species |
|
|
168
|
+
| `multisolvent_box.py` | Mixed-solvent box with ratio/density/count modes |
|
|
169
|
+
| `multilayer.py` | Five-layer multi-slab system |
|
|
170
|
+
| `sandwich_from_traj.py` | Electrode / membrane / electrode sandwich from an equilibrated MD trajectory |
|
|
171
|
+
| `polymer/polymer_piperion.py` | Co-polymer membrane box with explicit hydration number |
|
|
172
|
+
|
|
173
|
+
Full API reference and user guide: [roncofaber.github.io/mdinterface](https://roncofaber.github.io/mdinterface)
|
|
174
|
+
|
|
175
|
+
The legacy `SimulationBox` API is still available and unchanged; see [examples/legacy/](examples/legacy/).
|
|
176
|
+
|
|
177
|
+
## Roadmap
|
|
178
|
+
|
|
179
|
+
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.
|
|
180
|
+
|
|
181
|
+
## Questions & Issues
|
|
182
|
+
|
|
183
|
+
Sir, this is a WEMDY'S. Please contact me or open an issue, glad to talk about ideas and improvements!
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<div style="display: flex; align-items: center;">
|
|
2
|
+
<img src="./assets/mdinterface.png" alt="Logo" width="80" style="margin-right: 10px;">
|
|
3
|
+
<div style="display: flex; flex-direction: column;">
|
|
4
|
+
<h1 style="margin: 0;">mdinterface: Build Interface Systems for Molecular Dynamics Simulations</h1>
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/mdinterface/) [](https://github.com/roncofaber/mdinterface) [](https://roncofaber.github.io/mdinterface)
|
|
9
|
+
|
|
10
|
+
`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.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Layer-by-layer `SimCell` builder**: add slabs, solvent regions, and vacuum gaps one step at a time; call `.build()` when done.
|
|
15
|
+
- **ASE & MDAnalysis integration**: the assembled box converts to `ase.Atoms` or `mda.Universe` with a single call, ready for any downstream tool.
|
|
16
|
+
- **Multi-solvent support**: mix solvents by molar ratio + density, ratio + total count, or explicit per-species molecule counts.
|
|
17
|
+
- **Ion placement**: dissolve ions by count, molar concentration, or a spatially-varying concentration profile.
|
|
18
|
+
- **PACKMOL integration**: handles molecular packing automatically; tolerance and dilation are tunable per layer.
|
|
19
|
+
- **Configurable stacking axis**: build along Z (default) and permute to X or Y at the end.
|
|
20
|
+
- **Polymer builder**: generate chains of arbitrary length from a monomer `Specie`.
|
|
21
|
+
- **AIMD with FAIRChem**: run ML-potential dynamics via FAIRChem (optional).
|
|
22
|
+
- **RESP charges**: estimate partial charges with PySCF / gpu4pyscf (optional).
|
|
23
|
+
- **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.
|
|
24
|
+
- **LAMMPS output**: writes data files and force-field coefficient blocks ready to run.
|
|
25
|
+
- **GROMACS output** *(experimental)*: write `.gro`, `.top`, and per-species `.itp` files directly from `SimCell.write_gromacs()` or `Specie.write_gromacs_itp()`.
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
|
|
29
|
+
Check [requirements.txt](requirements.txt) for mandatory dependencies. `pip install mdinterface` handles them automatically.
|
|
30
|
+
|
|
31
|
+
You also need `packmol` installed and on your `PATH`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
conda install -c conda-forge packmol
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Optional packages
|
|
38
|
+
|
|
39
|
+
#### LigParGen (automatic OPLS-AA parameters)
|
|
40
|
+
|
|
41
|
+
Follow the instructions on the [LigParGen GitHub](https://github.com/Isra3l/ligpargen) (or try [this fork](https://github.com/roncofaber/ligpargen) if you hit installation issues). Point `mdinterface` to your BOSS backend via `config.ini`:
|
|
42
|
+
|
|
43
|
+
```ini
|
|
44
|
+
# ~/.config/mdinterface/config.ini (path is OS-dependent)
|
|
45
|
+
[settings]
|
|
46
|
+
BOSSdir = /path/to/boss # native directory
|
|
47
|
+
# BOSSdir = /path/to/boss.sif # Apptainer/Singularity container
|
|
48
|
+
# BOSSdir = boss-container:latest # Docker image
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
BOSS is a 32-bit binary that can be awkward to run on modern systems. The [boss-container](https://github.com/roncofaber/boss-container) repo provides a ready-to-build Docker/Apptainer image that handles the 32-bit library setup.
|
|
52
|
+
|
|
53
|
+
#### RESP charges with PySCF
|
|
54
|
+
|
|
55
|
+
Install [PySCF](https://github.com/pyscf/pyscf) and [PyMBXAS](https://gitlab.com/roncofaber/pymbxas). RESP fitting currently requires [gpu4pyscf](https://github.com/pyscf/gpu4pyscf).
|
|
56
|
+
|
|
57
|
+
#### AIMD with FAIRChem
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install fairchem-core
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
- **Python** 3.8+
|
|
66
|
+
- **PACKMOL** (see above)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Stable release
|
|
70
|
+
pip install mdinterface
|
|
71
|
+
|
|
72
|
+
# Development version
|
|
73
|
+
git clone https://github.com/roncofaber/mdinterface.git
|
|
74
|
+
cd mdinterface
|
|
75
|
+
pip install -e .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Optional extras:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install mdinterface[resp] # RESP charge analysis
|
|
82
|
+
pip install mdinterface[aimd] # FAIRChem AIMD
|
|
83
|
+
pip install mdinterface[all] # everything
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Quick start
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from mdinterface import SimCell
|
|
90
|
+
from mdinterface.database import Water, Metal111
|
|
91
|
+
|
|
92
|
+
water = Water()
|
|
93
|
+
gold = Metal111("Au")
|
|
94
|
+
|
|
95
|
+
simbox = SimCell(xysize=[15, 15])
|
|
96
|
+
simbox.add_slab(gold, nlayers=3)
|
|
97
|
+
simbox.add_solvent(water, zdim=20, density=1.0)
|
|
98
|
+
simbox.build()
|
|
99
|
+
|
|
100
|
+
atoms = simbox.to_ase() # ase.Atoms — ready for AIMD, ML-MD, or any other tool
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For LAMMPS, add ions and call `write_lammps()` instead:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from mdinterface.database import Ion
|
|
107
|
+
|
|
108
|
+
na = Ion("Na", ffield="Cheatham")
|
|
109
|
+
cl = Ion("Cl", ffield="Cheatham")
|
|
110
|
+
|
|
111
|
+
simbox = SimCell(xysize=[15, 15], verbose=True)
|
|
112
|
+
simbox.add_slab(gold, nlayers=3)
|
|
113
|
+
simbox.add_solvent(water, solute=[na, cl], nsolute=[5, 5], zdim=25, density=1.0)
|
|
114
|
+
simbox.add_slab(gold, nlayers=3)
|
|
115
|
+
simbox.build(padding=0.5)
|
|
116
|
+
simbox.write_lammps("data.lammps", atom_style="full", write_coeff=True)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
More complete scripts are in the [examples/](examples/) directory:
|
|
120
|
+
|
|
121
|
+
| Script | What it shows |
|
|
122
|
+
|--------|--------------|
|
|
123
|
+
| `electrode_interface.py` | Au / NaCl electrolyte / Au sandwich |
|
|
124
|
+
| `solvent_box.py` | Pure solvent + dissolved species |
|
|
125
|
+
| `multisolvent_box.py` | Mixed-solvent box with ratio/density/count modes |
|
|
126
|
+
| `multilayer.py` | Five-layer multi-slab system |
|
|
127
|
+
| `sandwich_from_traj.py` | Electrode / membrane / electrode sandwich from an equilibrated MD trajectory |
|
|
128
|
+
| `polymer/polymer_piperion.py` | Co-polymer membrane box with explicit hydration number |
|
|
129
|
+
|
|
130
|
+
Full API reference and user guide: [roncofaber.github.io/mdinterface](https://roncofaber.github.io/mdinterface)
|
|
131
|
+
|
|
132
|
+
The legacy `SimulationBox` API is still available and unchanged; see [examples/legacy/](examples/legacy/).
|
|
133
|
+
|
|
134
|
+
## Roadmap
|
|
135
|
+
|
|
136
|
+
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.
|
|
137
|
+
|
|
138
|
+
## Questions & Issues
|
|
139
|
+
|
|
140
|
+
Sir, this is a WEMDY'S. Please contact me or open an issue, glad to talk about ideas and improvements!
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
|
|
3
|
+
## Metals
|
|
4
|
+
|
|
5
|
+
::: mdinterface.database.metals.Metal111
|
|
6
|
+
|
|
7
|
+
## Water
|
|
8
|
+
|
|
9
|
+
::: mdinterface.database.molecules.Water
|
|
10
|
+
|
|
11
|
+
## Ions
|
|
12
|
+
|
|
13
|
+
::: mdinterface.database.ions.Ion
|
|
14
|
+
|
|
15
|
+
::: mdinterface.database.ions.lookup_parameters
|
|
16
|
+
|
|
17
|
+
## Noble gases
|
|
18
|
+
|
|
19
|
+
::: mdinterface.database.nobles.NobleGas
|
|
20
|
+
|
|
21
|
+
## Graphene
|
|
22
|
+
|
|
23
|
+
::: mdinterface.database.graphene.Graphene
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Externals
|
|
2
|
+
|
|
3
|
+
Optional integrations with third-party tools.
|
|
4
|
+
|
|
5
|
+
## LigParGen (OPLS-AA parameters)
|
|
6
|
+
|
|
7
|
+
::: mdinterface.externals.ligpargen.refine_large_specie_topology
|
|
8
|
+
|
|
9
|
+
## RESP charges (PySCF)
|
|
10
|
+
|
|
11
|
+
::: mdinterface.externals.pyscf.calculate_RESP_charges
|
|
12
|
+
|
|
13
|
+
## Structure relaxation (ASE)
|
|
14
|
+
|
|
15
|
+
::: mdinterface.externals.optimization.relax_structure
|
|
16
|
+
|
|
17
|
+
## AIMD (FAIRChem)
|
|
18
|
+
|
|
19
|
+
::: mdinterface.externals.aimd.run_aimd
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# I/O
|
|
2
|
+
|
|
3
|
+
## Reading structures
|
|
4
|
+
|
|
5
|
+
::: mdinterface.io.read.read_lammps_data_file
|
|
6
|
+
|
|
7
|
+
::: mdinterface.io.read.read_lammps_nth_frame
|
|
8
|
+
|
|
9
|
+
## GROMACS writer
|
|
10
|
+
|
|
11
|
+
!!! warning
|
|
12
|
+
GROMACS output is experimental. Verify results against a reference
|
|
13
|
+
before production use.
|
|
14
|
+
|
|
15
|
+
::: mdinterface.io.gromacswriter.write_gromacs_itp
|
|
16
|
+
|
|
17
|
+
::: mdinterface.io.gromacswriter.write_gromacs_top
|
|
18
|
+
|
|
19
|
+
## Logging utilities
|
|
20
|
+
|
|
21
|
+
::: mdinterface.utils.logger.set_verbosity
|
|
22
|
+
|
|
23
|
+
::: mdinterface.utils.logger.log_header
|
|
24
|
+
|
|
25
|
+
::: mdinterface.utils.logger.log_subheader
|
|
26
|
+
|
|
27
|
+
::: mdinterface.utils.logger.log_banner
|
|
Binary file
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
|
|
3
|
+
`mdinterface` ships a built-in database of common species with pre-defined force-field parameters. All entries are importable from `mdinterface.database`.
|
|
4
|
+
|
|
5
|
+
## Metals
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from mdinterface.database import Metal111
|
|
9
|
+
|
|
10
|
+
gold = Metal111("Au")
|
|
11
|
+
silver = Metal111("Ag")
|
|
12
|
+
platinum = Metal111("Pt")
|
|
13
|
+
copper = Metal111("Cu")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`Metal111` generates an FCC (111) surface slab. The element symbol selects the lattice parameter and Lennard-Jones parameters.
|
|
17
|
+
|
|
18
|
+
## Water models
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from mdinterface.database import Water
|
|
22
|
+
|
|
23
|
+
water_spce = Water(model="ewald") # modified tip3p model
|
|
24
|
+
water_tip4p = Water(model="spce") # SPC/E water
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Ions
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from mdinterface.database import Ion
|
|
31
|
+
|
|
32
|
+
na = Ion("Na", ffield="Cheatham")
|
|
33
|
+
cl = Ion("Cl", ffield="Cheatham")
|
|
34
|
+
li = Ion("Li", ffield="Cheatham")
|
|
35
|
+
k = Ion("K", ffield="Cheatham")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Currently, the following force field parameters for monovalent ions have been implemented:
|
|
39
|
+
|
|
40
|
+
- **Aqvist** : J. Phys. Chem. B 2008, [https://pubs.acs.org/doi/10.1021/jp8001614](https://pubs.acs.org/doi/10.1021/jp8001614),
|
|
41
|
+
- **Jorgensen**: J. Chem. Theory Comput. 2006, [https://pubs.acs.org/doi/10.1021/ct600252r](https://pubs.acs.org/doi/10.1021/ct600252r)
|
|
42
|
+
- **Cheatham** : J. Phys. Chem. B 2008, [https://pubs.acs.org/doi/10.1021/jp8001614](https://pubs.acs.org/doi/10.1021/jp8001614)
|
|
43
|
+
- **Sengupta** : J. Chem. Inf. Model. 2021, [https://pubs.acs.org/doi/10.1021/acs.jcim.0c01390](https://pubs.acs.org/doi/10.1021/acs.jcim.0c01390)
|
|
44
|
+
- **Dang** : J. Chem. Phys. 1992/1994
|
|
45
|
+
- **OPLS-AA** : J. Chem. Theory Comput. 2009, [https://pubs.acs.org/doi/10.1021/ct900009a](https://pubs.acs.org/doi/10.1021/ct900009a)
|
|
46
|
+
|
|
47
|
+
Special ion species also available:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from mdinterface.database import Perchlorate, Hydronium, Hydroxide
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If the parameter set you are looking for are not present, you can always create a Specie explicitly:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from mdinterface import Specie
|
|
57
|
+
|
|
58
|
+
Li = Specie("Li", charges=1, lj={"Li": [0.33673, 1.40940]})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Noble gases
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from mdinterface.database import Neon, Argon, Krypton, Xenon, NobleGas
|
|
67
|
+
|
|
68
|
+
ar = Argon()
|
|
69
|
+
xe = Xenon()
|
|
70
|
+
# or generically:
|
|
71
|
+
gas = NobleGas("Kr")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Graphene
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from mdinterface.database import Graphene
|
|
78
|
+
|
|
79
|
+
grap = Graphene()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Small molecules
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from mdinterface.database import Oxygen, Hydrogen, Nitrogen
|
|
86
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Logging
|
|
2
|
+
|
|
3
|
+
`mdinterface` uses Python's standard `logging` module. By default all log output is suppressed (a `NullHandler` is installed at import time, following standard library practice).
|
|
4
|
+
|
|
5
|
+
## Enabling output
|
|
6
|
+
|
|
7
|
+
**Package-wide** — the recommended approach:
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
import mdinterface
|
|
11
|
+
|
|
12
|
+
mdinterface.set_verbosity(1) # INFO (normal detail)
|
|
13
|
+
mdinterface.set_verbosity(2) # DEBUG (maximum detail)
|
|
14
|
+
mdinterface.set_verbosity(0) # WARNING (quiet)
|
|
15
|
+
mdinterface.set_verbosity("DEBUG") # string form
|
|
16
|
+
mdinterface.set_verbosity(True) # same as 1 / INFO
|
|
17
|
+
mdinterface.set_verbosity(False) # same as 0 / WARNING
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Via SimCell constructor** — convenient for one-off scripts:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from mdinterface import SimCell
|
|
24
|
+
|
|
25
|
+
simbox = SimCell(xysize=[15, 15], verbose=True) # INFO
|
|
26
|
+
simbox = SimCell(xysize=[15, 15], verbose=2) # DEBUG
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Verbosity levels
|
|
30
|
+
|
|
31
|
+
| Value | Level | Typical output |
|
|
32
|
+
|-------|-------|----------------|
|
|
33
|
+
| `0` / `False` | WARNING | Only warnings and errors |
|
|
34
|
+
| `1` / `True` | INFO | Build summary, layer sizes, molecule counts |
|
|
35
|
+
| `2` | DEBUG | PACKMOL details, internal operations |
|
|
36
|
+
| `"DEBUG"` / `"INFO"` / ... | raw Python level | Passed directly to `logging` |
|
|
37
|
+
|
|
38
|
+
## Log format
|
|
39
|
+
|
|
40
|
+
All messages are prefixed with `[mdi]` and a compact 4-character level name:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
[mdi] INFO | === Build ================================
|
|
44
|
+
[mdi] INFO |
|
|
45
|
+
[mdi] INFO | -- Layer [1/3] --------------------------
|
|
46
|
+
[mdi] INFO | >> Au (111): 14.421 x 14.421 x 6.657 Å, 480 atoms
|
|
47
|
+
[mdi] INFO | >> layer z: +6.66 Å | total z: 6.66 Å
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Integration with existing logging config
|
|
51
|
+
|
|
52
|
+
Since `mdinterface` uses a dedicated `"mdinterface"` logger subtree, it coexists cleanly with any logging configuration you already have in your application. `set_verbosity` only affects the `"mdinterface"` logger family and does not touch the root logger.
|