Skip to content

High pressure crystals structure relaxations#340

Open
JonathanSchmidt1 wants to merge 51 commits intoddmms:mainfrom
JonathanSchmidt1:high-pressure
Open

High pressure crystals structure relaxations#340
JonathanSchmidt1 wants to merge 51 commits intoddmms:mainfrom
JonathanSchmidt1:high-pressure

Conversation

@JonathanSchmidt1
Copy link
Copy Markdown

@JonathanSchmidt1 JonathanSchmidt1 commented Feb 4, 2026

Pre-review checklist for PR author

PR authors must check the boxes below when creating the PR.


Summary

Adds a new high-pressure relaxation benchmark that evaluates MLIP performance in predicting equilibrium structures under hydrostatic pressure.

  • 3000 structures from the Alexandria database
  • Relaxed at 7 pressure conditions:
    0, 25, 50, 75, 100, 125, 150 GPa
  • Results compared against PBE reference calculations

Metrics evaluated (at each pressure)

  • Volume per atom MAE (ų/atom)
  • Enthalpy per atom MAE (eV/atom), calculated as:
    H = E + PV
  • Convergence rate (%)

Methodology

  • Structures relaxed using janus-core's GeomOpt
  • ASE FixSymmetry constraint used to preserve crystallographic symmetry (matching DFT protocol)
  • FrechetCellFilter with specified scalar pressure
  • Force convergence threshold: 0.0002 eV/Å
  • Maximum of 500 steps
  • Up to 3 consecutive relaxation attempts if not converged
  • Obvious outliers based on the predicted energies are marked as non-converged and are part of the convergence percentage metric but not the MAEs

Linked issue

Resolves #338


Progress

  • Calculations
  • Analysis
  • Application
  • App works but I am not sure about the good and bad values for the metrics yet.
  • Documentation

Testing

Tested on the following models:

  • mace-mpa-0
  • orb-v3-consv-inf-mpa
  • Regression test comparing to results produced with scripts from the original paper for mace-mpa-0

New decorators / callbacks

No new decorators or callbacks required.

Note the pull request right now includes a new model

  • orb-v3-consv-inf-mpa
    because I wanted to compare to the original paper but this could be removed.
    I am looking for some feedback on the good/bad values for the metrics

@JonathanSchmidt1 JonathanSchmidt1 changed the title High pressure crystals structure relaxations [WIP] High pressure crystals structure relaxations Feb 4, 2026
@ElliottKasoar ElliottKasoar added the new benchmark Proposals and suggestions for new benchmarks label Feb 6, 2026
@JonathanSchmidt1 JonathanSchmidt1 marked this pull request as draft February 9, 2026 08:40
@JonathanSchmidt1 JonathanSchmidt1 marked this pull request as ready for review February 9, 2026 08:41
@JonathanSchmidt1 JonathanSchmidt1 changed the title [WIP] High pressure crystals structure relaxations High pressure crystals structure relaxations Feb 9, 2026
JonathanSchmidt1 and others added 9 commits February 16, 2026 11:51
Analysis:
- Replace parity plots with density scatter via plot_density_scatter decorator
- Add high_pressure_stats fixture pooling all pressures per model
- Use build_density_inputs for volume/energy density plots
- Rename output files to figure_volume_density.json / figure_energy_density.json

Calc:
- Write relaxed structures to relaxed_{pressure_label}.xyz per model/pressure
- Annotate relaxed atoms with mat_id and pressure_gpa in atoms.info

App:
- Update plot filenames to match new density plot filenames

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread ml_peg/analysis/utils/decorators.py Outdated
Comment thread ml_peg/models/models.yml Outdated
JonathanSchmidt1 and others added 2 commits March 4, 2026 18:47
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
…utils/decorators.py

Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
@joehart2001
Copy link
Copy Markdown
Collaborator

Hey @JonathanSchmidt1, thanks for the PR, its looking in great shape!

Some points:

  • It would be good to put a lot of the output information as part of the atoms.info like done in other benchmarks, as we're saving the xyz files for the structure visualisation anyway too. I know this could be slightly tricky with the convergence metric, and maybe only the csv will just contain this convergence info, whilst the atoms object can contain the rest. Would be good to know what you think about this
  • I've now implemented structure visualisation from density scatters, so it would be good to get that in. Take a look at e.g. NCIA_D1200 analysis and app. If you need any help with this then let me know and i can make a code suggestion. I've seen the suggestion you've made about the ordering of points, and i plan to look at that soon.

Sorry for the delay in getting back to you

kuryla and others added 3 commits April 8, 2026 11:20
Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Domantas Kuryla <dk584@icepc16>
Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Joseph Hart <92541539+joehart2001@users.noreply.github.com>
joehart2001 and others added 24 commits April 8, 2026 11:20
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: joehart2001 <jh2536@cam.ac.uk>

return relaxed, converged, enthalpy / n_atoms


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
@pytest.mark.very_slow


vol_trajs = collect_traj_assets(
data_path=DATA_PATH,
assets_prefix="assets/bulk_crystal/high_pressure_relaxation",
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
assets_prefix="assets/bulk_crystal/high_pressure_relaxation",
assets_prefix="/assets/bulk_crystal/high_pressure_relaxation",

)
energy_trajs = collect_traj_assets(
data_path=DATA_PATH,
assets_prefix="assets/bulk_crystal/high_pressure_relaxation",
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
assets_prefix="assets/bulk_crystal/high_pressure_relaxation",
assets_prefix="/assets/bulk_crystal/high_pressure_relaxation",

fmax=fmax,
steps=max_steps,
filter_kwargs={"scalar_pressure": pressure_gpa},
calc_kwargs={"default_dtype": "float64"},
Copy link
Copy Markdown
Collaborator

@joehart2001 joehart2001 Apr 13, 2026

Choose a reason for hiding this comment

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

@ElliottKasoar does this work in our case and is it robust? I would reccomend using model.default_dtype = "float64" before calling get calculator, like done here

Copy link
Copy Markdown
Collaborator

@ElliottKasoar ElliottKasoar Apr 13, 2026

Choose a reason for hiding this comment

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

Yes, unfortunately, generally this needs to be defined before the calculator is instantiated, and default_dtype is also not guaranteed to be the correct kwarg for a given calculator, so yes that linked implementation is safer.

(model.default_dtype sets our custom attribute that knows how to set it for the models we currently support, whereas janus-core's calc_kwargs would be passed straight to the relevant ASE calculator at the time it's set up)

@joehart2001
Copy link
Copy Markdown
Collaborator

Thanks for addressing the comments, the density plots look great! Just a few small things.

  • The suggestion to the assets path is due to a recent change we made
  • It seems your rebase has resulted in all the changes being commited to this branch and github is not realising these are not your changes. Maybe a fresh fetch and rebase would sort it out?

Also, the current density plot shows one density plot for all the pressures. Would you like to keep it this way or have one for each pressure?

@joehart2001 joehart2001 mentioned this pull request Apr 15, 2026
5 tasks
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.

High-Pressure Crystal Structure Relaxations

6 participants