3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * GROningen Mixture of Alchemy and Childrens' Stories
50 /* This file is completely threadsafe - keep it that way! */
52 #include "gromacs/fileio/futil.h"
53 #include "gromacs/legacyheaders/macros.h"
54 #include "gromacs/legacyheaders/random.h"
55 #include "gromacs/legacyheaders/smalloc.h"
56 #include "gromacs/legacyheaders/strdb.h"
57 #include "gromacs/legacyheaders/string2.h"
58 #include "gromacs/legacyheaders/vec.h"
60 #include "gromacs/fft/fft.h"
61 #include "gromacs/utility/exceptions.h"
62 #include "gromacs/utility/gmxassert.h"
63 #include "gromacs/utility/programinfo.h"
65 #include "buildinfo.h"
67 static gmx_bool be_cool(void)
69 /* Yes, it is bad to check the environment variable every call,
70 * but we dont call this routine often, and it avoids using
71 * a mutex for locking the variable...
73 #ifdef GMX_COOL_QUOTES
74 return (getenv("GMX_NO_QUOTES") == NULL);
81 static void pukeit(const char *db, const char *defstring, char *retstring,
82 int retsize, int *cqnum)
89 if (be_cool() && ((fp = low_libopen(db, FALSE)) != NULL))
91 nhlp = fget_lines(fp, &help);
92 /* for libraries we can use the low-level close routines */
95 *cqnum = static_cast<int>(nhlp*rando(&seed));
96 if (strlen(help[*cqnum]) >= STRLEN)
98 help[*cqnum][STRLEN-1] = '\0';
100 strncpy(retstring, help[*cqnum], retsize);
101 for (i = 0; (i < nhlp); i++)
110 strncpy(retstring, defstring, retsize);
114 void bromacs(char *retstring, int retsize)
118 pukeit("bromacs.dat",
119 "Groningen Machine for Chemical Simulation",
120 retstring, retsize, &dum);
123 void cool_quote(char *retstring, int retsize, int *cqnum)
138 /* protect audience from explicit lyrics */
139 snew(tmpstr, retsize+1);
140 pukeit("gurgle.dat", "Thanx for Using GROMACS - Have a Nice Day",
141 tmpstr, retsize-2, p);
143 if ((ptr = strchr(tmpstr, '_')) != NULL)
147 sprintf(retstring, "\"%s\" %s", tmpstr, ptr);
151 strcpy(retstring, tmpstr);
156 static void printCopyright(FILE *fp)
158 static const char * const CopyrightText[] = {
159 "GROMACS is written by:",
160 "Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,",
161 "Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra,",
162 "Gerrit Groenhof, Christoph Junghans, Peter Kasson, Carsten Kutzner",
163 "Per Larsson, Magnus Lundborg, Pieter Meulenhoff, Teemu Murtola,",
164 "Szilard Pall, Sander Pronk, Roland Schulz,",
165 "Michael Shirts, Alfons Sijbers, Peter Tieleman,\n",
166 "Christian Wennberg, Mark Abraham\n",
167 "Berk Hess, David van der Spoel, and Erik Lindahl.\n",
168 "Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
169 "Copyright (c) 2001-2013, The GROMACS development team at",
170 "Uppsala University & The Royal Institute of Technology, Sweden.",
171 "check out http://www.gromacs.org for more information."
174 static const char * const LicenseText[] = {
175 "GROMACS is free software; you can redistribute it and/or modify it",
176 "under the terms of the GNU Lesser General Public License",
177 "as published by the Free Software Foundation; either version 2.1",
178 "of the License, or (at your option) any later version."
181 #define NCR (int)asize(CopyrightText)
182 // FAH has an exception permission from LGPL to allow digital signatures in Gromacs.
186 #define NLICENSE (int)asize(LicenseText)
189 for (int i = 0; i < NCR; ++i)
191 fprintf(fp, "%s\n", CopyrightText[i]);
194 for (int i = 0; i < NLICENSE; ++i)
196 fprintf(fp, "%s\n", LicenseText[i]);
201 void gmx_thanx(FILE *fp)
206 /* protect the audience from suggestive discussions */
207 cool_quote(cq, 1023, &cqnum);
211 fprintf(fp, "\ngcq#%d: %s\n\n", cqnum, cq);
215 fprintf(fp, "\n%s\n\n", cq);
228 void please_cite(FILE *fp, const char *key)
230 static const t_citerec citedb[] = {
232 "M. P. Allen and D. J. Tildesley",
233 "Computer simulation of liquids",
234 "Oxford Science Publications",
237 "H. J. C. Berendsen, D. van der Spoel and R. van Drunen",
238 "GROMACS: A message-passing parallel molecular dynamics implementation",
242 "H. J. C. Berendsen, J. P. M. Postma, A. DiNola and J. R. Haak",
243 "Molecular dynamics with coupling to an external bath",
245 81, 1984, "3684-3690" },
247 "J. P. Ryckaert and G. Ciccotti and H. J. C. Berendsen",
248 "Numerical Integration of the Cartesian Equations of Motion of a System with Constraints; Molecular Dynamics of n-Alkanes",
250 23, 1977, "327-341" },
252 "S. Miyamoto and P. A. Kollman",
253 "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithms for Rigid Water Models",
255 13, 1992, "952-962" },
257 "D. T. Cromer & J. B. Mann",
258 "X-ray scattering factors computed from numerical Hartree-Fock wave functions",
262 "E. Barth and K. Kuczera and B. Leimkuhler and R. D. Skeel",
263 "Algorithms for Constrained Molecular Dynamics",
265 16, 1995, "1192-1209" },
267 "U. Essmann, L. Perera, M. L. Berkowitz, T. Darden, H. Lee and L. G. Pedersen ",
268 "A smooth particle mesh Ewald method",
270 103, 1995, "8577-8592" },
272 "A. E. Torda and R. M. Scheek and W. F. van Gunsteren",
273 "Time-dependent distance restraints in molecular dynamics simulations",
275 157, 1989, "289-294" },
277 "I. G. Tironi and R. Sperb and P. E. Smith and W. F. van Gunsteren",
278 "Generalized reaction field method for molecular dynamics simulations",
280 102, 1995, "5451-5459" },
282 "B. Hess and H. Bekker and H. J. C. Berendsen and J. G. E. M. Fraaije",
283 "LINCS: A Linear Constraint Solver for molecular simulations",
285 18, 1997, "1463-1472" },
288 "P-LINCS: A Parallel Linear Constraint Solver for molecular simulation",
289 "J. Chem. Theory Comput.",
290 4, 2008, "116-122" },
292 "B. Hess and C. Kutzner and D. van der Spoel and E. Lindahl",
293 "GROMACS 4: Algorithms for highly efficient, load-balanced, and scalable molecular simulation",
294 "J. Chem. Theory Comput.",
295 4, 2008, "435-447" },
297 "J. S. Hub, B. L. de Groot and D. van der Spoel",
298 "g_wham - A free weighted histogram analysis implementation including robust error and autocorrelation estimates",
299 "J. Chem. Theory Comput.",
300 6, 2010, "3713-3720"},
302 "Y. In-Chul and M. L. Berkowitz",
303 "Ewald summation for systems with slab geometry",
305 111, 1999, "3155-3162" },
307 "B. L. de Groot and D. M. F. van Aalten and R. M. Scheek and A. Amadei and G. Vriend and H. J. C. Berendsen",
308 "Prediction of Protein Conformational Freedom From Distance Constrains",
310 29, 1997, "240-251" },
312 "D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen",
313 "A systematic study of water models for molecular simulation. Derivation of models optimized for use with a reaction-field.",
315 108, 1998, "10220-10230" },
317 "D. S. Wishart and A. M. Nip",
318 "Protein Chemical Shift Analysis: A Practical Guide",
319 "Biochem. Cell Biol.",
320 76, 1998, "153-163" },
322 "V. N. Maiorov and G. M. Crippen",
323 "Size-Independent Comparison of Protein Three-Dimensional Structures",
324 "PROTEINS: Struct. Funct. Gen.",
325 22, 1995, "273-283" },
327 "K. A. Feenstra and B. Hess and H. J. C. Berendsen",
328 "Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of Hydrogen-rich Systems",
330 20, 1999, "786-798" },
332 "Tuanan C. Lourenco and Mariny F. C. Coelho and Teodorico C. Ramalho and David van der Spoel and Luciano T. Costa",
333 "Insights on the Solubility of CO2 in 1-Ethyl-3-methylimidazolium Bis(trifluoromethylsulfonyl)imide from the Microscopic Point of View",
334 "Environ. Sci. Technol.",
335 47, 2013, "7421-7429" },
337 "N. Timneanu and C. Caleman and J. Hajdu and D. van der Spoel",
338 "Auger Electron Cascades in Water and Ice",
340 299, 2004, "277-283" },
342 "T. A. Pascal and S. T. Lin and W. A. Goddard III",
343 "Thermodynamics of liquids: standard molar entropies and heat capacities of common solvents from 2PT molecular dynamics",
344 "Phys. Chem. Chem. Phys.",
345 13, 2011, "169-181" },
347 "C. Caleman and P. J. van Maaren and M. Hong and J. S. Hub and L. T. da Costa and D. van der Spoel",
348 "Force Field Benchmark of Organic Liquids: Density, Enthalpy of Vaporization, Heat Capacities, Surface Tension, Isothermal Compressibility, Volumetric Expansion Coefficient, and Dielectric Constant",
349 "J. Chem. Theo. Comp.",
352 "E. Lindahl and B. Hess and D. van der Spoel",
353 "GROMACS 3.0: A package for molecular simulation and trajectory analysis",
355 7, 2001, "306-317" },
357 "J. Wang and W. Wang and S. Huo and M. Lee and P. A. Kollman",
358 "Solvation model based on weighted solvent accessible surface area",
360 105, 2001, "5055-5067" },
362 "D. Eisenberg and A. D. McLachlan",
363 "Solvation energy in protein folding and binding",
365 319, 1986, "199-203" },
368 "van der Waals Volumes and Radii",
370 68, 1964, "441-451" },
372 "Frank Eisenhaber and Philip Lijnzaad and Patrick Argos and Chris Sander and Michael Scharf",
373 "The Double Cube Lattice Method: Efficient Approaches to Numerical Integration of Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies",
375 16, 1995, "273-284" },
377 "B. Hess, H. Saint-Martin and H.J.C. Berendsen",
378 "Flexible constraints: an adiabatic treatment of quantum degrees of freedom, with application to the flexible and polarizable MCDHO model for water",
380 116, 2002, "9602-9610" },
382 "Csaba Hetenyi and David van der Spoel",
383 "Efficient docking of peptides to proteins without prior knowledge of the binding site.",
385 11, 2002, "1729-1737" },
387 "B. Hess and R.M. Scheek",
388 "Orientation restraints in molecular dynamics simulations using time and ensemble averaging",
390 164, 2003, "19-27" },
392 "A. K. Rappe and W. A. Goddard III",
393 "Charge Equillibration for Molecular Dynamics Simulations",
395 95, 1991, "3358-3363" },
397 "Y. Mu, P. H. Nguyen and G. Stock",
398 "Energy landscape of a small peptide revelaed by dihedral angle principal component analysis",
399 "Prot. Struct. Funct. Bioinf.",
402 "T. Okabe and M. Kawata and Y. Okamoto and M. Mikami",
403 "Replica-exchange {M}onte {C}arlo method for the isobaric-isothermal ensemble",
405 335, 2001, "435-439" },
407 "K. Hukushima and K. Nemoto",
408 "Exchange Monte Carlo Method and Application to Spin Glass Simulations",
409 "J. Phys. Soc. Jpn.",
410 65, 1996, "1604-1608" },
413 "Dipolar Relaxation and Nuclear Overhauser effects in nonrigid molecules: The effect of fluctuating internuclear distances",
415 72, 1980, "6035-6043" },
417 "P. Bultinck and W. Langenaeker and P. Lahorte and F. De Proft and P. Geerlings and M. Waroquier and J. P. Tollenaere",
418 "The electronegativity equalization method I: Parametrization and validation for atomic charge calculations",
420 106, 2002, "7887-7894" },
422 "Q. Y. Yang and K. A. Sharp",
423 "Atomic charge parameters for the finite difference Poisson-Boltzmann method using electronegativity neutralization",
424 "J. Chem. Theory Comput.",
425 2, 2006, "1152-1167" },
427 "D. van der Spoel, E. Lindahl, B. Hess, G. Groenhof, A. E. Mark and H. J. C. Berendsen",
428 "GROMACS: Fast, Flexible and Free",
430 26, 2005, "1701-1719" },
432 "D. van der Spoel, P. J. van Maaren, P. Larsson and N. Timneanu",
433 "Thermodynamics of hydrogen bonding in hydrophilic and hydrophobic media",
435 110, 2006, "4393-4398" },
437 "D. van der Spoel and M. M. Seibert",
438 "Protein folding kinetics and thermodynamics from atomistic simulations",
439 "Phys. Rev. Letters",
440 96, 2006, "238102" },
443 "Transverse-current autocorrelation-function calculations of the shear viscosity for molecular liquids",
445 49, 1994, "359-366" },
447 "G. Bussi, D. Donadio and M. Parrinello",
448 "Canonical sampling through velocity rescaling",
450 126, 2007, "014101" },
452 "J. S. Hub and B. L. de Groot",
453 "Does CO2 permeate through Aquaporin-1?",
455 91, 2006, "842-848" },
457 "J. S. Hub and B. L. de Groot",
458 "Mechanism of selectivity in aquaporins and aquaglyceroporins",
460 105, 2008, "1198-1203" },
462 "M. S. Friedrichs, P. Eastman, V. Vaidyanathan, M. Houston, S. LeGrand, A. L. Beberg, D. L. Ensign, C. M. Bruns, and V. S. Pande",
463 "Accelerating Molecular Dynamic Simulation on Graphics Processing Units",
465 30, 2009, "864-872" },
467 "O. Engin, A. Villa, M. Sayar and B. Hess",
468 "Driving Forces for Adsorption of Amphiphilic Peptides to Air-Water Interface",
470 114, 2010, "11093" },
472 "S. Fritsch, C. Junghans and K. Kremer",
473 "Adaptive molecular simulation study on structure formation of toluene around C60 using Gromacs",
474 "J. Chem. Theo. Comp.",
477 "C. Junghans and S. Poblete",
478 "A reference implementation of the adaptive resolution scheme in ESPResSo",
482 "H. Wang, F. Dommert, C.Holm",
483 "Optimizing working parameters of the smooth particle mesh Ewald algorithm in terms of accuracy and efficiency",
485 133, 2010, "034117" },
487 "Y. Sugita, Y. Okamoto",
488 "Replica-exchange molecular dynamics method for protein folding",
490 314, 1999, "141-151" },
492 "C. Kutzner and J. Czub and H. Grubmuller",
493 "Keep it Flexible: Driving Macromolecular Rotary Motions in Atomistic Simulations with GROMACS",
494 "J. Chem. Theory Comput.",
495 7, 2011, "1381-1393" },
497 "M. Hoefling, N. Lima, D. Haenni, C.A.M. Seidel, B. Schuler, H. Grubmuller",
498 "Structural Heterogeneity and Quantitative FRET Efficiency Distributions of Polyprolines through a Hybrid Atomistic Simulation and Monte Carlo Approach",
502 "R. W. Hockney and J. W. Eastwood",
503 "Computer simulation using particles",
507 "V. Ballenegger, J.J. Cerda, and C. Holm",
508 "How to Convert SPME to P3M: Influence Functions and Error Estimates",
509 "J. Chem. Theory Comput.",
510 8, 2012, "936-947" },
512 "Garmay Yu, Shvetsov A, Karelov D, Lebedev D, Radulescu A, Petukhov M, Isaev-Ivanov V",
513 "Correlated motion of protein subdomains and large-scale conformational flexibility of RecA protein filament",
514 "Journal of Physics: Conference Series",
515 340, 2012, "012094" }
517 #define NSTR (int)asize(citedb)
522 #define LINE_WIDTH 79
529 for (index = 0; (index < NSTR) && (strcmp(citedb[index].key, key) != 0); index++)
534 fprintf(fp, "\n++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++\n");
537 /* Insert newlines */
538 author = wrap_lines(citedb[index].author, LINE_WIDTH, 0, FALSE);
539 title = wrap_lines(citedb[index].title, LINE_WIDTH, 0, FALSE);
540 fprintf(fp, "%s\n%s\n%s %d (%d) pp. %s\n",
541 author, title, citedb[index].journal,
542 citedb[index].volume, citedb[index].year,
543 citedb[index].pages);
549 fprintf(fp, "Entry %s not found in citation database\n", key);
551 fprintf(fp, "-------- -------- --- Thank You --- -------- --------\n\n");
555 #ifdef GMX_GIT_VERSION_INFO
556 /* Version information generated at compile time. */
557 #include "gromacs/utility/gitversion.h"
559 /* Fall back to statically defined version. */
560 static const char _gmx_ver_string[] = "VERSION " VERSION;
563 const char *GromacsVersion()
565 return _gmx_ver_string;
568 const char *ShortProgram(void)
572 // TODO: Use the display name once it doesn't break anything.
573 return gmx::ProgramInfo::getInstance().programName().c_str();
575 GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
578 const char *Program(void)
582 return gmx::ProgramInfo::getInstance().fullBinaryPath().c_str();
584 GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
588 extern void gmx_print_version_info_gpu(FILE *fp);
590 static void gmx_print_version_info(FILE *fp)
592 fprintf(fp, "Gromacs version: %s\n", _gmx_ver_string);
593 #ifdef GMX_GIT_VERSION_INFO
594 fprintf(fp, "GIT SHA1 hash: %s\n", _gmx_full_git_hash);
595 /* Only print out the branch information if present.
596 * The generating script checks whether the branch point actually
597 * coincides with the hash reported above, and produces an empty string
599 if (_gmx_central_base_hash[0] != 0)
601 fprintf(fp, "Branched from: %s\n", _gmx_central_base_hash);
606 fprintf(fp, "Precision: double\n");
608 fprintf(fp, "Precision: single\n");
610 fprintf(fp, "Memory model: %lu bit\n", 8*sizeof(void *));
612 #ifdef GMX_THREAD_MPI
613 fprintf(fp, "MPI library: thread_mpi\n");
614 #elif defined(GMX_MPI)
615 fprintf(fp, "MPI library: MPI\n");
617 fprintf(fp, "MPI library: none\n");
620 fprintf(fp, "OpenMP support: enabled\n");
622 fprintf(fp, "OpenMP support: disabled\n");
625 fprintf(fp, "GPU support: enabled\n");
627 fprintf(fp, "GPU support: disabled\n");
629 /* A preprocessor trick to avoid duplicating logic from vec.h */
630 #define gmx_stringify2(x) #x
631 #define gmx_stringify(x) gmx_stringify2(x)
632 fprintf(fp, "invsqrt routine: %s\n", gmx_stringify(gmx_invsqrt(x)));
633 fprintf(fp, "CPU acceleration: %s\n", GMX_CPU_ACCELERATION_STRING);
635 fprintf(fp, "FFT library: %s\n", gmx_fft_get_version_info());
637 fprintf(fp, "RDTSCP usage: enabled\n");
639 fprintf(fp, "RDTSCP usage: disabled\n");
642 fprintf(fp, "Built on: %s\n", BUILD_TIME);
643 fprintf(fp, "Built by: %s\n", BUILD_USER);
644 fprintf(fp, "Build OS/arch: %s\n", BUILD_HOST);
645 fprintf(fp, "Build CPU vendor: %s\n", BUILD_CPU_VENDOR);
646 fprintf(fp, "Build CPU brand: %s\n", BUILD_CPU_BRAND);
647 fprintf(fp, "Build CPU family: %d Model: %d Stepping: %d\n",
648 BUILD_CPU_FAMILY, BUILD_CPU_MODEL, BUILD_CPU_STEPPING);
649 /* TODO: The below strings can be quite long, so it would be nice to wrap
650 * them. Can wait for later, as the master branch has ready code to do all
652 fprintf(fp, "Build CPU features: %s\n", BUILD_CPU_FEATURES);
653 fprintf(fp, "C compiler: %s\n", BUILD_C_COMPILER);
654 fprintf(fp, "C compiler flags: %s\n", BUILD_CFLAGS);
655 fprintf(fp, "C++ compiler: %s\n", BUILD_CXX_COMPILER);
656 fprintf(fp, "C++ compiler flags: %s\n", BUILD_CXXFLAGS);
658 /* MKL might be used for LAPACK/BLAS even if FFTs use FFTW, so keep it separate */
659 fprintf(fp, "Linked with Intel MKL version %d.%d.%d.\n",
660 __INTEL_MKL__, __INTEL_MKL_MINOR__, __INTEL_MKL_UPDATE__);
663 gmx_print_version_info_gpu(fp);
670 BinaryInformationSettings::BinaryInformationSettings()
671 : bExtendedInfo_(false), bCopyright_(false),
672 bGeneratedByHeader_(false), prefix_(""), suffix_("")
676 void printBinaryInformation(FILE *fp, const ProgramInfo &programInfo)
678 printBinaryInformation(fp, programInfo, BinaryInformationSettings());
681 void printBinaryInformation(FILE *fp, const ProgramInfo &programInfo,
682 const BinaryInformationSettings &settings)
684 const char *prefix = settings.prefix_;
685 const char *suffix = settings.suffix_;
686 const char *precisionString = "";
688 precisionString = " (double precision)";
690 const std::string &name = programInfo.displayName();
691 if (settings.bGeneratedByHeader_)
693 fprintf(fp, "%sCreated by:%s\n", prefix, suffix);
695 if (settings.bCopyright_)
697 GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
698 "Prefix/suffix not supported with copyright");
699 // This line is printed again after the copyright notice to make it
700 // appear together with all the other information, so that it is not
701 // necessary to read stuff above the copyright notice.
702 // The line above the copyright notice puts the copyright notice is
704 // TODO: It would be nice to know here whether we are really running a
705 // Gromacs binary or some other binary that is calling Gromacs; we
706 // could then print "%s is part of GROMACS" or some alternative text.
707 fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name.c_str(),
708 GromacsVersion(), precisionString, suffix);
713 fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name.c_str(),
714 GromacsVersion(), precisionString, suffix);
715 fprintf(fp, "%sExecutable: %s%s\n", prefix,
716 programInfo.fullBinaryPath().c_str(), suffix);
717 fprintf(fp, "%sCommand line:%s\n%s %s%s\n",
718 prefix, suffix, prefix, programInfo.commandLine().c_str(), suffix);
719 if (settings.bExtendedInfo_)
721 GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
722 "Prefix/suffix not supported with extended info");
724 gmx_print_version_info(fp);