-
Notifications
You must be signed in to change notification settings - Fork 56
Fix unit and frechet cell FIRE optimizers not rescaling atom positions after each cell update #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
tests/test_optimizers_vs_ase.py
Outdated
| "osn2_sim_state", | ||
| "frechet", | ||
| FrechetCellFilter, | ||
| 50, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's looks good!
… 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
There was a problem hiding this 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!
|
Thanks a lot for your quick fix! 🙏 |
closes #198
torch_sim/optimizers.pyhad 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 updateOsN2and distortedFCC Alstructures intest_optimizers_vs_ase.py, covering both Frechet and Unit Cell FIRE optimizerstest_optimizers_vs_ase.pydue to improved agreement betweentorch-simandASEoptimizersin 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