Skip to content

Automatically center box when converting to GSD. #80

Merged
mphoward merged 10 commits into
mainfrom
feature/hoomd-center-box
Jun 4, 2025
Merged

Automatically center box when converting to GSD. #80
mphoward merged 10 commits into
mainfrom
feature/hoomd-center-box

Conversation

@clpetix

@clpetix clpetix commented May 29, 2025

Copy link
Copy Markdown
Contributor

This adds functionality to automatically center box for conversion to GSD rather than raise an error.

Additionally, this fixes a bug where tilts were not being converted to HOOMD-blue's convention in to_hoomd_gsd(). I believe this error went unnoticed in our unit tests because we were creating a reference to the tilt data in from_hoomd_gsd() rather than a copy.

Comment thread src/lammpsio/snapshot.py Outdated
Comment thread src/lammpsio/snapshot.py Outdated
@clpetix

clpetix commented May 30, 2025

Copy link
Copy Markdown
Contributor Author

We had another bug floating around our conversion from_hoomd_gsd. We had previously set snap.box.low equal to -L/2 which isn't correct when there is tilt since HOOMD is always centered.

I think I've ironed out all the problems with how the conversions work and have checked both orthorhombic and triclinic boxes look correct in Ovito going both directions.

@mphoward, please let me know if you see anything else that needs tweaked here!

Comment thread src/lammpsio/snapshot.py Outdated
Comment thread src/lammpsio/snapshot.py
Comment thread src/lammpsio/snapshot.py Outdated
@clpetix

clpetix commented Jun 4, 2025

Copy link
Copy Markdown
Contributor Author

@mphoward, I've applied the suggested edits! This should be ready for you to take another look!

@mphoward mphoward left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Two small suggestions to simplify the code, then this looks good to me.

Comment thread src/lammpsio/snapshot.py Outdated
Comment thread src/lammpsio/snapshot.py Outdated
@clpetix

clpetix commented Jun 4, 2025

Copy link
Copy Markdown
Contributor Author

I've made those two changes, so this should be good to go!

@mphoward
mphoward merged commit fe85500 into main Jun 4, 2025
15 checks passed
@mphoward

mphoward commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Thank you!

@mphoward
mphoward deleted the feature/hoomd-center-box branch June 4, 2025 17:05
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