Fix grompp net charge check
authorBerk Hess <hess@kth.se>
Tue, 13 Feb 2018 11:55:35 +0000 (12:55 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 14 Feb 2018 08:58:35 +0000 (09:58 +0100)
The grompp check for the net charge would ignore molecule blocks
at the end when molecule types are used in multiple, non consecutive
molecule blocks.

Fixes #2407

Change-Id: I4e7c6c609da99025174f180f9d4037ac9f9fd7fc

src/gromacs/gmxpreprocess/topio.cpp

index e37e6d3c31aa28afa7b37f598bea299527392c66..05913765edc60a6a02b328fe850836089d29bf90 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -188,7 +188,7 @@ double check_mol(gmx_mtop_t *mtop, warninp_t wi)
     /* Check mass and charge */
     q = 0.0;
 
-    for (mb = 0; mb < mtop->nmoltype; mb++)
+    for (mb = 0; mb < mtop->nmolblock; mb++)
     {
         atoms = &mtop->moltype[mtop->molblock[mb].type].atoms;
         nmol  = mtop->molblock[mb].nmol;