Added warnings for ewald-geometry and surface-epsilon
authorDavid van der Spoel <spoel@xray.bmc.uu.se>
Sun, 23 Nov 2014 11:01:02 +0000 (12:01 +0100)
committerBerk Hess <hess@kth.se>
Mon, 24 Nov 2014 08:29:09 +0000 (09:29 +0100)
ewald-geometry and surface-epsilon require the system dipole,
which will be incorrect when charge groups with net charge cross pbc.
grompp now checks and warns for this.
Refs #1645.

Change-Id: I02e317cbddb47256f942312ec53c5bab2b13be2a

src/kernel/readir.c

index 012d3312433226f92d610d5a5056f1f8bd72d2bc..9057ab27e52c4b2d587af35cc07525080689641f 100644 (file)
@@ -1157,7 +1157,28 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
         sprintf(err_buf, "wall-ewald-zfac should be >= 2");
         CHECK(ir->wall_ewald_zfac < 2);
     }
-
+    if ((ir->ewald_geometry == eewg3DC) && (ir->ePBC != epbcXY) &&
+        EEL_FULL(ir->coulombtype))
+    {
+        sprintf(warn_buf, "With %s and ewald_geometry = %s you should use pbc = %s",
+                eel_names[ir->coulombtype], eewg_names[eewg3DC], epbc_names[epbcXY]);
+        warning(wi, warn_buf);
+    }
+    if ((ir->epsilon_surface != 0) && EEL_FULL(ir->coulombtype))
+    {
+        if (ir->cutoff_scheme == ecutsVERLET)
+        {
+            sprintf(warn_buf, "Since molecules/charge groups are broken using the Verlet scheme, you can not use a dipole correction to the %s electrostatics.",
+                    eel_names[ir->coulombtype]);
+            warning(wi, warn_buf);
+        }
+        else
+        {
+            sprintf(warn_buf, "Dipole corrections to %s electrostatics only work if all charge groups that can cross PBC boundaries are dipoles. If this is not the case set epsilon_surface to 0",
+                    eel_names[ir->coulombtype]);
+            warning_note(wi, warn_buf);
+        }
+    }
     if (EVDW_SWITCHED(ir->vdwtype))
     {
         sprintf(err_buf, "With vdwtype = %s rvdw-switch must be < rvdw. Or, better - use a potential modifier.",