GO-Diff
Project description
GO-Diff
GO-Diff (Gradient-Optimised Diffusion) is a generative diffusion framework for atomistic structure search. It couples a learned diffusion model with an energy/force calculator (e.g. MACE) and iteratively refines the model through Boltzmann-weighted training, adaptive temperature annealing, and an adaptive replay buffer.
Installation
pip install go-diff
(Optional) Reproduce paper results
pip install mace-torch
pip install "agox[full]"
Quick Start
import numpy as np
from ase.build import surface
from mace.calculators import mace_mp
from agedi import create_diffusion
from go_diff import GODiff
from go_diff.controllers import (
TemperatureSchedule,
SampleController,
MomentumConsensusStop,
)
from go_diff.noisers import WeightedPositions
# 1. Calculator
calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device="cuda")
# 2. Substrate template (atoms to keep fixed)
template = surface("Pt", (1, 2, 2), 5, vacuum=8.0)
template.positions[:, 2] -= template.positions[:, 2].min()
confinement = [0.0, 4.0 + template.positions[:, 2].max()]
# 3. Diffusion model
diffusion = create_diffusion(noisers=(WeightedPositions(),))
# 4. GO-Diff optimiser
godiff = GODiff(
calculator=calc,
diffusion=diffusion,
temperature_schedule=TemperatureSchedule(fast=0.5, slow=0.9),
sample_controller=SampleController(initial_N=16, target_ess=8),
training_controller=MomentumConsensusStop(min_steps=100, patience=250, drop_factor=0.9),
sample_config={
"template": template,
"atomic_numbers": [78], # one Pt adatom
},
dataset_config={
"mask": "MaskFixed",
"confinement": confinement,
},
initial_buffer_size=16,
min_E=-200,
)
# 5. Run
final_checkpoint = godiff.run(max_iterations=50)
print(f"Model saved to {final_checkpoint}")
See scripts/example_script.py for the full script and scripts/ for all
paper reproduction scripts.
Key components
| Class / module | Description |
|---|---|
GODiff |
Main optimisation loop (sample → evaluate → buffer → train) |
TemperatureSchedule |
Adaptive annealing; fast / slow cooling factors based on heat capacity |
SampleController |
Stops sampling when the Effective Sample Size (ESS) reaches a target |
MomentumConsensusStop |
Stops training when gradient–momentum agreement drops |
AdaptiveRefinementStop |
Alternative stop criterion based on split-batch gradient agreement EMA |
WeightedPositions |
Boltzmann-weighted position noiser for the diffusion model |
GODiffLogger |
TensorBoard logger (energies, ESS, timing, analysis figures) |
Running the tests
pip install ".[test]"
pytest
Scripts
Scripts to reproduce the results in the paper are in scripts/. Utilities for
identifying the Pt-heptamer structure are in utils/.
Citation
If you use GO-Diff please cite:
Ronne, Nikolaj, and Bjork Hammer. "Atomistic Generative Diffusion for Materials Modeling." arXiv:2507.18314. Preprint, arXiv, July 24, 2025. https://arxiv.org/abs/2507.18314
If studying surface-supported systems also cite:
Ronne, Nikolaj, Alan Aspuru-Guzik, and Bjork Hammer. "Generative Diffusion Model for Surface Structure Discovery." Physical Review B 110, no. 23 (2024): 235427. https://doi.org/10.1103/PhysRevB.110.235427
Optionally, if using any AGOX functionality:
Christiansen, Mads-Peter V., Nikolaj Ronne, and Bjork Hammer. "Atomistic Global Optimization X: A Python Package for Optimization of Atomistic Structures." The Journal of Chemical Physics 157, no. 5 (2022): 054701. https://doi.org/10.1063/5.0094165
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file go_diff-1.0.0.tar.gz.
File metadata
- Download URL: go_diff-1.0.0.tar.gz
- Upload date:
- Size: 196.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e0c121a5dc5236b73e4b70a3e5919de1fcd73c289d19cc3a082092c8dac87a5
|
|
| MD5 |
53d0f348684b34a46474ec2bab283714
|
|
| BLAKE2b-256 |
b7bf2d65c026aba31ee591c146e360966e07b02739c0db1b088757f68346a028
|
Provenance
The following attestation bundles were made for go_diff-1.0.0.tar.gz:
Publisher:
publish.yml on nronne/go-diff
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
go_diff-1.0.0.tar.gz -
Subject digest:
8e0c121a5dc5236b73e4b70a3e5919de1fcd73c289d19cc3a082092c8dac87a5 - Sigstore transparency entry: 1697364871
- Sigstore integration time:
-
Permalink:
nronne/go-diff@70811888eb745cd60532d86a930b42f966c507fa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nronne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@70811888eb745cd60532d86a930b42f966c507fa -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file go_diff-1.0.0-py3-none-any.whl.
File metadata
- Download URL: go_diff-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9fb5179f51d72f48d120268cf5ca4dd3d2d475d1682c8a5024051b8fcc6c063
|
|
| MD5 |
372db7706d0b4db5866199ab2d05a27f
|
|
| BLAKE2b-256 |
0cd3fe9b333f7ebce7b943b1e4ea605c346930a2fb51e421dac63241aba8f5a9
|
Provenance
The following attestation bundles were made for go_diff-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on nronne/go-diff
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
go_diff-1.0.0-py3-none-any.whl -
Subject digest:
c9fb5179f51d72f48d120268cf5ca4dd3d2d475d1682c8a5024051b8fcc6c063 - Sigstore transparency entry: 1697365355
- Sigstore integration time:
-
Permalink:
nronne/go-diff@70811888eb745cd60532d86a930b42f966c507fa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nronne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@70811888eb745cd60532d86a930b42f966c507fa -
Trigger Event:
workflow_dispatch
-
Statement type: