Move dump, check and tpbconv utilities
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 18 Jan 2014 21:28:14 +0000 (22:28 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 19 Jan 2014 08:03:55 +0000 (09:03 +0100)
These now form the start of the tools module, which is intended to
contain code for GROMACS tools whose use is not primarily for analysis
of data from simulations.

tpbcmp.* now named compare.*, since that code did not relate only to
run input files.

Removed declarations duplicated in legacycmodules.cpp in favour
of those in legacycmainfunctions.h.

Uncrustified, added copyright headers.

Change-Id: I48bf171f290fdfb177d5a020473b3a5296d89305

13 files changed:
src/gromacs/CMakeLists.txt
src/gromacs/tools/CMakeLists.txt [new file with mode: 0644]
src/gromacs/tools/check.c [moved from src/programs/gmx/gmxcheck.c with 99% similarity]
src/gromacs/tools/check.h [new file with mode: 0644]
src/gromacs/tools/compare.c [moved from src/programs/gmx/tpbcmp.c with 99% similarity]
src/gromacs/tools/compare.h [moved from src/programs/gmx/tpbcmp.h with 88% similarity]
src/gromacs/tools/dump.c [moved from src/programs/gmx/gmxdump.c with 99% similarity]
src/gromacs/tools/dump.h [new file with mode: 0644]
src/gromacs/tools/tpbconv.c [moved from src/programs/gmx/tpbconv.c with 99% similarity]
src/gromacs/tools/tpbconv.h [new file with mode: 0644]
src/programs/gmx/legacycmainfunctions.h
src/programs/gmx/legacymodules.cpp
src/programs/mdrun/tests/xtc_output.cpp

index 64a948161abb295d0d6a24103d98d2cd8a8e9720..c743bb7ab00851f1000eb5313ecc63e820000271 100644 (file)
@@ -66,6 +66,7 @@ if (NOT GMX_BUILD_MDRUN_ONLY)
     add_subdirectory(analysisdata)
     add_subdirectory(selection)
     add_subdirectory(trajectoryanalysis)
+    add_subdirectory(tools)
 endif ()
 
 list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES})
diff --git a/src/gromacs/tools/CMakeLists.txt b/src/gromacs/tools/CMakeLists.txt
new file mode 100644 (file)
index 0000000..80ee76b
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2014, 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.
+
+file(GLOB TOOLS_SOURCES *.cpp *.c)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOOLS_SOURCES} PARENT_SCOPE)
+
+set(TOOLS_PUBLIC_HEADERS
+    )
+gmx_install_headers(tools ${TOOLS_PUBLIC_HEADERS})
+
+if (BUILD_TESTING)
+#    add_subdirectory(tests)
+endif (BUILD_TESTING)
similarity index 99%
rename from src/programs/gmx/gmxcheck.c
rename to src/gromacs/tools/check.c
index 610ec1049a7cac8790b573714b49b5358a292a71..53c09b6ff746abb04a445cee29a7a2eb78d1bd19 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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.
 #include "main.h"
 #include "macros.h"
 #include <math.h>
-#include "gromacs/fileio/futil.h"
 #include "gromacs/commandline/pargs.h"
 #include "sysstuff.h"
 #include "txtdump.h"
 #include "gmx_fatal.h"
-#include "gromacs/fileio/gmxfio.h"
-#include "gromacs/fileio/trnio.h"
-#include "gromacs/fileio/xtcio.h"
 #include "atomprop.h"
 #include "vec.h"
 #include "pbc.h"
 #include "physics.h"
 #include "index.h"
 #include "smalloc.h"
+#include "names.h"
+#include "mtop_util.h"
+#include "gromacs/fileio/futil.h"
+#include "gromacs/fileio/gmxfio.h"
+#include "gromacs/fileio/trnio.h"
+#include "gromacs/fileio/xtcio.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/enxio.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "names.h"
-#include "mtop_util.h"
 
-#include "tpbcmp.h"
+#include "compare.h"
 
 typedef struct {
     int bStep;
@@ -707,7 +707,7 @@ void chk_enx(const char *fn)
     sfree(fr);
 }
 
-int gmx_gmxcheck(int argc, char *argv[])
+int gmx_check(int argc, char *argv[])
 {
     const char     *desc[] = {
         "[THISMODULE] reads a trajectory ([TT].trj[tt], [TT].trr[tt] or ",
diff --git a/src/gromacs/tools/check.h b/src/gromacs/tools/check.h
new file mode 100644 (file)
index 0000000..3eb6acd
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2014, 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.
+ */
+#ifndef GMX_TOOLS_CHECK_H
+#define GMX_TOOLS_CHECK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+/*! \brief Implements gmx check
+ *
+ * \param[in] argc  argc value passed to main().
+ * \param[in] argv  argv array passed to main().
+ */
+int gmx_check(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
similarity index 99%
rename from src/programs/gmx/tpbcmp.c
rename to src/gromacs/tools/compare.c
index add3e9f80eb3ac9c470b1cdb96148a5f1d833adf..4552ec19bdd45475637ff5d7e4307e54294905cc 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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 88%
rename from src/programs/gmx/tpbcmp.h
rename to src/gromacs/tools/compare.h
index 3309f93bb8a5e71715b8c3db91b23b3dec97e3a7..cf4f5470deda0eb427c39d3df45eafc41f831d9f 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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.
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-#ifndef _tpbcmp_h
-#define _tpbcmp_h
+#ifndef GMX_TOOLS_COMPARE_H
+#define GMX_TOOLS_COMPARE_H
+
+/* Routines for comparing data structures from non-trajectory binary
+   file formats (e.g. as used by gmx check). */
 
 void
 comp_tpx(const char *fn1, const char *fn2, gmx_bool bRMSD, real ftol, real abstol);
-/* Compare two binary topology files */
+/* Compare two binary run input files */
 
 void
 comp_trx(const output_env_t oenv, const char *fn1, const char *fn2,
similarity index 99%
rename from src/programs/gmx/gmxdump.c
rename to src/gromacs/tools/dump.c
index d79cf33511e2a34da52218fc845d98e3f1032782..f894def871dcb66efd593ac82148907e63ac4b79 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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.
 #include <assert.h>
 #include "main.h"
 #include "macros.h"
-#include "gromacs/fileio/futil.h"
 #include "gromacs/commandline/pargs.h"
 #include "sysstuff.h"
 #include "txtdump.h"
 #include "gmx_fatal.h"
-#include "gromacs/fileio/xtcio.h"
-#include "gromacs/fileio/enxio.h"
 #include "smalloc.h"
 #include "names.h"
-#include "gromacs/fileio/gmxfio.h"
-#include "gromacs/fileio/tpxio.h"
-#include "gromacs/fileio/trnio.h"
 #include "txtdump.h"
-#include "gmxcpp.h"
+#include "gromacs/gmxpreprocess/gmxcpp.h"
 #include "checkpoint.h"
 #include "mtop_util.h"
+#include "gromacs/fileio/xtcio.h"
+#include "gromacs/fileio/enxio.h"
+#include "gromacs/fileio/gmxfio.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trnio.h"
+#include "gromacs/fileio/futil.h"
 
 #include "gromacs/linearalgebra/mtxio.h"
 #include "gromacs/linearalgebra/sparsematrix.h"
@@ -522,7 +522,7 @@ static void list_mtx(const char *fn)
     sfree(full);
 }
 
-int gmx_gmxdump(int argc, char *argv[])
+int gmx_dump(int argc, char *argv[])
 {
     const char *desc[] = {
         "[THISMODULE] reads a run input file ([TT].tpa[tt]/[TT].tpr[tt]/[TT].tpb[tt]),",
diff --git a/src/gromacs/tools/dump.h b/src/gromacs/tools/dump.h
new file mode 100644 (file)
index 0000000..cf0195e
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2014, 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.
+ */
+#ifndef GMX_TOOLS_DUMP_H
+#define GMX_TOOLS_DUMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+/*! \brief Implements gmx dump
+ *
+ * \param[in] argc  argc value passed to main().
+ * \param[in] argv  argv array passed to main().
+ */
+int gmx_dump(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
similarity index 99%
rename from src/programs/gmx/tpbconv.c
rename to src/gromacs/tools/tpbconv.c
index 880efc205454135426a2b64124009a7666d58310..ff39619810f7853fd8a96761d087a98d40c3adf0 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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.
 #include "macros.h"
 #include "names.h"
 #include "typedefs.h"
-#include "gromacs/fileio/tpxio.h"
-#include "gromacs/fileio/trnio.h"
-#include "gromacs/fileio/enxio.h"
-#include "readir.h"
+#include "gromacs/gmxpreprocess/readir.h"
 #include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/futil.h"
 #include "vec.h"
 #include "mtop_util.h"
 #include "random.h"
 #include "checkpoint.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trnio.h"
+#include "gromacs/fileio/enxio.h"
+#include "gromacs/fileio/futil.h"
 
 #define RANGECHK(i, n) if ((i) >= (n)) gmx_fatal(FARGS, "Your index file contains atomnumbers (e.g. %d)\nthat are larger than the number of atoms in the tpr file (%d)", (i), (n))
 
diff --git a/src/gromacs/tools/tpbconv.h b/src/gromacs/tools/tpbconv.h
new file mode 100644 (file)
index 0000000..abc0d1b
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2014, 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.
+ */
+#ifndef GMX_TOOLS_TPBCONV_H
+#define GMX_TOOLS_TPBCONV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+/*! \brief Implements gmx tpbconv
+ *
+ * \param[in] argc  argc value passed to main().
+ * \param[in] argv  argv array passed to main().
+ */
+int gmx_tpbconv(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 097b2563d2d1941477d148f6441be2ad2c34b031..2366a1d81ed2326f146519dbd3e844cd14b2ef1a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014, 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.
 extern "C"
 {
 
-int gmx_gmxcheck(int argc, char *argv[]);
-int gmx_gmxdump(int argc, char *argv[]);
 int gmx_grompp(int argc, char *argv[]);
 int gmx_pdb2gmx(int argc, char *argv[]);
 int gmx_protonate(int argc, char *argv[]);
-int gmx_tpbconv(int argc, char *argv[]);
 int gmx_x2top(int argc, char *argv[]);
 
 }
index ab74aad094e4526572f3c397f7236d1584ed5c52..3b22a25894abce6fa7e2e9256d72e85b0068372c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014, 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.
 
 #include "../view/view.h"
 #include "../mdrun/mdrun_main.h"
+#include "gromacs/tools/check.h"
+#include "gromacs/tools/dump.h"
+#include "gromacs/tools/tpbconv.h"
 
-extern "C"
-{
-
-int gmx_gmxcheck(int argc, char *argv[]);
-int gmx_gmxdump(int argc, char *argv[]);
-int gmx_grompp(int argc, char *argv[]);
-int gmx_pdb2gmx(int argc, char *argv[]);
-int gmx_protonate(int argc, char *argv[]);
-int gmx_tpbconv(int argc, char *argv[]);
-int gmx_x2top(int argc, char *argv[]);
-
-}
+#include "legacycmainfunctions.h"
 
 namespace
 {
@@ -146,16 +138,16 @@ void registerObsoleteTool(gmx::CommandLineModuleManager *manager,
 void registerLegacyModules(gmx::CommandLineModuleManager *manager)
 {
     // Modules from this directory (were in src/kernel/).
-    registerModule(manager, &gmx_gmxcheck, "check",
+    registerModule(manager, &gmx_check, "check",
                    "Check and compare files");
-    registerModule(manager, &gmx_gmxdump, "dump",
+    registerModule(manager, &gmx_dump, "dump",
                    "Make binary files human readable");
     registerModule(manager, &gmx_grompp, "grompp",
                    "Make a run input file");
     registerModule(manager, &gmx_pdb2gmx, "pdb2gmx",
                    "Convert coordinate files to topology and FF-compliant coordinate files");
     registerModule(manager, &gmx_tpbconv, "tpbconv",
-                   "Make a run input file for restarting a crashed run");
+                   "Make a modifed run-input file");
 
     registerModule(manager, &gmx_protonate, "protonate",
                    "Protonate structures");
index e1b5367436ebcc80aa1ff30379e8d96aa5af71c2..667681e7ebce92b3e1ae27047eb9e39d5e7de3b8 100644 (file)
@@ -44,7 +44,7 @@
 #include <gtest/gtest.h>
 #include <string>
 #include "gromacs/options/filenameoption.h"
-#include "programs/gmx/legacycmainfunctions.h"
+#include "gromacs/tools/check.h"
 #include "testutils/cmdlinetest.h"
 
 namespace
@@ -73,7 +73,7 @@ TEST_P(XtcOutputTest, ExitsNormally)
     ::gmx::test::CommandLine checkCaller;
     checkCaller.append("check");
     checkCaller.addOption("-f", xtcFileName);
-    ASSERT_EQ(0, gmx_gmxcheck(checkCaller.argc(), checkCaller.argv()));
+    ASSERT_EQ(0, gmx_check(checkCaller.argc(), checkCaller.argv()));
 }
 
 #ifdef __INTEL_COMPILER