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

Checkpointing does not preserve particle director #4633

Closed
christophlohrmann opened this issue Dec 19, 2022 · 2 comments · Fixed by #4637
Closed

Checkpointing does not preserve particle director #4633

christophlohrmann opened this issue Dec 19, 2022 · 2 comments · Fixed by #4637

Comments

@christophlohrmann
Copy link
Contributor

christophlohrmann commented Dec 19, 2022

import espressomd
import espressomd.checkpointing
import numpy as np

direc_before = [1,0,0]
system = espressomd.System(box_l= 3*[100])
part = system.part.add(pos=3*[0], director=direc_before, id = 7)

checkpoint = espressomd.checkpointing.Checkpoint(
    checkpoint_id="test",
    checkpoint_path="./",
)

checkpoint.register("system")
checkpoint.save()
system.part.clear()
checkpoint.load(0)
direc_after = system.part.by_id(7).director

np.testing.assert_allclose(direc_after, direc_before, atol=1e-14)

This also creates problems with virtual sites, e.g., raspberry particles all point to [0,0,1] after checkpoint loading which can crash simulations

@jngrad
Copy link
Member

jngrad commented Dec 19, 2022

The magnetic dipole overwrites the quaternion during checkpointing, yikes! This regression was introduced in 4.2.0.

While I write the bugfix, you can disable feature DIPOLES from your myconfig file.

@jngrad jngrad added this to the Espresso 4.2.1 milestone Dec 19, 2022
@jngrad jngrad self-assigned this Dec 19, 2022
@kodiakhq kodiakhq bot closed this as completed in #4637 Dec 23, 2022
kodiakhq bot added a commit that referenced this issue Dec 23, 2022
Fixes #4633

Release 4.2.0 introduced a regression that causes checkpoint files to overwrite the particle quaternion/director by a unit vector pointing along the z direction, when the `DIPOLES` feature is part of the myconfig file. This leads to incorrect trajectories when reloading a simulation from a checkpoint file, if the particle director plays a role in the simulation (ex: relative virtual sites, Gay-Berne potential, anisotropic particles, active particles, etc.). Since the default myconfig file contains `DIPOLES`, most ESPResSo users are affected.

Description of changes:
- write new checkpointing logic to avoid overwriting the particle director with the particle dipole moment
- add checks to verify particle properties are correctly reloaded from a checkpoint file
- fix regressions in the checkpointing tests
@jngrad
Copy link
Member

jngrad commented Dec 23, 2022

Likewise, the angular velocity omega was wrong, since it was reloaded before the quaternion. It was thus calculated using the default-constructed quaternion.

jngrad pushed a commit to jngrad/espresso that referenced this issue Dec 23, 2022
Fixes espressomd#4633

Release 4.2.0 introduced a regression that causes checkpoint files to overwrite the particle quaternion/director by a unit vector pointing along the z direction, when the `DIPOLES` feature is part of the myconfig file. This leads to incorrect trajectories when reloading a simulation from a checkpoint file, if the particle director plays a role in the simulation (ex: relative virtual sites, Gay-Berne potential, anisotropic particles, active particles, etc.). Since the default myconfig file contains `DIPOLES`, most ESPResSo users are affected.

Description of changes:
- write new checkpointing logic to avoid overwriting the particle director with the particle dipole moment
- add checks to verify particle properties are correctly reloaded from a checkpoint file
- fix regressions in the checkpointing tests
jngrad pushed a commit to jngrad/espresso that referenced this issue Dec 23, 2022
Fixes espressomd#4633

Release 4.2.0 introduced a regression that causes checkpoint files to overwrite the particle quaternion/director by a unit vector pointing along the z direction, when the `DIPOLES` feature is part of the myconfig file. This leads to incorrect trajectories when reloading a simulation from a checkpoint file, if the particle director plays a role in the simulation (ex: relative virtual sites, Gay-Berne potential, anisotropic particles, active particles, etc.). Since the default myconfig file contains `DIPOLES`, most ESPResSo users are affected.

Description of changes:
- write new checkpointing logic to avoid overwriting the particle director with the particle dipole moment
- add checks to verify particle properties are correctly reloaded from a checkpoint file
- fix regressions in the checkpointing tests
jngrad pushed a commit to jngrad/espresso that referenced this issue Dec 23, 2022
Fixes espressomd#4633

Release 4.2.0 introduced a regression that causes checkpoint files to overwrite the particle quaternion/director by a unit vector pointing along the z direction, when the `DIPOLES` feature is part of the myconfig file. This leads to incorrect trajectories when reloading a simulation from a checkpoint file, if the particle director plays a role in the simulation (ex: relative virtual sites, Gay-Berne potential, anisotropic particles, active particles, etc.). Since the default myconfig file contains `DIPOLES`, most ESPResSo users are affected.

Description of changes:
- write new checkpointing logic to avoid overwriting the particle director with the particle dipole moment
- add checks to verify particle properties are correctly reloaded from a checkpoint file
- fix regressions in the checkpointing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants