Grompp error for mismatching nst for energy calulation and densityfitting
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / readir.cpp
index 8ac8242b70edae5ef2768e3ee5ba1c63a92ba06c..339c7185806d32f4c3a15c83affd5cb2d495df68 100644 (file)
@@ -238,8 +238,8 @@ static void process_interaction_modifier(int *eintmod)
     }
 }
 
-void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
-              warninp_t wi)
+void check_ir(const char *mdparin, const gmx::MdModulesNotifier &mdModulesNotifier,
+              t_inputrec *ir, t_gromppopts *opts, warninp_t wi)
 /* Check internal consistency.
  * NOTE: index groups are not set here yet, don't check things
  * like temperature coupling group options here, but in triple_check
@@ -527,6 +527,17 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
             check_nst("nstcalcenergy", ir->nstcalcenergy,
                       "nstenergy", &ir->nstenergy, wi);
         }
+
+        // Inquire all MdModules, if their parameters match with the energy
+        // calculation frequency
+        gmx::EnergyCalculationFrequencyErrors energyCalculationFrequencyErrors(ir->nstcalcenergy);
+        mdModulesNotifier.notifier_.notify(&energyCalculationFrequencyErrors);
+
+        // Emit all errors from the energy calculation frequency checks
+        for (const std::string &energyFrequencyErrorMessage : energyCalculationFrequencyErrors.errorMessages())
+        {
+            warning_error(wi, energyFrequencyErrorMessage);
+        }
     }
 
     if (ir->nsteps == 0 && !ir->bContinuation)