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/legacyheaders/futil.h"
53 #include "gromacs/legacyheaders/macros.h"
54 #include "gromacs/legacyheaders/random.h"
55 #include "gromacs/legacyheaders/smalloc.h"
56 #include "gromacs/legacyheaders/statutil.h"
57 #include "gromacs/legacyheaders/strdb.h"
58 #include "gromacs/legacyheaders/string2.h"
59 #include "gromacs/legacyheaders/vec.h"
61 #include "gromacs/fft/fft.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 space(FILE *out, int n)
83 fprintf(out, "%*s", n, "");
86 static void sp_print(FILE *out, const char *s)
91 space(out, (80-slen)/2);
92 fprintf(out, "%s\n", s);
95 static void ster_print(FILE *out, const char *s)
100 snprintf(buf, 128, ":-) %s (-:", s);
102 space(out, (80-slen)/2);
103 fprintf(out, "%s\n", buf);
107 static void pukeit(const char *db, const char *defstring, char *retstring,
108 int retsize, int *cqnum)
115 if (be_cool() && ((fp = low_libopen(db, FALSE)) != NULL))
117 nhlp = fget_lines(fp, &help);
118 /* for libraries we can use the low-level close routines */
121 *cqnum = static_cast<int>(nhlp*rando(&seed));
122 if (strlen(help[*cqnum]) >= STRLEN)
124 help[*cqnum][STRLEN-1] = '\0';
126 strncpy(retstring, help[*cqnum], retsize);
127 for (i = 0; (i < nhlp); i++)
136 strncpy(retstring, defstring, retsize);
140 void bromacs(char *retstring, int retsize)
144 pukeit("bromacs.dat",
145 "Groningen Machine for Chemical Simulation",
146 retstring, retsize, &dum);
149 void cool_quote(char *retstring, int retsize, int *cqnum)
164 /* protect audience from explicit lyrics */
165 snew(tmpstr, retsize+1);
166 pukeit("gurgle.dat", "Thanx for Using GROMACS - Have a Nice Day",
167 tmpstr, retsize-2, p);
169 if ((ptr = strchr(tmpstr, '_')) != NULL)
173 sprintf(retstring, "\"%s\" %s", tmpstr, ptr);
177 strcpy(retstring, tmpstr);
182 static void CopyRight(FILE *out)
184 static const char * const CopyrightText[] = {
185 "Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,",
186 "Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, ",
187 "Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, ",
188 "Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, ",
189 "Michael Shirts, Alfons Sijbers, Peter Tieleman,\n",
190 "Berk Hess, David van der Spoel, and Erik Lindahl.\n",
191 "Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
192 "Copyright (c) 2001-2013, The GROMACS development team at",
193 "Uppsala University & The Royal Institute of Technology, Sweden.",
194 "check out http://www.gromacs.org for more information.\n"
197 static const char * const LicenseText[] = {
198 "This program is free software; you can redistribute it and/or",
199 "modify it under the terms of the GNU Lesser General Public License",
200 "as published by the Free Software Foundation; either version 2.1",
201 "of the License, or (at your option) any later version."
204 #define NCR (int)asize(CopyrightText)
205 /* TODO: Is this exception still needed? */
207 #define NLICENSE 0 /*FAH has an exception permission from LGPL to allow digital signatures in Gromacs*/
209 #define NLICENSE (int)asize(LicenseText)
215 // TODO: Consider making the output more compact to fit better with
216 // other information written by printBinaryInformation().
217 ster_print(out, "G R O M A C S");
220 bromacs(tmpstr, 1023);
221 sp_print(out, tmpstr);
224 for (i = 0; (i < NCR); i++)
226 sp_print(out, CopyrightText[i]);
228 for (i = 0; (i < NLICENSE); i++)
230 sp_print(out, LicenseText[i]);
235 void gmx_thanx(FILE *fp)
240 /* protect the audience from suggestive discussions */
241 cool_quote(cq, 1023, &cqnum);
245 fprintf(fp, "\ngcq#%d: %s\n\n", cqnum, cq);
249 fprintf(fp, "\n%s\n\n", cq);
262 void please_cite(FILE *fp, const char *key)
264 static const t_citerec citedb[] = {
266 "M. P. Allen and D. J. Tildesley",
267 "Computer simulation of liquids",
268 "Oxford Science Publications",
271 "H. J. C. Berendsen, D. van der Spoel and R. van Drunen",
272 "GROMACS: A message-passing parallel molecular dynamics implementation",
276 "H. J. C. Berendsen, J. P. M. Postma, A. DiNola and J. R. Haak",
277 "Molecular dynamics with coupling to an external bath",
279 81, 1984, "3684-3690" },
281 "J. P. Ryckaert and G. Ciccotti and H. J. C. Berendsen",
282 "Numerical Integration of the Cartesian Equations of Motion of a System with Constraints; Molecular Dynamics of n-Alkanes",
284 23, 1977, "327-341" },
286 "S. Miyamoto and P. A. Kollman",
287 "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithms for Rigid Water Models",
289 13, 1992, "952-962" },
291 "D. T. Cromer & J. B. Mann",
292 "X-ray scattering factors computed from numerical Hartree-Fock wave functions",
296 "E. Barth and K. Kuczera and B. Leimkuhler and R. D. Skeel",
297 "Algorithms for Constrained Molecular Dynamics",
299 16, 1995, "1192-1209" },
301 "U. Essmann, L. Perera, M. L. Berkowitz, T. Darden, H. Lee and L. G. Pedersen ",
302 "A smooth particle mesh Ewald method",
304 103, 1995, "8577-8592" },
306 "A. E. Torda and R. M. Scheek and W. F. van Gunsteren",
307 "Time-dependent distance restraints in molecular dynamics simulations",
309 157, 1989, "289-294" },
311 "I. G. Tironi and R. Sperb and P. E. Smith and W. F. van Gunsteren",
312 "Generalized reaction field method for molecular dynamics simulations",
314 102, 1995, "5451-5459" },
316 "B. Hess and H. Bekker and H. J. C. Berendsen and J. G. E. M. Fraaije",
317 "LINCS: A Linear Constraint Solver for molecular simulations",
319 18, 1997, "1463-1472" },
322 "P-LINCS: A Parallel Linear Constraint Solver for molecular simulation",
323 "J. Chem. Theory Comput.",
324 4, 2008, "116-122" },
326 "B. Hess and C. Kutzner and D. van der Spoel and E. Lindahl",
327 "GROMACS 4: Algorithms for highly efficient, load-balanced, and scalable molecular simulation",
328 "J. Chem. Theory Comput.",
329 4, 2008, "435-447" },
331 "J. S. Hub, B. L. de Groot and D. van der Spoel",
332 "g_wham - A free weighted histogram analysis implementation including robust error and autocorrelation estimates",
333 "J. Chem. Theory Comput.",
334 6, 2010, "3713-3720"},
336 "Y. In-Chul and M. L. Berkowitz",
337 "Ewald summation for systems with slab geometry",
339 111, 1999, "3155-3162" },
341 "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",
342 "Prediction of Protein Conformational Freedom From Distance Constrains",
344 29, 1997, "240-251" },
346 "D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen",
347 "A systematic study of water models for molecular simulation. Derivation of models optimized for use with a reaction-field.",
349 108, 1998, "10220-10230" },
351 "D. S. Wishart and A. M. Nip",
352 "Protein Chemical Shift Analysis: A Practical Guide",
353 "Biochem. Cell Biol.",
354 76, 1998, "153-163" },
356 "V. N. Maiorov and G. M. Crippen",
357 "Size-Independent Comparison of Protein Three-Dimensional Structures",
358 "PROTEINS: Struct. Funct. Gen.",
359 22, 1995, "273-283" },
361 "K. A. Feenstra and B. Hess and H. J. C. Berendsen",
362 "Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of Hydrogen-rich Systems",
364 20, 1999, "786-798" },
366 "Tuanan C. Lourenco and Mariny F. C. Coelho and Teodorico C. Ramalho and David van der Spoel and Luciano T. Costa",
367 "Insights on the Solubility of CO2 in 1-Ethyl-3-methylimidazolium Bis(trifluoromethylsulfonyl)imide from the Microscopic Point of View",
368 "Environ. Sci. Technol.",
369 47, 2013, "7421-7429" },
371 "N. Timneanu and C. Caleman and J. Hajdu and D. van der Spoel",
372 "Auger Electron Cascades in Water and Ice",
374 299, 2004, "277-283" },
376 "T. A. Pascal and S. T. Lin and W. A. Goddard III",
377 "Thermodynamics of liquids: standard molar entropies and heat capacities of common solvents from 2PT molecular dynamics",
378 "Phys. Chem. Chem. Phys.",
379 13, 2011, "169-181" },
381 "C. Caleman and P. J. van Maaren and M. Hong and J. S. Hub and L. T. da Costa and D. van der Spoel",
382 "Force Field Benchmark of Organic Liquids: Density, Enthalpy of Vaporization, Heat Capacities, Surface Tension, Isothermal Compressibility, Volumetric Expansion Coefficient, and Dielectric Constant",
383 "J. Chem. Theo. Comp.",
386 "E. Lindahl and B. Hess and D. van der Spoel",
387 "GROMACS 3.0: A package for molecular simulation and trajectory analysis",
389 7, 2001, "306-317" },
391 "J. Wang and W. Wang and S. Huo and M. Lee and P. A. Kollman",
392 "Solvation model based on weighted solvent accessible surface area",
394 105, 2001, "5055-5067" },
396 "D. Eisenberg and A. D. McLachlan",
397 "Solvation energy in protein folding and binding",
399 319, 1986, "199-203" },
402 "van der Waals Volumes and Radii",
404 68, 1964, "441-451" },
406 "Frank Eisenhaber and Philip Lijnzaad and Patrick Argos and Chris Sander and Michael Scharf",
407 "The Double Cube Lattice Method: Efficient Approaches to Numerical Integration of Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies",
409 16, 1995, "273-284" },
411 "B. Hess, H. Saint-Martin and H.J.C. Berendsen",
412 "Flexible constraints: an adiabatic treatment of quantum degrees of freedom, with application to the flexible and polarizable MCDHO model for water",
414 116, 2002, "9602-9610" },
416 "Csaba Hetenyi and David van der Spoel",
417 "Efficient docking of peptides to proteins without prior knowledge of the binding site.",
419 11, 2002, "1729-1737" },
421 "B. Hess and R.M. Scheek",
422 "Orientation restraints in molecular dynamics simulations using time and ensemble averaging",
424 164, 2003, "19-27" },
426 "A. K. Rappe and W. A. Goddard III",
427 "Charge Equillibration for Molecular Dynamics Simulations",
429 95, 1991, "3358-3363" },
431 "Y. Mu, P. H. Nguyen and G. Stock",
432 "Energy landscape of a small peptide revelaed by dihedral angle principal component analysis",
433 "Prot. Struct. Funct. Bioinf.",
436 "T. Okabe and M. Kawata and Y. Okamoto and M. Mikami",
437 "Replica-exchange {M}onte {C}arlo method for the isobaric-isothermal ensemble",
439 335, 2001, "435-439" },
441 "K. Hukushima and K. Nemoto",
442 "Exchange Monte Carlo Method and Application to Spin Glass Simulations",
443 "J. Phys. Soc. Jpn.",
444 65, 1996, "1604-1608" },
447 "Dipolar Relaxation and Nuclear Overhauser effects in nonrigid molecules: The effect of fluctuating internuclear distances",
449 72, 1980, "6035-6043" },
451 "P. Bultinck and W. Langenaeker and P. Lahorte and F. De Proft and P. Geerlings and M. Waroquier and J. P. Tollenaere",
452 "The electronegativity equalization method I: Parametrization and validation for atomic charge calculations",
454 106, 2002, "7887-7894" },
456 "Q. Y. Yang and K. A. Sharp",
457 "Atomic charge parameters for the finite difference Poisson-Boltzmann method using electronegativity neutralization",
458 "J. Chem. Theory Comput.",
459 2, 2006, "1152-1167" },
461 "D. van der Spoel, E. Lindahl, B. Hess, G. Groenhof, A. E. Mark and H. J. C. Berendsen",
462 "GROMACS: Fast, Flexible and Free",
464 26, 2005, "1701-1719" },
466 "D. van der Spoel, P. J. van Maaren, P. Larsson and N. Timneanu",
467 "Thermodynamics of hydrogen bonding in hydrophilic and hydrophobic media",
469 110, 2006, "4393-4398" },
471 "D. van der Spoel and M. M. Seibert",
472 "Protein folding kinetics and thermodynamics from atomistic simulations",
473 "Phys. Rev. Letters",
474 96, 2006, "238102" },
477 "Transverse-current autocorrelation-function calculations of the shear viscosity for molecular liquids",
479 49, 1994, "359-366" },
481 "G. Bussi, D. Donadio and M. Parrinello",
482 "Canonical sampling through velocity rescaling",
484 126, 2007, "014101" },
486 "J. S. Hub and B. L. de Groot",
487 "Does CO2 permeate through Aquaporin-1?",
489 91, 2006, "842-848" },
491 "J. S. Hub and B. L. de Groot",
492 "Mechanism of selectivity in aquaporins and aquaglyceroporins",
494 105, 2008, "1198-1203" },
496 "M. S. Friedrichs, P. Eastman, V. Vaidyanathan, M. Houston, S. LeGrand, A. L. Beberg, D. L. Ensign, C. M. Bruns, and V. S. Pande",
497 "Accelerating Molecular Dynamic Simulation on Graphics Processing Units",
499 30, 2009, "864-872" },
501 "O. Engin, A. Villa, M. Sayar and B. Hess",
502 "Driving Forces for Adsorption of Amphiphilic Peptides to Air-Water Interface",
504 114, 2010, "11093" },
506 "S. Fritsch, C. Junghans and K. Kremer",
507 "Adaptive molecular simulation study on structure formation of toluene around C60 using Gromacs",
508 "J. Chem. Theo. Comp.",
511 "C. Junghans and S. Poblete",
512 "A reference implementation of the adaptive resolution scheme in ESPResSo",
516 "H. Wang, F. Dommert, C.Holm",
517 "Optimizing working parameters of the smooth particle mesh Ewald algorithm in terms of accuracy and efficiency",
519 133, 2010, "034117" },
521 "Y. Sugita, Y. Okamoto",
522 "Replica-exchange molecular dynamics method for protein folding",
524 314, 1999, "141-151" },
526 "C. Kutzner and J. Czub and H. Grubmuller",
527 "Keep it Flexible: Driving Macromolecular Rotary Motions in Atomistic Simulations with GROMACS",
528 "J. Chem. Theory Comput.",
529 7, 2011, "1381-1393" },
531 "M. Hoefling, N. Lima, D. Haenni, C.A.M. Seidel, B. Schuler, H. Grubmuller",
532 "Structural Heterogeneity and Quantitative FRET Efficiency Distributions of Polyprolines through a Hybrid Atomistic Simulation and Monte Carlo Approach",
536 "R. W. Hockney and J. W. Eastwood",
537 "Computer simulation using particles",
541 "V. Ballenegger, J.J. Cerda, and C. Holm",
542 "How to Convert SPME to P3M: Influence Functions and Error Estimates",
543 "J. Chem. Theory Comput.",
544 8, 2012, "936-947" },
546 "Garmay Yu, Shvetsov A, Karelov D, Lebedev D, Radulescu A, Petukhov M, Isaev-Ivanov V",
547 "Correlated motion of protein subdomains and large-scale conformational flexibility of RecA protein filament",
548 "Journal of Physics: Conference Series",
549 340, 2012, "012094" }
551 #define NSTR (int)asize(citedb)
556 #define LINE_WIDTH 79
563 for (index = 0; (index < NSTR) && (strcmp(citedb[index].key, key) != 0); index++)
568 fprintf(fp, "\n++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++\n");
571 /* Insert newlines */
572 author = wrap_lines(citedb[index].author, LINE_WIDTH, 0, FALSE);
573 title = wrap_lines(citedb[index].title, LINE_WIDTH, 0, FALSE);
574 fprintf(fp, "%s\n%s\n%s %d (%d) pp. %s\n",
575 author, title, citedb[index].journal,
576 citedb[index].volume, citedb[index].year,
577 citedb[index].pages);
583 fprintf(fp, "Entry %s not found in citation database\n", key);
585 fprintf(fp, "-------- -------- --- Thank You --- -------- --------\n\n");
589 #ifdef GMX_GIT_VERSION_INFO
590 /* Version information generated at compile time. */
591 #include "gromacs/utility/gitversion.h"
593 /* Fall back to statically defined version. */
594 static const char _gmx_ver_string[] = "VERSION " VERSION;
597 const char *GromacsVersion()
599 return _gmx_ver_string;
602 extern void gmx_print_version_info_gpu(FILE *fp);
604 static void gmx_print_version_info(FILE *fp)
606 fprintf(fp, "Gromacs version: %s\n", _gmx_ver_string);
607 #ifdef GMX_GIT_VERSION_INFO
608 fprintf(fp, "GIT SHA1 hash: %s\n", _gmx_full_git_hash);
609 /* Only print out the branch information if present.
610 * The generating script checks whether the branch point actually
611 * coincides with the hash reported above, and produces an empty string
613 if (_gmx_central_base_hash[0] != 0)
615 fprintf(fp, "Branched from: %s\n", _gmx_central_base_hash);
620 fprintf(fp, "Precision: double\n");
622 fprintf(fp, "Precision: single\n");
624 fprintf(fp, "Memory model: %lu bit\n", 8*sizeof(void *));
626 #ifdef GMX_THREAD_MPI
627 fprintf(fp, "MPI library: thread_mpi\n");
628 #elif defined(GMX_MPI)
629 fprintf(fp, "MPI library: MPI\n");
631 fprintf(fp, "MPI library: none\n");
634 fprintf(fp, "OpenMP support: enabled\n");
636 fprintf(fp, "OpenMP support: disabled\n");
639 fprintf(fp, "GPU support: enabled\n");
641 fprintf(fp, "GPU support: disabled\n");
643 /* A preprocessor trick to avoid duplicating logic from vec.h */
644 #define gmx_stringify2(x) #x
645 #define gmx_stringify(x) gmx_stringify2(x)
646 fprintf(fp, "invsqrt routine: %s\n", gmx_stringify(gmx_invsqrt(x)));
647 fprintf(fp, "CPU acceleration: %s\n", GMX_CPU_ACCELERATION_STRING);
649 fprintf(fp, "FFT library: %s\n", gmx_fft_get_version_info());
650 #ifdef GMX_LARGEFILES
651 fprintf(fp, "Large file support: enabled\n");
653 fprintf(fp, "Large file support: disabled\n");
656 fprintf(fp, "RDTSCP usage: enabled\n");
658 fprintf(fp, "RDTSCP usage: disabled\n");
661 fprintf(fp, "Built on: %s\n", BUILD_TIME);
662 fprintf(fp, "Built by: %s\n", BUILD_USER);
663 fprintf(fp, "Build OS/arch: %s\n", BUILD_HOST);
664 fprintf(fp, "Build CPU vendor: %s\n", BUILD_CPU_VENDOR);
665 fprintf(fp, "Build CPU brand: %s\n", BUILD_CPU_BRAND);
666 fprintf(fp, "Build CPU family: %d Model: %d Stepping: %d\n",
667 BUILD_CPU_FAMILY, BUILD_CPU_MODEL, BUILD_CPU_STEPPING);
668 /* TODO: The below strings can be quite long, so it would be nice to wrap
669 * them. Can wait for later, as the master branch has ready code to do all
671 fprintf(fp, "Build CPU features: %s\n", BUILD_CPU_FEATURES);
672 fprintf(fp, "C compiler: %s\n", BUILD_C_COMPILER);
673 fprintf(fp, "C compiler flags: %s\n", BUILD_CFLAGS);
674 fprintf(fp, "C++ compiler: %s\n", BUILD_CXX_COMPILER);
675 fprintf(fp, "C++ compiler flags: %s\n", BUILD_CXXFLAGS);
677 /* MKL might be used for LAPACK/BLAS even if FFTs use FFTW, so keep it separate */
678 fprintf(fp, "Linked with Intel MKL version %d.%d.%d.\n",
679 __INTEL_MKL__, __INTEL_MKL_MINOR__, __INTEL_MKL_UPDATE__);
682 gmx_print_version_info_gpu(fp);
689 BinaryInformationSettings::BinaryInformationSettings()
690 : bExtendedInfo_(false), bCopyright_(false),
691 bGeneratedByHeader_(false), prefix_(""), suffix_("")
695 void printBinaryInformation(FILE *fp, const ProgramInfo &programInfo)
697 printBinaryInformation(fp, programInfo, BinaryInformationSettings());
700 void printBinaryInformation(FILE *fp, const ProgramInfo &programInfo,
701 const BinaryInformationSettings &settings)
703 const char *prefix = settings.prefix_;
704 const char *suffix = settings.suffix_;
705 const char *precisionString = "";
707 precisionString = " (double precision)";
709 const std::string &name = programInfo.displayName();
710 if (settings.bGeneratedByHeader_)
712 fprintf(fp, "%sCreated by:%s\n", prefix, suffix);
714 fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name.c_str(),
715 GromacsVersion(), precisionString, suffix);
716 fprintf(fp, "%sExecutable: %s%s\n", prefix,
717 programInfo.programNameWithPath().c_str(), suffix);
718 fprintf(fp, "%sCommand line:%s\n%s %s%s\n",
719 prefix, suffix, prefix, programInfo.commandLine().c_str(), suffix);
720 if (settings.bCopyright_)
722 GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
723 "Prefix/suffix not supported with copyright");
727 if (settings.bExtendedInfo_)
729 GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
730 "Prefix/suffix not supported with extended info");
732 gmx_print_version_info(fp);