Introduced fatal error in grompp for incorrect use of settle and charge groups.
authorDavid van der Spoel <spoel@xray.bmc.uu.se>
Wed, 4 Jan 2012 09:58:22 +0000 (10:58 +0100)
committerDavid van der Spoel <spoel@xray.bmc.uu.se>
Wed, 4 Jan 2012 09:58:22 +0000 (10:58 +0100)
Change-Id: I02dfe3f3454a6fc329d9b5ecb2fd4b544c8d2cd1

src/kernel/grompp.c

index 2d3b71663653feb38cef25828305a4186060286d..7f96d8719abde4a0f2465eb1cd757544cb599bde 100644 (file)
@@ -1125,6 +1125,22 @@ static void check_gbsa_params(t_inputrec *ir,gpp_atomtype_t atype)
   
 }
 
+static void check_settle(gmx_mtop_t   *sys)
+{
+    int i,j,cgj1,nra;
+    
+    nra = interaction_function[F_SETTLE].nratoms;
+    for(i=0; (i<sys->nmoltype); i++) 
+    {
+        for(j=0; (j<sys->moltype[i].ilist[F_SETTLE].nr); j+=nra+1)
+        {
+            cgj1 = sys->moltype[i].cgs.index[j+1];
+            if (j+2 >= cgj1)
+                gmx_fatal(FARGS,"For SETTLE you need to have all atoms involved in one charge group. Please fix your topology.");
+        }
+    }
+}
+
 int main (int argc, char *argv[])
 {
   static const char *desc[] = {
@@ -1469,6 +1485,9 @@ int main (int argc, char *argv[])
     check_vel(sys,state.v);
   }
     
+  /* check for charge groups in settles */
+  check_settle(sys);
+  
   /* check masses */
   check_mol(sys,wi);