Reduce misuse of fatalerror.h
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 8 Sep 2015 14:09:51 +0000 (16:09 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 9 Sep 2015 15:49:29 +0000 (17:49 +0200)
Header files should not generally need to include fatalerror.h, and
quite a few source files were not declaring their dependency on it
because some widely-used header files were including it.

Removed unused modulo functionality from vec.h

Moved divide_err functionality to the one place it is used

The matrix-inversion code that calls gmx_fatal was in vec.h so that it
can be inlined, but it's only called every MD step for box inversions,
and never called by mdrun on a per-atom basis, so the need for
inlining is low. The remaining use of FARGS (and thus need for
fatalerror.h) in that code could be removed by throwing an exception
(in some later change). Maybe then it could be put back into a header
for inlining.

Change-Id: I74d7dc6d4568c5d7fd9086ee1d48e54d18267b9d

46 files changed:
src/gromacs/domdec/domdec_setup.cpp
src/gromacs/ewald/ewald.cpp
src/gromacs/ewald/long-range-correction.cpp
src/gromacs/ewald/pme-grid.cpp
src/gromacs/ewald/pme-load-balancing.cpp
src/gromacs/ewald/pme-redistribute.cpp
src/gromacs/ewald/pme-spread.cpp
src/gromacs/fileio/vmdio.cpp
src/gromacs/gmxana/gmx_mindist.cpp
src/gromacs/gmxana/gmx_rmsdist.cpp
src/gromacs/gmxana/gmx_rotmat.cpp
src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp
src/gromacs/gmxpreprocess/sortwater.cpp
src/gromacs/gmxpreprocess/specbond.cpp
src/gromacs/legacyheaders/network.h
src/gromacs/listed-forces/listed-forces.cpp
src/gromacs/listed-forces/position-restraints.cpp
src/gromacs/math/invertmatrix.cpp [new file with mode: 0644]
src/gromacs/math/vec.h
src/gromacs/mdlib/md_support.cpp
src/gromacs/mdlib/mdebin.cpp
src/gromacs/mdlib/mdrun_signalling.cpp
src/gromacs/mdlib/nbnxn_atomdata.c
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.c
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref.c
src/gromacs/mdlib/nbnxn_search.c
src/gromacs/mdlib/ns.cpp
src/gromacs/mdlib/rf_util.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/tgroup.cpp
src/gromacs/mdlib/update.cpp
src/gromacs/mdlib/vcm.cpp
src/gromacs/mdlib/vsite.cpp
src/gromacs/mdlib/wall.cpp
src/gromacs/mdrunutility/handlerestart.cpp
src/gromacs/pbcutil/pbc-simd.h
src/gromacs/pulling/pull.cpp
src/gromacs/pulling/pull_rotation.cpp
src/gromacs/selection/centerofmass.cpp
src/gromacs/statistics/statistics.cpp
src/gromacs/swap/swapcoords.cpp
src/gromacs/trajectoryanalysis/modules/surfacearea.cpp
src/programs/mdrun/membed.c
src/programs/mdrun/repl_ex.cpp
src/programs/mdrun/runner.cpp
src/programs/view/manager.cpp

index a6d9a4a2736c67401a1447875dddc058942835f4..fd93cd42971c2ccc89f3e043c4cc75b102a72059 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/legacyheaders/types/commrec.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 /*! \brief Margin for setting up the DD grid */
index cdd67142e1125fa2b21a61aa973f6a75256882b9..04975c723af82092da4683e1f5ebadaea0d44f0c 100644 (file)
@@ -61,6 +61,7 @@
 #include "gromacs/math/gmxcomplex.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/math/vectypes.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 struct gmx_ewald_tab_t
index 0dd94130e8e7726ae989be27398f33e9eca46529..7906b4783bc29e4ecb0bc1e64524d89a8c0f5472 100644 (file)
@@ -47,6 +47,7 @@
 #include "gromacs/math/units.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/utility/fatalerror.h"
 
 /* There's nothing special to do here if just masses are perturbed,
  * but if either charge or type is perturbed then the implementation
index dcdca578bd779b37c268c3147e575f9a56d882cd..1a5fdd890f900ea109557a28e4a1b4fbff5c48a0 100644 (file)
@@ -46,6 +46,7 @@
 #include "gromacs/ewald/pme.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/timing/cyclecounter.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 #ifdef DEBUG_PME
index 29b25c1f63d68cf4cf7e523593ae84a6493c0916..159b8411a1e974196916d100eb51343acfb0d596 100644 (file)
@@ -67,6 +67,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 #include "pme-internal.h"
index 44bbdaeb60c26afd428aeac6b7c501af31e35dec..28b1d78397acd76f3e60291a2b780bf8a4c31db8 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "gromacs/legacyheaders/types/commrec.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/smalloc.h"
 
index 204a97a06bdad36261e0ddb3bc433813a23118a4..2364a157a0bd84ecfb0349c2cd30677088495c6d 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "gromacs/ewald/pme.h"
 #include "gromacs/simd/simd.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 #include "pme-internal.h"
index 84e687871630719f72ea80d92faff6db85edf33b..d04a384bf7f2cd4863867993fac2d4e0f62a05f2 100644 (file)
 #include "gromacs/fileio/trx.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
index c1ab45b4ab7e871e0e16bc5310454b0653be7656..febe923513687f8a936a42fa11da698bb30a2143 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/pbcutil/rmpbc.h"
 #include "gromacs/topology/index.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/smalloc.h"
index 984a20e11d5641d85cf223041794b2078d6cdb1f..b56ce87b8a1c3e99673d0aff912200d7b5d1d452 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/index.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
index 997330d66ac2e682671f5c6e550b2500bb706cec..9020e3acaa9dbfeb0d7c795de3de076e8d5d4a0e 100644 (file)
@@ -49,6 +49,7 @@
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/rmpbc.h"
 #include "gromacs/topology/index.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/smalloc.h"
index 3ba751f6b29ac1e9e3b800dd05c3ca6afb092506..8296c5deefc26da60cc6e87d4411eb41692f77fd 100644 (file)
@@ -45,6 +45,7 @@
 #include "gromacs/math/vec.h"
 #include "gromacs/random/random.h"
 #include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 static void low_mspeed(real tempi,
index 1248f8d46a914d0c012bd69c65810a5c9adbad04..59f13b385746724a88fbdcaa3b215fa93b540683 100644 (file)
@@ -43,6 +43,7 @@
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/random/random.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 static rvec   *xptr, box_1;
index 700e216d4218f2875cb1d88bf05964ec238579f0..beb4cd45abfd43b662a238f0f43589221109e9ea 100644 (file)
@@ -52,6 +52,7 @@
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 gmx_bool yesno(void)
index 0824c6576a231facc2500b714e8d371fc923cd88..d452ac59300307ae5e452018027540dcaaf8292b 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, 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.
@@ -46,7 +46,6 @@
 #include <stdio.h>
 
 #include "gromacs/utility/basedefinitions.h"
-#include "gromacs/utility/fatalerror.h"
 
 #ifdef __cplusplus
 extern "C" {
index 1fa6afccd2635c5f5a678dc3d9779f975f4b2b8b..ab3b1d3e30a23e63a67780c82f44ff235d3b0c95 100644 (file)
@@ -64,6 +64,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/simd/simd.h"
 #include "gromacs/timing/wallcycle.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 #include "listed-internal.h"
index 3a37dbdfa4a023b84a08f8effedb1d80ecb3c3b9..6ecf6319faefc156f02306be6b687d3d86509364 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/topology/idef.h"
 #include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/fatalerror.h"
 
 struct gmx_wallcycle;
 
diff --git a/src/gromacs/math/invertmatrix.cpp b/src/gromacs/math/invertmatrix.cpp
new file mode 100644 (file)
index 0000000..1f1ad95
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2015, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#include "gmxpre.h"
+
+#include <cmath>
+
+#include "gromacs/math/vec.h"
+#include "gromacs/utility/fatalerror.h"
+
+void m_inv_ur0(gmx_cxx_const matrix src, matrix dest)
+{
+    double tmp = src[XX][XX]*src[YY][YY]*src[ZZ][ZZ];
+    if (std::fabs(tmp) <= 100*GMX_REAL_MIN)
+    {
+        gmx_fatal(FARGS, "Can not invert matrix, determinant is zero");
+    }
+
+    dest[XX][XX] = 1/src[XX][XX];
+    dest[YY][YY] = 1/src[YY][YY];
+    dest[ZZ][ZZ] = 1/src[ZZ][ZZ];
+    dest[ZZ][XX] = (src[YY][XX]*src[ZZ][YY]*dest[YY][YY]
+                    - src[ZZ][XX])*dest[XX][XX]*dest[ZZ][ZZ];
+    dest[YY][XX] = -src[YY][XX]*dest[XX][XX]*dest[YY][YY];
+    dest[ZZ][YY] = -src[ZZ][YY]*dest[YY][YY]*dest[ZZ][ZZ];
+    dest[XX][YY] = 0.0;
+    dest[XX][ZZ] = 0.0;
+    dest[YY][ZZ] = 0.0;
+}
+
+void m_inv(gmx_cxx_const matrix src, matrix dest)
+{
+    const real smallreal = (real)1.0e-24;
+    const real largereal = (real)1.0e24;
+
+    real       determinant = det(src);
+    real       c           = (real)1.0/determinant;
+    real       fc          = (real)std::fabs(c);
+
+    if ((fc <= smallreal) || (fc >= largereal))
+    {
+        gmx_fatal(FARGS, "Can not invert matrix, determinant = %e", determinant);
+    }
+
+    dest[XX][XX] = c*(src[YY][YY]*src[ZZ][ZZ]-src[ZZ][YY]*src[YY][ZZ]);
+    dest[XX][YY] = -c*(src[XX][YY]*src[ZZ][ZZ]-src[ZZ][YY]*src[XX][ZZ]);
+    dest[XX][ZZ] = c*(src[XX][YY]*src[YY][ZZ]-src[YY][YY]*src[XX][ZZ]);
+    dest[YY][XX] = -c*(src[YY][XX]*src[ZZ][ZZ]-src[ZZ][XX]*src[YY][ZZ]);
+    dest[YY][YY] = c*(src[XX][XX]*src[ZZ][ZZ]-src[ZZ][XX]*src[XX][ZZ]);
+    dest[YY][ZZ] = -c*(src[XX][XX]*src[YY][ZZ]-src[YY][XX]*src[XX][ZZ]);
+    dest[ZZ][XX] = c*(src[YY][XX]*src[ZZ][YY]-src[ZZ][XX]*src[YY][YY]);
+    dest[ZZ][YY] = -c*(src[XX][XX]*src[ZZ][YY]-src[ZZ][XX]*src[XX][YY]);
+    dest[ZZ][ZZ] = c*(src[XX][XX]*src[YY][YY]-src[YY][XX]*src[XX][YY]);
+}
index af5212ee17fcc8c7d5458b6182ea44ff8d3b7ebf..09c385513860aaf15874322ffd11448fbbc8a95f 100644 (file)
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vectypes.h"
 #include "gromacs/utility/basedefinitions.h"
-#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/real.h"
 
 #ifdef __cplusplus
@@ -738,51 +737,9 @@ static gmx_inline void msmul(gmx_cxx_const matrix m1, real r1, matrix dest)
     dest[ZZ][ZZ] = r1*m1[ZZ][ZZ];
 }
 
-static gmx_inline void m_inv_ur0(gmx_cxx_const matrix src, matrix dest)
-{
-    double tmp = src[XX][XX]*src[YY][YY]*src[ZZ][ZZ];
-    if (fabs(tmp) <= 100*GMX_REAL_MIN)
-    {
-        gmx_fatal(FARGS, "Can not invert matrix, determinant is zero");
-    }
-
-    dest[XX][XX] = 1/src[XX][XX];
-    dest[YY][YY] = 1/src[YY][YY];
-    dest[ZZ][ZZ] = 1/src[ZZ][ZZ];
-    dest[ZZ][XX] = (src[YY][XX]*src[ZZ][YY]*dest[YY][YY]
-                    - src[ZZ][XX])*dest[XX][XX]*dest[ZZ][ZZ];
-    dest[YY][XX] = -src[YY][XX]*dest[XX][XX]*dest[YY][YY];
-    dest[ZZ][YY] = -src[ZZ][YY]*dest[YY][YY]*dest[ZZ][ZZ];
-    dest[XX][YY] = 0.0;
-    dest[XX][ZZ] = 0.0;
-    dest[YY][ZZ] = 0.0;
-}
-
-static gmx_inline void m_inv(gmx_cxx_const matrix src, matrix dest)
-{
-    const real smallreal = (real)1.0e-24;
-    const real largereal = (real)1.0e24;
-    real       deter, c, fc;
-
-    deter = det(src);
-    c     = (real)1.0/deter;
-    fc    = (real)fabs(c);
-
-    if ((fc <= smallreal) || (fc >= largereal))
-    {
-        gmx_fatal(FARGS, "Can not invert matrix, determinant = %e", deter);
-    }
-
-    dest[XX][XX] = c*(src[YY][YY]*src[ZZ][ZZ]-src[ZZ][YY]*src[YY][ZZ]);
-    dest[XX][YY] = -c*(src[XX][YY]*src[ZZ][ZZ]-src[ZZ][YY]*src[XX][ZZ]);
-    dest[XX][ZZ] = c*(src[XX][YY]*src[YY][ZZ]-src[YY][YY]*src[XX][ZZ]);
-    dest[YY][XX] = -c*(src[YY][XX]*src[ZZ][ZZ]-src[ZZ][XX]*src[YY][ZZ]);
-    dest[YY][YY] = c*(src[XX][XX]*src[ZZ][ZZ]-src[ZZ][XX]*src[XX][ZZ]);
-    dest[YY][ZZ] = -c*(src[XX][XX]*src[YY][ZZ]-src[YY][XX]*src[XX][ZZ]);
-    dest[ZZ][XX] = c*(src[YY][XX]*src[ZZ][YY]-src[ZZ][XX]*src[YY][YY]);
-    dest[ZZ][YY] = -c*(src[XX][XX]*src[ZZ][YY]-src[ZZ][XX]*src[XX][YY]);
-    dest[ZZ][ZZ] = c*(src[XX][XX]*src[YY][YY]-src[YY][XX]*src[XX][YY]);
-}
+/* Routines defined in invertmatrix.cpp */
+void m_inv_ur0(gmx_cxx_const matrix src, matrix dest);
+void m_inv(gmx_cxx_const matrix src, matrix dest);
 
 static gmx_inline void mvmul(gmx_cxx_const matrix a, const rvec src, rvec dest)
 {
@@ -838,24 +795,6 @@ static gmx_inline real trace(gmx_cxx_const matrix m)
     return (m[XX][XX]+m[YY][YY]+m[ZZ][ZZ]);
 }
 
-static gmx_inline real _divide_err(real a, real b, const char *file, int line)
-{
-    if (fabs(b) <= GMX_REAL_MIN)
-    {
-        gmx_fatal(FARGS, "Dividing by zero, file %s, line %d", file, line);
-    }
-    return a/b;
-}
-
-static gmx_inline int _mod(int a, int b, const char *file, int line)
-{
-    if (b == 0)
-    {
-        gmx_fatal(FARGS, "Modulo zero, file %s, line %d", file, line);
-    }
-    return a % b;
-}
-
 /* Operations on multidimensional rvecs, used e.g. in edsam.c */
 static gmx_inline void m_rveccopy(int dim, gmx_cxx_const rvec *a, rvec *b)
 {
@@ -882,9 +821,6 @@ static gmx_inline void matrix_convert(matrix box, const rvec vec, rvec angle)
                        -box[ZZ][XX]*box[ZZ][XX]-box[ZZ][YY]*box[ZZ][YY]);
 }
 
-#define divide_err(a, b) _divide_err((a), (b), __FILE__, __LINE__)
-#define mod(a, b)    _mod((a), (b), __FILE__, __LINE__)
-
 #ifdef __cplusplus
 }
 #endif
index 713d3a732284f90b257c75b052038f19f9c3bc94..600035ce3a2a8ea03b93a6f9e729ca81d795c15d 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/snprintf.h"
 
index 8ffbaadc3fb0e57fe8a6c5854ea74789273f268b..45d7fe79b4b1d4b2fb2057efd17fcda1b3265ca4 100644 (file)
@@ -59,6 +59,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/pulling/pull.h"
 #include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 static const char *conrmsd_nm[] = { "Constr. rmsd", "Constr.2 rmsd" };
index 1714753f6bbc74077ba6c7f435d8d66cd60aaf02..cc3b3a5129a13fd16711897287b03630a1bedc35 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/legacyheaders/types/commrec.h"
 #include "gromacs/legacyheaders/types/inputrec.h"
 #include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/real.h"
 
 void init_global_signals(struct gmx_signalling_t *gs, const t_commrec *cr,
index 1ae2f5552006c939a640432b68dc90a22eaf6695..32c09e32d3b359e1cbfcbecf67bf387eec716a7a 100644 (file)
@@ -56,6 +56,7 @@
 #include "gromacs/mdlib/nbnxn_simd.h"
 #include "gromacs/pbcutil/ishift.h"
 #include "gromacs/simd/simd.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxomp.h"
 #include "gromacs/utility/smalloc.h"
 
index 5e8ac7ca2abd538f80614883b54427f65d2c016d..a2d7fd252dc97360ee14c3f0d9131a8ab6918f93 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, 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.
@@ -49,6 +49,7 @@
 #include "gromacs/mdlib/nbnxn_consts.h"
 #include "gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_common.h"
 #include "gromacs/pbcutil/ishift.h"
+#include "gromacs/utility/fatalerror.h"
 
 #define NCL_PER_SUPERCL         (NBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER)
 #define CL_SIZE                 (NBNXN_GPU_CLUSTER_SIZE)
index 4cad2a2f5637ba5b410af8db8ca1225cc441d1a6..a53b3b471daf22ad742fcc43649a68cd7da5839e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, 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.
@@ -49,6 +49,7 @@
 #include "gromacs/mdlib/nbnxn_consts.h"
 #include "gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_common.h"
 #include "gromacs/pbcutil/ishift.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 /*! \brief Typedefs for declaring lookup tables of kernel functions.
index 16fd3b010127634444485d6a7b183a2192331ad9..1c5699f927463741865e17616453819ccc56ae5a 100644 (file)
@@ -57,6 +57,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/simd/simd.h"
 #include "gromacs/simd/vector_operations.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 #ifdef NBNXN_SEARCH_BB_SIMD4
index e3f37fc45a6b089a0ae6715d3b82b81f0bc98023..2d25db8b0bf88f6f2491e4ea076d0d2b7e353f7d 100644 (file)
@@ -1768,7 +1768,11 @@ static int ns_simple_core(t_forcerec *fr,
     {
         for (m = 0; (m < DIM); m++)
         {
-            b_inv[m] = divide_err(1.0, box_size[m]);
+            if (gmx_numzero(box_size[m]))
+            {
+                gmx_fatal(FARGS, "Dividing by zero box size!");
+            }
+            b_inv[m] = 1.0/box_size[m];
         }
         bTriclinic = TRICLINIC(box);
     }
index 0058ed7f6c0989e4d845d3285ef03553958dc53e..0c11d72a479733bb5ada28259b2473d14d696e74 100644 (file)
@@ -47,6 +47,7 @@
 #include "gromacs/pbcutil/ishift.h"
 #include "gromacs/pbcutil/mshift.h"
 #include "gromacs/pbcutil/pbc.h"
+#include "gromacs/utility/fatalerror.h"
 
 real RF_excl_correction(const t_forcerec *fr, t_graph *g,
                         const t_mdatoms *mdatoms, const t_blocka *excl,
index 2622dc0f2e854adbba06f115cdb4136d20e9f4ed..cae6b150f9fc3ff5b022419e7772c5616c8b2e55 100644 (file)
@@ -92,6 +92,7 @@
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/timing/walltime_accounting.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/sysinfo.h"
index 7640a3cc47c29fd4a4a3aa3c868aa9b152957171..a6e7450de2a66cf27984bf0ead34f628ea1fb2f2 100644 (file)
@@ -48,6 +48,7 @@
 #include "gromacs/legacyheaders/update.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
index 638c1a646596370e341d87ac98919aec075f2ac4..59ccf82ed0e9903f3af3c025cf1c91d9a413e81c 100644 (file)
@@ -64,6 +64,7 @@
 #include "gromacs/pulling/pull.h"
 #include "gromacs/random/random.h"
 #include "gromacs/timing/wallcycle.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/gmxomp.h"
 #include "gromacs/utility/smalloc.h"
index b1d5a805481b5590cf1c2a527bf6a496ac1f5e05..978d4878f8b587207dbb13d92046f685d4d368c7 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, 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.
@@ -45,6 +45,7 @@
 #include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 t_vcm *init_vcm(FILE *fp, gmx_groups_t *groups, t_inputrec *ir)
index f24850725555d8d740be2a4677e4e5e337d2c327..5d86e66f855ef4fa56a6fb2b7e53f0922c4cdd8f 100644 (file)
@@ -54,6 +54,7 @@
 #include "gromacs/pbcutil/mshift.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxomp.h"
 #include "gromacs/utility/smalloc.h"
 
index c8aee134c6338fe60cef51c52a5f243e61450f31..4b7ef4c51c8cfe79a0f92d036f47efec6da2d309 100644 (file)
@@ -49,6 +49,7 @@
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 void make_wall_tables(FILE *fplog, const output_env_t oenv,
index 30386629cd1a66c6d7342e62ecf879806a43179f..47cca15c1fe8ffb162bb8eae726031c9f4d9db05 100644 (file)
@@ -59,6 +59,7 @@
 #include "gromacs/legacyheaders/main.h"
 #include "gromacs/legacyheaders/types/commrec.h"
 #include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 /*! \brief Search for \p fnm_cp in fnm and return true iff found
index fc7b29a968e9f8b9844f66854f703541356b00b2..c873e28a4051901bdda0ef98e13047854961fdc3 100644 (file)
@@ -49,7 +49,6 @@
 
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/simd/simd.h"
-#include "gromacs/utility/fatalerror.h"
 
 #ifdef __cplusplus
 extern "C" {
index db58d8aaf775950858221e9aa2804e162ddd97fb..0e12fe96e2f52b8e61d2bc27a21ac2e779d33d9e 100644 (file)
@@ -64,6 +64,7 @@
 #include "gromacs/pulling/pull_internal.h"
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/smalloc.h"
index a44e84a47775c7458ea11f481ce12081fdce3b13..15725134cfdd14cecf0293cf706444fe0d6f945f 100644 (file)
@@ -64,6 +64,7 @@
 #include "gromacs/timing/cyclecounter.h"
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/qsort_threadsafe.h"
 #include "gromacs/utility/smalloc.h"
index 474175ef89d0961fa9274a5606af9ea568917841..ff0a842de2e732987d14f3b021a8b149181e314b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, 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.
@@ -49,6 +49,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/block.h"
 #include "gromacs/topology/topology.h"
+#include "gromacs/utility/fatalerror.h"
 
 int
 gmx_calc_cog(t_topology * /* top */, rvec x[], int nrefat, atom_id index[], rvec xout)
index 5815a45b38453d89a04d1fef059f0d2a15b4fba6..623a47a05a02501603e11138f3d6af70389cffc5 100644 (file)
@@ -41,6 +41,7 @@
 #include <cmath>
 
 #include "gromacs/math/vec.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/real.h"
 #include "gromacs/utility/smalloc.h"
 
index 6314bbedf8f20e32b9d0f51c95073deb91bd36f9..3876d4f23886ca72f8f9c6a245aea05765823543 100644 (file)
@@ -63,6 +63,7 @@
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 static const char *SwS      = {"SWAP:"};                                           /**< For output that comes from the swap module */
index e8c839bb60812f3a099425dc44786c9bc16379da..51a5f4ba9dd2c946faba654c4417886193554984 100644 (file)
@@ -50,6 +50,7 @@
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/selection/nbsearch.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/smalloc.h"
 
index 64c3680ffa6e37d4b11f220218f2d623401b56fd..7a1256cb0825e8108127c6701a3e13d4ff668111 100644 (file)
@@ -51,6 +51,7 @@
 #include "gromacs/topology/index.h"
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
index 4b0e81063a0d383606a9bb2bcb00080d8ac89990..bdcf30172248551bbebd78c2d6982259f850b3e3 100644 (file)
@@ -51,6 +51,7 @@
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/random/random.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 #define PROBABILITYCUTOFF 100
index 8afd2ce13d056ebddf38177c1c710905dd7a8065..01191b1f9d3a51ef278be14efc66ab851a1199ef 100644 (file)
@@ -85,6 +85,7 @@
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/smalloc.h"
index 5eb8a16f4789093bd8821cf3d636be6895040832..cfa9ca3932502cfcfbb5a7798f18dfacb8ea28b3 100644 (file)
@@ -58,6 +58,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/atomprop.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"