Implemented fatal error for nstcalcenergy!=1 with shells.
authorDavid van der Spoel <spoel@xray.bmc.uu.se>
Sun, 22 Jun 2014 20:30:51 +0000 (22:30 +0200)
committerDavid van der Spoel <spoel@xray.bmc.uu.se>
Sun, 22 Jun 2014 20:30:51 +0000 (22:30 +0200)
The combination of using shell particles with a value for
nstcalcenergy that is different from 1 leads to energies
not being communicated around on a parallel machine and hence
a meaningless shell relaxation procedure. This patch will just
bail out with a fatal error if the combination is detected.
Fixes #1376.

Change-Id: Ia54f1480b2358355438acb5de31dfa56b7f8d603

src/kernel/md.c

index 8909fb8ed759fa31d43cc474ecf6b3346e55f406..c9415eee962b465f76003d59b269d30f7b4ef0c7 100644 (file)
@@ -347,7 +347,10 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
                                  (ir->bContinuation ||
                                   (DOMAINDECOMP(cr) && !MASTER(cr))) ?
                                  NULL : state_global->x);
-
+    if (shellfc && ir->nstcalcenergy != 1)
+    {
+        gmx_fatal(FARGS, "You have nstcalcenergy set to a value (%d) that is different from 1.\nThis is not supported in combinations with shell particles.\nPlease make a new tpr file.", ir->nstcalcenergy);
+    }
     if (shellfc && ir->eI == eiNM)
     {
         /* Currently shells don't work with Normal Modes */