Internal parameter storage for IMDModules
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / grompp.cpp
index 43a317cc211793837f3f4531f07e310b3c5bc733..10cb4d9875e5430d2f90a01b292446fead7e3c19 100644 (file)
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/keyvaluetreebuilder.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/snprintf.h"
 
@@ -2418,6 +2419,15 @@ int gmx_grompp(int argc, char *argv[])
         }
     }
 
+    // Add the md modules internal parameters that are not mdp options
+    // e.g., atom indices
+
+    {
+        gmx::KeyValueTreeBuilder internalParameterBuilder;
+        mdModules.notifier().notify(&internalParameterBuilder);
+        ir->internalParameters = std::make_unique<gmx::KeyValueTreeObject>(internalParameterBuilder.build());
+    }
+
     if (bVerbose)
     {
         fprintf(stderr, "writing run input file...\n");