/*
+ * This file is part of the GROMACS molecular simulation package.
*
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * 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.
+ *
+ * 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.
*
- * If you want to redistribute modifications, 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 www.gromacs.org.
+ * 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.
*
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
+ * 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.
*
- * For more info, check our website at http://www.gromacs.org
+ * 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.
*
- * And Hey:
- * GROningen Mixture of Alchemy and Childrens' Stories
+ * 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 "copyrite.h"
+#include "gmxpre.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "gromacs/legacyheaders/copyrite.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include "config.h"
+
#ifdef HAVE_LIBMKL
#include <mkl.h>
#endif
+#ifdef HAVE_EXTRAE
+#include <extrae_user_events.h>
+#endif
+#include <boost/version.hpp>
/* This file is completely threadsafe - keep it that way! */
-#include "gromacs/legacyheaders/futil.h"
-#include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/random.h"
-#include "gromacs/legacyheaders/smalloc.h"
-#include "gromacs/legacyheaders/statutil.h"
-#include "gromacs/legacyheaders/strdb.h"
-#include "gromacs/legacyheaders/string2.h"
-#include "gromacs/legacyheaders/vec.h"
-
-#include "gromacs/fft/fft.h"
-
#include "buildinfo.h"
+#include "gromacs/fft/fft.h"
+#include "gromacs/fileio/strdb.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/random/random.h"
+#include "gromacs/utility/baseversion.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/programcontext.h"
+#include "gromacs/utility/smalloc.h"
static gmx_bool be_cool(void)
{
#endif
}
-static void space(FILE *out, int n)
-{
- fprintf(out, "%*s", n, "");
-}
-
-static void sp_print(FILE *out, const char *s)
-{
- int slen;
-
- slen = strlen(s);
- space(out, (80-slen)/2);
- fprintf(out, "%s\n", s);
-}
-
-static void ster_print(FILE *out, const char *s)
-{
- int slen;
- char buf[128];
-
- snprintf(buf, 128, ":-) %s (-:", s);
- slen = strlen(buf);
- space(out, (80-slen)/2);
- fprintf(out, "%s\n", buf);
-}
-
-
static void pukeit(const char *db, const char *defstring, char *retstring,
int retsize, int *cqnum)
{
- FILE *fp;
- char **help;
- int i, nhlp;
- int seed;
+ FILE *fp;
+ char **help;
+ int i, nhlp;
+ gmx_rng_t rng;
if (be_cool() && ((fp = low_libopen(db, FALSE)) != NULL))
{
nhlp = fget_lines(fp, &help);
/* for libraries we can use the low-level close routines */
- ffclose(fp);
- seed = time(NULL);
- *cqnum = static_cast<int>(nhlp*rando(&seed));
+ gmx_ffclose(fp);
+ rng = gmx_rng_init(gmx_rng_make_seed());
+ *cqnum = static_cast<int>(nhlp*gmx_rng_uniform_real(rng));
+ gmx_rng_destroy(rng);
if (strlen(help[*cqnum]) >= STRLEN)
{
help[*cqnum][STRLEN-1] = '\0';
sfree(tmpstr);
}
-void CopyRight(FILE *out, const char *szProgram)
+static void printCopyright(FILE *fp)
{
- static const char * CopyrightText[] = {
- "Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,",
- "Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, ",
- "Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, ",
- "Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, ",
- "Michael Shirts, Alfons Sijbers, Peter Tieleman,\n",
- "Berk Hess, David van der Spoel, and Erik Lindahl.\n",
+ static const char * const Contributors[] = {
+ "Emile Apol",
+ "Rossen Apostolov",
+ "Herman J.C. Berendsen",
+ "Par Bjelkmar",
+ "Aldert van Buuren",
+ "Rudi van Drunen",
+ "Anton Feenstra",
+ "Sebastian Fritsch",
+ "Gerrit Groenhof",
+ "Christoph Junghans",
+ "Peter Kasson",
+ "Carsten Kutzner",
+ "Per Larsson",
+ "Justin A. Lemkul",
+ "Magnus Lundborg",
+ "Pieter Meulenhoff",
+ "Erik Marklund",
+ "Teemu Murtola",
+ "Szilard Pall",
+ "Sander Pronk",
+ "Roland Schulz",
+ "Alexey Shvetsov",
+ "Michael Shirts",
+ "Alfons Sijbers",
+ "Peter Tieleman",
+ "Christian Wennberg",
+ "Maarten Wolf"
+ };
+ static const char * const CopyrightText[] = {
"Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
- "Copyright (c) 2001-2010, The GROMACS development team at",
- "Uppsala University & The Royal Institute of Technology, Sweden.",
- "check out http://www.gromacs.org for more information.\n"
+ "Copyright (c) 2001-2014, The GROMACS development team at",
+ "Uppsala University, Stockholm University and",
+ "the Royal Institute of Technology, Sweden.",
+ "check out http://www.gromacs.org for more information."
};
-
- static const char * LicenseText[] = {
- "This program is free software; you can redistribute it and/or",
- "modify it under the terms of the GNU Lesser General Public License",
+ static const char * const LicenseText[] = {
+ "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."
};
- /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the
- * name of a file. Otherwise, we won't be able to find the library dir.
- */
-
+#define NCONTRIBUTORS (int)asize(Contributors)
#define NCR (int)asize(CopyrightText)
-/* TODO: Is this exception still needed? */
-#ifdef GMX_FAHCORE
-#define NLICENSE 0 /*FAH has an exception permission from LGPL to allow digital signatures in Gromacs*/
-#else
-#define NLICENSE (int)asize(LicenseText)
-#endif
-
- char buf[256], tmpstr[1024];
- int i;
+// FAH has an exception permission from LGPL to allow digital signatures in Gromacs.
#ifdef GMX_FAHCORE
- set_program_name("Gromacs");
+#define NLICENSE 0
#else
- set_program_name(szProgram);
+#define NLICENSE (int)asize(LicenseText)
#endif
- ster_print(out, "G R O M A C S");
- fprintf(out, "\n");
-
- bromacs(tmpstr, 1023);
- sp_print(out, tmpstr);
- fprintf(out, "\n");
-
- ster_print(out, GromacsVersion());
- fprintf(out, "\n");
-
- if (getenv("GMX_NO_CREDITS"))
+ fprintf(fp, "GROMACS is written by:\n");
+ for (int i = 0; i < NCONTRIBUTORS; )
{
- return;
+ for (int j = 0; j < 4 && i < NCONTRIBUTORS; ++j, ++i)
+ {
+ fprintf(fp, "%-18s ", Contributors[i]);
+ }
+ fprintf(fp, "\n");
}
-
- /* fprintf(out,"\n");*/
-
- /* sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
-
- fprintf(out,"\n"); */
-
- for (i = 0; (i < NCR); i++)
+ fprintf(fp, "and the project leaders:\n");
+ fprintf(fp, "Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel\n");
+ fprintf(fp, "\n");
+ for (int i = 0; i < NCR; ++i)
{
- sp_print(out, CopyrightText[i]);
+ fprintf(fp, "%s\n", CopyrightText[i]);
}
- for (i = 0; (i < NLICENSE); i++)
+ fprintf(fp, "\n");
+ for (int i = 0; i < NLICENSE; ++i)
{
- sp_print(out, LicenseText[i]);
+ fprintf(fp, "%s\n", LicenseText[i]);
}
-
- fprintf(out, "\n");
-
- snprintf(buf, 256, "%s", Program());
-#ifdef GMX_DOUBLE
- strcat(buf, " (double precision)");
-#endif
- ster_print(out, buf);
- fprintf(out, "\n");
}
"Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of Hydrogen-rich Systems",
"J. Comput. Chem.",
20, 1999, "786-798" },
+ { "Lourenco2013a",
+ "Tuanan C. Lourenco and Mariny F. C. Coelho and Teodorico C. Ramalho and David van der Spoel and Luciano T. Costa",
+ "Insights on the Solubility of CO2 in 1-Ethyl-3-methylimidazolium Bis(trifluoromethylsulfonyl)imide from the Microscopic Point of View",
+ "Environ. Sci. Technol.",
+ 47, 2013, "7421-7429" },
{ "Timneanu2004a",
"N. Timneanu and C. Caleman and J. Hajdu and D. van der Spoel",
"Auger Electron Cascades in Water and Ice",
"Garmay Yu, Shvetsov A, Karelov D, Lebedev D, Radulescu A, Petukhov M, Isaev-Ivanov V",
"Correlated motion of protein subdomains and large-scale conformational flexibility of RecA protein filament",
"Journal of Physics: Conference Series",
- 340, 2012, "012094" }
+ 340, 2012, "012094" },
+ { "Kutzner2011b",
+ "C. Kutzner, H. Grubmuller, B. L. de Groot, and U. Zachariae",
+ "Computational Electrophysiology: The Molecular Dynamics of Ion Channel Permeation and Selectivity in Atomistic Detail",
+ "Biophys. J.",
+ 101, 2011, "809-817"},
+ { "Lundborg2014",
+ "M. Lundborg, R. Apostolov, D. Spangberg, A. Gardenas, D. van der Spoel and E. Lindahl",
+ "An efficient and extensible format, library, and API for binary trajectory data from molecular simulations",
+ "J. Comput. Chem.",
+ 35, 2014, "260-269"},
+ { "Goga2012",
+ "N. Goga and A. J. Rzepiela and A. H. de Vries and S. J. Marrink and H. J. C. Berendsen",
+ "Efficient Algorithms for Langevin and DPD Dynamics",
+ "J. Chem. Theory Comput.",
+ 8, 2012, "3637--3649"}
};
#define NSTR (int)asize(citedb)
fflush(fp);
}
-#ifdef GMX_GIT_VERSION_INFO
-/* Version information generated at compile time. */
-#include "gromacs/utility/gitversion.h"
-#else
-/* Fall back to statically defined version. */
-static const char _gmx_ver_string[] = "VERSION " VERSION;
-#endif
-
const char *GromacsVersion()
{
- return _gmx_ver_string;
+ return gmx_version();
+}
+
+const char *ShortProgram(void)
+{
+ const char *programName = NULL;
+
+ try
+ {
+ // TODO: Use the display name once it doesn't break anything.
+ programName = gmx::getProgramContext().programName();
+ }
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+
+ return programName;
+}
+
+const char *Program(void)
+{
+ try
+ {
+ return gmx::getProgramContext().fullBinaryPath();
+ }
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
-void gmx_print_version_info_gpu(FILE *fp);
-void gmx_print_version_info(FILE *fp)
+extern void gmx_print_version_info_gpu(FILE *fp);
+
+static void gmx_print_version_info(FILE *fp)
{
- fprintf(fp, "Gromacs version: %s\n", _gmx_ver_string);
-#ifdef GMX_GIT_VERSION_INFO
- fprintf(fp, "GIT SHA1 hash: %s\n", _gmx_full_git_hash);
- /* Only print out the branch information if present.
- * The generating script checks whether the branch point actually
- * coincides with the hash reported above, and produces an empty string
- * in such cases. */
- if (_gmx_central_base_hash[0] != 0)
+ fprintf(fp, "Gromacs version: %s\n", gmx_version());
+ const char *const git_hash = gmx_version_git_full_hash();
+ if (git_hash[0] != '\0')
{
- fprintf(fp, "Branched from: %s\n", _gmx_central_base_hash);
+ fprintf(fp, "GIT SHA1 hash: %s\n", git_hash);
+ }
+ const char *const base_hash = gmx_version_git_central_base_hash();
+ if (base_hash[0] != '\0')
+ {
+ fprintf(fp, "Branched from: %s\n", base_hash);
}
-#endif
#ifdef GMX_DOUBLE
fprintf(fp, "Precision: double\n");
#else
fprintf(fp, "Precision: single\n");
#endif
- fprintf(fp, "Memory model: %lu bit\n", 8*sizeof(void *));
+ fprintf(fp, "Memory model: %u bit\n", (unsigned)(8*sizeof(void *)));
#ifdef GMX_THREAD_MPI
fprintf(fp, "MPI library: thread_mpi\n");
#define gmx_stringify2(x) #x
#define gmx_stringify(x) gmx_stringify2(x)
fprintf(fp, "invsqrt routine: %s\n", gmx_stringify(gmx_invsqrt(x)));
- fprintf(fp, "CPU acceleration: %s\n", GMX_CPU_ACCELERATION_STRING);
-
- fprintf(fp, "FFT library: %s\n", gmx_fft_get_version_info());
-#ifdef GMX_LARGEFILES
- fprintf(fp, "Large file support: enabled\n");
+#ifndef __MIC__
+ fprintf(fp, "SIMD instructions: %s\n", GMX_SIMD_STRING);
#else
- fprintf(fp, "Large file support: disabled\n");
+ fprintf(fp, "SIMD instructions: %s\n", "Intel MIC");
#endif
+
+ fprintf(fp, "FFT library: %s\n", gmx_fft_get_version_info());
#ifdef HAVE_RDTSCP
fprintf(fp, "RDTSCP usage: enabled\n");
#else
fprintf(fp, "RDTSCP usage: disabled\n");
#endif
+#ifdef GMX_CXX11
+ fprintf(fp, "C++11 compilation: enabled\n");
+#else
+ fprintf(fp, "C++11 compilation: disabled\n");
+#endif
+#ifdef GMX_USE_TNG
+ fprintf(fp, "TNG support: enabled\n");
+#else
+ fprintf(fp, "TNG support: disabled\n");
+#endif
+#ifdef HAVE_EXTRAE
+ unsigned major, minor, revision;
+ Extrae_get_version(&major, &minor, &revision);
+ fprintf(fp, "Tracing support: enabled. Using Extrae-%d.%d.%d\n", major, minor, revision);
+#else
+ fprintf(fp, "Tracing support: disabled\n");
+#endif
+
fprintf(fp, "Built on: %s\n", BUILD_TIME);
fprintf(fp, "Built by: %s\n", BUILD_USER);
fprintf(fp, "Linked with Intel MKL version %d.%d.%d.\n",
__INTEL_MKL__, __INTEL_MKL_MINOR__, __INTEL_MKL_UPDATE__);
#endif
+#ifdef GMX_EXTERNAL_BOOST
+ const bool bExternalBoost = true;
+#else
+ const bool bExternalBoost = false;
+#endif
+ fprintf(fp, "Boost version: %d.%d.%d%s\n", BOOST_VERSION / 100000,
+ BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100,
+ bExternalBoost ? " (external)" : " (internal)");
#ifdef GMX_GPU
gmx_print_version_info_gpu(fp);
#endif
+}
+#ifdef GMX_DOUBLE
+void gmx_is_double_precision()
+{
+ /* allow precision detection */
}
+#else
+void gmx_is_single_precision()
+{
+ /* allow precision detection */
+}
+#endif
+
+namespace gmx
+{
+
+BinaryInformationSettings::BinaryInformationSettings()
+ : bExtendedInfo_(false), bCopyright_(false),
+ bGeneratedByHeader_(false), prefix_(""), suffix_("")
+{
+}
+
+void printBinaryInformation(FILE *fp,
+ const ProgramContextInterface &programContext)
+{
+ printBinaryInformation(fp, programContext, BinaryInformationSettings());
+}
+
+void printBinaryInformation(FILE *fp,
+ const ProgramContextInterface &programContext,
+ const BinaryInformationSettings &settings)
+{
+ const char *prefix = settings.prefix_;
+ const char *suffix = settings.suffix_;
+ const char *precisionString = "";
+#ifdef GMX_DOUBLE
+ precisionString = " (double precision)";
+#endif
+ const char *const name = programContext.displayName();
+ if (settings.bGeneratedByHeader_)
+ {
+ fprintf(fp, "%sCreated by:%s\n", prefix, suffix);
+ }
+ if (settings.bCopyright_)
+ {
+ GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
+ "Prefix/suffix not supported with copyright");
+ // This line is printed again after the copyright notice to make it
+ // appear together with all the other information, so that it is not
+ // necessary to read stuff above the copyright notice.
+ // The line above the copyright notice puts the copyright notice is
+ // context, though.
+ // TODO: It would be nice to know here whether we are really running a
+ // Gromacs binary or some other binary that is calling Gromacs; we
+ // could then print "%s is part of GROMACS" or some alternative text.
+ fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name,
+ gmx_version(), precisionString, suffix);
+ fprintf(fp, "\n");
+ printCopyright(fp);
+ fprintf(fp, "\n");
+ }
+ fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name,
+ gmx_version(), precisionString, suffix);
+ const char *const binaryPath = programContext.fullBinaryPath();
+ if (binaryPath != NULL && binaryPath[0] != '\0')
+ {
+ fprintf(fp, "%sExecutable: %s%s\n", prefix, binaryPath, suffix);
+ }
+ const char *const libraryPath = programContext.defaultLibraryDataPath();
+ if (libraryPath != NULL && libraryPath[0] != '\0')
+ {
+ fprintf(fp, "%sLibrary dir: %s%s\n", prefix, libraryPath, suffix);
+ }
+ const char *const commandLine = programContext.commandLine();
+ if (commandLine != NULL && commandLine[0] != '\0')
+ {
+ fprintf(fp, "%sCommand line:%s\n%s %s%s\n",
+ prefix, suffix, prefix, commandLine, suffix);
+ }
+ if (settings.bExtendedInfo_)
+ {
+ GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
+ "Prefix/suffix not supported with extended info");
+ fprintf(fp, "\n");
+ gmx_print_version_info(fp);
+ }
+}
+
+} // namespace gmx