Skip to content
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

Disable box length reset when particles are present #4901

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

jngrad
Copy link
Member

@jngrad jngrad commented Apr 8, 2024

Fixes #4834

Description of changes:

  • Resizing the box via system.box_l = new_box_l now throws a runtime error if there are particles present, because particle position folding cannot be guaranteed to be correct; use system.change_volume_and_rescale_particles() instead, which properly rescales particle positions.

Also veto box change before the box length update to avoid leaving
the system in an undefined state.
@jngrad jngrad marked this pull request as ready for review April 8, 2024 15:40
@jngrad jngrad requested a review from reinaual April 8, 2024 15:41
@jngrad jngrad added this to the ESPResSo 4.2.2 milestone Apr 8, 2024
Comment on lines +114 to 116
m_instance->veto_boxl_change();
m_instance->box_geo->set_length(new_value);
m_instance->on_boxl_change();
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to reviewers: there are long-term plans to replace this clumsy veto/on_change mechanism by a proper message-passing interface (#4762).

Copy link
Contributor

@reinaual reinaual left a comment

Choose a reason for hiding this comment

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

I think we should add this change as a major one in the release-notes, to make sure it is as visible as possible to the users. This has a lot of potential to break old scripts, especially custom checkpointing solutions

@jngrad jngrad added the automerge Merge with kodiak label Apr 9, 2024
@kodiakhq kodiakhq bot merged commit 9db4de1 into espressomd:python Apr 9, 2024
10 checks passed
@jngrad jngrad deleted the fix-4834 branch April 9, 2024 11:19
jngrad pushed a commit to jngrad/espresso that referenced this pull request Apr 25, 2024
Fixes espressomd#4834

Description of changes:
- Resizing the box via `system.box_l = new_box_l` now throws a runtime error if there are particles present, because particle position folding cannot be guaranteed to be correct; use `system.change_volume_and_rescale_particles()` instead, which properly rescales particle positions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Box length change invalidates particle positions
2 participants