Skip to content

Fix Molecule.get_boxed_structure when reorder=False#4419

Merged
shyuep merged 1 commit intomaterialsproject:masterfrom
gpetretto:bugfix
May 28, 2025
Merged

Fix Molecule.get_boxed_structure when reorder=False#4419
shyuep merged 1 commit intomaterialsproject:masterfrom
gpetretto:bugfix

Conversation

@gpetretto
Copy link
Contributor

@gpetretto gpetretto commented May 27, 2025

Summary

In Molecule.get_boxed_structure, when reorder=False, in the current version of the code does not use the processed new coordinates, but the initial ones of the Molecule. This usually results for example in a Molecule not being centered in the box.
Unless I am missing something there should be no reason not to use the modified coordinates in the case of reorder=False. This PR switches to use the same coordinates independently of the final sorting.

I added a test based on the coordinates that would have failed in the previous implementation due to the molecule not being centered in the box.

@gpetretto gpetretto requested review from mkhorton and shyuep as code owners May 27, 2025 09:09
@shyuep shyuep merged commit c6031ff into materialsproject:master May 28, 2025
43 checks passed
@shyuep
Copy link
Member

shyuep commented May 28, 2025

Thanks,.

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.

2 participants