GO-Diff 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {go_diff-1.0.0 → go_diff-1.0.1}/PKG-INFO +59 -43
  2. {go_diff-1.0.0 → go_diff-1.0.1}/README.md +58 -42
  3. go_diff-1.0.1/VERSION +1 -0
  4. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/concepts.rst +1 -1
  5. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/conf.py +1 -1
  6. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/index.rst +2 -6
  7. go_diff-1.0.1/docs/source/installation.rst +34 -0
  8. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/overview.rst +4 -3
  9. go_diff-1.0.1/docs/source/references.rst +84 -0
  10. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/troubleshooting.rst +6 -8
  11. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/tutorial/quickstart.rst +50 -53
  12. go_diff-1.0.0/scripts/heptamer_ffg.py → go_diff-1.0.1/scripts/heptamer.py +2 -2
  13. go_diff-1.0.0/scripts/stepped_pt_ffg.py → go_diff-1.0.1/scripts/stepped_pt.py +2 -1
  14. go_diff-1.0.0/VERSION +0 -1
  15. go_diff-1.0.0/docs/source/installation.rst +0 -60
  16. go_diff-1.0.0/docs/source/references.rst +0 -69
  17. go_diff-1.0.0/scripts/heptamer.py +0 -70
  18. go_diff-1.0.0/scripts/stepped_pt.py +0 -69
  19. {go_diff-1.0.0 → go_diff-1.0.1}/.github/workflows/auto-tag.yml +0 -0
  20. {go_diff-1.0.0 → go_diff-1.0.1}/.github/workflows/publish.yml +0 -0
  21. {go_diff-1.0.0 → go_diff-1.0.1}/.github/workflows/tests.yml +0 -0
  22. {go_diff-1.0.0 → go_diff-1.0.1}/.gitignore +0 -0
  23. {go_diff-1.0.0 → go_diff-1.0.1}/.readthedocs.yaml +0 -0
  24. {go_diff-1.0.0 → go_diff-1.0.1}/LICENSE +0 -0
  25. {go_diff-1.0.0 → go_diff-1.0.1}/docs/Makefile +0 -0
  26. {go_diff-1.0.0 → go_diff-1.0.1}/docs/make.bat +0 -0
  27. {go_diff-1.0.0 → go_diff-1.0.1}/docs/requirements.txt +0 -0
  28. {go_diff-1.0.0 → go_diff-1.0.1}/docs/source/tutorial/tutorial.rst +0 -0
  29. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/__init__.py +0 -0
  30. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/controllers/__init__.py +0 -0
  31. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/controllers/buffer.py +0 -0
  32. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/controllers/sample.py +0 -0
  33. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/controllers/temperature.py +0 -0
  34. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/controllers/training.py +0 -0
  35. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/filter.py +0 -0
  36. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/go_diff.py +0 -0
  37. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/logger.py +0 -0
  38. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/noisers/__init__.py +0 -0
  39. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/noisers/weighted_pos.py +0 -0
  40. {go_diff-1.0.0 → go_diff-1.0.1}/go_diff/utils.py +0 -0
  41. {go_diff-1.0.0 → go_diff-1.0.1}/pyproject.toml +0 -0
  42. {go_diff-1.0.0 → go_diff-1.0.1}/tests/__init__.py +0 -0
  43. {go_diff-1.0.0 → go_diff-1.0.1}/tests/conftest.py +0 -0
  44. {go_diff-1.0.0 → go_diff-1.0.1}/tests/test_godiff.py +0 -0
  45. {go_diff-1.0.0 → go_diff-1.0.1}/tests/test_sample_controller.py +0 -0
  46. {go_diff-1.0.0 → go_diff-1.0.1}/tests/test_temperature.py +0 -0
  47. {go_diff-1.0.0 → go_diff-1.0.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GO-Diff
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: GO-Diff
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -22,9 +22,9 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  # GO-Diff
24
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
25
+ **GO-Diff: Data-free and amortized global structure optimization** a
26
+ generative diffusion framework for atomistic structure search. It couples a diffusion model with an
27
+ energy/force calculator and iteratively refines the model through
28
28
  Boltzmann-weighted training, adaptive temperature annealing, and an adaptive
29
29
  replay buffer.
30
30
 
@@ -32,15 +32,15 @@ replay buffer.
32
32
 
33
33
  ## Installation
34
34
 
35
+ Install from pypi
35
36
  ```bash
36
37
  pip install go-diff
37
38
  ```
38
39
 
39
- ### (Optional) Reproduce paper results
40
-
40
+ ### (Optional) Install of MLIPs for running GO-Diff
41
+ E.g.
41
42
  ```bash
42
43
  pip install mace-torch
43
- pip install "agox[full]"
44
44
  ```
45
45
 
46
46
  ---
@@ -49,55 +49,68 @@ pip install "agox[full]"
49
49
 
50
50
  ```python
51
51
  import numpy as np
52
- from ase.build import surface
52
+
53
+ from ase.build import fcc111, surface
53
54
  from mace.calculators import mace_mp
54
- from agedi import create_diffusion
55
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
56
+ from agedi import AtomsGraph, create_diffusion
57
+ from agedi.diffusion import ForcefieldGuidanceConfig
63
58
 
64
- # 1. Calculator
65
- calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device="cuda")
59
+ from go_diff import GODiff, MinEnergyFilter
60
+ from go_diff.controllers import SampleController, BufferController, TemperatureSchedule, MomentumConsensusStop
61
+ from go_diff.noisers import WeightedConfinedCellPositions
66
62
 
67
- # 2. Substrate template (atoms to keep fixed)
68
- template = surface("Pt", (1, 2, 2), 5, vacuum=8.0)
63
+ ##### SYSTEM #####
64
+ formula = "Pt"
65
+
66
+ template = surface('Pt', (1,2,2), 5, vacuum=8.0)
69
67
  template.positions[:, 2] -= template.positions[:, 2].min()
70
- confinement = [0.0, 4.0 + template.positions[:, 2].max()]
71
68
 
72
- # 3. Diffusion model
73
- diffusion = create_diffusion(noisers=(WeightedPositions(),))
69
+ confinement_above_zmax = np.array([0.0, 4.0])
70
+ confinement = confinement_above_zmax + template.positions[:, 2].max()
71
+
72
+
73
+ ##### CALCULATOR #####
74
+ from mace.calculators import mace_mp
75
+ calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device='cuda')
76
+
77
+
78
+ #### DIFFUSION MODEL #####
79
+ diffusion = create_diffusion(noisers=(WeightedConfinedCellPositions(),), force_field=True)
80
+
74
81
 
75
- # 4. GO-Diff optimiser
82
+ #### GO-DIFF #####
76
83
  godiff = GODiff(
77
84
  calculator=calc,
78
85
  diffusion=diffusion,
79
86
  temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
80
87
  sample_controller=SampleController(initial_N=16, target_ess=8),
88
+ buffer_controller=BufferController(initial_buffer_size=16, max_buffer_size=96, adaption_rate=0.2),
81
89
  training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
82
90
  sample_config={
83
91
  "template": template,
84
- "atomic_numbers": [78], # one Pt adatom
92
+ "formula": formula,
93
+ "confinement": confinement,
94
+ "ff_guidance": ForcefieldGuidanceConfig(guidance=1.0,)
85
95
  },
86
96
  dataset_config={
87
97
  "mask": "MaskFixed",
88
98
  "confinement": confinement,
99
+ "regressor_data": "all_data", # use all data for training the regressor, not just the data in the buffer
100
+ },
101
+ trainer_config={
102
+ "name": name
89
103
  },
90
- initial_buffer_size=16,
91
- min_E=-200,
104
+ min_E=min_E,
105
+ valid_structure_filters=[MinEnergyFilter(-200)],
92
106
  )
93
107
 
94
- # 5. Run
95
- final_checkpoint = godiff.run(max_iterations=50)
96
- print(f"Model saved to {final_checkpoint}")
108
+ #### RUN GO-Diff #####
109
+ godiff.run(max_iterations=20)
110
+
97
111
  ```
98
112
 
99
- See `scripts/example_script.py` for the full script and `scripts/` for all
100
- paper reproduction scripts.
113
+ See `scripts/*.py` for the full scripts.
101
114
 
102
115
  ---
103
116
 
@@ -109,7 +122,7 @@ paper reproduction scripts.
109
122
  | `TemperatureSchedule` | Adaptive annealing; `fast` / `slow` cooling factors based on heat capacity |
110
123
  | `SampleController` | Stops sampling when the Effective Sample Size (ESS) reaches a target |
111
124
  | `MomentumConsensusStop` | Stops training when gradient–momentum agreement drops |
112
- | `AdaptiveRefinementStop` | Alternative stop criterion based on split-batch gradient agreement EMA |
125
+ | `AdaptiveRefinementStop` | Stop criterion based on split-batch gradient agreement EMA |
113
126
  | `WeightedPositions` | Boltzmann-weighted position noiser for the diffusion model |
114
127
  | `GODiffLogger` | TensorBoard logger (energies, ESS, timing, analysis figures) |
115
128
 
@@ -118,35 +131,38 @@ paper reproduction scripts.
118
131
  ## Running the tests
119
132
 
120
133
  ```bash
134
+ <!-- CLONE package -->
135
+ git clone https://github.com/nronne/go-diff.git
136
+ cd go-diff
137
+
138
+ <!-- INSTALL with pip including test extras-->
121
139
  pip install ".[test]"
140
+
141
+ <!-- RUN pytest -->
122
142
  pytest
123
143
  ```
124
144
 
125
145
  ---
126
146
 
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
147
 
134
148
  ## Citation
135
149
 
136
150
  If you use GO-Diff please cite:
151
+ > Ronne, Nikolaj, Tejs Vegge and Arghya Bhowmik. "GO-Diff: Data-free
152
+ > and amortized global structure optimization"
153
+ > arXiv:2510.13448. Preprint, arXiv, October 15, 2025.
154
+ > <https://arxiv.org/abs/2510.13448>
137
155
 
138
156
  > Ronne, Nikolaj, and Bjork Hammer. "Atomistic Generative Diffusion for Materials
139
157
  > Modeling." arXiv:2507.18314. Preprint, arXiv, July 24, 2025.
140
158
  > <https://arxiv.org/abs/2507.18314>
141
159
 
142
- If studying surface-supported systems also cite:
143
-
160
+ If studying surface-supported systems please also cite:
144
161
  > Ronne, Nikolaj, Alan Aspuru-Guzik, and Bjork Hammer. "Generative Diffusion
145
162
  > Model for Surface Structure Discovery." Physical Review B 110, no. 23 (2024):
146
163
  > 235427. <https://doi.org/10.1103/PhysRevB.110.235427>
147
164
 
148
- Optionally, if using any AGOX functionality:
149
-
165
+ Optionally, if using any AGOX functionality please cite:
150
166
  > Christiansen, Mads-Peter V., Nikolaj Ronne, and Bjork Hammer. "Atomistic
151
167
  > Global Optimization X: A Python Package for Optimization of Atomistic
152
168
  > Structures." The Journal of Chemical Physics 157, no. 5 (2022): 054701.
@@ -1,8 +1,8 @@
1
1
  # GO-Diff
2
2
 
3
- **GO-Diff** (Gradient-Optimised Diffusion) is a generative diffusion framework for
4
- atomistic structure search. It couples a learned diffusion model with an
5
- energy/force calculator (e.g. MACE) and iteratively refines the model through
3
+ **GO-Diff: Data-free and amortized global structure optimization** a
4
+ generative diffusion framework for atomistic structure search. It couples a diffusion model with an
5
+ energy/force calculator and iteratively refines the model through
6
6
  Boltzmann-weighted training, adaptive temperature annealing, and an adaptive
7
7
  replay buffer.
8
8
 
@@ -10,15 +10,15 @@ replay buffer.
10
10
 
11
11
  ## Installation
12
12
 
13
+ Install from pypi
13
14
  ```bash
14
15
  pip install go-diff
15
16
  ```
16
17
 
17
- ### (Optional) Reproduce paper results
18
-
18
+ ### (Optional) Install of MLIPs for running GO-Diff
19
+ E.g.
19
20
  ```bash
20
21
  pip install mace-torch
21
- pip install "agox[full]"
22
22
  ```
23
23
 
24
24
  ---
@@ -27,55 +27,68 @@ pip install "agox[full]"
27
27
 
28
28
  ```python
29
29
  import numpy as np
30
- from ase.build import surface
30
+
31
+ from ase.build import fcc111, surface
31
32
  from mace.calculators import mace_mp
32
- from agedi import create_diffusion
33
33
 
34
- from go_diff import GODiff
35
- from go_diff.controllers import (
36
- TemperatureSchedule,
37
- SampleController,
38
- MomentumConsensusStop,
39
- )
40
- from go_diff.noisers import WeightedPositions
34
+ from agedi import AtomsGraph, create_diffusion
35
+ from agedi.diffusion import ForcefieldGuidanceConfig
41
36
 
42
- # 1. Calculator
43
- calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device="cuda")
37
+ from go_diff import GODiff, MinEnergyFilter
38
+ from go_diff.controllers import SampleController, BufferController, TemperatureSchedule, MomentumConsensusStop
39
+ from go_diff.noisers import WeightedConfinedCellPositions
44
40
 
45
- # 2. Substrate template (atoms to keep fixed)
46
- template = surface("Pt", (1, 2, 2), 5, vacuum=8.0)
41
+ ##### SYSTEM #####
42
+ formula = "Pt"
43
+
44
+ template = surface('Pt', (1,2,2), 5, vacuum=8.0)
47
45
  template.positions[:, 2] -= template.positions[:, 2].min()
48
- confinement = [0.0, 4.0 + template.positions[:, 2].max()]
49
46
 
50
- # 3. Diffusion model
51
- diffusion = create_diffusion(noisers=(WeightedPositions(),))
47
+ confinement_above_zmax = np.array([0.0, 4.0])
48
+ confinement = confinement_above_zmax + template.positions[:, 2].max()
49
+
50
+
51
+ ##### CALCULATOR #####
52
+ from mace.calculators import mace_mp
53
+ calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device='cuda')
54
+
55
+
56
+ #### DIFFUSION MODEL #####
57
+ diffusion = create_diffusion(noisers=(WeightedConfinedCellPositions(),), force_field=True)
58
+
52
59
 
53
- # 4. GO-Diff optimiser
60
+ #### GO-DIFF #####
54
61
  godiff = GODiff(
55
62
  calculator=calc,
56
63
  diffusion=diffusion,
57
64
  temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
58
65
  sample_controller=SampleController(initial_N=16, target_ess=8),
66
+ buffer_controller=BufferController(initial_buffer_size=16, max_buffer_size=96, adaption_rate=0.2),
59
67
  training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
60
68
  sample_config={
61
69
  "template": template,
62
- "atomic_numbers": [78], # one Pt adatom
70
+ "formula": formula,
71
+ "confinement": confinement,
72
+ "ff_guidance": ForcefieldGuidanceConfig(guidance=1.0,)
63
73
  },
64
74
  dataset_config={
65
75
  "mask": "MaskFixed",
66
76
  "confinement": confinement,
77
+ "regressor_data": "all_data", # use all data for training the regressor, not just the data in the buffer
78
+ },
79
+ trainer_config={
80
+ "name": name
67
81
  },
68
- initial_buffer_size=16,
69
- min_E=-200,
82
+ min_E=min_E,
83
+ valid_structure_filters=[MinEnergyFilter(-200)],
70
84
  )
71
85
 
72
- # 5. Run
73
- final_checkpoint = godiff.run(max_iterations=50)
74
- print(f"Model saved to {final_checkpoint}")
86
+ #### RUN GO-Diff #####
87
+ godiff.run(max_iterations=20)
88
+
75
89
  ```
76
90
 
77
- See `scripts/example_script.py` for the full script and `scripts/` for all
78
- paper reproduction scripts.
91
+ See `scripts/*.py` for the full scripts.
79
92
 
80
93
  ---
81
94
 
@@ -87,7 +100,7 @@ paper reproduction scripts.
87
100
  | `TemperatureSchedule` | Adaptive annealing; `fast` / `slow` cooling factors based on heat capacity |
88
101
  | `SampleController` | Stops sampling when the Effective Sample Size (ESS) reaches a target |
89
102
  | `MomentumConsensusStop` | Stops training when gradient–momentum agreement drops |
90
- | `AdaptiveRefinementStop` | Alternative stop criterion based on split-batch gradient agreement EMA |
103
+ | `AdaptiveRefinementStop` | Stop criterion based on split-batch gradient agreement EMA |
91
104
  | `WeightedPositions` | Boltzmann-weighted position noiser for the diffusion model |
92
105
  | `GODiffLogger` | TensorBoard logger (energies, ESS, timing, analysis figures) |
93
106
 
@@ -96,35 +109,38 @@ paper reproduction scripts.
96
109
  ## Running the tests
97
110
 
98
111
  ```bash
112
+ <!-- CLONE package -->
113
+ git clone https://github.com/nronne/go-diff.git
114
+ cd go-diff
115
+
116
+ <!-- INSTALL with pip including test extras-->
99
117
  pip install ".[test]"
118
+
119
+ <!-- RUN pytest -->
100
120
  pytest
101
121
  ```
102
122
 
103
123
  ---
104
124
 
105
- ## Scripts
106
-
107
- Scripts to reproduce the results in the paper are in `scripts/`. Utilities for
108
- identifying the Pt-heptamer structure are in `utils/`.
109
-
110
- ---
111
125
 
112
126
  ## Citation
113
127
 
114
128
  If you use GO-Diff please cite:
129
+ > Ronne, Nikolaj, Tejs Vegge and Arghya Bhowmik. "GO-Diff: Data-free
130
+ > and amortized global structure optimization"
131
+ > arXiv:2510.13448. Preprint, arXiv, October 15, 2025.
132
+ > <https://arxiv.org/abs/2510.13448>
115
133
 
116
134
  > Ronne, Nikolaj, and Bjork Hammer. "Atomistic Generative Diffusion for Materials
117
135
  > Modeling." arXiv:2507.18314. Preprint, arXiv, July 24, 2025.
118
136
  > <https://arxiv.org/abs/2507.18314>
119
137
 
120
- If studying surface-supported systems also cite:
121
-
138
+ If studying surface-supported systems please also cite:
122
139
  > Ronne, Nikolaj, Alan Aspuru-Guzik, and Bjork Hammer. "Generative Diffusion
123
140
  > Model for Surface Structure Discovery." Physical Review B 110, no. 23 (2024):
124
141
  > 235427. <https://doi.org/10.1103/PhysRevB.110.235427>
125
142
 
126
- Optionally, if using any AGOX functionality:
127
-
143
+ Optionally, if using any AGOX functionality please cite:
128
144
  > Christiansen, Mads-Peter V., Nikolaj Ronne, and Bjork Hammer. "Atomistic
129
145
  > Global Optimization X: A Python Package for Optimization of Atomistic
130
146
  > Structures." The Journal of Chemical Physics 157, no. 5 (2022): 054701.
go_diff-1.0.1/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.1
@@ -74,7 +74,7 @@ Adaptive buffer size
74
74
  --------------------
75
75
 
76
76
  The buffer size is adapted each iteration using a smoothed update towards the
77
- current ESS:
77
+ current ESS. E.g. for `adaptation_rate=0.2`:
78
78
 
79
79
  .. code-block:: text
80
80
 
@@ -9,7 +9,7 @@
9
9
  project = 'GO-Diff'
10
10
  copyright = '2025, Nikolaj Rønne'
11
11
  author = 'Nikolaj Rønne'
12
- release = '0.0.1'
12
+ release = '1.0.0'
13
13
 
14
14
  # -- General configuration ---------------------------------------------------
15
15
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -3,16 +3,12 @@
3
3
  GO-Diff Documentation
4
4
  =====================
5
5
 
6
- **GO-Diff** (Gradient-Optimised Diffusion) is a generative diffusion framework
7
- for atomistic structure search. It couples a learned diffusion model with an
6
+ **GO-Diff: Data-free and amortized global structure optimization** a
7
+ generative diffusion framework for atomistic structure search. It couples a diffusion model with an
8
8
  energy/force calculator and iteratively refines the model through
9
9
  Boltzmann-weighted training, adaptive temperature annealing, and an adaptive
10
10
  replay buffer.
11
11
 
12
- .. note::
13
-
14
- This project is under active development.
15
-
16
12
  .. toctree::
17
13
  :maxdepth: 2
18
14
  :caption: Documentation
@@ -0,0 +1,34 @@
1
+ Installation
2
+ ============
3
+
4
+ Requirements
5
+ ------------
6
+
7
+ - Python >= 3.12
8
+ - A CUDA-capable GPU is strongly recommended for training and sampling.
9
+
10
+ Install GO-Diff
11
+ ---------------
12
+
13
+ .. code-block:: console
14
+
15
+ pip install go-diff
16
+
17
+
18
+ Developer install
19
+ -----------------
20
+
21
+ Clone the repository and install in editable mode with the test extras:
22
+
23
+ .. code-block:: console
24
+
25
+ git clone https://github.com/nronne/go-diff.git
26
+ cd go-diff
27
+ pip install -e ".[test]"
28
+
29
+ Verify installation
30
+ -------------------
31
+
32
+ .. code-block:: console
33
+
34
+ python -c "from go_diff import GODiff; print('GO-Diff installed successfully')"
@@ -4,7 +4,7 @@ Overview
4
4
  What GO-Diff is
5
5
  ---------------
6
6
 
7
- GO-Diff (Gradient-Optimised Diffusion) is a framework for atomistic global
7
+ GO-Diff is a framework for atomistic global
8
8
  structure search using diffusion models. It wraps the
9
9
  `AGeDi <https://github.com/nronne/agedi>`_ diffusion backend with an outer
10
10
  optimisation loop that drives the model towards low-energy configurations via
@@ -58,5 +58,6 @@ Typical workflow
58
58
  3. Instantiate :class:`~go_diff.GODiff` with the calculator, diffusion model,
59
59
  and desired controllers.
60
60
  4. Call :py:meth:`~go_diff.GODiff.run` to start the optimisation loop.
61
- 5. Inspect saved checkpoints and trajectory files in the output directory.
62
- 6. Analyse TensorBoard logs for energy, ESS, and gradient-agreement curves.
61
+ 5. Inspect saved checkpoints and trajectory files in the output
62
+ directory and TensorBoard logs.
63
+
@@ -0,0 +1,84 @@
1
+ References and citation
2
+ =======================
3
+
4
+ Primary publications
5
+ --------------------
6
+
7
+ 1. N. Rønne, T. Vegge and A. Bhowmik
8
+ *GO-Diff: Data-free and amortized global structure optimization*
9
+ arXiv preprint **arXiv:2510.13448** (2025).
10
+ URL: https://arxiv.org/abs/2510.13448
11
+
12
+ 2. N. Rønne and B. Hammer,
13
+ *Atomistic Generative Diffusion for Materials Modeling*,
14
+ arXiv preprint **arXiv:2507.18314** (2025).
15
+ URL: https://arxiv.org/abs/2507.18314
16
+
17
+ 3. N. Rønne, A. Aspuru-Guzik, and B. Hammer,
18
+ *Generative Diffusion Model for Surface Structure Discovery*,
19
+ **Physical Review B** **110**, 235427 (2024).
20
+ DOI: https://doi.org/10.1103/PhysRevB.110.235427
21
+
22
+ How this documentation maps to the papers
23
+ ------------------------------------------
24
+
25
+ - GO-Diff including buffered training and Boltzmann-weighting is
26
+ described in ref. 1.
27
+ - The atomistic diffusion model package AGeDi used as the diffusion
28
+ model in GO-Diff is presented in ref. 2
29
+ - The surface supported diffusion model including its confinement and
30
+ correspond methodology is introduced in ref. 3.
31
+
32
+
33
+ Suggested citation
34
+ ------------------
35
+
36
+ If you use GO-Diff in academic work, please cite the GO-Diff preprint,
37
+ the AGeDi preprint and the PRB paper::
38
+
39
+ @misc{ronne2025A,
40
+ title={GO-Diff: Data-free and amortized global structure optimization},
41
+ author={Nikolaj Rønne and Tejs Vegge and Arghya Bhowmik},
42
+ year={2025},
43
+ eprint={2510.13448},
44
+ archivePrefix={arXiv},
45
+ primaryClass={physics.comp-ph},
46
+ url={https://arxiv.org/abs/2510.13448},
47
+ }
48
+
49
+ @misc{ronne2025B,
50
+ title={Atomistic Generative Diffusion for Materials Modeling},
51
+ author={Nikolaj Rønne and Bjørk Hammer},
52
+ year={2025},
53
+ eprint={2507.18314},
54
+ archivePrefix={arXiv},
55
+ primaryClass={physics.comp-ph},
56
+ url={https://arxiv.org/abs/2507.18314},
57
+ }
58
+
59
+
60
+ If investigating surface supported systems please also cite::
61
+
62
+ @article{ronne2024,
63
+ title = {Generative Diffusion Model for Surface Structure Discovery},
64
+ author = {R{\o}nne, Nikolaj and Aspuru-Guzik, Al{\'a}n and Hammer, Bj{\o}rk},
65
+ journal = {Physical Review B},
66
+ volume = {110},
67
+ pages = {235427},
68
+ year = {2024},
69
+ doi = {10.1103/PhysRevB.110.235427},
70
+ }
71
+
72
+ If you make use of AGOX utilities please also cite::
73
+
74
+ @article{christiansen2022,
75
+ title = {Atomistic Global Optimization X: A Python Package for
76
+ Optimization of Atomistic Structures},
77
+ author = {Christiansen, Mads-Peter V. and R{\o}nne, Nikolaj and
78
+ Hammer, Bj{\o}rk},
79
+ journal = {The Journal of Chemical Physics},
80
+ volume = {157},
81
+ pages = {054701},
82
+ year = {2022},
83
+ doi = {10.1063/5.0094165},
84
+ }
@@ -10,14 +10,12 @@ Sampling pitfalls
10
10
 
11
11
  - **All sampled structures are filtered out**
12
12
 
13
- GO-Diff discards structures with energy below ``min_E`` (default: -500 eV)
14
- and structures with interatomic distances below 1.0 Å. If every structure
15
- in an iteration is rejected the buffer will be empty and training cannot
16
- proceed.
17
-
18
- *Fix*: lower ``min_E`` if your system legitimately reaches very negative
19
- energies, or check that the confinement bounds are physically reasonable
20
- so structures do not overlap.
13
+ GO-Diff can use filters defined through ``valid_structure_filters``
14
+ such as ``MinEnergyFilter`` to discard unphysical structures before
15
+ contaminating the search.
16
+
17
+ *Fix*: Change ``valid_structure_filters`` to fit the system you are
18
+ investigating.
21
19
 
22
20
  - **ESS target never reached**
23
21
 
@@ -2,78 +2,84 @@ Quickstart: Pt adatom on a Pt slab
2
2
  ===================================
3
3
 
4
4
  This end-to-end example reproduces the Pt heptamer search from the paper.
5
- It places a single Pt adatom on a Pt(1,2,2) × 5-layer slab, using MACE-MP
5
+ It places a single Pt adatom on a Pt(1,2,2) × 5-layer slab, using MACE MLIP
6
6
  as the energy/force calculator.
7
7
 
8
8
  Prerequisites
9
9
  -------------
10
10
 
11
- Make sure you have completed the :doc:`../installation` steps and have both
12
- MACE and the full AGeDi backend available:
11
+ Make sure you have completed the :doc:`../installation` steps and have
12
+ the MACE MLIP available:
13
13
 
14
14
  .. code-block:: console
15
15
 
16
16
  pip install mace-torch
17
- pip install "agedi[full]"
18
17
 
19
18
  Full script
20
19
  -----------
21
20
 
22
21
  .. code-block:: python
23
-
22
+
24
23
  import numpy as np
25
- from ase.build import surface
24
+
25
+ from ase.build import fcc111, surface
26
26
  from mace.calculators import mace_mp
27
- from agedi import create_diffusion
28
27
 
29
- from go_diff import GODiff
30
- from go_diff.controllers import (
31
- TemperatureSchedule,
32
- SampleController,
33
- MomentumConsensusStop,
34
- )
35
- from go_diff.noisers import WeightedPositions
36
-
37
- # 1. Calculator
38
- calc = mace_mp(
39
- model="medium",
40
- dispersion=False,
41
- default_dtype="float32",
42
- device="cuda",
43
- )
28
+ from agedi import AtomsGraph, create_diffusion
29
+ from agedi.diffusion import ForcefieldGuidanceConfig
44
30
 
45
- # 2. Substrate template (atoms to keep fixed)
46
- template = surface("Pt", (1, 2, 2), 5, vacuum=8.0)
31
+ from go_diff import GODiff, MinEnergyFilter
32
+ from go_diff.controllers import SampleController, BufferController, TemperatureSchedule, MomentumConsensusStop
33
+ from go_diff.noisers import WeightedConfinedCellPositions
34
+
35
+ ##### SYSTEM #####
36
+ formula = "Pt"
37
+
38
+ template = surface('Pt', (1,2,2), 5, vacuum=8.0)
47
39
  template.positions[:, 2] -= template.positions[:, 2].min()
48
- confinement = [0.0, 4.0 + template.positions[:, 2].max()]
49
40
 
50
- # 3. Diffusion model (AGeDi)
51
- diffusion = create_diffusion(noisers=(WeightedPositions(),))
41
+ confinement_above_zmax = np.array([0.0, 4.0])
42
+ confinement = confinement_above_zmax + template.positions[:, 2].max()
43
+
44
+
45
+ ##### CALCULATOR #####
46
+ from mace.calculators import mace_mp
47
+ calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device='cuda')
48
+
49
+
50
+ #### DIFFUSION MODEL #####
51
+ diffusion = create_diffusion(noisers=(WeightedConfinedCellPositions(),), force_field=True)
52
+
52
53
 
53
- # 4. GO-Diff optimiser
54
+ #### GO-DIFF #####
54
55
  godiff = GODiff(
55
56
  calculator=calc,
56
57
  diffusion=diffusion,
57
58
  temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
58
59
  sample_controller=SampleController(initial_N=16, target_ess=8),
59
- training_controller=MomentumConsensusStop(
60
- min_steps=100, patience=250, drop_factor=0.9
61
- ),
60
+ buffer_controller=BufferController(initial_buffer_size=16, max_buffer_size=96, adaption_rate=0.2),
61
+ training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
62
62
  sample_config={
63
- "template": template,
64
- "atomic_numbers": [78], # one Pt adatom
63
+ "template": template,
64
+ "formula": formula,
65
+ "confinement": confinement,
66
+ "ff_guidance": ForcefieldGuidanceConfig(guidance=1.0,)
65
67
  },
66
68
  dataset_config={
67
- "mask": "MaskFixed",
68
- "confinement": confinement,
69
+ "mask": "MaskFixed",
70
+ "confinement": confinement,
71
+ "regressor_data": "all_data", # use all data for training the regressor, not just the data in the buffer
69
72
  },
70
- initial_buffer_size=16,
71
- min_E=-200,
73
+ trainer_config={
74
+ "name": name
75
+ },
76
+ min_E=min_E,
77
+ valid_structure_filters=[MinEnergyFilter(-200)],
72
78
  )
73
79
 
74
- # 5. Run
75
- final_checkpoint = godiff.run(max_iterations=50)
76
- print(f"Model saved to {final_checkpoint}")
80
+ #### RUN GO-Diff #####
81
+ godiff.run(max_iterations=20)
82
+
77
83
 
78
84
  Step-by-step walkthrough
79
85
  ------------------------
@@ -110,8 +116,8 @@ z-coordinate range within which new atoms are generated. Setting
110
116
 
111
117
  **GODiff.run**
112
118
 
113
- Calling ``godiff.run(max_iterations=50)`` starts the outer loop. Output is
114
- written to a timestamped directory (``godiff_<timestamp>/``) containing:
119
+ Calling ``godiff.run(max_iterations=20)`` starts the outer loop. Output is
120
+ written to a logs directory containing:
115
121
 
116
122
  * ``all_data.traj`` – all evaluated structures sorted by energy.
117
123
  * ``iteration_data_T<temp>.traj`` – per-iteration structures.
@@ -122,7 +128,7 @@ Monitoring with TensorBoard
122
128
 
123
129
  .. code-block:: console
124
130
 
125
- tensorboard --logdir godiff_<timestamp>/lightning_logs
131
+ tensorboard --logdir ...
126
132
 
127
133
  Key scalars to watch:
128
134
 
@@ -134,13 +140,4 @@ Key scalars to watch:
134
140
  Reproducing paper scripts
135
141
  --------------------------
136
142
 
137
- The ``scripts/`` directory contains the scripts used to produce the paper
138
- results:
139
-
140
- * ``scripts/heptamer.py`` – Pt heptamer search (main result).
141
- * ``scripts/heptamer_ffg.py`` – heptamer search with force-field guidance.
142
- * ``scripts/heptamer_transfer.py`` – transfer from a pre-trained checkpoint.
143
- * ``scripts/stepped_Pt.py`` – stepped Pt surface search.
144
-
145
- Additional utilities for identifying the Pt heptamer structure are in
146
- ``utils/``.
143
+ The ``scripts/`` directory contains the several useful scripts.
@@ -7,7 +7,7 @@ from mace.calculators import mace_mp
7
7
  from agedi import AtomsGraph, create_diffusion
8
8
  from agedi.diffusion import ForcefieldGuidanceConfig
9
9
 
10
- from go_diff import GODiff
10
+ from go_diff import GODiff, MinEnergyFilter
11
11
  from go_diff.controllers import SampleController, TemperatureSchedule, MomentumConsensusStop
12
12
  from go_diff.noisers import WeightedConfinedCellPositions
13
13
 
@@ -65,7 +65,7 @@ godiff = GODiff(
65
65
  trainer_config={
66
66
  "name": name
67
67
  },
68
- min_E=min_E,
68
+ valid_structure_filters=[MinEnergyFilter(min_E)],
69
69
  )
70
70
 
71
71
  # Train the model
@@ -7,7 +7,7 @@ from mace.calculators import mace_mp
7
7
  from agedi import AtomsGraph, create_diffusion
8
8
  from agedi.diffusion import ForcefieldGuidanceConfig
9
9
 
10
- from go_diff import GODiff
10
+ from go_diff import GODiff, MinEnergyFilter
11
11
  from go_diff.controllers import SampleController, BufferController, TemperatureSchedule, MomentumConsensusStop
12
12
  from go_diff.noisers import WeightedConfinedCellPositions
13
13
 
@@ -67,6 +67,7 @@ godiff = GODiff(
67
67
  "name": name
68
68
  },
69
69
  min_E=min_E,
70
+ valid_structure_filters=[MinEnergyFilter(min_E)],
70
71
  )
71
72
 
72
73
  # Train the model
go_diff-1.0.0/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.0
@@ -1,60 +0,0 @@
1
- Installation
2
- ============
3
-
4
- Requirements
5
- ------------
6
-
7
- - Python >= 3.11
8
- - A CUDA-capable GPU is strongly recommended for training and sampling.
9
-
10
- Step 1 – Install AGeDi (required diffusion backend)
11
- ----------------------------------------------------
12
-
13
- GO-Diff builds on the ``boltzmann-diffusion`` branch of AGeDi:
14
-
15
- .. code-block:: console
16
-
17
- git clone https://github.com/nronne/agedi.git
18
- cd agedi
19
- git checkout boltzmann-diffusion
20
- pip install .
21
- pip install matscipy schnetpack
22
- cd ..
23
-
24
- Step 2 – Install GO-Diff
25
- ------------------------
26
-
27
- .. code-block:: console
28
-
29
- git clone https://github.com/nronne/go-diff.git
30
- cd go-diff
31
- pip install .
32
-
33
- Step 3 – (Optional) Paper-reproduction dependencies
34
- ----------------------------------------------------
35
-
36
- To reproduce the results from the paper you additionally need MACE and the
37
- full AGOX package:
38
-
39
- .. code-block:: console
40
-
41
- pip install mace-torch
42
- pip install "agox[full]"
43
-
44
- Developer install
45
- -----------------
46
-
47
- Clone the repository and install in editable mode with the test extras:
48
-
49
- .. code-block:: console
50
-
51
- git clone https://github.com/nronne/go-diff.git
52
- cd go-diff
53
- pip install -e ".[test]"
54
-
55
- Verify installation
56
- -------------------
57
-
58
- .. code-block:: console
59
-
60
- python -c "from go_diff import GODiff; print('GO-Diff installed successfully')"
@@ -1,69 +0,0 @@
1
- References and citation
2
- =======================
3
-
4
- Primary publications
5
- --------------------
6
-
7
- 1. N. Rønne and B. Hammer,
8
- *Atomistic Generative Diffusion for Materials Modeling*,
9
- arXiv preprint **arXiv:2507.18314** (2025).
10
- URL: https://arxiv.org/abs/2507.18314
11
-
12
- 2. N. Rønne, A. Aspuru-Guzik, and B. Hammer,
13
- *Generative Diffusion Model for Surface Structure Discovery*,
14
- **Physical Review B** **110**, 235427 (2024).
15
- DOI: https://doi.org/10.1103/PhysRevB.110.235427
16
-
17
- 3. M.-P. V. Christiansen, N. Rønne, and B. Hammer,
18
- *Atomistic Global Optimization X: A Python Package for Optimization of
19
- Atomistic Structures*,
20
- **The Journal of Chemical Physics** **157**, 054701 (2022).
21
- DOI: https://doi.org/10.1063/5.0094165
22
-
23
- How this documentation maps to the papers
24
- ------------------------------------------
25
-
26
- - The GO-Diff outer loop (sample → evaluate → buffer → train) is the
27
- algorithm described in the AGeDi preprint (reference 1).
28
- - The surface-template workflow, confinement, and Boltzmann-weighted diffusion
29
- correspond to the methodology introduced in the PRB paper (reference 2).
30
- - AGOX functionality (reference 3) is used optionally for analysis utilities
31
- in ``utils/``.
32
-
33
- Suggested citation
34
- ------------------
35
-
36
- If you use GO-Diff in academic work, please cite the AGeDi preprint and the
37
- PRB paper::
38
-
39
- @misc{ronne2025agedi,
40
- title = {Atomistic Generative Diffusion for Materials Modeling},
41
- author = {R{\o}nne, Nikolaj and Hammer, Bjørk},
42
- year = {2025},
43
- eprint = {2507.18314},
44
- archivePrefix = {arXiv},
45
- }
46
-
47
- @article{ronne2024generative,
48
- title = {Generative Diffusion Model for Surface Structure Discovery},
49
- author = {R{\o}nne, Nikolaj and Aspuru-Guzik, Al{\'a}n and Hammer, Bj{\o}rk},
50
- journal = {Physical Review B},
51
- volume = {110},
52
- pages = {235427},
53
- year = {2024},
54
- doi = {10.1103/PhysRevB.110.235427},
55
- }
56
-
57
- If you also use AGOX utilities, cite reference 3 as well::
58
-
59
- @article{christiansen2022agox,
60
- title = {Atomistic Global Optimization X: A Python Package for
61
- Optimization of Atomistic Structures},
62
- author = {Christiansen, Mads-Peter V. and R{\o}nne, Nikolaj and
63
- Hammer, Bj{\o}rk},
64
- journal = {The Journal of Chemical Physics},
65
- volume = {157},
66
- pages = {054701},
67
- year = {2022},
68
- doi = {10.1063/5.0094165},
69
- }
@@ -1,70 +0,0 @@
1
- import numpy as np
2
- from argparse import ArgumentParser
3
-
4
- from ase.build import fcc111, surface
5
- from mace.calculators import mace_mp
6
-
7
- from agedi import AtomsGraph, create_diffusion
8
-
9
- from go_diff import GODiff
10
- from go_diff.controllers import SampleController, TemperatureSchedule, MomentumConsensusStop
11
- from go_diff.noisers import WeightedConfinedCellPositions
12
-
13
- parser = ArgumentParser(description="Train a diffusion model for GO tasks.")
14
- parser.add_argument('-i', '--index', type=int, default=0, help="Index for the training run.")
15
- args = parser.parse_args()
16
- index = args.index
17
-
18
-
19
- ##### HYPERPARAMETERS #####
20
- name = __file__.split('/')[-1].split('.')[0] # use the filename as the name of the experiment
21
-
22
- initial_buffer_size = 16
23
- min_E = -500 # to avoid false minimas in the MACE potential
24
- formula = "Pt7"
25
- confinement_above_zmax = np.array([1.0, 6.0]) # confinement above the maximum z position of the template
26
-
27
-
28
- ##### CALCULATOR #####
29
- from mace.calculators import mace_mp
30
- calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device='cuda')
31
-
32
- ##### TEMPLATE #####
33
- template = fcc111('Pt', size=(6, 6, 2), vacuum=8.0)
34
- template.positions[:, 2] -= template.positions[:, 2].min()
35
-
36
-
37
- confinement = confinement_above_zmax + template.positions[:, 2].max()
38
- template = AtomsGraph.from_atoms(template, confinement=confinement)
39
-
40
-
41
- #### DIFFUSION MODEL #####
42
- diffusion = create_diffusion(noisers=(WeightedConfinedCellPositions(),))
43
-
44
- #### GO-DIFF #####
45
-
46
-
47
- godiff = GODiff(
48
- calculator=calc,
49
- diffusion=diffusion,
50
- temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
51
- sample_controller=SampleController(initial_N=16, target_ess=8),
52
- training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
53
- sample_config={
54
- "template": template,
55
- "formula": formula,
56
- "confinement": confinement,
57
- },
58
- dataset_config={
59
- "mask": "MaskFixed",
60
- "confinement": confinement,
61
- },
62
- trainer_config={
63
- "name": name
64
- },
65
- initial_buffer_size=initial_buffer_size,
66
- min_E=min_E,
67
- )
68
-
69
- # Train the model
70
- godiff.run(max_iterations=50)
@@ -1,69 +0,0 @@
1
- import numpy as np
2
- from argparse import ArgumentParser
3
-
4
- from ase.build import fcc111, surface
5
- from mace.calculators import mace_mp
6
-
7
- from agedi import AtomsGraph, create_diffusion
8
-
9
- from go_diff import GODiff
10
- from go_diff.controllers import SampleController, BufferController, TemperatureSchedule, MomentumConsensusStop
11
- from go_diff.noisers import WeightedConfinedCellPositions
12
-
13
- parser = ArgumentParser(description="Train a diffusion model for GO tasks.")
14
- parser.add_argument('-i', '--index', type=int, default=0, help="Index for the training run.")
15
- args = parser.parse_args()
16
- index = args.index
17
-
18
-
19
- ##### HYPERPARAMETERS #####
20
- name = __file__.split('/')[-1].split('.')[0] # use the filename as the name of the experiment
21
-
22
- min_E = -200 # to avoid false minimas in the MACE potential
23
- n_atoms = 1 # number of atoms in the optimization
24
- formula = "Pt"
25
- confinement_above_zmax = np.array([0.0, 4.0]) # confinement above the maximum z position of the template
26
-
27
-
28
- ##### CALCULATOR #####
29
- calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device='cuda')
30
-
31
- ##### TEMPLATE #####
32
- template = surface('Pt', (1,2,2), 5, vacuum=8.0)
33
- template.positions[:, 2] -= template.positions[:, 2].min()
34
-
35
- confinement = confinement_above_zmax + template.positions[:, 2].max()
36
- template = AtomsGraph.from_atoms(template, confinement=confinement)
37
-
38
-
39
-
40
- #### DIFFUSION MODEL #####
41
- diffusion = create_diffusion(noisers=(WeightedConfinedCellPositions(),))
42
-
43
- #### GO-DIFF #####
44
-
45
-
46
- godiff = GODiff(
47
- calculator=calc,
48
- diffusion=diffusion,
49
- temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
50
- sample_controller=SampleController(initial_N=16, target_ess=8),
51
- buffer_controller=BufferController(initial_buffer_size=16, max_buffer_size=96, adaption_rate=0.2),
52
- training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
53
- sample_config={
54
- "template": template,
55
- "formula": formula,
56
- "confinement": confinement,
57
- },
58
- dataset_config={
59
- "mask": "MaskFixed",
60
- "confinement": confinement,
61
- },
62
- trainer_config={
63
- "name": name
64
- },
65
- min_E=min_E,
66
- )
67
-
68
- # Train the model
69
- godiff.run(max_iterations=20)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes