Disallow infinite epsilon with PME or GB.
authorErik Lindahl <erik@kth.se>
Fri, 19 Jun 2015 08:20:23 +0000 (10:20 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 20 Jun 2015 18:09:17 +0000 (20:09 +0200)
This leads to divide-by-zero errors, and since it just turns off
electrostatics it will be faster to use a plain cutoff, which we
now recommend instead.

Fixes #1297.

Change-Id: Ia5eba7a1d4bd3b387174c9cb4878a2d65ead2c6c

src/gromacs/gmxpreprocess/readir.c

index b5baf43a7db04e7aecb4c2b0133c9937dc79bedd..c3685b48e331a764cc770a2c2e388308f6a6c251 100644 (file)
@@ -1083,6 +1083,14 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
         ir->epsilon_r  = 1.0;
     }
 
+    if (ir->epsilon_r == 0)
+    {
+        sprintf(err_buf,
+                "It is pointless to use long-range or Generalized Born electrostatics with infinite relative permittivity."
+                "Since you are effectively turning of electrostatics, a plain cutoff will be much faster.");
+        CHECK(EEL_FULL(ir->coulombtype) || ir->implicit_solvent == eisGBSA);
+    }
+
     if (getenv("GMX_DO_GALACTIC_DYNAMICS") == NULL)
     {
         sprintf(err_buf, "epsilon-r must be >= 0 instead of %g\n", ir->epsilon_r);