You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The particle type map is updated when removing individual particles, but not when clearing all particles. The type map remains desynchronized until new particles are created. Affects all ESPResSo versions since 4.0.
importespressomdimportespressomd.reaction_methodsimportnumpyasnpnp.random.seed(seed=42)
system=espressomd.System(box_l=3* [10.])
system.time_step=0.02system.cell_system.skin=0.4# set particlestype_A=0type_B=1system.part.add(pos=np.random.random((10, 3)) *system.box_l, type=10* [type_B])
# set reaction 1A <-> 1BRE=espressomd.reaction_methods.ReactionEnsemble(kT=1., exclusion_range=0., seed=42)
RE.add_reaction(reactant_types=[type_A], reactant_coefficients=[1],
product_types=[type_B], product_coefficients=[1],
gamma=0.001, default_charges={type_A: 0, type_B: 0})
RE.set_non_interacting_type(type=2)
# clear particle listsystem.part.clear()
# state tracking is now out of syncprint(f"n_A = {system.number_of_particles(type=type_A)}")
print(f"n_B = {system.number_of_particles(type=type_B)}")
# triggering a cell system reset has no effect on state trackingsystem.cell_system.set_n_square()
system.cell_system.set_regular_decomposition()
# reaction failsRE.reaction(reaction_steps=4)
Output:
n_A = 0
n_B = 10
Traceback (most recent call last):
File "/work/jgrad/espresso/build/mwe.py", line 27, in <module>
RE.reaction(reaction_steps=4)
File "script_interface.pyx", line 425, in espressomd.script_interface.ScriptInterfaceHelper.generate_caller.template_method
File "script_interface.pyx", line 159, in espressomd.script_interface.PScriptInterface.call_method
RuntimeError: Particle node for id 0 not found!
Expected output:
n_A = 0
n_B = 0
The text was updated successfully, but these errors were encountered:
Fixes#4644Fixes#4645
Pre-requisite to #4629
Description of changes:
- bugfix: the type map is now properly updated when clearing particles
- add missing feature guards in the testsuite
- add subtests to provide more context when a test fails
jngrad
added a commit
to jngrad/espresso
that referenced
this issue
Jan 19, 2023
Fixesespressomd#4644Fixesespressomd#4645
Description of changes:
- bugfix: the type map is now properly updated when clearing particles
- add missing feature guards in the testsuite
- add subtests to provide more context when a test fails
The particle type map is updated when removing individual particles, but not when clearing all particles. The type map remains desynchronized until new particles are created. Affects all ESPResSo versions since 4.0.
MWE for 4.3-dev (tested on 30c7c23):
Output:
Expected output:
The text was updated successfully, but these errors were encountered: