Skip to content

Plutonium Dioxide benchmark#396

Open
williamdavie wants to merge 7 commits intoddmms:mainfrom
williamdavie:plutonium-dioxide
Open

Plutonium Dioxide benchmark#396
williamdavie wants to merge 7 commits intoddmms:mainfrom
williamdavie:plutonium-dioxide

Conversation

@williamdavie
Copy link
Copy Markdown

Pre-review checklist for PR author

PR author must check the checkboxes below when creating the PR.

Summary

Evaluation of energy, forces and stress on Plutonium (IV) Dioxide

Linked issue

Resolves #347

Progress

  • Calculations
  • Analysis
  • Application
  • Documentation

Testing

Models tested:

image

New decorators/callbacks

@ElliottKasoar ElliottKasoar added the new benchmark Proposals and suggestions for new benchmarks label Mar 2, 2026
@williamdavie williamdavie marked this pull request as ready for review March 13, 2026 12:18
@joehart2001
Copy link
Copy Markdown
Collaborator

I think we're looking pretty good over here, @ElliottKasoar can you take a look?

Copy link
Copy Markdown
Collaborator

@ElliottKasoar ElliottKasoar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @williamdavie, thanks for this! This is generally looking great, I've just left a few comments/suggestions to tidy things up

Comment on lines +1 to +3
==================
Actinides
==================
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
==================
Actinides
==================
=========
Actinides
=========

Minor nitpick

Comment on lines +51 to +53
atoms.calc = (
model.get_calculator()
) # must be called each time as number of atoms changes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary for the calculators we currently support? Plenty of our tests have structures with different numbers of atoms.

You may need to do something like calc = copy(calc) within the loop, but otherwise this adds quite a bit of cost, as we need to fully reload the model each for each structure.


results_to_save = []

for atoms in ref_structures:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add tqdm to show the progress here?

atoms.calc = (
model.get_calculator()
) # must be called each time as number of atoms changes.
atoms.get_potential_energy()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set a charge and spin (multiplicity) before this, as some models e.g. Orb-omol require these to be set. E.g.

# Set default charge and spin
atoms.info.setdefault("charge", 0)
atoms.info.setdefault("spin", 1)

Comment on lines +33 to +34
EV_TO_KJ_PER_MOL = units.mol / units.kJ

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EV_TO_KJ_PER_MOL = units.mol / units.kJ

Unused?

energy_labels: list[str] = []
force_labels: list[str] = []
stress_labels: list[str] = []
excluded = 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be changed at all, so probably isn't necessary?

excluded = 0
frame_idx = 0

for xyz_file in sorted(model_dir.glob("*.xyz")):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't the outputs of the calculation written to a single file? In that case you don't need to loop over this, and can use enumerate(frames) or similar instead of manually iterating through frame_index

Comment on lines +71 to +87
e_ref = atoms.info.get("energy_xtb")
f_ref = atoms.arrays.get("forces_xtb")
s_ref = atoms.info.get("REF_stress")

io.write(struct_dir / f"{label}.xyz", atoms)

if e_ref is not None:
energies_ref.append(e_ref / natoms)
energies_pred.append(atoms.get_total_energy() / natoms)
energy_labels.append(label)

if f_ref is not None:
forces_ref.append(f_ref.ravel())
forces_pred.append(atoms.get_forces().ravel())
force_labels.extend([label] * (natoms * 3))

if s_ref is not None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any that don't have reference values and/or predicted values?

I'm not sure if mae works if the lengths of the lists are different/have None, which is possible given the way this is set up


MODELS = get_model_names(current_models)
BENCHMARK_NAME = "Plutonium Dioxide"
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/actinides.html#plutonium_dioxide"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/actinides.html#plutonium_dioxide"
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/actinides.html#plutonium-dioxide"

This comes from your Plutonium Dioxide header in the docs rst file, and the space there is converted into a -

y_label="Predicted Energy / eV / Atom",
annotation_metadata={"excluded": "Excluded"},
)
def energy_density(puo2_stats: dict[str, dict[str, Any]]) -> dict[str, dict]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions aren't currently being run, so the plots are not generated during analysis. The easiest way is to add them as inputs e.g. test_puo2 (they don't have to be used, since they're fixtures)

Copy link
Copy Markdown
Collaborator

@ElliottKasoar ElliottKasoar Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add actinides to docs/source/user_guide/benchmarks/index.rst? Otherwise it won't be built as part of the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new benchmark Proposals and suggestions for new benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plutonium dioxide benchmarks

3 participants