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

Virtual sites can have non-zero kinetic energy #4838

Closed
jngrad opened this issue Dec 11, 2023 · 0 comments · Fixed by #4839
Closed

Virtual sites can have non-zero kinetic energy #4838

jngrad opened this issue Dec 11, 2023 · 0 comments · Fixed by #4839
Assignees

Comments

@jngrad
Copy link
Member

jngrad commented Dec 11, 2023

The translational and rotational kinetic energy kernels have diverged from one another in 4.2.0, such that a virtual site can have a non-zero rotational inertia and thus contribute a non-zero kinetic energy when spinning.

MWE:

import espressomd
assert espressomd.has_features(["MASS"])
assert espressomd.has_features(["ROTATIONAL_INERTIA"])
system = espressomd.System(box_l=[1, 1, 1])
def calc_kinetic_energy(**kwargs):
    system.part.clear()
    system.part.add(pos=[0, 0, 0], rotation=3 * [True], **kwargs)
    print(f"Particle(**{kwargs=}) -> {system.analysis.energy()['kinetic']}")
calc_kinetic_energy(v=[1, 2, 3], virtual=False)
calc_kinetic_energy(v=[1, 2, 3], virtual=True)
calc_kinetic_energy(omega_lab=[1, 2, 3], virtual=False)
calc_kinetic_energy(omega_lab=[1, 2, 3], virtual=True)

Output:

Particle(**kwargs={'v': [1, 2, 3], 'virtual': False}) -> 7.0
Particle(**kwargs={'v': [1, 2, 3], 'virtual': True}) -> 0.0
Particle(**kwargs={'omega_lab': [1, 2, 3], 'virtual': False}) -> 7.0
Particle(**kwargs={'omega_lab': [1, 2, 3], 'virtual': True}) -> 7.0

Expected output: the last line should have zero energy.

@jngrad jngrad added this to the ESPResSo 4.2.2 milestone Dec 11, 2023
@jngrad jngrad self-assigned this Dec 11, 2023
@kodiakhq kodiakhq bot closed this as completed in #4839 Dec 14, 2023
kodiakhq bot added a commit that referenced this issue Dec 14, 2023
Fixes #4838

Description of changes:
- fix virtual sites regression introduced in ESPResSo 4.2.0
- update description of `MASS` and `ROTATIONAL_INERTIA` features
jngrad pushed a commit to jngrad/espresso that referenced this issue Jan 2, 2024
Fixes espressomd#4838

Description of changes:
- fix virtual sites regression introduced in ESPResSo 4.2.0
- update description of `MASS` and `ROTATIONAL_INERTIA` features
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.

1 participant