Add comments to grompp generated .mdp output for densityfitting
authorChristian Blau <cblau@gwdg.de>
Mon, 9 Sep 2019 15:45:53 +0000 (17:45 +0200)
committerChristian Blau <cblau@gwdg.de>
Wed, 11 Sep 2019 12:51:58 +0000 (14:51 +0200)
Adds additional explanatory comments to the grompp generated mdout.mdp
file for densityfitting.

refs #2282

Change-Id: I496cccced2cc87cb2434f877c0caf04cb29c1903

12 files changed:
src/gromacs/applied_forces/densityfittingoptions.cpp
src/gromacs/applied_forces/tests/densityfittingoptions.cpp
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsDefineParametersWithValuesIncludingAssignment.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsElectricField.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsElectricFieldOscillating.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsElectricFieldPulsed.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsEmptyLines.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsImplicitSolventNo.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsKeyWithoutValue.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_AcceptsMimic.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_HandlesDifferentKindsOfMdpLines.xml
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_HandlesOnlyCutoffScheme.xml

index 41065db8ccfed5220f75014079fd9943f5c149da..8137869837734f6f3dd4335b22568c6d65578ead 100644 (file)
@@ -86,9 +86,9 @@ void densityfittingMdpTransformFromString(IKeyValueTreeTransformRules * rules,
 }
 /*! \brief Helper to declare mdp output.
  *
- * Enforces uniform mdp options output sting that are always prepended with the
- * correct string for the densityfitting mdp options and is consistent with the
- * options name and transformation.
+ * Enforces uniform mdp options output strings that are always prepended with the
+ * correct string for the densityfitting mdp options and are consistent with the
+ * options name and transformation type.
  *
  * \tparam OptionType the type of the mdp option
  * \param[in] builder the KVT builder to generate the output
@@ -105,6 +105,23 @@ void addDensityFittingMdpOutputValue(KeyValueTreeObjectBuilder *builder,
                                   option);
 }
 
+/*! \brief Helper to declare mdp output comments.
+ *
+ * Enforces uniform mdp options comment output strings that are always prepended
+ * with the correct string for the densityfitting mdp options and are consistent
+ * with the options name and transformation type.
+ *
+ * \param[in] builder the KVT builder to generate the output
+ * \param[in] comment on the mdp option
+ * \param[in] optionTag string tag that describes the mdp option
+ */
+void addDensityFittingMdpOutputValueComment(KeyValueTreeObjectBuilder *builder,
+                                            const std::string         &comment,
+                                            const std::string         &optionTag)
+{
+    builder->addValue<std::string>("comment-" + DensityFittingModuleInfo::name_ + "-" + optionTag, comment);
+}
+
 }   // namespace
 
 void DensityFittingOptions::initMdpTransform(IKeyValueTreeTransformRules * rules)
@@ -126,14 +143,21 @@ void DensityFittingOptions::initMdpTransform(IKeyValueTreeTransformRules * rules
 
 void DensityFittingOptions::buildMdpOutput(KeyValueTreeObjectBuilder *builder) const
 {
+
+    addDensityFittingMdpOutputValueComment(builder, "", "empty-line");
+    addDensityFittingMdpOutputValueComment(builder, "; Density guided simulation", "module");
+
     addDensityFittingMdpOutputValue(builder, parameters_.active_, c_activeTag_);
     if (parameters_.active_)
     {
         addDensityFittingMdpOutputValue(builder, groupString_, c_groupTag_);
+
+        addDensityFittingMdpOutputValueComment(builder, "; Similarity measure between densities: inner-product, or relative-entropy", c_similarityMeasureTag_);
         addDensityFittingMdpOutputValue<std::string>(builder,
                                                      c_densitySimilarityMeasureMethodNames[parameters_.similarityMeasureMethod_],
                                                      c_similarityMeasureTag_);
 
+        addDensityFittingMdpOutputValueComment(builder, "; Atom amplitude for spreading onto grid: unity, mass, or charges", c_amplitudeMethodTag_);
         addDensityFittingMdpOutputValue<std::string>(builder,
                                                      c_densityFittingAmplitudeMethodNames[parameters_.amplitudeLookupMethod_],
                                                      c_amplitudeMethodTag_);
@@ -141,8 +165,10 @@ void DensityFittingOptions::buildMdpOutput(KeyValueTreeObjectBuilder *builder) c
         addDensityFittingMdpOutputValue(builder, parameters_.forceConstant_, c_forceConstantTag_);
         addDensityFittingMdpOutputValue(builder, parameters_.gaussianTransformSpreadingWidth_, c_gaussianTransformSpreadingWidthTag_);
         addDensityFittingMdpOutputValue(builder, parameters_.gaussianTransformSpreadingRangeInMultiplesOfWidth_, c_gaussianTransformSpreadingRangeInMultiplesOfWidthTag_);
+        addDensityFittingMdpOutputValueComment(builder, "; Reference density file location as absolute path or relative to the gmx mdrun calling location", c_referenceDensityFileNameTag_);
         addDensityFittingMdpOutputValue(builder, referenceDensityFileName_, c_referenceDensityFileNameTag_);
         addDensityFittingMdpOutputValue(builder, parameters_.calculationIntervalInSteps_, c_everyNStepsTag_);
+        addDensityFittingMdpOutputValueComment(builder, "; Normalize the sum of density voxel values to one", c_normalizeDensitiesTag_);
         addDensityFittingMdpOutputValue(builder, parameters_.normalizeDensities_, c_normalizeDensitiesTag_);
     }
 }
index aab2654e4051a19b717cf073ba749a74e1ed3f8b..79764008cb344953ed681b41c1e307e8b98545d2 100644 (file)
@@ -169,7 +169,9 @@ TEST_F(DensityFittingOptionsTest, OutputNoDefaultValuesWhenInactive)
     }
     stream.close();
 
-    EXPECT_EQ(stream.toString(), std::string("density-guided-simulation-active = false\n"));
+    EXPECT_EQ(stream.toString(),
+              std::string(
+                      "\n; Density guided simulation\ndensity-guided-simulation-active = false\n"));
 }
 
 TEST_F(DensityFittingOptionsTest, OutputDefaultValuesWhenActive)
@@ -189,15 +191,21 @@ TEST_F(DensityFittingOptionsTest, OutputDefaultValuesWhenActive)
     stream.close();
     std::string expected
         = {
+        "\n"
+        "; Density guided simulation\n"
         "density-guided-simulation-active = true\n"
         "density-guided-simulation-group = protein\n"
+        "; Similarity measure between densities: inner-product, or relative-entropy\n"
         "density-guided-simulation-similarity-measure = inner-product\n"
+        "; Atom amplitude for spreading onto grid: unity, mass, or charges\n"
         "density-guided-simulation-amplitude-method = unity\n"
         "density-guided-simulation-force-constant = 1e+09\n"
         "density-guided-simulation-gaussian-transform-spreading-width = 0.2\n"
         "density-guided-simulation-gaussian-transform-spreading-range-in-multiples-of-width = 4\n"
+        "; Reference density file location as absolute path or relative to the gmx mdrun calling location\n"
         "density-guided-simulation-reference-density-filename = reference.mrc\n"
         "density-guided-simulation-nst = 1\n"
+        "; Normalize the sum of density voxel values to one\n"
         "density-guided-simulation-normalize-densities = true\n"
         };
 
index d6a6c525a8eb2c5d046e4ed04a93aa02c1998bb6..2f245eeb275d662c2aa7561b71a3180b5a5f7dea 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 83176825700dfc9d8db5c49c9fd9f05d253c1438..5ed81b24e68b6becee330a12779a68c4b8c5dc6b 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 1.2 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 2041c81ec1a4cce8266191daaefff20d53350861..44c58b763ce382301c013393edf7794e8bb4b3c3 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 3.7 7.5 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 518fe2c5e8eda99e388b2546c324aae89b0f5bad..87feffeb09c02c30071a80ec89cf9cc765db3658 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 3.7 2 6.5 1
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 1ad5d1e06d8fe3b3037f2f0e7f9fd08d556e7c82..d1f17e207707f83e842841efda77ba4fb3e28715 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 1ad5d1e06d8fe3b3037f2f0e7f9fd08d556e7c82..d1f17e207707f83e842841efda77ba4fb3e28715 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 1ad5d1e06d8fe3b3037f2f0e7f9fd08d556e7c82..d1f17e207707f83e842841efda77ba4fb3e28715 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index b9f5f4b6db2b9eac6f1bb6bc3c5ec797861e8274..b4534cb0c6aacee20a8b79e7b8675ba840862233 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index dddb943d272184e37fdef50ad06c52cd948f4c5b..ad013492cb3967a48f07482328cebafb9db3e830 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>
index 5e82a412126274b1621b54b0f058f5bd34e38456..f232463605f134db5899fb269c300e47ace5a615 100644 (file)
@@ -317,6 +317,8 @@ userreal4                = 0
 electric-field-x         = 0 0 0 0
 electric-field-y         = 0 0 0 0
 electric-field-z         = 0 0 0 0
+
+; Density guided simulation
 density-guided-simulation-active = false
 </String>
 </ReferenceData>