GO-Diff 1.0.0__py3-none-any.whl
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.
- go_diff/__init__.py +3 -0
- go_diff/controllers/__init__.py +4 -0
- go_diff/controllers/buffer.py +89 -0
- go_diff/controllers/sample.py +98 -0
- go_diff/controllers/temperature.py +116 -0
- go_diff/controllers/training.py +407 -0
- go_diff/filter.py +70 -0
- go_diff/go_diff.py +751 -0
- go_diff/logger.py +453 -0
- go_diff/noisers/__init__.py +1 -0
- go_diff/noisers/weighted_pos.py +59 -0
- go_diff/utils.py +50 -0
- go_diff-1.0.0.dist-info/METADATA +153 -0
- go_diff-1.0.0.dist-info/RECORD +16 -0
- go_diff-1.0.0.dist-info/WHEEL +4 -0
- go_diff-1.0.0.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: GO-Diff
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: GO-Diff
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: agedi[full]>=1.0.0
|
|
8
|
+
Requires-Dist: ase
|
|
9
|
+
Requires-Dist: lightning
|
|
10
|
+
Requires-Dist: matplotlib
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: rich-click
|
|
14
|
+
Requires-Dist: seaborn
|
|
15
|
+
Requires-Dist: tensorboard
|
|
16
|
+
Requires-Dist: torch
|
|
17
|
+
Requires-Dist: torch-geometric
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest; extra == 'test'
|
|
20
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# GO-Diff
|
|
24
|
+
|
|
25
|
+
**GO-Diff** (Gradient-Optimised Diffusion) is a generative diffusion framework for
|
|
26
|
+
atomistic structure search. It couples a learned diffusion model with an
|
|
27
|
+
energy/force calculator (e.g. MACE) and iteratively refines the model through
|
|
28
|
+
Boltzmann-weighted training, adaptive temperature annealing, and an adaptive
|
|
29
|
+
replay buffer.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install go-diff
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### (Optional) Reproduce paper results
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install mace-torch
|
|
43
|
+
pip install "agox[full]"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import numpy as np
|
|
52
|
+
from ase.build import surface
|
|
53
|
+
from mace.calculators import mace_mp
|
|
54
|
+
from agedi import create_diffusion
|
|
55
|
+
|
|
56
|
+
from go_diff import GODiff
|
|
57
|
+
from go_diff.controllers import (
|
|
58
|
+
TemperatureSchedule,
|
|
59
|
+
SampleController,
|
|
60
|
+
MomentumConsensusStop,
|
|
61
|
+
)
|
|
62
|
+
from go_diff.noisers import WeightedPositions
|
|
63
|
+
|
|
64
|
+
# 1. Calculator
|
|
65
|
+
calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device="cuda")
|
|
66
|
+
|
|
67
|
+
# 2. Substrate template (atoms to keep fixed)
|
|
68
|
+
template = surface("Pt", (1, 2, 2), 5, vacuum=8.0)
|
|
69
|
+
template.positions[:, 2] -= template.positions[:, 2].min()
|
|
70
|
+
confinement = [0.0, 4.0 + template.positions[:, 2].max()]
|
|
71
|
+
|
|
72
|
+
# 3. Diffusion model
|
|
73
|
+
diffusion = create_diffusion(noisers=(WeightedPositions(),))
|
|
74
|
+
|
|
75
|
+
# 4. GO-Diff optimiser
|
|
76
|
+
godiff = GODiff(
|
|
77
|
+
calculator=calc,
|
|
78
|
+
diffusion=diffusion,
|
|
79
|
+
temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
|
|
80
|
+
sample_controller=SampleController(initial_N=16, target_ess=8),
|
|
81
|
+
training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
|
|
82
|
+
sample_config={
|
|
83
|
+
"template": template,
|
|
84
|
+
"atomic_numbers": [78], # one Pt adatom
|
|
85
|
+
},
|
|
86
|
+
dataset_config={
|
|
87
|
+
"mask": "MaskFixed",
|
|
88
|
+
"confinement": confinement,
|
|
89
|
+
},
|
|
90
|
+
initial_buffer_size=16,
|
|
91
|
+
min_E=-200,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# 5. Run
|
|
95
|
+
final_checkpoint = godiff.run(max_iterations=50)
|
|
96
|
+
print(f"Model saved to {final_checkpoint}")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See `scripts/example_script.py` for the full script and `scripts/` for all
|
|
100
|
+
paper reproduction scripts.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Key components
|
|
105
|
+
|
|
106
|
+
| Class / module | Description |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `GODiff` | Main optimisation loop (sample → evaluate → buffer → train) |
|
|
109
|
+
| `TemperatureSchedule` | Adaptive annealing; `fast` / `slow` cooling factors based on heat capacity |
|
|
110
|
+
| `SampleController` | Stops sampling when the Effective Sample Size (ESS) reaches a target |
|
|
111
|
+
| `MomentumConsensusStop` | Stops training when gradient–momentum agreement drops |
|
|
112
|
+
| `AdaptiveRefinementStop` | Alternative stop criterion based on split-batch gradient agreement EMA |
|
|
113
|
+
| `WeightedPositions` | Boltzmann-weighted position noiser for the diffusion model |
|
|
114
|
+
| `GODiffLogger` | TensorBoard logger (energies, ESS, timing, analysis figures) |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Running the tests
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
pip install ".[test]"
|
|
122
|
+
pytest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Scripts
|
|
128
|
+
|
|
129
|
+
Scripts to reproduce the results in the paper are in `scripts/`. Utilities for
|
|
130
|
+
identifying the Pt-heptamer structure are in `utils/`.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Citation
|
|
135
|
+
|
|
136
|
+
If you use GO-Diff please cite:
|
|
137
|
+
|
|
138
|
+
> Ronne, Nikolaj, and Bjork Hammer. "Atomistic Generative Diffusion for Materials
|
|
139
|
+
> Modeling." arXiv:2507.18314. Preprint, arXiv, July 24, 2025.
|
|
140
|
+
> <https://arxiv.org/abs/2507.18314>
|
|
141
|
+
|
|
142
|
+
If studying surface-supported systems also cite:
|
|
143
|
+
|
|
144
|
+
> Ronne, Nikolaj, Alan Aspuru-Guzik, and Bjork Hammer. "Generative Diffusion
|
|
145
|
+
> Model for Surface Structure Discovery." Physical Review B 110, no. 23 (2024):
|
|
146
|
+
> 235427. <https://doi.org/10.1103/PhysRevB.110.235427>
|
|
147
|
+
|
|
148
|
+
Optionally, if using any AGOX functionality:
|
|
149
|
+
|
|
150
|
+
> Christiansen, Mads-Peter V., Nikolaj Ronne, and Bjork Hammer. "Atomistic
|
|
151
|
+
> Global Optimization X: A Python Package for Optimization of Atomistic
|
|
152
|
+
> Structures." The Journal of Chemical Physics 157, no. 5 (2022): 054701.
|
|
153
|
+
> <https://doi.org/10.1063/5.0094165>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
go_diff/__init__.py,sha256=XuCa2kPtVCJGXRm8ZnvoOJs3Sd9dHuNz3ldOqmAprVs,122
|
|
2
|
+
go_diff/filter.py,sha256=CIUqyNNEyzY0xNZhF9q2030crwMqiN7JZ7kX0iwOpaA,2037
|
|
3
|
+
go_diff/go_diff.py,sha256=7nJ37voHo8krrj3LlKA8-q-Fmzwg5PscSDLuDTqpvJ8,27765
|
|
4
|
+
go_diff/logger.py,sha256=j-IcjXZ8FB2m2XPpdOkIGYTrymgT8OSP8zKN2GpaUmo,19327
|
|
5
|
+
go_diff/utils.py,sha256=LMxrhv6HpS_HKOLBmCUzP0Edl1CX5ECz4ozIUqr9kjU,1427
|
|
6
|
+
go_diff/controllers/__init__.py,sha256=I2zXG0bDDrayKEPqCLTqxEcTlDo-IWGe2297I7ryix0,211
|
|
7
|
+
go_diff/controllers/buffer.py,sha256=88dEbL1UNkk944yZEiDzk18byjVgAdRbrH2LBjysU1s,2900
|
|
8
|
+
go_diff/controllers/sample.py,sha256=tRVml0LWLH9BAQUFIOEP4c0gixOEuRsYmYcCfvkP2FE,3160
|
|
9
|
+
go_diff/controllers/temperature.py,sha256=wjaJOBg7TPmsAwFEJUtUFfV1s7EvowHuzg0nRTcN7Ao,3776
|
|
10
|
+
go_diff/controllers/training.py,sha256=1ZZYLdv5JW8PY3nEjGV80nM8TWl4GZ28h6oanWh-hmM,15285
|
|
11
|
+
go_diff/noisers/__init__.py,sha256=V75n6hvaKUL5XQ76ySM4MSUnmH_sXYaB00nBO1oVMAE,75
|
|
12
|
+
go_diff/noisers/weighted_pos.py,sha256=2t_kkkHXwSklkUl9UrUX5gozxMMCm1M34iUyS2nK670,1697
|
|
13
|
+
go_diff-1.0.0.dist-info/METADATA,sha256=8wrS04fEI8qgEFtaocl5e2_puu7uMcQhi2-lccNU8qk,4271
|
|
14
|
+
go_diff-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
15
|
+
go_diff-1.0.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
16
|
+
go_diff-1.0.0.dist-info/RECORD,,
|