Skip to content

Conversation

@wwymak
Copy link

@wwymak wwymak commented Oct 25, 2025

Summary

resolves #304

Checklist

Before a pull request can be merged, the following items must be checked:

  • [ x ] Doc strings have been added in the Google docstring format.
  • [ x ] Run ruff on your code.
  • [ x ] Tests have been added for any new functionality or bug fixes.

We highly recommended installing the prek hooks running in CI locally to speedup the development process. Simply run pip install prek && prek install to install the hooks which will check your code before each commit.

Copy link
Collaborator

@orionarcher orionarcher left a 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

Copy link
Collaborator

@thomasloux thomasloux left a comment

Choose a reason for hiding this comment

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

see previous comments

)


def test_cell_to_cellpar(si_sim_state: SimState) -> None:
Copy link
Collaborator

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))
Copy link
Collaborator

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

Copy link
Author

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.

@wwymak wwymak requested a review from thomasloux November 4, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reimplement cell_to_cellpar in torchsim

3 participants