Fix MiMiC with vsites
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 26 Feb 2021 11:51:46 +0000 (11:51 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 26 Feb 2021 11:51:46 +0000 (11:51 +0000)
This moves the call to the virtual site construction in MiMiC.
The current call happened after virtual
sites are used. This call has been moved to right after the coordinates
are received. The underlying problem is likely to have lead to wrong results when using
MiMiC with virtual sites.

Refs #3866
Fixes #3904

docs/release-notes/2021/2021.1.rst
src/gromacs/mdrun/mimic.cpp

index 0b2eca9ac9b3ab0a54298882f7d4c03852a27332..d76f9fcd4a95f935d460d7cb662de1038954c9f8 100644 (file)
@@ -16,6 +16,15 @@ in the :ref:`release-notes`.
 Fixes where mdrun could behave incorrectly
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+Fix MiMiC with virtual sites
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+It is likely that MiMiC with virtual sites has not worked
+correctly because the call to construct the sites was placed
+after the call that uses the sites. Now it should work, but we have not tested that it does.
+
+:issue:`3866`
+
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
index 22a8458f0244f360b65413bb8a1847c2dfa7d371..e37d921c5a768584f9499e7750f214ec3d59dee5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -386,6 +386,12 @@ void gmx::LegacySimulator::do_mimic()
                           "decomposition, "
                           "use a single rank");
             }
+            if (constructVsites)
+            {
+                wallcycle_start(wcycle, ewcVSITECONSTR);
+                vsite->construct(state->x, ir->delta_t, state->v, state->box);
+                wallcycle_stop(wcycle, ewcVSITECONSTR);
+            }
         }
 
         if (DOMAINDECOMP(cr))
@@ -452,13 +458,6 @@ void gmx::LegacySimulator::do_mimic()
 
         stopHandler->setSignal();
 
-        if (vsite != nullptr)
-        {
-            wallcycle_start(wcycle, ewcVSITECONSTR);
-            vsite->construct(state->x, ir->delta_t, state->v, state->box);
-            wallcycle_stop(wcycle, ewcVSITECONSTR);
-        }
-
         {
             const bool          doInterSimSignal = false;
             const bool          doIntraSimSignal = true;