Skip to content

Conversation

@janosh
Copy link
Collaborator

@janosh janosh commented May 16, 2025

closes #198

  • torch_sim/optimizers.py had a bug discovered by @t-reents in FIRE relaxation where atomic positions were not correctly updated when the cell changed. resolved by scaling atomic positions by the difference between new and previous cell after each cell update
  • new relaxation tests for OsN2 and distorted FCC Al structures in test_optimizers_vs_ase.py, covering both Frechet and Unit Cell FIRE optimizers
  • tightened existing assertion tolerances in test_optimizers_vs_ase.py due to improved agreement between torch-sim and ASE optimizers

in a future PR, it probably makes sense to change the handling of atom positions from absolute to fractional (unwrapped) coordinates which would mean the atom positions don't require manual scaling after cell changes

janosh added 4 commits May 16, 2025 15:18
by adding temp variable old_row_vector_cell to store the prev state of row_vector_cell
and use it to scale atomic positions with
torch.bmm(inv_old_cell_batch, current_new_row_vector_cell) after each cell update
…_diff now that we get better torch-sim ASE agreement
…nit Cell FIRE optimizers in test_optimizers_vs_ase.py

- new fixtures for initial SimState of rhombohedral OsN2 and distorted FCC Al
- new tests comparing torch-sim's Frechet Cell FIRE and Unit Cell FIRE optimizers with ASE's implementations
@janosh janosh added tests Test all the things fix Bug fix geo-opt Geometry optimization labels May 16, 2025
@cla-bot cla-bot bot added the cla-signed Contributor license agreement signed label May 16, 2025
@janosh janosh requested review from CompRhys and abhijeetgangan May 16, 2025 19:54
"osn2_sim_state",
"frechet",
FrechetCellFilter,
50,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we track different nsteps? i.e compare for 20, 50, 100 etc and see if they give same structure and properties.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good call, see b2d4f15 which makes tests in test_optimizers_vs_ase.py more stringent by comparing ASE and torch-sim EFS + cell at multiple checkpoints in each relaxation

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's looks good!

janosh added 2 commits May 16, 2025 15:59
… by comparing ASE and torch-sim EFS + cell at multiple checkpoints during each relaxation

- _run_and_compare_optimizers now accepts a list of checkpoints instead of a single n_steps parameter
even though passing locally
distorted_fcc_al_conventional_sim_state fixtures to root conftest
Copy link
Member

@CompRhys CompRhys left a comment

Choose a reason for hiding this comment

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

LGTM!

thanks @t-reents for spotting the issue!

@t-reents
Copy link
Contributor

Thanks a lot for your quick fix! 🙏

@janosh janosh merged commit b626d09 into main May 16, 2025
95 of 96 checks passed
@janosh janosh deleted the fix-gh-198 branch May 16, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed Contributor license agreement signed fix Bug fix geo-opt Geometry optimization tests Test all the things

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question regarding comparison of ASE and torch-sim optimization

4 participants