mdinterface 1.5.0__tar.gz → 1.5.2__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.
Files changed (99) hide show
  1. {mdinterface-1.5.0/mdinterface.egg-info → mdinterface-1.5.2}/PKG-INFO +47 -61
  2. mdinterface-1.5.2/README.md +140 -0
  3. mdinterface-1.5.2/docs/api/database.md +23 -0
  4. mdinterface-1.5.2/docs/api/externals.md +19 -0
  5. mdinterface-1.5.2/docs/api/io.md +27 -0
  6. mdinterface-1.5.2/docs/api/polymer.md +3 -0
  7. mdinterface-1.5.2/docs/api/simcell.md +3 -0
  8. mdinterface-1.5.2/docs/api/specie.md +3 -0
  9. mdinterface-1.5.2/docs/assets/mdinterface.png +0 -0
  10. mdinterface-1.5.2/docs/guide/database.md +86 -0
  11. mdinterface-1.5.2/docs/guide/logging.md +52 -0
  12. mdinterface-1.5.2/docs/guide/polymer.md +176 -0
  13. mdinterface-1.5.2/docs/guide/simcell.md +170 -0
  14. mdinterface-1.5.2/docs/guide/specie.md +60 -0
  15. mdinterface-1.5.2/docs/index.md +50 -0
  16. mdinterface-1.5.2/docs/installation.md +86 -0
  17. mdinterface-1.5.2/docs/quickstart.md +108 -0
  18. mdinterface-1.5.2/docs/requirements.txt +2 -0
  19. mdinterface-1.5.0/examples/box_builder/builder_electrode_interface.py → mdinterface-1.5.2/examples/electrode_interface.py +8 -7
  20. mdinterface-1.5.0/examples/box_builder/builder_multilayer.py → mdinterface-1.5.2/examples/multilayer.py +7 -7
  21. mdinterface-1.5.0/examples/box_builder/builder_multisolvent_box.py → mdinterface-1.5.2/examples/multisolvent_box.py +9 -9
  22. mdinterface-1.5.2/examples/polymer/polymer_piperion.py +156 -0
  23. mdinterface-1.5.2/examples/sandwich_from_traj.py +111 -0
  24. mdinterface-1.5.0/examples/box_builder/builder_solvent_box.py → mdinterface-1.5.2/examples/solvent_box.py +6 -6
  25. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/__init__.py +5 -4
  26. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/build/__init__.py +9 -2
  27. mdinterface-1.5.2/mdinterface/build/box.py +232 -0
  28. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/build/builder.py +397 -128
  29. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/build/continuum2sim.py +11 -2
  30. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/build/polymerize.py +8 -3
  31. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/build/snippets.py +5 -2
  32. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/build/solvent.py +142 -88
  33. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/core/polymer.py +62 -10
  34. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/core/specie.py +222 -17
  35. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/core/topology.py +6 -2
  36. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/database/__init__.py +4 -2
  37. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/database/graphene.py +24 -2
  38. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/database/ions.py +88 -10
  39. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/database/metals.py +29 -3
  40. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/database/molecules.py +28 -2
  41. mdinterface-1.5.2/mdinterface/externals/__init__.py +22 -0
  42. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/externals/aimd.py +18 -6
  43. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/externals/ase.py +12 -3
  44. mdinterface-1.5.2/mdinterface/externals/ligpargen.py +465 -0
  45. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/externals/obabel.py +8 -3
  46. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/externals/optimization.py +12 -3
  47. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/externals/pyscf.py +17 -14
  48. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/io/__init__.py +1 -0
  49. mdinterface-1.5.2/mdinterface/io/gromacswriter.py +269 -0
  50. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/io/lammpswriter.py +8 -3
  51. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/io/packmol.py +4 -2
  52. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/io/read.py +46 -5
  53. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/simulationbox.py +5 -2
  54. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/auxiliary.py +3 -2
  55. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/graphs.py +4 -2
  56. mdinterface-1.5.2/mdinterface/utils/logger.py +190 -0
  57. {mdinterface-1.5.0 → mdinterface-1.5.2/mdinterface.egg-info}/PKG-INFO +47 -61
  58. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface.egg-info/SOURCES.txt +30 -10
  59. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface.egg-info/requires.txt +0 -1
  60. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface.egg-info/top_level.txt +1 -0
  61. {mdinterface-1.5.0 → mdinterface-1.5.2}/pyproject.toml +0 -1
  62. {mdinterface-1.5.0 → mdinterface-1.5.2}/tests/test_builder.py +67 -66
  63. mdinterface-1.5.2/tests/test_solvent.py +129 -0
  64. mdinterface-1.5.0/README.md +0 -153
  65. mdinterface-1.5.0/examples/box_builder/builder_sandwich_from_traj.py +0 -91
  66. mdinterface-1.5.0/mdinterface/build/box.py +0 -150
  67. mdinterface-1.5.0/mdinterface/externals/__init__.py +0 -19
  68. mdinterface-1.5.0/mdinterface/externals/ligpargen.py +0 -109
  69. {mdinterface-1.5.0 → mdinterface-1.5.2}/LICENSE +0 -0
  70. {mdinterface-1.5.0 → mdinterface-1.5.2}/MANIFEST.in +0 -0
  71. {mdinterface-1.5.0 → mdinterface-1.5.2}/assets/mdinterface.png +0 -0
  72. {mdinterface-1.5.0/examples/simulation_box → mdinterface-1.5.2/examples/legacy}/make_POSCAR.py +0 -0
  73. {mdinterface-1.5.0/examples/simulation_box → mdinterface-1.5.2/examples/legacy}/make_box.py +0 -0
  74. {mdinterface-1.5.0/examples/simulation_box → mdinterface-1.5.2/examples/legacy}/make_polymer.py +0 -0
  75. {mdinterface-1.5.0/examples/simulation_box → mdinterface-1.5.2/examples/legacy}/make_solvent_box.py +0 -0
  76. {mdinterface-1.5.0/examples/simulation_box → mdinterface-1.5.2/examples/legacy}/make_specie_ligpargen_resp.py +0 -0
  77. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/config.py +0 -0
  78. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/core/__init__.py +0 -0
  79. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/database/nobles.py +0 -0
  80. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/read/cp2ktraj.py +0 -0
  81. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/read/lammpstraj.py +0 -0
  82. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/read/read.py +0 -0
  83. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/read/trajectory.py +0 -0
  84. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/read/xyztraj.py +0 -0
  85. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/__init__.py +0 -0
  86. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/draw.py +0 -0
  87. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/map.py +0 -0
  88. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/poisson.py +0 -0
  89. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/rings.py +0 -0
  90. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface/utils/units.py +0 -0
  91. {mdinterface-1.5.0 → mdinterface-1.5.2}/mdinterface.egg-info/dependency_links.txt +0 -0
  92. {mdinterface-1.5.0 → mdinterface-1.5.2}/requirements.txt +0 -0
  93. {mdinterface-1.5.0 → mdinterface-1.5.2}/setup.cfg +0 -0
  94. {mdinterface-1.5.0 → mdinterface-1.5.2}/setup.py +0 -0
  95. {mdinterface-1.5.0 → mdinterface-1.5.2}/tests/__init__.py +0 -0
  96. {mdinterface-1.5.0 → mdinterface-1.5.2}/tests/test_auxiliary.py +0 -0
  97. {mdinterface-1.5.0 → mdinterface-1.5.2}/tests/test_database.py +0 -0
  98. {mdinterface-1.5.0 → mdinterface-1.5.2}/tests/test_specie.py +0 -0
  99. {mdinterface-1.5.0 → mdinterface-1.5.2}/tests/test_topology.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdinterface
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: Build Interface Systems for Molecular Dynamics Simulations
5
5
  Author-email: Fabrice Roncoroni <fabrice.roncoroni@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -30,7 +30,6 @@ Requires-Dist: numpy>=1.20.0
30
30
  Requires-Dist: networkx>=2.5
31
31
  Requires-Dist: platformdirs>=2.0.0
32
32
  Requires-Dist: configparser>=5.0.0
33
- Requires-Dist: libarvo
34
33
  Provides-Extra: resp
35
34
  Requires-Dist: pyscf>=2.0.0; extra == "resp"
36
35
  Requires-Dist: pymbxas; extra == "resp"
@@ -49,22 +48,24 @@ Dynamic: license-file
49
48
  </div>
50
49
  </div>
51
50
 
52
- [![PyPI version](https://badge.fury.io/py/mdinterface.svg?icon=si%3Apython)](https://pypi.org/project/mdinterface/) [![GitHub version](https://badge.fury.io/gh/roncofaber%2Fmdinterface.svg?icon=si%3Agithub)](https://github.com/roncofaber/mdinterface)
51
+ [![PyPI version](https://badge.fury.io/py/mdinterface.svg?icon=si%3Apython)](https://pypi.org/project/mdinterface/) [![GitHub version](https://badge.fury.io/gh/roncofaber%2Fmdinterface.svg?icon=si%3Agithub)](https://github.com/roncofaber/mdinterface) [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://roncofaber.github.io/mdinterface)
53
52
 
54
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.
55
54
 
56
55
  ## Features
57
56
 
58
- - **Fluent `BoxBuilder` API** -- stack slabs, solvent regions, and vacuum gaps layer by layer; call `.build()` when done.
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
- - **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](https://github.com/Isra3l/ligpargen).
63
- - **Polymer builder** -- generate chains of arbitrary length from a monomer `Specie`.
64
- - **RESP charges** -- estimate partial charges with [PySCF](https://github.com/pyscf/pyscf) / [gpu4pyscf](https://github.com/pyscf/gpu4pyscf) (optional).
65
- - **AIMD with FAIRChem** -- run ML-potential dynamics via [FAIRChem](https://github.com/facebookresearch/fairchem) (optional).
66
- - **LAMMPS output** -- writes data files and force-field coefficient blocks ready to run.
67
- - **MDAnalysis integration** -- every object converts to `mda.Universe` with a single call.
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()`.
68
69
 
69
70
  ## Requirements
70
71
 
@@ -80,14 +81,18 @@ conda install -c conda-forge packmol
80
81
 
81
82
  #### LigParGen (automatic OPLS-AA parameters)
82
83
 
83
- 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 directory via `config.ini`:
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`:
84
85
 
85
86
  ```ini
86
87
  # ~/.config/mdinterface/config.ini (path is OS-dependent)
87
88
  [settings]
88
- BOSSdir = /path/to/boss
89
+ BOSSdir = /path/to/boss # native directory
90
+ # BOSSdir = /path/to/boss.sif # Apptainer/Singularity container
91
+ # BOSSdir = boss-container:latest # Docker image
89
92
  ```
90
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
+
91
96
  #### RESP charges with PySCF
92
97
 
93
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).
@@ -123,70 +128,51 @@ pip install mdinterface[all] # everything
123
128
 
124
129
  ## Quick start
125
130
 
126
- ### Define species
127
-
128
131
  ```python
129
- from mdinterface import BoxBuilder
130
- from mdinterface.database import Water, Ion, Metal111
132
+ from mdinterface import SimCell
133
+ from mdinterface.database import Water, Metal111
131
134
 
132
- water = Water(model="ewald")
133
- na = Ion("Na", ffield="Cheatham")
134
- cl = Ion("Cl", ffield="Cheatham")
135
+ water = Water()
135
136
  gold = Metal111("Au")
136
- ```
137
137
 
138
- ### Build a gold / NaCl electrolyte / gold sandwich
139
-
140
- ```python
141
- simbox = BoxBuilder(xysize=[15, 15], verbose=True)
142
-
143
- simbox.add_slab(gold, nlayers=3)
144
- simbox.add_solvent(water, ions=[na, cl], nions=[5, 5], zdim=25, density=1.0)
138
+ simbox = SimCell(xysize=[15, 15])
145
139
  simbox.add_slab(gold, nlayers=3)
146
- simbox.add_vacuum(zdim=5)
140
+ simbox.add_solvent(water, zdim=20, density=1.0)
141
+ simbox.build()
147
142
 
148
- simbox.build(padding=0.5)
149
- simbox.write_lammps("data.lammps", atom_style="full", write_coeff=True)
143
+ atoms = simbox.to_ase() # ase.Atoms — ready for AIMD, ML-MD, or any other tool
150
144
  ```
151
145
 
152
- ### Mixed-solvent box (water + methanol)
146
+ For LAMMPS, add ions and call `write_lammps()` instead:
153
147
 
154
148
  ```python
155
- from mdinterface.core.specie import Specie
156
-
157
- methanol = Specie("CH3OH", ligpargen=True)
158
-
159
- simbox = BoxBuilder(xysize=[25, 25])
160
- simbox.add_solvent(
161
- [water, methanol],
162
- ratio=[3, 1], # 3 water : 1 methanol by mole
163
- density=0.95,
164
- zdim=30,
165
- ions=[na, cl],
166
- nions=[5, 5],
167
- )
168
- simbox.build(padding=0.5)
169
- simbox.write_lammps("data_mixture.lammps", atom_style="full", write_coeff=True)
170
- ```
149
+ from mdinterface.database import Ion
171
150
 
172
- ### Convert to ASE or MDAnalysis
151
+ na = Ion("Na", ffield="Cheatham")
152
+ cl = Ion("Cl", ffield="Cheatham")
173
153
 
174
- ```python
175
- atoms = simbox.to_ase() # ase.Atoms with cell and PBC
176
- universe = simbox.universe # mda.Universe
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)
177
160
  ```
178
161
 
179
- See the [examples/box_builder/](examples/box_builder/) directory for more complete scripts:
162
+ More complete scripts are in the [examples/](examples/) directory:
180
163
 
181
164
  | Script | What it shows |
182
165
  |--------|--------------|
183
- | `builder_electrode_interface.py` | Au / NaCl electrolyte / Au sandwich |
184
- | `builder_solvent_box.py` | Pure solvent + dissolved species |
185
- | `builder_multisolvent_box.py` | Mixed-solvent box with ratio/density/count modes |
186
- | `builder_multilayer.py` | Five-layer multi-slab system |
187
- | `builder_sandwich_from_traj.py` | Load a relaxed structure via `hijack` |
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)
188
174
 
189
- The legacy `SimulationBox` API is still available and unchanged; see [examples/simulation_box/](examples/simulation_box/).
175
+ The legacy `SimulationBox` API is still available and unchanged; see [examples/legacy/](examples/legacy/).
190
176
 
191
177
  ## Roadmap
192
178
 
@@ -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
+ [![PyPI version](https://badge.fury.io/py/mdinterface.svg?icon=si%3Apython)](https://pypi.org/project/mdinterface/) [![GitHub version](https://badge.fury.io/gh/roncofaber%2Fmdinterface.svg?icon=si%3Agithub)](https://github.com/roncofaber/mdinterface) [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](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
@@ -0,0 +1,3 @@
1
+ # Polymer
2
+
3
+ ::: mdinterface.core.polymer.Polymer
@@ -0,0 +1,3 @@
1
+ # SimCell
2
+
3
+ ::: mdinterface.build.builder.SimCell
@@ -0,0 +1,3 @@
1
+ # Specie
2
+
3
+ ::: mdinterface.core.specie.Specie
@@ -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.