Issue warnings for potential switch w/o defining switch regions.
authorMichael Shirts <michael.shirts@virginia.edu>
Fri, 18 Apr 2014 03:09:01 +0000 (23:09 -0400)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 21 Apr 2014 18:17:17 +0000 (20:17 +0200)
If either older style switches or new potential-switch modifiers are
used, issue a warning if the PME regions is too long, resulting in
inaccurate energies. Also issue a warning if rvdw_switch is 0, which
occurs if no value is specified.

Discussion is in redmine #1463

Change-Id: I7a2c29f87ceb04712aab5076ac97f5f22f573671

src/kernel/readir.c

index 011894f1fb3e2caaaaf9e7391c220d28ebe61b54..1474cb4aa4eb2a833fe4d04da5d1e04acd6a69d4 100644 (file)
@@ -1088,13 +1088,22 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
         warning_note(wi, warn_buf);
     }
 
-    if (ir->coulombtype == eelPMESWITCH)
+    if (ir->coulombtype == eelPMESWITCH || ir->coulomb_modifier == eintmodPOTSWITCH)
     {
         if (ir->rcoulomb_switch/ir->rcoulomb < 0.9499)
         {
-            sprintf(warn_buf, "The switching range for %s should be 5%% or less, energy conservation will be good anyhow, since ewald_rtol = %g",
-                    eel_names[ir->coulombtype],
-                    ir->ewald_rtol);
+            real percentage  = 100*(ir->rcoulomb-ir->rcoulomb_switch)/ir->rcoulomb;
+            sprintf(warn_buf, "The switching range for should be 5%% or less (currently %.2f%% using a switching range of %4f-%4f) for accurate electrostatic energies, energy conservation will be good regardless, since ewald_rtol = %g.",
+                    percentage,ir->rcoulomb_switch,ir->rcoulomb,ir->ewald_rtol);
+            warning(wi, warn_buf);
+        }
+    }
+
+    if (ir->vdwtype == evdwSWITCH || ir->vdw_modifier == eintmodPOTSWITCH)
+    {
+        if (ir->rvdw_switch==0)
+        {
+            sprintf(warn_buf, "rvdw-switch is equal 0 even though you are using a switched Lennard-Jones potential.  This suggests it was not set in the mdp, which can lead to large energy errors.  In GROMACS, 0.05 to 0.1 nm is often a reasonable vdw switching range.");
             warning(wi, warn_buf);
         }
     }