Fix mdrun-only build
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 13 Feb 2015 18:13:02 +0000 (18:13 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 13 Feb 2015 18:29:42 +0000 (18:29 +0000)
The GMX_BUILD_ONLY_MDRUN build now does not include
the gmxpreprocess module. Some Verlet-scheme code moved
to mdlib because it it used in mdrun and grompp.

gmx membed uses a utility function otherwise used only in
gmxpreprocess, but the error message it gives is wrong for the gmx
membed context, so I duplicated the function definition for now. Noted
TODOs for future clean up.

Fixes #1683

Change-Id: Ibc1291e88151f8d5befac2b1840a41402272a05f

src/gromacs/CMakeLists.txt
src/gromacs/gmxpreprocess/grompp.c
src/gromacs/gmxpreprocess/readir.c
src/gromacs/mdlib/calc_verletbuf.c [moved from src/gromacs/gmxpreprocess/calc_verletbuf.c with 99% similarity]
src/gromacs/mdlib/calc_verletbuf.h [moved from src/gromacs/gmxpreprocess/calc_verletbuf.h with 95% similarity]
src/gromacs/mdlib/compute_io.c [moved from src/gromacs/gmxpreprocess/compute_io.c with 98% similarity]
src/gromacs/mdlib/compute_io.h [moved from src/gromacs/gmxpreprocess/compute_io.h with 93% similarity]
src/programs/mdrun/md.cpp
src/programs/mdrun/membed.c
src/programs/mdrun/runner.cpp

index a4ac6155837858e456e3408702e755c337190d2b..ea3c0806cc0e67138ecf875a4d6574585aa0f3a4 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 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.
@@ -91,7 +91,6 @@ endif()
 
 add_subdirectory(gmxlib)
 add_subdirectory(mdlib)
-add_subdirectory(gmxpreprocess)
 add_subdirectory(listed-forces)
 add_subdirectory(commandline)
 add_subdirectory(domdec)
@@ -115,6 +114,7 @@ add_subdirectory(imd)
 if (NOT GMX_BUILD_MDRUN_ONLY)
     add_subdirectory(legacyheaders)
     add_subdirectory(gmxana)
+    add_subdirectory(gmxpreprocess)
     add_subdirectory(correlationfunctions)
     add_subdirectory(statistics)
     add_subdirectory(analysisdata)
index edd40cf3630fc783c08180ead821f6895ae902cb..c7cfab8f7ff2653179fa53cb543d02d9575a529b 100644 (file)
@@ -54,8 +54,6 @@
 #include "gromacs/fileio/trnio.h"
 #include "gromacs/fileio/trxio.h"
 #include "gromacs/gmxpreprocess/add_par.h"
-#include "gromacs/gmxpreprocess/calc_verletbuf.h"
-#include "gromacs/gmxpreprocess/compute_io.h"
 #include "gromacs/gmxpreprocess/convparm.h"
 #include "gromacs/gmxpreprocess/gen_maxwell_velocities.h"
 #include "gromacs/gmxpreprocess/gpp_atomtype.h"
@@ -76,6 +74,8 @@
 #include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/legacyheaders/warninp.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/mdlib/calc_verletbuf.h"
+#include "gromacs/mdlib/compute_io.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/random/random.h"
 #include "gromacs/topology/mtop_util.h"
index 6b4a6e8caf99c43e96b66fbfa3b93d05e48c10b9..d3c06878d896f739327668fca04dda6852eddc2d 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.
@@ -42,7 +42,6 @@
 #include <limits.h>
 #include <stdlib.h>
 
-#include "gromacs/gmxpreprocess/calc_verletbuf.h"
 #include "gromacs/gmxpreprocess/toputil.h"
 #include "gromacs/legacyheaders/chargegroup.h"
 #include "gromacs/legacyheaders/inputrec.h"
@@ -54,6 +53,7 @@
 #include "gromacs/legacyheaders/warninp.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/mdlib/calc_verletbuf.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/block.h"
 #include "gromacs/topology/index.h"
@@ -2532,6 +2532,9 @@ static int search_QMstring(const char *s, int ng, const char *gn[])
 } /* search_QMstring */
 
 /* We would like gn to be const as well, but C doesn't allow this */
+/* TODO this is utility functionality (search for the index of a
+   string in a collection), so should be refactored and located more
+   centrally. */
 int search_string(const char *s, int ng, char *gn[])
 {
     int i;
similarity index 99%
rename from src/gromacs/gmxpreprocess/calc_verletbuf.c
rename to src/gromacs/mdlib/calc_verletbuf.c
index 0116bfeb04215bd6b68169a60994786ce04059d3..b737e2a2fd068e76b0a9d560ab0b78e32c8ea7f1 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.
similarity index 95%
rename from src/gromacs/gmxpreprocess/calc_verletbuf.h
rename to src/gromacs/mdlib/calc_verletbuf.h
index 00696edb4ada6ef26be7bc0a3204fe2349bab4c7..edce6db14353426511cd4cde5168f14c376fbb15 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.
@@ -33,8 +33,8 @@
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-#ifndef GMX_GMXPREPROCESS_CALC_VERLETBUF_H
-#define GMX_GMXPREPROCESS_CALC_VERLETBUF_H
+#ifndef GMX_MDLIB_CALC_VERLETBUF_H
+#define GMX_MDLIB_CALC_VERLETBUF_H
 
 #include "gromacs/legacyheaders/typedefs.h"
 
similarity index 98%
rename from src/gromacs/gmxpreprocess/compute_io.c
rename to src/gromacs/mdlib/compute_io.c
index 51a73d1a845aa5666dc869041927c29256579b85..7835ef41126aec39daa69bf081f3b42f52ae573f 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) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
@@ -36,6 +36,8 @@
  */
 #include "gmxpre.h"
 
+#include "compute_io.h"
+
 #include <signal.h>
 #include <stdlib.h>
 
similarity index 93%
rename from src/gromacs/gmxpreprocess/compute_io.h
rename to src/gromacs/mdlib/compute_io.h
index c9ff85de9615a36473d2b27da9cb11afa4d37e1c..a184d2816df9b48a8042471f7d0042a6de9c364d 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) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,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.
@@ -35,8 +35,8 @@
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-#ifndef GMX_GMXPREPROCESS_COMPUTE_IO_H
-#define GMX_GMXPREPROCESS_COMPUTE_IO_H
+#ifndef GMX_MDLIB_COMPUTE_IO_H
+#define GMX_MDLIB_COMPUTE_IO_H
 
 #include "gromacs/legacyheaders/typedefs.h"
 
index c708faf628d2bef95e04af7c78d58a38e9c2e552..ff5af6d6491a7268f52d40410ff602c20d2020c3 100644 (file)
@@ -53,7 +53,6 @@
 #include "gromacs/fileio/trajectory_writing.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/gmxpreprocess/compute_io.h"
 #include "gromacs/imd/imd.h"
 #include "gromacs/legacyheaders/constr.h"
 #include "gromacs/legacyheaders/ebin.h"
@@ -94,6 +93,7 @@
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/math/vectypes.h"
+#include "gromacs/mdlib/compute_io.h"
 #include "gromacs/mdlib/nb_verlet.h"
 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.h"
 #include "gromacs/pbcutil/mshift.h"
index cef61ffb3d38ae580263b7bee1bc5acf814be74b..6e68fdcf71dad90773f1c19a5421818b4a166e6e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 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.
@@ -41,7 +41,6 @@
 
 #include "gromacs/essentialdynamics/edsam.h"
 #include "gromacs/fileio/tpxio.h"
-#include "gromacs/gmxpreprocess/readir.h"
 #include "gromacs/legacyheaders/macros.h"
 #include "gromacs/legacyheaders/names.h"
 #include "gromacs/legacyheaders/readinp.h"
@@ -982,6 +981,32 @@ void rescale_membed(int step_rel, gmx_membed_t membed, rvec *x)
     resize(membed->r_ins, x, membed->pos_ins, membed->fac);
 }
 
+/* We would like gn to be const as well, but C doesn't allow this */
+/* TODO this is utility functionality (search for the index of a
+   string in a collection), so should be refactored and located more
+   centrally. Also, it nearly duplicates the same string in readir.c */
+static int search_string(const char *s, int ng, char *gn[])
+{
+    int i;
+
+    for (i = 0; (i < ng); i++)
+    {
+        if (gmx_strcasecmp(s, gn[i]) == 0)
+        {
+            return i;
+        }
+    }
+
+    gmx_fatal(FARGS,
+              "Group %s selected for embedding was not found in the index file.\n"
+              "Group names must match either [moleculetype] names or custom index group\n"
+              "names, in which case you must supply an index file to the '-n' option\n"
+              "of grompp.",
+              s);
+
+    return -1;
+}
+
 gmx_membed_t init_membed(FILE *fplog, int nfile, const t_filenm fnm[], gmx_mtop_t *mtop,
                          t_inputrec *inputrec, t_state *state, t_commrec *cr, real *cpt)
 {
index d9d2fd26776360f0ef83431cb852d9e380d75940..5c852d663738ed8cdeb18c4f62e921c63519cc1e 100644 (file)
@@ -50,7 +50,6 @@
 #include "gromacs/essentialdynamics/edsam.h"
 #include "gromacs/ewald/pme.h"
 #include "gromacs/fileio/tpxio.h"
-#include "gromacs/gmxpreprocess/calc_verletbuf.h"
 #include "gromacs/legacyheaders/checkpoint.h"
 #include "gromacs/legacyheaders/constr.h"
 #include "gromacs/legacyheaders/disre.h"
@@ -74,6 +73,7 @@
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/math/calculate-ewald-splitting-coefficient.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/mdlib/calc_verletbuf.h"
 #include "gromacs/mdlib/nbnxn_consts.h"
 #include "gromacs/mdlib/nbnxn_search.h"
 #include "gromacs/pbcutil/pbc.h"