vpmdk 0.2.0__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.
- vpmdk-0.2.0/LICENSE +15 -0
- vpmdk-0.2.0/MANIFEST.in +8 -0
- vpmdk-0.2.0/PKG-INFO +248 -0
- vpmdk-0.2.0/README.md +228 -0
- vpmdk-0.2.0/pyproject.toml +33 -0
- vpmdk-0.2.0/setup.cfg +4 -0
- vpmdk-0.2.0/src/vpmdk.egg-info/PKG-INFO +248 -0
- vpmdk-0.2.0/src/vpmdk.egg-info/SOURCES.txt +12 -0
- vpmdk-0.2.0/src/vpmdk.egg-info/dependency_links.txt +1 -0
- vpmdk-0.2.0/src/vpmdk.egg-info/entry_points.txt +2 -0
- vpmdk-0.2.0/src/vpmdk.egg-info/requires.txt +3 -0
- vpmdk-0.2.0/src/vpmdk.egg-info/top_level.txt +2 -0
- vpmdk-0.2.0/src/vpmdk.py +13 -0
- vpmdk-0.2.0/src/vpmdk_core/__init__.py +2136 -0
vpmdk-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Corteo Co., Ltd.
|
|
4
|
+
Copyright (c) 2025, Corteo LLC
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
3. Neither the name of Corteo LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
vpmdk-0.2.0/MANIFEST.in
ADDED
vpmdk-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vpmdk
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Run machine-learning potentials using VASP style inputs.
|
|
5
|
+
License-Expression: BSD-3-Clause
|
|
6
|
+
Keywords: vasp,molecular-dynamics,machine-learning,ase
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: ase
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: pymatgen
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# VPMDK
|
|
22
|
+
|
|
23
|
+
VPMDK (*Vasp-Protocol Machine-learning Dynamics Kit*, aka “VasP-MoDoKi”) is a lightweight engine that **reads and writes VASP-style inputs/outputs** and performs **molecular dynamics and structure relaxations** using **machine-learning interatomic potentials**. Keep familiar VASP workflows and artifacts while computations run through ASE-compatible ML calculators. The `vpmdk` command (and legacy `vpmdk.py` wrapper) are provided.
|
|
24
|
+
|
|
25
|
+
**Supported calculators (via ASE):** **CHGNet**, **SevenNet**, **MatterSim**, **MACE**, **Matlantis**, **NequIP**, **Allegro**, **ORB**, **MatGL** (via the M3GNet model), **FAIRChem** (including eSEN checkpoints), **GRACE** (TensorPotential foundation models or checkpoints), and **DeePMD-kit**. Availability depends on the corresponding Python packages being installed.
|
|
26
|
+
|
|
27
|
+
*Not affiliated with, endorsed by, or a replacement for VASP; “VASP” is a trademark of its respective owner. VPMDK only mimics VASP I/O conventions for compatibility.*
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Install the package from PyPI (or from a checkout):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install vpmdk
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
1. Prepare a directory containing at least `POSCAR`. Optional files are
|
|
40
|
+
`INCAR`, `POTCAR`, and `BCAR`. `KPOINTS`, `WAVECAR`, and `CHGCAR` are
|
|
41
|
+
recognised but ignored (a note is printed if they are present).
|
|
42
|
+
2. Install requirements: `ase`, `pymatgen` and, depending on the potential you
|
|
43
|
+
wish to use, `chgnet`, `mattersim`, `mace-torch` or `matgl`.
|
|
44
|
+
3. Run:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
vpmdk [--dir PATH_TO_INPUT]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If `--dir` is omitted, the current directory (`.`) is used.
|
|
51
|
+
|
|
52
|
+
When running directly from a repository checkout, the legacy wrapper still works:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python vpmdk.py [--dir PATH_TO_INPUT]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Input files
|
|
59
|
+
|
|
60
|
+
Calculation directories may contain the following files:
|
|
61
|
+
|
|
62
|
+
- `POSCAR` *(required)* – atomic positions and cell.
|
|
63
|
+
- `INCAR` – VASP-style run parameters; only a subset of tags is supported.
|
|
64
|
+
- `BCAR` – simple `key=value` file selecting the machine-learning potential.
|
|
65
|
+
- `POTCAR` – accepted for compatibility but ignored except for aligning species
|
|
66
|
+
names.
|
|
67
|
+
|
|
68
|
+
### Supported INCAR tags
|
|
69
|
+
|
|
70
|
+
The script reads a subset of common VASP `INCAR` settings. Other tags are ignored with a warning.
|
|
71
|
+
|
|
72
|
+
| Tag | Meaning | Default / Notes |
|
|
73
|
+
|-----|---------|-----------------|
|
|
74
|
+
| `NSW` | Number of ionic steps. | `0` (single-point calculation). |
|
|
75
|
+
| `IBRION` | Ionic movement algorithm. | `<0` performs a single-point calculation without moving ions, `0` runs molecular dynamics, positive values trigger a BFGS geometry optimisation with a fixed cell. Defaults to `-1`. |
|
|
76
|
+
| `ISIF` | Controls whether the cell changes during relaxations. | `2` keeps the cell fixed (default). `3` relaxes ions and the full cell, `4` keeps the volume constant while optimising ions and the cell shape, `5` optimises the cell shape at constant volume with fixed ions, `6` changes only the cell, `7` enables isotropic cell changes with fixed ions, and `8` couples ionic relaxations to isotropic volume changes. Unsupported values fall back to `2` with a warning. |
|
|
77
|
+
| `EDIFFG` | Convergence threshold for relaxations in eV/Å. | `-0.02`. |
|
|
78
|
+
| `TEBEG` | Initial temperature in kelvin for molecular dynamics (`IBRION=0`). | `300`. |
|
|
79
|
+
| `TEEND` | Final temperature in kelvin when ramping MD runs. | Same as `TEBEG`. Temperature is linearly ramped between `TEBEG` and `TEEND` over the MD steps. |
|
|
80
|
+
| `POTIM` | Time step in femtoseconds for molecular dynamics (`IBRION=0`). | `2`. |
|
|
81
|
+
| `MDALGO` | Selects the MD integrator / thermostat. | `0` (NVE). When left at `0`, `SMASS>0` falls back to Nose–Hoover (`MDALGO=2`) and `SMASS<0` falls back to Langevin (`MDALGO=3`). See [MD algorithms](#md-algorithms) for details. |
|
|
82
|
+
| `SMASS` | Thermostat-specific mass parameter. | Used for Nose–Hoover time constant (`abs(SMASS)` fs) or as a fallback to set `LANGEVIN_GAMMA` when negative. |
|
|
83
|
+
| `ANDERSEN_PROB` | Collision probability for the Andersen thermostat. | `0.1`. Only used with `MDALGO=1`. |
|
|
84
|
+
| `LANGEVIN_GAMMA` | Friction coefficient (1/ps) for Langevin dynamics. | `1.0`. Only used with `MDALGO=3`; falls back to `abs(SMASS)` when `SMASS<0`. |
|
|
85
|
+
| `CSVR_PERIOD` | Relaxation time (fs) for the canonical sampling velocity rescaling thermostat. | `max(100×POTIM, POTIM)`. Only used with `MDALGO=5`. |
|
|
86
|
+
| `NHC_NCHAINS` | Nose–Hoover chain length. | `1` for `MDALGO=2`, `3` for `MDALGO=4`. |
|
|
87
|
+
| `PSTRESS` | External pressure in kBar applied during relaxations. | Converts to scalar pressure in the ASE optimiser when `ISIF` allows cell changes. |
|
|
88
|
+
| `MAGMOM` | Initial magnetic moments. | Parsed like VASP; supports shorthand such as `2*1.0`. |
|
|
89
|
+
|
|
90
|
+
### MD algorithms
|
|
91
|
+
|
|
92
|
+
`MDALGO` selects between different ASE molecular dynamics drivers. Some options require optional ASE modules; if they are missing VPMDK falls back to plain velocity-Verlet (NVE) integration and prints a warning.
|
|
93
|
+
|
|
94
|
+
| `MDALGO` | Integrator | Notes |
|
|
95
|
+
|---------:|-----------|-------|
|
|
96
|
+
| `0` | Velocity-Verlet (NVE) | No thermostat. |
|
|
97
|
+
| `1` | Andersen thermostat | Controlled by `ANDERSEN_PROB`. |
|
|
98
|
+
| `2` | Nose–Hoover chain (single thermostat) | Uses `SMASS`/`NHC_NCHAINS` to configure the chain. |
|
|
99
|
+
| `3` | Langevin thermostat | Uses `LANGEVIN_GAMMA` (or `abs(SMASS)` if negative). |
|
|
100
|
+
| `4` | Nose–Hoover chain (three thermostats) | Chain length defaults to 3 unless overridden. |
|
|
101
|
+
| `5` | Bussi (canonical sampling velocity rescaling) thermostat | Uses `CSVR_PERIOD`. |
|
|
102
|
+
|
|
103
|
+
### BCAR tags
|
|
104
|
+
|
|
105
|
+
`BCAR` is a concise `key=value` file that selects the backend, its weights, and a handful of quality-of-life options. A minimal
|
|
106
|
+
file looks like:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
NNP=CHGNET # Potential backend
|
|
110
|
+
MODEL=/path/to/model # Optional path to weights (varies by backend)
|
|
111
|
+
DEVICE=cuda # Optional device override when the backend supports it
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Core selection.**
|
|
115
|
+
|
|
116
|
+
| Tag | Meaning | Default |
|
|
117
|
+
|-----|---------|---------|
|
|
118
|
+
| `NNP` | Backend name (`CHGNET`, `MACE`, `MATGL`, `MATLANTIS`, `MATTERSIM`, `NEQUIP`, `ALLEGRO`, `ORB`, `FAIRCHEM`, `FAIRCHEM_V2`, `FAIRCHEM_V1`, `GRACE`, `DEEPMD`, `SEVENNET`) | `CHGNET` |
|
|
119
|
+
| `MODEL` | Path to a trained parameter set (ORB accepts checkpoints; FAIRChem also accepts model names such as `esen-sm-direct-all-oc25`) | Backend default or bundled weights |
|
|
120
|
+
| `DEVICE` | Device hint for backends that support it (`cpu`, `cuda`, `cuda:N`) | Auto-detects GPU when available |
|
|
121
|
+
|
|
122
|
+
**Output and workflow aids.**
|
|
123
|
+
|
|
124
|
+
| Tag | Meaning | Default |
|
|
125
|
+
|-----|---------|---------|
|
|
126
|
+
| `WRITE_ENERGY_CSV` | Write `energy.csv` during relaxation (`1` to enable) | `0` |
|
|
127
|
+
| `WRITE_LAMMPS_TRAJ` | Write a LAMMPS trajectory during MD (`1` to enable) | `0` |
|
|
128
|
+
| `LAMMPS_TRAJ_INTERVAL` | MD steps between trajectory frames (only when `WRITE_LAMMPS_TRAJ=1`) | `1` |
|
|
129
|
+
| `DEEPMD_TYPE_MAP` | Comma/space-separated species list mapped to the DeePMD graph | Inferred from `POSCAR` order |
|
|
130
|
+
| `DEEPMD_HEAD` | Select a DeePMD model head by name (when supported by the checkpoint) | Unset |
|
|
131
|
+
|
|
132
|
+
**Backend-specific knobs.** Only relevant when the corresponding backend is chosen.
|
|
133
|
+
|
|
134
|
+
| Tag | Applies to | Meaning | Default |
|
|
135
|
+
|-----|-----------|---------|---------|
|
|
136
|
+
| `MATLANTIS_MODEL_VERSION` | Matlantis | Estimator version identifier | `v8.0.0` |
|
|
137
|
+
| `MATLANTIS_PRIORITY` | Matlantis | Job priority forwarded to the estimator | `50` |
|
|
138
|
+
| `MATLANTIS_CALC_MODE` | Matlantis | Calculation mode (`CRYSTAL`, `MOLECULE`, …) | `PBE` |
|
|
139
|
+
| `ORB_MODEL` | ORB | Pretrained architecture key recognised by `orb_models` | `orb-v3-conservative-20-omat` |
|
|
140
|
+
| `ORB_PRECISION` | ORB | Floating-point precision string forwarded to orb-models loaders | `float32-high` |
|
|
141
|
+
| `ORB_COMPILE` | ORB | Whether to `torch.compile` the ORB model (`0/1`, `true/false`, …) | Library default |
|
|
142
|
+
| `FAIRCHEM_TASK` | FAIRChem v2 (`FAIRCHEM`/`FAIRCHEM_V2`) | Task head to use (e.g. `omol`) | Auto-detected when possible |
|
|
143
|
+
| `FAIRCHEM_INFERENCE_SETTINGS` | FAIRChem v2 (`FAIRCHEM`/`FAIRCHEM_V2`) | Inference profile forwarded to FAIRChem | `default` |
|
|
144
|
+
| `FAIRCHEM_CONFIG` | FAIRChem v1 (`FAIRCHEM_V1`) | Path to the YAML config used with the checkpoint | Required for most checkpoints |
|
|
145
|
+
| `FAIRCHEM_V1_PREDICTOR` | FAIRChem v1 (`FAIRCHEM_V1`) | Use the predictor directly instead of the OCPCalculator (`1` to enable) | `0` |
|
|
146
|
+
| `GRACE_PAD_NEIGHBORS_FRACTION` | GRACE | Fake-neighbour padding fraction forwarded to TensorPotential | Library default (typically `0.05`) |
|
|
147
|
+
| `GRACE_PAD_ATOMS_NUMBER` | GRACE | Number of fake atoms for padding | Library default (typically `10`) |
|
|
148
|
+
| `GRACE_MAX_RECOMPILATION` | GRACE | Max recompilations triggered by padding reduction | Library default (typically `2`) |
|
|
149
|
+
| `GRACE_MIN_DIST` | GRACE | Minimum allowed interatomic distance | Unset (no extra validation) |
|
|
150
|
+
| `GRACE_FLOAT_DTYPE` | GRACE | Floating-point dtype passed to TensorPotential | `float64` |
|
|
151
|
+
|
|
152
|
+
Matlantis calculations rely on the [Matlantis API](https://matlantis.com) via
|
|
153
|
+
`pfp-api-client`; ensure your environment is configured with the required API
|
|
154
|
+
credentials before running VPMDK with `NNP=MATLANTIS`.
|
|
155
|
+
|
|
156
|
+
ORB calculations rely on the [orb-models](https://github.com/orbital-materials/orb-models)
|
|
157
|
+
package. When `MODEL` is omitted, VPMDK downloads the pretrained weights specified by
|
|
158
|
+
`ORB_MODEL` using orb-models; set `MODEL=/path/to/checkpoint.ckpt` to run with local weights.
|
|
159
|
+
|
|
160
|
+
FAIRChem 2.x and 1.x are incompatible. Select `NNP=FAIRCHEM` (or `FAIRCHEM_V2`) to
|
|
161
|
+
use FAIRChem v2 checkpoints via `FAIRChemCalculator.from_model_checkpoint`, and
|
|
162
|
+
`NNP=FAIRCHEM_V1` when running legacy OCP/FAIRChem v1 checkpoints with
|
|
163
|
+
`OCPCalculator`. Switching conda environments per checkpoint version is supported by
|
|
164
|
+
selecting the appropriate tag.
|
|
165
|
+
|
|
166
|
+
## Output files
|
|
167
|
+
|
|
168
|
+
Depending on the calculation type, VPMDK produces the following files in VASP format:
|
|
169
|
+
|
|
170
|
+
| File | When produced | Contents |
|
|
171
|
+
|------|---------------|----------|
|
|
172
|
+
| `CONTCAR` | Always | Final atomic positions and cell. |
|
|
173
|
+
| `OUTCAR` | Relaxations and MD | Step-by-step potential, kinetic, and total energies along with temperature. |
|
|
174
|
+
| `XDATCAR` | MD only (`IBRION=0`) | Atomic positions at each MD step (trajectory). |
|
|
175
|
+
| `lammps.lammpstrj` | MD with `WRITE_LAMMPS_TRAJ=1` | LAMMPS text dump of atomic positions at the requested interval. |
|
|
176
|
+
| `energy.csv` | Relaxations with `WRITE_ENERGY_CSV=1` | Potential energy at each relaxation step. |
|
|
177
|
+
|
|
178
|
+
Relaxations terminate when either the maximum force drops below the value set
|
|
179
|
+
by `EDIFFG` (default `0.02` eV/Å) or, when `EDIFFG` is positive, when the
|
|
180
|
+
change in energy between ionic steps falls below the specified threshold.
|
|
181
|
+
|
|
182
|
+
Initial magnetic moments from `MAGMOM` are propagated to ASE when the value can
|
|
183
|
+
be matched with the number of atoms or species counts in the POSCAR.
|
|
184
|
+
|
|
185
|
+
Final energies are also printed to the console for single-point calculations.
|
|
186
|
+
|
|
187
|
+
### Required Python modules
|
|
188
|
+
|
|
189
|
+
`ase` and `pymatgen` are always required. Additional modules depend on the
|
|
190
|
+
selected potential or thermostat:
|
|
191
|
+
|
|
192
|
+
| Feature | Module to install | Notes |
|
|
193
|
+
|---------|-------------------|-------|
|
|
194
|
+
| CHGNet potential | `chgnet` (uses PyTorch) | Bundled with a default model; specify `MODEL` to use another |
|
|
195
|
+
| SevenNet potential | `sevennet` (uses PyTorch) | Bundled with a default model; specify `MODEL` to use another |
|
|
196
|
+
| NequIP potential | `nequip` (uses PyTorch) | `MODEL` should point to a deployed model file; compiled/TorchScript models are also accepted when supported by the NequIP version (`from_compiled_model`) |
|
|
197
|
+
| Allegro potential | `allegro` (uses PyTorch and depends on `nequip`) | `MODEL` should point to a deployed model file; compiled/TorchScript models are also accepted when supported by the NequIP version (`from_compiled_model`) |
|
|
198
|
+
| MatGL (M3GNet) potential | `matgl` (uses PyTorch + DGL or JAX, depending on install) | Bundled with a default model; specify `MODEL` to use another. MatGL 1.x commonly expects a model directory passed through `matgl.load_model`. |
|
|
199
|
+
| MACE potential | `mace-torch` (PyTorch) | Set `MODEL` to a trained `.model` file |
|
|
200
|
+
| DeePMD-kit potential | `deepmd-kit` | Set `MODEL` to the frozen graph (`.pb`) or a PyTorch checkpoint (`.pt`), depending on the DeePMD backend, and optionally `DEEPMD_TYPE_MAP`/`DEEPMD_HEAD` |
|
|
201
|
+
| Matlantis potential | `pfp-api-client` (plus `matlantis-features`) | Uses the Matlantis estimator service; configure with `MATLANTIS_*` BCAR tags |
|
|
202
|
+
| ORB potential | `orb-models` (PyTorch) | Downloads pretrained weights unless `MODEL` points to a checkpoint |
|
|
203
|
+
| MatterSim potential | `mattersim` (PyTorch) | Set `MODEL` to the trained parameters |
|
|
204
|
+
| GRACE potential | `grace-tensorpotential` (TensorFlow) | Uses TensorPotential checkpoints (`MODEL=/path/to/model`) or foundation models when available |
|
|
205
|
+
| Andersen thermostat | `ase.md.andersen` (part of ASE extras) | Install ASE with MD extras to enable |
|
|
206
|
+
| Langevin thermostat | `ase.md.langevin` | Ships with ASE; ensure ASE is up to date |
|
|
207
|
+
| Bussi thermostat | `ase.md.bussi` | Included in ASE >= 3.22 |
|
|
208
|
+
| Nose–Hoover chain thermostat | `ase.md.nose_hoover_chain` | Included in ASE >= 3.22 |
|
|
209
|
+
|
|
210
|
+
Install each module using `pip install MODULE_NAME`. Install the GPU-enabled
|
|
211
|
+
version of PyTorch or JAX if you want to use GPUs.
|
|
212
|
+
|
|
213
|
+
### Where to place parameter files
|
|
214
|
+
|
|
215
|
+
The model file is loaded from the path given by `MODEL` in `BCAR`. Typically the
|
|
216
|
+
file is located within the calculation directory or specified via an absolute
|
|
217
|
+
path. CHGNet and MatGL ship with default models; omitting `MODEL` uses those
|
|
218
|
+
defaults automatically.
|
|
219
|
+
|
|
220
|
+
### GPU usage
|
|
221
|
+
|
|
222
|
+
This script does not directly manage GPU settings. Each potential selects a
|
|
223
|
+
device on its own. CHGNet, MatGL/M3GNet, MACE, ORB, and FAIRChem honour
|
|
224
|
+
`DEVICE` in `BCAR` (e.g. `DEVICE=cpu` to force a CPU run). With CUDA devices you
|
|
225
|
+
can choose which GPU to use with `CUDA_VISIBLE_DEVICES`. MatGL GPU tuning is
|
|
226
|
+
backend-dependent (PyTorch+DGL vs JAX), so environment variables differ between
|
|
227
|
+
installations. A GPU with at least 8 GB of memory is recommended, though running
|
|
228
|
+
on a CPU also works.
|
|
229
|
+
|
|
230
|
+
### Example directory layout
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
calc_dir/
|
|
234
|
+
├── POSCAR # required
|
|
235
|
+
├── INCAR # optional
|
|
236
|
+
├── POTCAR # optional
|
|
237
|
+
└── BCAR # optional, specify potential and model path
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Example command:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
vpmdk --dir calc_dir
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
VPMDK is distributed under the BSD 3-Clause License. See [LICENSE](LICENSE) for details.
|
vpmdk-0.2.0/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# VPMDK
|
|
2
|
+
|
|
3
|
+
VPMDK (*Vasp-Protocol Machine-learning Dynamics Kit*, aka “VasP-MoDoKi”) is a lightweight engine that **reads and writes VASP-style inputs/outputs** and performs **molecular dynamics and structure relaxations** using **machine-learning interatomic potentials**. Keep familiar VASP workflows and artifacts while computations run through ASE-compatible ML calculators. The `vpmdk` command (and legacy `vpmdk.py` wrapper) are provided.
|
|
4
|
+
|
|
5
|
+
**Supported calculators (via ASE):** **CHGNet**, **SevenNet**, **MatterSim**, **MACE**, **Matlantis**, **NequIP**, **Allegro**, **ORB**, **MatGL** (via the M3GNet model), **FAIRChem** (including eSEN checkpoints), **GRACE** (TensorPotential foundation models or checkpoints), and **DeePMD-kit**. Availability depends on the corresponding Python packages being installed.
|
|
6
|
+
|
|
7
|
+
*Not affiliated with, endorsed by, or a replacement for VASP; “VASP” is a trademark of its respective owner. VPMDK only mimics VASP I/O conventions for compatibility.*
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Install the package from PyPI (or from a checkout):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install vpmdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
1. Prepare a directory containing at least `POSCAR`. Optional files are
|
|
20
|
+
`INCAR`, `POTCAR`, and `BCAR`. `KPOINTS`, `WAVECAR`, and `CHGCAR` are
|
|
21
|
+
recognised but ignored (a note is printed if they are present).
|
|
22
|
+
2. Install requirements: `ase`, `pymatgen` and, depending on the potential you
|
|
23
|
+
wish to use, `chgnet`, `mattersim`, `mace-torch` or `matgl`.
|
|
24
|
+
3. Run:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
vpmdk [--dir PATH_TO_INPUT]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If `--dir` is omitted, the current directory (`.`) is used.
|
|
31
|
+
|
|
32
|
+
When running directly from a repository checkout, the legacy wrapper still works:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python vpmdk.py [--dir PATH_TO_INPUT]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Input files
|
|
39
|
+
|
|
40
|
+
Calculation directories may contain the following files:
|
|
41
|
+
|
|
42
|
+
- `POSCAR` *(required)* – atomic positions and cell.
|
|
43
|
+
- `INCAR` – VASP-style run parameters; only a subset of tags is supported.
|
|
44
|
+
- `BCAR` – simple `key=value` file selecting the machine-learning potential.
|
|
45
|
+
- `POTCAR` – accepted for compatibility but ignored except for aligning species
|
|
46
|
+
names.
|
|
47
|
+
|
|
48
|
+
### Supported INCAR tags
|
|
49
|
+
|
|
50
|
+
The script reads a subset of common VASP `INCAR` settings. Other tags are ignored with a warning.
|
|
51
|
+
|
|
52
|
+
| Tag | Meaning | Default / Notes |
|
|
53
|
+
|-----|---------|-----------------|
|
|
54
|
+
| `NSW` | Number of ionic steps. | `0` (single-point calculation). |
|
|
55
|
+
| `IBRION` | Ionic movement algorithm. | `<0` performs a single-point calculation without moving ions, `0` runs molecular dynamics, positive values trigger a BFGS geometry optimisation with a fixed cell. Defaults to `-1`. |
|
|
56
|
+
| `ISIF` | Controls whether the cell changes during relaxations. | `2` keeps the cell fixed (default). `3` relaxes ions and the full cell, `4` keeps the volume constant while optimising ions and the cell shape, `5` optimises the cell shape at constant volume with fixed ions, `6` changes only the cell, `7` enables isotropic cell changes with fixed ions, and `8` couples ionic relaxations to isotropic volume changes. Unsupported values fall back to `2` with a warning. |
|
|
57
|
+
| `EDIFFG` | Convergence threshold for relaxations in eV/Å. | `-0.02`. |
|
|
58
|
+
| `TEBEG` | Initial temperature in kelvin for molecular dynamics (`IBRION=0`). | `300`. |
|
|
59
|
+
| `TEEND` | Final temperature in kelvin when ramping MD runs. | Same as `TEBEG`. Temperature is linearly ramped between `TEBEG` and `TEEND` over the MD steps. |
|
|
60
|
+
| `POTIM` | Time step in femtoseconds for molecular dynamics (`IBRION=0`). | `2`. |
|
|
61
|
+
| `MDALGO` | Selects the MD integrator / thermostat. | `0` (NVE). When left at `0`, `SMASS>0` falls back to Nose–Hoover (`MDALGO=2`) and `SMASS<0` falls back to Langevin (`MDALGO=3`). See [MD algorithms](#md-algorithms) for details. |
|
|
62
|
+
| `SMASS` | Thermostat-specific mass parameter. | Used for Nose–Hoover time constant (`abs(SMASS)` fs) or as a fallback to set `LANGEVIN_GAMMA` when negative. |
|
|
63
|
+
| `ANDERSEN_PROB` | Collision probability for the Andersen thermostat. | `0.1`. Only used with `MDALGO=1`. |
|
|
64
|
+
| `LANGEVIN_GAMMA` | Friction coefficient (1/ps) for Langevin dynamics. | `1.0`. Only used with `MDALGO=3`; falls back to `abs(SMASS)` when `SMASS<0`. |
|
|
65
|
+
| `CSVR_PERIOD` | Relaxation time (fs) for the canonical sampling velocity rescaling thermostat. | `max(100×POTIM, POTIM)`. Only used with `MDALGO=5`. |
|
|
66
|
+
| `NHC_NCHAINS` | Nose–Hoover chain length. | `1` for `MDALGO=2`, `3` for `MDALGO=4`. |
|
|
67
|
+
| `PSTRESS` | External pressure in kBar applied during relaxations. | Converts to scalar pressure in the ASE optimiser when `ISIF` allows cell changes. |
|
|
68
|
+
| `MAGMOM` | Initial magnetic moments. | Parsed like VASP; supports shorthand such as `2*1.0`. |
|
|
69
|
+
|
|
70
|
+
### MD algorithms
|
|
71
|
+
|
|
72
|
+
`MDALGO` selects between different ASE molecular dynamics drivers. Some options require optional ASE modules; if they are missing VPMDK falls back to plain velocity-Verlet (NVE) integration and prints a warning.
|
|
73
|
+
|
|
74
|
+
| `MDALGO` | Integrator | Notes |
|
|
75
|
+
|---------:|-----------|-------|
|
|
76
|
+
| `0` | Velocity-Verlet (NVE) | No thermostat. |
|
|
77
|
+
| `1` | Andersen thermostat | Controlled by `ANDERSEN_PROB`. |
|
|
78
|
+
| `2` | Nose–Hoover chain (single thermostat) | Uses `SMASS`/`NHC_NCHAINS` to configure the chain. |
|
|
79
|
+
| `3` | Langevin thermostat | Uses `LANGEVIN_GAMMA` (or `abs(SMASS)` if negative). |
|
|
80
|
+
| `4` | Nose–Hoover chain (three thermostats) | Chain length defaults to 3 unless overridden. |
|
|
81
|
+
| `5` | Bussi (canonical sampling velocity rescaling) thermostat | Uses `CSVR_PERIOD`. |
|
|
82
|
+
|
|
83
|
+
### BCAR tags
|
|
84
|
+
|
|
85
|
+
`BCAR` is a concise `key=value` file that selects the backend, its weights, and a handful of quality-of-life options. A minimal
|
|
86
|
+
file looks like:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
NNP=CHGNET # Potential backend
|
|
90
|
+
MODEL=/path/to/model # Optional path to weights (varies by backend)
|
|
91
|
+
DEVICE=cuda # Optional device override when the backend supports it
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Core selection.**
|
|
95
|
+
|
|
96
|
+
| Tag | Meaning | Default |
|
|
97
|
+
|-----|---------|---------|
|
|
98
|
+
| `NNP` | Backend name (`CHGNET`, `MACE`, `MATGL`, `MATLANTIS`, `MATTERSIM`, `NEQUIP`, `ALLEGRO`, `ORB`, `FAIRCHEM`, `FAIRCHEM_V2`, `FAIRCHEM_V1`, `GRACE`, `DEEPMD`, `SEVENNET`) | `CHGNET` |
|
|
99
|
+
| `MODEL` | Path to a trained parameter set (ORB accepts checkpoints; FAIRChem also accepts model names such as `esen-sm-direct-all-oc25`) | Backend default or bundled weights |
|
|
100
|
+
| `DEVICE` | Device hint for backends that support it (`cpu`, `cuda`, `cuda:N`) | Auto-detects GPU when available |
|
|
101
|
+
|
|
102
|
+
**Output and workflow aids.**
|
|
103
|
+
|
|
104
|
+
| Tag | Meaning | Default |
|
|
105
|
+
|-----|---------|---------|
|
|
106
|
+
| `WRITE_ENERGY_CSV` | Write `energy.csv` during relaxation (`1` to enable) | `0` |
|
|
107
|
+
| `WRITE_LAMMPS_TRAJ` | Write a LAMMPS trajectory during MD (`1` to enable) | `0` |
|
|
108
|
+
| `LAMMPS_TRAJ_INTERVAL` | MD steps between trajectory frames (only when `WRITE_LAMMPS_TRAJ=1`) | `1` |
|
|
109
|
+
| `DEEPMD_TYPE_MAP` | Comma/space-separated species list mapped to the DeePMD graph | Inferred from `POSCAR` order |
|
|
110
|
+
| `DEEPMD_HEAD` | Select a DeePMD model head by name (when supported by the checkpoint) | Unset |
|
|
111
|
+
|
|
112
|
+
**Backend-specific knobs.** Only relevant when the corresponding backend is chosen.
|
|
113
|
+
|
|
114
|
+
| Tag | Applies to | Meaning | Default |
|
|
115
|
+
|-----|-----------|---------|---------|
|
|
116
|
+
| `MATLANTIS_MODEL_VERSION` | Matlantis | Estimator version identifier | `v8.0.0` |
|
|
117
|
+
| `MATLANTIS_PRIORITY` | Matlantis | Job priority forwarded to the estimator | `50` |
|
|
118
|
+
| `MATLANTIS_CALC_MODE` | Matlantis | Calculation mode (`CRYSTAL`, `MOLECULE`, …) | `PBE` |
|
|
119
|
+
| `ORB_MODEL` | ORB | Pretrained architecture key recognised by `orb_models` | `orb-v3-conservative-20-omat` |
|
|
120
|
+
| `ORB_PRECISION` | ORB | Floating-point precision string forwarded to orb-models loaders | `float32-high` |
|
|
121
|
+
| `ORB_COMPILE` | ORB | Whether to `torch.compile` the ORB model (`0/1`, `true/false`, …) | Library default |
|
|
122
|
+
| `FAIRCHEM_TASK` | FAIRChem v2 (`FAIRCHEM`/`FAIRCHEM_V2`) | Task head to use (e.g. `omol`) | Auto-detected when possible |
|
|
123
|
+
| `FAIRCHEM_INFERENCE_SETTINGS` | FAIRChem v2 (`FAIRCHEM`/`FAIRCHEM_V2`) | Inference profile forwarded to FAIRChem | `default` |
|
|
124
|
+
| `FAIRCHEM_CONFIG` | FAIRChem v1 (`FAIRCHEM_V1`) | Path to the YAML config used with the checkpoint | Required for most checkpoints |
|
|
125
|
+
| `FAIRCHEM_V1_PREDICTOR` | FAIRChem v1 (`FAIRCHEM_V1`) | Use the predictor directly instead of the OCPCalculator (`1` to enable) | `0` |
|
|
126
|
+
| `GRACE_PAD_NEIGHBORS_FRACTION` | GRACE | Fake-neighbour padding fraction forwarded to TensorPotential | Library default (typically `0.05`) |
|
|
127
|
+
| `GRACE_PAD_ATOMS_NUMBER` | GRACE | Number of fake atoms for padding | Library default (typically `10`) |
|
|
128
|
+
| `GRACE_MAX_RECOMPILATION` | GRACE | Max recompilations triggered by padding reduction | Library default (typically `2`) |
|
|
129
|
+
| `GRACE_MIN_DIST` | GRACE | Minimum allowed interatomic distance | Unset (no extra validation) |
|
|
130
|
+
| `GRACE_FLOAT_DTYPE` | GRACE | Floating-point dtype passed to TensorPotential | `float64` |
|
|
131
|
+
|
|
132
|
+
Matlantis calculations rely on the [Matlantis API](https://matlantis.com) via
|
|
133
|
+
`pfp-api-client`; ensure your environment is configured with the required API
|
|
134
|
+
credentials before running VPMDK with `NNP=MATLANTIS`.
|
|
135
|
+
|
|
136
|
+
ORB calculations rely on the [orb-models](https://github.com/orbital-materials/orb-models)
|
|
137
|
+
package. When `MODEL` is omitted, VPMDK downloads the pretrained weights specified by
|
|
138
|
+
`ORB_MODEL` using orb-models; set `MODEL=/path/to/checkpoint.ckpt` to run with local weights.
|
|
139
|
+
|
|
140
|
+
FAIRChem 2.x and 1.x are incompatible. Select `NNP=FAIRCHEM` (or `FAIRCHEM_V2`) to
|
|
141
|
+
use FAIRChem v2 checkpoints via `FAIRChemCalculator.from_model_checkpoint`, and
|
|
142
|
+
`NNP=FAIRCHEM_V1` when running legacy OCP/FAIRChem v1 checkpoints with
|
|
143
|
+
`OCPCalculator`. Switching conda environments per checkpoint version is supported by
|
|
144
|
+
selecting the appropriate tag.
|
|
145
|
+
|
|
146
|
+
## Output files
|
|
147
|
+
|
|
148
|
+
Depending on the calculation type, VPMDK produces the following files in VASP format:
|
|
149
|
+
|
|
150
|
+
| File | When produced | Contents |
|
|
151
|
+
|------|---------------|----------|
|
|
152
|
+
| `CONTCAR` | Always | Final atomic positions and cell. |
|
|
153
|
+
| `OUTCAR` | Relaxations and MD | Step-by-step potential, kinetic, and total energies along with temperature. |
|
|
154
|
+
| `XDATCAR` | MD only (`IBRION=0`) | Atomic positions at each MD step (trajectory). |
|
|
155
|
+
| `lammps.lammpstrj` | MD with `WRITE_LAMMPS_TRAJ=1` | LAMMPS text dump of atomic positions at the requested interval. |
|
|
156
|
+
| `energy.csv` | Relaxations with `WRITE_ENERGY_CSV=1` | Potential energy at each relaxation step. |
|
|
157
|
+
|
|
158
|
+
Relaxations terminate when either the maximum force drops below the value set
|
|
159
|
+
by `EDIFFG` (default `0.02` eV/Å) or, when `EDIFFG` is positive, when the
|
|
160
|
+
change in energy between ionic steps falls below the specified threshold.
|
|
161
|
+
|
|
162
|
+
Initial magnetic moments from `MAGMOM` are propagated to ASE when the value can
|
|
163
|
+
be matched with the number of atoms or species counts in the POSCAR.
|
|
164
|
+
|
|
165
|
+
Final energies are also printed to the console for single-point calculations.
|
|
166
|
+
|
|
167
|
+
### Required Python modules
|
|
168
|
+
|
|
169
|
+
`ase` and `pymatgen` are always required. Additional modules depend on the
|
|
170
|
+
selected potential or thermostat:
|
|
171
|
+
|
|
172
|
+
| Feature | Module to install | Notes |
|
|
173
|
+
|---------|-------------------|-------|
|
|
174
|
+
| CHGNet potential | `chgnet` (uses PyTorch) | Bundled with a default model; specify `MODEL` to use another |
|
|
175
|
+
| SevenNet potential | `sevennet` (uses PyTorch) | Bundled with a default model; specify `MODEL` to use another |
|
|
176
|
+
| NequIP potential | `nequip` (uses PyTorch) | `MODEL` should point to a deployed model file; compiled/TorchScript models are also accepted when supported by the NequIP version (`from_compiled_model`) |
|
|
177
|
+
| Allegro potential | `allegro` (uses PyTorch and depends on `nequip`) | `MODEL` should point to a deployed model file; compiled/TorchScript models are also accepted when supported by the NequIP version (`from_compiled_model`) |
|
|
178
|
+
| MatGL (M3GNet) potential | `matgl` (uses PyTorch + DGL or JAX, depending on install) | Bundled with a default model; specify `MODEL` to use another. MatGL 1.x commonly expects a model directory passed through `matgl.load_model`. |
|
|
179
|
+
| MACE potential | `mace-torch` (PyTorch) | Set `MODEL` to a trained `.model` file |
|
|
180
|
+
| DeePMD-kit potential | `deepmd-kit` | Set `MODEL` to the frozen graph (`.pb`) or a PyTorch checkpoint (`.pt`), depending on the DeePMD backend, and optionally `DEEPMD_TYPE_MAP`/`DEEPMD_HEAD` |
|
|
181
|
+
| Matlantis potential | `pfp-api-client` (plus `matlantis-features`) | Uses the Matlantis estimator service; configure with `MATLANTIS_*` BCAR tags |
|
|
182
|
+
| ORB potential | `orb-models` (PyTorch) | Downloads pretrained weights unless `MODEL` points to a checkpoint |
|
|
183
|
+
| MatterSim potential | `mattersim` (PyTorch) | Set `MODEL` to the trained parameters |
|
|
184
|
+
| GRACE potential | `grace-tensorpotential` (TensorFlow) | Uses TensorPotential checkpoints (`MODEL=/path/to/model`) or foundation models when available |
|
|
185
|
+
| Andersen thermostat | `ase.md.andersen` (part of ASE extras) | Install ASE with MD extras to enable |
|
|
186
|
+
| Langevin thermostat | `ase.md.langevin` | Ships with ASE; ensure ASE is up to date |
|
|
187
|
+
| Bussi thermostat | `ase.md.bussi` | Included in ASE >= 3.22 |
|
|
188
|
+
| Nose–Hoover chain thermostat | `ase.md.nose_hoover_chain` | Included in ASE >= 3.22 |
|
|
189
|
+
|
|
190
|
+
Install each module using `pip install MODULE_NAME`. Install the GPU-enabled
|
|
191
|
+
version of PyTorch or JAX if you want to use GPUs.
|
|
192
|
+
|
|
193
|
+
### Where to place parameter files
|
|
194
|
+
|
|
195
|
+
The model file is loaded from the path given by `MODEL` in `BCAR`. Typically the
|
|
196
|
+
file is located within the calculation directory or specified via an absolute
|
|
197
|
+
path. CHGNet and MatGL ship with default models; omitting `MODEL` uses those
|
|
198
|
+
defaults automatically.
|
|
199
|
+
|
|
200
|
+
### GPU usage
|
|
201
|
+
|
|
202
|
+
This script does not directly manage GPU settings. Each potential selects a
|
|
203
|
+
device on its own. CHGNet, MatGL/M3GNet, MACE, ORB, and FAIRChem honour
|
|
204
|
+
`DEVICE` in `BCAR` (e.g. `DEVICE=cpu` to force a CPU run). With CUDA devices you
|
|
205
|
+
can choose which GPU to use with `CUDA_VISIBLE_DEVICES`. MatGL GPU tuning is
|
|
206
|
+
backend-dependent (PyTorch+DGL vs JAX), so environment variables differ between
|
|
207
|
+
installations. A GPU with at least 8 GB of memory is recommended, though running
|
|
208
|
+
on a CPU also works.
|
|
209
|
+
|
|
210
|
+
### Example directory layout
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
calc_dir/
|
|
214
|
+
├── POSCAR # required
|
|
215
|
+
├── INCAR # optional
|
|
216
|
+
├── POTCAR # optional
|
|
217
|
+
└── BCAR # optional, specify potential and model path
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Example command:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
vpmdk --dir calc_dir
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
VPMDK is distributed under the BSD 3-Clause License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vpmdk"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Run machine-learning potentials using VASP style inputs."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "BSD-3-Clause"
|
|
12
|
+
keywords = ["vasp", "molecular-dynamics", "machine-learning", "ase"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"ase",
|
|
23
|
+
"numpy",
|
|
24
|
+
"pymatgen",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
vpmdk = "vpmdk:main"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools]
|
|
31
|
+
package-dir = { "" = "src" }
|
|
32
|
+
packages = ["vpmdk_core"]
|
|
33
|
+
py-modules = ["vpmdk"]
|
vpmdk-0.2.0/setup.cfg
ADDED