espressomd/espresso

Lost virtual particle propagation flag after checkpointing

RebeccaStephan opened this issue · 1 comments

When creating a virtual particle using vs_relative_to() coupled to a lb fluid by setting couple_to_lb = True adding the TRANS_LB_MOMENTUM_EXCHANGE flag manually, this specific flag is lost after checkpointing. The other flags somehow are still there.
minimum_example.txt

The propagation flag seems to be overwritten by a default-constructed vs_relative flag. Could you please try the following patch with git apply patch.diff in the top-level folder of your git clone and see if this fixes your issue:

diff --git a/src/script_interface/particle_data/ParticleHandle.cpp b/src/script_interface/particle_data/ParticleHandle.cpp
index aece29c03a..bd762a5db3 100644
--- a/src/script_interface/particle_data/ParticleHandle.cpp
+++ b/src/script_interface/particle_data/ParticleHandle.cpp
@@ -789,4 +789,4 @@ void ParticleHandle::do_construct(VariantMap const &params) {
       std::set<std::string> const skip = {
-          "pos_folded", "pos", "quat", "director", "id",
-          "exclusions", "dip", "node", "image_box", "bonds",
+          "pos_folded", "pos", "vs_relative", "quat", "director", "id",
+          "exclusions", "dip", "propagation", "node", "image_box", "bonds",
           "lees_edwards_flag", "__cpt_sentinel",
@@ -806,2 +806,11 @@ void ParticleHandle::do_construct(VariantMap const &params) {
 #endif // ROTATION
+      // multiple parameters can potentially set the propagation flag, but one
+      // takes precedence; this conditional is required to handle a reload
+      // from a checkpoint file, where all properties exist (avoids accidentally
+      // overwriting the propagation property by the vs_relative property)
+      for (std::string name : {"vs_relative", "propagation"}) {
+        if (has_param(name)) {
+          do_set_parameter(name, params.at(name));
+        }
+      }
       for (auto const &name : get_parameter_insertion_order()) {