-
Notifications
You must be signed in to change notification settings - Fork 61
convert cell_to_cellpar from ase's numpy implementation to pytorch #306
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
base: main
Are you sure you want to change the base?
Conversation
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, test is good. Maybe get final sign off from @thomasloux
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.
see previous comments
tests/models/test_orb.py
Outdated
| ) | ||
|
|
||
|
|
||
| def test_cell_to_cellpar(si_sim_state: SimState) -> None: |
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.
You can't use this one as it's cubic cell. So you wouldn't identify the possible issue of convention.
| lattice_per_system = torch.from_numpy( | ||
| cell_to_cellpar(cell_per_system.squeeze(0).cpu().numpy()) | ||
| ) | ||
| lattice_per_system = cell_to_cellpar(cell_per_system.squeeze(0)) |
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.
Ok I didn't see that the cell was extracted explicitly with the convention row_vector. When I say that the convention is not the same is that if A=Ase.atoms.cell[:] and B=SimState.cell, then A=B.T (transpose form). So in here, either you assume that the input is row and then you should have the same behaviour as ASE.cell_to_cellpar or you change that and then you have to change the input.
Given the current state of code, I suggest to use the same cell_to_cellpar convention as ASE, which is to assume that the input cell is a row_vector. Then modify the test accordingly
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.
Hi, I have changed the function to use the row convention and also updated the test.
Summary
resolves #304
Checklist
Before a pull request can be merged, the following items must be checked:
We highly recommended installing the
prekhooks running in CI locally to speedup the development process. Simply runpip install prek && prek installto install the hooks which will check your code before each commit.