atoms-md 1.0.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.
- atoms_md-1.0.0/.gitignore +28 -0
- atoms_md-1.0.0/CITATION.cff +21 -0
- atoms_md-1.0.0/LICENSE +21 -0
- atoms_md-1.0.0/PKG-INFO +179 -0
- atoms_md-1.0.0/README.md +151 -0
- atoms_md-1.0.0/pyproject.toml +76 -0
- atoms_md-1.0.0/src/atoms/__init__.py +234 -0
- atoms_md-1.0.0/src/atoms/ewald.py +2949 -0
- atoms_md-1.0.0/src/atoms/forcefield.py +3331 -0
- atoms_md-1.0.0/src/atoms/integrator.py +647 -0
- atoms_md-1.0.0/src/atoms/lj.py +1100 -0
- atoms_md-1.0.0/src/atoms/neighbor_list.py +1325 -0
- atoms_md-1.0.0/src/atoms/oracle.py +760 -0
- atoms_md-1.0.0/src/atoms/pbc.py +745 -0
- atoms_md-1.0.0/src/atoms/sdk/__init__.py +79 -0
- atoms_md-1.0.0/src/atoms/sdk/certificates.py +916 -0
- atoms_md-1.0.0/src/atoms/sdk/integrators.py +79 -0
- atoms_md-1.0.0/src/atoms/sdk/io.py +710 -0
- atoms_md-1.0.0/src/atoms/sdk/reporters.py +605 -0
- atoms_md-1.0.0/src/atoms/sdk/simulation.py +3138 -0
- atoms_md-1.0.0/src/atoms/sdk/systems.py +1595 -0
- atoms_md-1.0.0/src/atoms/spme.py +6050 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
.venv/
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
|
|
12
|
+
# Lean 4
|
|
13
|
+
lean/.lake/
|
|
14
|
+
|
|
15
|
+
# Local scratch & secrets
|
|
16
|
+
.env
|
|
17
|
+
*.ptx
|
|
18
|
+
*.cubin
|
|
19
|
+
|
|
20
|
+
# LaTeX build artifacts
|
|
21
|
+
paper/*.aux
|
|
22
|
+
paper/*.bbl
|
|
23
|
+
paper/*.blg
|
|
24
|
+
paper/*.fdb_latexmk
|
|
25
|
+
paper/*.fls
|
|
26
|
+
paper/*.log
|
|
27
|
+
paper/*.out
|
|
28
|
+
paper/acs-*.bib
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: "atoms: Machine-Checked Force Fields, Numerical Error Certificates, and PTX-Audited GPU Molecular Dynamics"
|
|
3
|
+
message: "If you use this software or formalization, please cite it using the metadata below."
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Engel
|
|
7
|
+
given-names: Christian
|
|
8
|
+
email: chris@christianengel.dev
|
|
9
|
+
orcid: "https://orcid.org/0009-0007-8205-9231"
|
|
10
|
+
affiliation: Independent Researcher
|
|
11
|
+
repository-code: "https://github.com/protortyp/atoms"
|
|
12
|
+
url: "https://protortyp.github.io/atoms/"
|
|
13
|
+
license: MIT
|
|
14
|
+
keywords:
|
|
15
|
+
- molecular dynamics
|
|
16
|
+
- formal verification
|
|
17
|
+
- Lean 4
|
|
18
|
+
- IEEE-754 floating-point error bounds
|
|
19
|
+
- neighbor lists
|
|
20
|
+
- Smooth Particle Mesh Ewald
|
|
21
|
+
- GPU computing
|
atoms_md-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christian Engel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
atoms_md-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: atoms-md
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: GPU-accelerated molecular dynamics engine in NVIDIA Warp with machine-checked Lean 4 force-field specifications and certified numerical error bounds
|
|
5
|
+
Project-URL: Homepage, https://protortyp.github.io/atoms/
|
|
6
|
+
Project-URL: Repository, https://github.com/protortyp/atoms
|
|
7
|
+
Project-URL: Documentation, https://github.com/protortyp/atoms/blob/develop/docs/SDK.md
|
|
8
|
+
Project-URL: Paper, https://protortyp.github.io/atoms/paper/main.pdf
|
|
9
|
+
Project-URL: Issues, https://github.com/protortyp/atoms/issues
|
|
10
|
+
Author-email: Christian Engel <chris@christianengel.dev>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: amber,computational-chemistry,ewald,formal-verification,gpu,lean4,molecular-dynamics,nvidia-warp,spme
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
21
|
+
Requires-Python: >=3.13
|
|
22
|
+
Requires-Dist: numpy>=2.0
|
|
23
|
+
Requires-Dist: scipy>=1.14
|
|
24
|
+
Requires-Dist: warp-lang>=1.19
|
|
25
|
+
Provides-Extra: openmm
|
|
26
|
+
Requires-Dist: openmm>=8.6; extra == 'openmm'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# atoms
|
|
30
|
+
|
|
31
|
+
GPU-accelerated molecular dynamics engine in NVIDIA Warp paired with machine-checked Lean 4 force-field specifications, IEEE-754 floating-point and Ewald truncation bounds, and conditionally certified Verlet neighbor lists.
|
|
32
|
+
|
|
33
|
+
[Paper (PDF)](https://protortyp.github.io/atoms/paper/main.pdf) · [Supporting Information (PDF)](https://protortyp.github.io/atoms/paper/suppinfo.pdf) · [Project Page](https://protortyp.github.io/atoms/) · [SDK Reference](docs/SDK.md) · MIT License
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/) (or pip). GPU execution uses NVIDIA Warp (`device="cuda:0"`), with CPU fallback via `device="cpu"`.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uv add atoms-md # PyPI package (`import atoms`)
|
|
41
|
+
uv add "atoms-md[openmm]" # optional OpenMM/PDB loader support
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
From source (including tests, OpenMM benchmarks, and optional Lean 4 proofs / `atoms-oracle`):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git clone https://github.com/protortyp/atoms.git
|
|
48
|
+
cd atoms
|
|
49
|
+
uv sync --group dev
|
|
50
|
+
|
|
51
|
+
# Optional: build Lean 4 proofs and the atoms-oracle binary (needed only for
|
|
52
|
+
# `sim.certify(include_lj_bound=True)` / `use_oracle_ewald=True` / `atoms.lj_fp_bound`)
|
|
53
|
+
cd lean && lake build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quickstart
|
|
57
|
+
|
|
58
|
+
All APIs use OpenMM/GROMACS units: **nm**, **ps**, **kJ/mol**, **Da**, **K**, and elementary charge **e**. See [docs/SDK.md](docs/SDK.md) for the complete SDK reference and [examples/](examples/) for runnable scripts.
|
|
59
|
+
|
|
60
|
+
### 1. Liquid Argon NVE with Certified Verlet Neighbor Lists
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import atoms
|
|
64
|
+
|
|
65
|
+
system = atoms.LJSystem.argon(n_side=6) # 864 atoms, FCC liquid density
|
|
66
|
+
integrator = atoms.VerletIntegrator(dt=0.002)
|
|
67
|
+
|
|
68
|
+
with atoms.Simulation(system, integrator, precision="float32", device="cuda:0") as sim:
|
|
69
|
+
sim.minimize(max_iter=100)
|
|
70
|
+
sim.set_velocities_to_temperature(94.4, seed=42)
|
|
71
|
+
sim.step(2000, reporters=[atoms.StateLogger(interval=500)])
|
|
72
|
+
|
|
73
|
+
print(sim.certify().summary())
|
|
74
|
+
print(f"Pressure = {sim.pressure_bar():.1f} bar")
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 2. GPU SPME Liquid Water (NVT → NVE)
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import atoms
|
|
81
|
+
|
|
82
|
+
water = atoms.WaterSystem.spce(n_side=8, density_g_cm3=0.997) # 512 flexible SPC/E waters
|
|
83
|
+
nvt = atoms.LangevinIntegrator(dt=0.0005, temperature=300.0, friction=1.0, seed=7)
|
|
84
|
+
|
|
85
|
+
with atoms.Simulation(water, nvt, precision="float32", device="cuda:0") as sim:
|
|
86
|
+
sim.minimize(max_iter=100, tol=50.0)
|
|
87
|
+
sim.set_velocities_to_temperature(300.0, seed=7)
|
|
88
|
+
sim.step(1000) # 0.5 ps NVT equilibration
|
|
89
|
+
|
|
90
|
+
# Switch seamlessly to NVE production on the same GPU buffers
|
|
91
|
+
sim.set_integrator(atoms.VerletIntegrator(dt=0.0005), reset_clock=True)
|
|
92
|
+
traj = atoms.TrajectoryReporter(interval=250)
|
|
93
|
+
sim.step(1000, reporters=[atoms.StateLogger(interval=250), traj])
|
|
94
|
+
print(sim.certify().summary())
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. AMBER Force Field, Reverse-Mode Autodiff & OpenMM Interop
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import numpy as np
|
|
101
|
+
import atoms
|
|
102
|
+
|
|
103
|
+
ala2 = atoms.MolecularSystem.alanine_dipeptide() # or MolecularSystem.from_openmm(omm_sys, pos)
|
|
104
|
+
nvt = atoms.LangevinIntegrator(dt=0.001, temperature=300.0, friction=1.0, seed=123)
|
|
105
|
+
|
|
106
|
+
with atoms.Simulation(ala2, nvt, precision="float64", device="cuda:0") as sim:
|
|
107
|
+
energy, f_ana = sim.energy_and_forces()
|
|
108
|
+
f_ad = sim.forces_autodiff()
|
|
109
|
+
print(f"U = {energy:.2f} kJ/mol, max |F_ana - F_ad| = {np.max(np.abs(f_ana - f_ad)):.2e}")
|
|
110
|
+
|
|
111
|
+
traj = atoms.TrajectoryReporter(interval=100, save_forces=True)
|
|
112
|
+
sim.step(1000, reporters=[traj])
|
|
113
|
+
batch = ala2.evaluate_batch(traj.to_trajectory().positions, precision="float32", device="cuda:0")
|
|
114
|
+
print(f"Evaluated {len(batch.energies)} conformations on GPU")
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 4. Certified Numerical Error Bounds
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
import numpy as np
|
|
121
|
+
import atoms
|
|
122
|
+
|
|
123
|
+
# Certified IEEE-754 neighbor-list rounding margin (nm)
|
|
124
|
+
nl_cert = atoms.certify_neighbor_list(box=(3.0, 3.0, 3.0), rc=0.9, r_skin=0.1, dtype=np.float32)
|
|
125
|
+
print(nl_cert.summary())
|
|
126
|
+
|
|
127
|
+
# Certified Ewald real + reciprocal truncation parameters (|U_tail| <= tol kJ/mol)
|
|
128
|
+
charges = np.array([-0.8476, 0.4238, 0.4238] * 256)
|
|
129
|
+
ew_cert = atoms.certify_ewald(box=(2.5, 2.5, 2.5), rc=0.9, tol=5e-4, charges=charges)
|
|
130
|
+
print(ew_cert.summary())
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Verification & Reproducing Paper Results
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 1. Build Lean 4 proofs and verify zero sorry / standard axioms only (168 declarations)
|
|
137
|
+
cd lean && lake build && cd ..
|
|
138
|
+
./scripts/check_lean.sh
|
|
139
|
+
|
|
140
|
+
# 2. Audit NVRTC-emitted CUDA PTX across all 8 core GPU modules
|
|
141
|
+
uv run python scripts/audit_ptx.py --markdown
|
|
142
|
+
|
|
143
|
+
# 3. Run unit, SDK, oracle-differential, NIST SRSW, and OpenMM validation tests
|
|
144
|
+
uv run pytest
|
|
145
|
+
|
|
146
|
+
# 4. End-to-end paper reproduction (Lean check, PTX audit, ruff, tests, figures, PDFs)
|
|
147
|
+
bash scripts/reproduce_paper.sh
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Scope & Limitations
|
|
151
|
+
|
|
152
|
+
- **Formally verified (Lean 4 + FloatLib):** Exact-$\mathbb{R}$ force-field gradients ($F = -\nabla U$), $SE(3)$/$SO(3)$ symmetries, single-step Velocity-Verlet symplecticity ($\det J = 1$), cardinal B-spline SPME identities, single-evaluation IEEE-754 Lennard-Jones force error bounds, build-time floating-point Verlet neighbor-list completeness (`certifiedDeltaRound`), and upward-rounded exact-$\mathbb{Q}$ Ewald truncation certificates, instantiated by 30 closed non-vacuity witnesses (`lean/Audit.lean`).
|
|
153
|
+
- **Not formally certified:** Long-term chaotic MD trajectories ($10^5+$ steps), arbitrary-$\Delta t$ energy stability, SPME mesh-truncation error, and thermodynamic observables ($g_{\mathrm{OO}}(r)$, $D$, Ramachandran distributions) are validated empirically against NIST SRSW and OpenMM 8.6.1.
|
|
154
|
+
- **Unverified execution TCB:** NVIDIA Warp AST lowering, `cuFFT`, `CUB` radix sort, NVRTC, `ptxas`, CUDA drivers, and GPU hardware lie outside Lean's verified boundary and are never claimed bug-free. See [docs/TCB.md](docs/TCB.md) for the full boundary specification.
|
|
155
|
+
|
|
156
|
+
## Documentation
|
|
157
|
+
|
|
158
|
+
- [docs/SDK.md](docs/SDK.md) — High-level Python SDK reference (`Simulation`, systems, OpenMM/PDB loaders, reporters, certificates)
|
|
159
|
+
- [docs/TCB.md](docs/TCB.md) — Three-layer Trusted Computing Base, proof assumptions, and scope boundaries
|
|
160
|
+
- [docs/THEOREMS.md](docs/THEOREMS.md) — Catalog of all 115 theorem entries (168 audited Lean 4 declarations)
|
|
161
|
+
- [docs/PTX_AUDIT.md](docs/PTX_AUDIT.md) — Compiled CUDA PTX instruction audit across all 8 core GPU modules
|
|
162
|
+
- [docs/BENCHMARKS.md](docs/BENCHMARKS.md) — Accuracy, statistical MD validation, and RTX 3090 throughput results
|
|
163
|
+
- [docs/RELATED_WORK.md](docs/RELATED_WORK.md) — Comparison with formal MD, FP verification tools, and GPU MD engines
|
|
164
|
+
|
|
165
|
+
## Citation
|
|
166
|
+
|
|
167
|
+
```bibtex
|
|
168
|
+
@misc{engel2026atoms,
|
|
169
|
+
author = {Engel, Christian},
|
|
170
|
+
title = {atoms: Machine-Checked Force Fields, Numerical Error Certificates, and PTX-Audited GPU Molecular Dynamics},
|
|
171
|
+
year = {2026},
|
|
172
|
+
howpublished = {\url{https://github.com/protortyp/atoms}},
|
|
173
|
+
url = {https://protortyp.github.io/atoms/}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT License — see [LICENSE](LICENSE).
|
atoms_md-1.0.0/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# atoms
|
|
2
|
+
|
|
3
|
+
GPU-accelerated molecular dynamics engine in NVIDIA Warp paired with machine-checked Lean 4 force-field specifications, IEEE-754 floating-point and Ewald truncation bounds, and conditionally certified Verlet neighbor lists.
|
|
4
|
+
|
|
5
|
+
[Paper (PDF)](https://protortyp.github.io/atoms/paper/main.pdf) · [Supporting Information (PDF)](https://protortyp.github.io/atoms/paper/suppinfo.pdf) · [Project Page](https://protortyp.github.io/atoms/) · [SDK Reference](docs/SDK.md) · MIT License
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/) (or pip). GPU execution uses NVIDIA Warp (`device="cuda:0"`), with CPU fallback via `device="cpu"`.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv add atoms-md # PyPI package (`import atoms`)
|
|
13
|
+
uv add "atoms-md[openmm]" # optional OpenMM/PDB loader support
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
From source (including tests, OpenMM benchmarks, and optional Lean 4 proofs / `atoms-oracle`):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/protortyp/atoms.git
|
|
20
|
+
cd atoms
|
|
21
|
+
uv sync --group dev
|
|
22
|
+
|
|
23
|
+
# Optional: build Lean 4 proofs and the atoms-oracle binary (needed only for
|
|
24
|
+
# `sim.certify(include_lj_bound=True)` / `use_oracle_ewald=True` / `atoms.lj_fp_bound`)
|
|
25
|
+
cd lean && lake build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quickstart
|
|
29
|
+
|
|
30
|
+
All APIs use OpenMM/GROMACS units: **nm**, **ps**, **kJ/mol**, **Da**, **K**, and elementary charge **e**. See [docs/SDK.md](docs/SDK.md) for the complete SDK reference and [examples/](examples/) for runnable scripts.
|
|
31
|
+
|
|
32
|
+
### 1. Liquid Argon NVE with Certified Verlet Neighbor Lists
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import atoms
|
|
36
|
+
|
|
37
|
+
system = atoms.LJSystem.argon(n_side=6) # 864 atoms, FCC liquid density
|
|
38
|
+
integrator = atoms.VerletIntegrator(dt=0.002)
|
|
39
|
+
|
|
40
|
+
with atoms.Simulation(system, integrator, precision="float32", device="cuda:0") as sim:
|
|
41
|
+
sim.minimize(max_iter=100)
|
|
42
|
+
sim.set_velocities_to_temperature(94.4, seed=42)
|
|
43
|
+
sim.step(2000, reporters=[atoms.StateLogger(interval=500)])
|
|
44
|
+
|
|
45
|
+
print(sim.certify().summary())
|
|
46
|
+
print(f"Pressure = {sim.pressure_bar():.1f} bar")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. GPU SPME Liquid Water (NVT → NVE)
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import atoms
|
|
53
|
+
|
|
54
|
+
water = atoms.WaterSystem.spce(n_side=8, density_g_cm3=0.997) # 512 flexible SPC/E waters
|
|
55
|
+
nvt = atoms.LangevinIntegrator(dt=0.0005, temperature=300.0, friction=1.0, seed=7)
|
|
56
|
+
|
|
57
|
+
with atoms.Simulation(water, nvt, precision="float32", device="cuda:0") as sim:
|
|
58
|
+
sim.minimize(max_iter=100, tol=50.0)
|
|
59
|
+
sim.set_velocities_to_temperature(300.0, seed=7)
|
|
60
|
+
sim.step(1000) # 0.5 ps NVT equilibration
|
|
61
|
+
|
|
62
|
+
# Switch seamlessly to NVE production on the same GPU buffers
|
|
63
|
+
sim.set_integrator(atoms.VerletIntegrator(dt=0.0005), reset_clock=True)
|
|
64
|
+
traj = atoms.TrajectoryReporter(interval=250)
|
|
65
|
+
sim.step(1000, reporters=[atoms.StateLogger(interval=250), traj])
|
|
66
|
+
print(sim.certify().summary())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. AMBER Force Field, Reverse-Mode Autodiff & OpenMM Interop
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import numpy as np
|
|
73
|
+
import atoms
|
|
74
|
+
|
|
75
|
+
ala2 = atoms.MolecularSystem.alanine_dipeptide() # or MolecularSystem.from_openmm(omm_sys, pos)
|
|
76
|
+
nvt = atoms.LangevinIntegrator(dt=0.001, temperature=300.0, friction=1.0, seed=123)
|
|
77
|
+
|
|
78
|
+
with atoms.Simulation(ala2, nvt, precision="float64", device="cuda:0") as sim:
|
|
79
|
+
energy, f_ana = sim.energy_and_forces()
|
|
80
|
+
f_ad = sim.forces_autodiff()
|
|
81
|
+
print(f"U = {energy:.2f} kJ/mol, max |F_ana - F_ad| = {np.max(np.abs(f_ana - f_ad)):.2e}")
|
|
82
|
+
|
|
83
|
+
traj = atoms.TrajectoryReporter(interval=100, save_forces=True)
|
|
84
|
+
sim.step(1000, reporters=[traj])
|
|
85
|
+
batch = ala2.evaluate_batch(traj.to_trajectory().positions, precision="float32", device="cuda:0")
|
|
86
|
+
print(f"Evaluated {len(batch.energies)} conformations on GPU")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 4. Certified Numerical Error Bounds
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import numpy as np
|
|
93
|
+
import atoms
|
|
94
|
+
|
|
95
|
+
# Certified IEEE-754 neighbor-list rounding margin (nm)
|
|
96
|
+
nl_cert = atoms.certify_neighbor_list(box=(3.0, 3.0, 3.0), rc=0.9, r_skin=0.1, dtype=np.float32)
|
|
97
|
+
print(nl_cert.summary())
|
|
98
|
+
|
|
99
|
+
# Certified Ewald real + reciprocal truncation parameters (|U_tail| <= tol kJ/mol)
|
|
100
|
+
charges = np.array([-0.8476, 0.4238, 0.4238] * 256)
|
|
101
|
+
ew_cert = atoms.certify_ewald(box=(2.5, 2.5, 2.5), rc=0.9, tol=5e-4, charges=charges)
|
|
102
|
+
print(ew_cert.summary())
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Verification & Reproducing Paper Results
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 1. Build Lean 4 proofs and verify zero sorry / standard axioms only (168 declarations)
|
|
109
|
+
cd lean && lake build && cd ..
|
|
110
|
+
./scripts/check_lean.sh
|
|
111
|
+
|
|
112
|
+
# 2. Audit NVRTC-emitted CUDA PTX across all 8 core GPU modules
|
|
113
|
+
uv run python scripts/audit_ptx.py --markdown
|
|
114
|
+
|
|
115
|
+
# 3. Run unit, SDK, oracle-differential, NIST SRSW, and OpenMM validation tests
|
|
116
|
+
uv run pytest
|
|
117
|
+
|
|
118
|
+
# 4. End-to-end paper reproduction (Lean check, PTX audit, ruff, tests, figures, PDFs)
|
|
119
|
+
bash scripts/reproduce_paper.sh
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Scope & Limitations
|
|
123
|
+
|
|
124
|
+
- **Formally verified (Lean 4 + FloatLib):** Exact-$\mathbb{R}$ force-field gradients ($F = -\nabla U$), $SE(3)$/$SO(3)$ symmetries, single-step Velocity-Verlet symplecticity ($\det J = 1$), cardinal B-spline SPME identities, single-evaluation IEEE-754 Lennard-Jones force error bounds, build-time floating-point Verlet neighbor-list completeness (`certifiedDeltaRound`), and upward-rounded exact-$\mathbb{Q}$ Ewald truncation certificates, instantiated by 30 closed non-vacuity witnesses (`lean/Audit.lean`).
|
|
125
|
+
- **Not formally certified:** Long-term chaotic MD trajectories ($10^5+$ steps), arbitrary-$\Delta t$ energy stability, SPME mesh-truncation error, and thermodynamic observables ($g_{\mathrm{OO}}(r)$, $D$, Ramachandran distributions) are validated empirically against NIST SRSW and OpenMM 8.6.1.
|
|
126
|
+
- **Unverified execution TCB:** NVIDIA Warp AST lowering, `cuFFT`, `CUB` radix sort, NVRTC, `ptxas`, CUDA drivers, and GPU hardware lie outside Lean's verified boundary and are never claimed bug-free. See [docs/TCB.md](docs/TCB.md) for the full boundary specification.
|
|
127
|
+
|
|
128
|
+
## Documentation
|
|
129
|
+
|
|
130
|
+
- [docs/SDK.md](docs/SDK.md) — High-level Python SDK reference (`Simulation`, systems, OpenMM/PDB loaders, reporters, certificates)
|
|
131
|
+
- [docs/TCB.md](docs/TCB.md) — Three-layer Trusted Computing Base, proof assumptions, and scope boundaries
|
|
132
|
+
- [docs/THEOREMS.md](docs/THEOREMS.md) — Catalog of all 115 theorem entries (168 audited Lean 4 declarations)
|
|
133
|
+
- [docs/PTX_AUDIT.md](docs/PTX_AUDIT.md) — Compiled CUDA PTX instruction audit across all 8 core GPU modules
|
|
134
|
+
- [docs/BENCHMARKS.md](docs/BENCHMARKS.md) — Accuracy, statistical MD validation, and RTX 3090 throughput results
|
|
135
|
+
- [docs/RELATED_WORK.md](docs/RELATED_WORK.md) — Comparison with formal MD, FP verification tools, and GPU MD engines
|
|
136
|
+
|
|
137
|
+
## Citation
|
|
138
|
+
|
|
139
|
+
```bibtex
|
|
140
|
+
@misc{engel2026atoms,
|
|
141
|
+
author = {Engel, Christian},
|
|
142
|
+
title = {atoms: Machine-Checked Force Fields, Numerical Error Certificates, and PTX-Audited GPU Molecular Dynamics},
|
|
143
|
+
year = {2026},
|
|
144
|
+
howpublished = {\url{https://github.com/protortyp/atoms}},
|
|
145
|
+
url = {https://protortyp.github.io/atoms/}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT License — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "atoms-md"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "GPU-accelerated molecular dynamics engine in NVIDIA Warp with machine-checked Lean 4 force-field specifications and certified numerical error bounds"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Christian Engel", email = "chris@christianengel.dev" },
|
|
9
|
+
]
|
|
10
|
+
requires-python = ">=3.13"
|
|
11
|
+
keywords = [
|
|
12
|
+
"molecular-dynamics",
|
|
13
|
+
"gpu",
|
|
14
|
+
"nvidia-warp",
|
|
15
|
+
"formal-verification",
|
|
16
|
+
"lean4",
|
|
17
|
+
"spme",
|
|
18
|
+
"ewald",
|
|
19
|
+
"amber",
|
|
20
|
+
"computational-chemistry",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Science/Research",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Chemistry",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"numpy>=2.0",
|
|
33
|
+
"scipy>=1.14",
|
|
34
|
+
"warp-lang>=1.19",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
openmm = ["openmm>=8.6"]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://protortyp.github.io/atoms/"
|
|
42
|
+
Repository = "https://github.com/protortyp/atoms"
|
|
43
|
+
Documentation = "https://github.com/protortyp/atoms/blob/develop/docs/SDK.md"
|
|
44
|
+
Paper = "https://protortyp.github.io/atoms/paper/main.pdf"
|
|
45
|
+
Issues = "https://github.com/protortyp/atoms/issues"
|
|
46
|
+
|
|
47
|
+
[dependency-groups]
|
|
48
|
+
dev = [
|
|
49
|
+
"matplotlib>=3.9",
|
|
50
|
+
"openmm[cuda12]>=8.6",
|
|
51
|
+
"pytest>=8.0",
|
|
52
|
+
"ruff>=0.9",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[build-system]
|
|
56
|
+
requires = ["hatchling"]
|
|
57
|
+
build-backend = "hatchling.build"
|
|
58
|
+
|
|
59
|
+
[tool.hatch.build.targets.wheel]
|
|
60
|
+
packages = ["src/atoms"]
|
|
61
|
+
|
|
62
|
+
[tool.hatch.build.targets.sdist]
|
|
63
|
+
include = [
|
|
64
|
+
"/src",
|
|
65
|
+
"/README.md",
|
|
66
|
+
"/LICENSE",
|
|
67
|
+
"/CITATION.cff",
|
|
68
|
+
"/pyproject.toml",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 100
|
|
73
|
+
target-version = "py313"
|
|
74
|
+
|
|
75
|
+
[tool.pytest.ini_options]
|
|
76
|
+
testpaths = ["tests"]
|