Issue fatal errors rather than use broken shell code
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 4 Feb 2014 21:13:46 +0000 (22:13 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 8 Feb 2014 20:45:25 +0000 (21:45 +0100)
Refs #1429

Change-Id: I18a17f1e232a86a13f4e3b591bd992702af3017b

include/shellfc.h
src/kernel/md.c
src/mdlib/shellfc.c

index 3790a3b21c1d499c51e74aa21a5e5fc8776ef7a3..4fad146b0f8eaf4dbcf44113574f0a36dc43be91 100644 (file)
@@ -47,7 +47,8 @@ extern "C" {
  * If x!=NULL, the shells are predict for the global coordinates x.
  */
 GMX_LIBMD_EXPORT
-gmx_shellfc_t init_shell_flexcon(FILE *log,
+gmx_shellfc_t init_shell_flexcon(FILE *fplog, const t_commrec *cr,
+                                 gmx_bool bCutoffSchemeIsVerlet,
                                  gmx_mtop_t *mtop, int nflexcon,
                                  rvec *x);
 
index 803b4e643c9dacd3c30a8cbec1e52bb2e874b1f6..5d32a809b14f900c60f017fac47ee2065cf1e2e6 100644 (file)
@@ -342,7 +342,7 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     debug_gmx();
 
     /* Check for polarizable models and flexible constraints */
-    shellfc = init_shell_flexcon(fplog,
+    shellfc = init_shell_flexcon(fplog, cr, fr->cutoff_scheme == ecutsVERLET,
                                  top_global, n_flexible_constraints(constr),
                                  (ir->bContinuation ||
                                   (DOMAINDECOMP(cr) && !MASTER(cr))) ?
index 0ec2c1ccdd5689636c6d85f498ff12899d0f2c0f..2e8ea110c441b2cedb932e922dee740180aff3dc 100644 (file)
@@ -230,7 +230,8 @@ static void predict_shells(FILE *fplog, rvec x[], rvec v[], real dt,
     }
 }
 
-gmx_shellfc_t init_shell_flexcon(FILE *fplog,
+gmx_shellfc_t init_shell_flexcon(FILE *fplog, const t_commrec *cr,
+                                 gmx_bool bCutoffSchemeIsVerlet,
                                  gmx_mtop_t *mtop, int nflexcon,
                                  rvec *x)
 {
@@ -280,9 +281,20 @@ gmx_shellfc_t init_shell_flexcon(FILE *fplog,
 
     if (nshell == 0 && nflexcon == 0)
     {
+        /* We're not doing shells or flexible constraints */
         return NULL;
     }
 
+    if (DOMAINDECOMP(cr))
+    {
+        gmx_fatal(FARGS, "The shell code does not work with domain decomposition. Use particle decomposition, or only one MPI rank.\n");
+        /* The problem is probably not severe. See Redmine #1429. */
+    }
+    if (bCutoffSchemeIsVerlet)
+    {
+        gmx_fatal(FARGS, "The shell code does not work with the Verlet cut-off scheme.\n");
+    }
+
     snew(shfc, 1);
     shfc->nflexcon = nflexcon;