Adapted clang-AMD-FMA workaround for both C and C++
[alexxy/gromacs.git] / src / gromacs / gmxlib / copyrite.c
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  *                        VERSION 3.2.0
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.
14
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.
19  *
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.
26  *
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.
29  *
30  * For more info, check our website at http://www.gromacs.org
31  *
32  * And Hey:
33  * GROningen Mixture of Alchemy and Childrens' Stories
34  */
35 #include "copyrite.h"
36
37 #ifdef HAVE_CONFIG_H
38 #include "config.h"
39 #endif
40
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <string.h>
44 #include <time.h>
45
46 #ifdef HAVE_LIBMKL
47 #include <mkl.h>
48 #endif
49
50 /* This file is completely threadsafe - keep it that way! */
51
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"
60
61 #include "gromacs/fft/fft.h"
62
63 #include "buildinfo.h"
64
65 static gmx_bool be_cool(void)
66 {
67     /* Yes, it is bad to check the environment variable every call,
68      * but we dont call this routine often, and it avoids using
69      * a mutex for locking the variable...
70      */
71 #ifdef GMX_COOL_QUOTES
72     return (getenv("GMX_NO_QUOTES") == NULL);
73 #else
74     /*be uncool*/
75     return FALSE;
76 #endif
77 }
78
79 static void space(FILE *out, int n)
80 {
81     fprintf(out, "%*s", n, "");
82 }
83
84 static void sp_print(FILE *out, const char *s)
85 {
86     int slen;
87
88     slen = strlen(s);
89     space(out, (80-slen)/2);
90     fprintf(out, "%s\n", s);
91 }
92
93 static void ster_print(FILE *out, const char *s)
94 {
95     int  slen;
96     char buf[128];
97
98     snprintf(buf, 128, ":-)  %s  (-:", s);
99     slen = strlen(buf);
100     space(out, (80-slen)/2);
101     fprintf(out, "%s\n", buf);
102 }
103
104
105 static void pukeit(const char *db, const char *defstring, char *retstring,
106                    int retsize, int *cqnum)
107 {
108     FILE  *fp;
109     char **help;
110     int    i, nhlp;
111     int    seed;
112
113     if (be_cool() && ((fp = low_libopen(db, FALSE)) != NULL))
114     {
115         nhlp = fget_lines(fp, &help);
116         /* for libraries we can use the low-level close routines */
117         ffclose(fp);
118         seed   = time(NULL);
119         *cqnum = nhlp*rando(&seed);
120         if (strlen(help[*cqnum]) >= STRLEN)
121         {
122             help[*cqnum][STRLEN-1] = '\0';
123         }
124         strncpy(retstring, help[*cqnum], retsize);
125         for (i = 0; (i < nhlp); i++)
126         {
127             sfree(help[i]);
128         }
129         sfree(help);
130     }
131     else
132     {
133         strncpy(retstring, defstring, retsize);
134     }
135 }
136
137 void bromacs(char *retstring, int retsize)
138 {
139     int dum;
140
141     pukeit("bromacs.dat",
142            "Groningen Machine for Chemical Simulation",
143            retstring, retsize, &dum);
144 }
145
146 void cool_quote(char *retstring, int retsize, int *cqnum)
147 {
148     char *tmpstr;
149     char *s, *ptr;
150     int   tmpcq, *p;
151
152     if (cqnum != NULL)
153     {
154         p = cqnum;
155     }
156     else
157     {
158         p = &tmpcq;
159     }
160
161     /* protect audience from explicit lyrics */
162     snew(tmpstr, retsize+1);
163     pukeit("gurgle.dat", "Thanx for Using GROMACS - Have a Nice Day",
164            tmpstr, retsize-2, p);
165
166     if ((ptr = strchr(tmpstr, '_')) != NULL)
167     {
168         *ptr = '\0';
169         ptr++;
170         sprintf(retstring, "\"%s\" %s", tmpstr, ptr);
171     }
172     else
173     {
174         strcpy(retstring, tmpstr);
175     }
176     sfree(tmpstr);
177 }
178
179 void CopyRight(FILE *out, const char *szProgram)
180 {
181     static const char * CopyrightText[] = {
182         "Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,",
183         "Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, ",
184         "Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, ",
185         "Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, ",
186         "Michael Shirts, Alfons Sijbers, Peter Tieleman,\n",
187         "Berk Hess, David van der Spoel, and Erik Lindahl.\n",
188         "Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
189         "Copyright (c) 2001-2010, The GROMACS development team at",
190         "Uppsala University & The Royal Institute of Technology, Sweden.",
191         "check out http://www.gromacs.org for more information.\n"
192     };
193
194     static const char * LicenseText[] = {
195         "This program is free software; you can redistribute it and/or",
196         "modify it under the terms of the GNU Lesser General Public License",
197         "as published by the Free Software Foundation; either version 2.1",
198         "of the License, or (at your option) any later version."
199     };
200
201     /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the
202      * name of a file. Otherwise, we won't be able to find the library dir.
203      */
204 #define NCR (int)asize(CopyrightText)
205 /* TODO: Is this exception still needed? */
206 #ifdef GMX_FAHCORE
207 #define NLICENSE 0 /*FAH has an exception permission from LGPL to allow digital signatures in Gromacs*/
208 #else
209 #define NLICENSE (int)asize(LicenseText)
210 #endif
211
212     char buf[256], tmpstr[1024];
213     int  i;
214
215 #ifdef GMX_FAHCORE
216     set_program_name("Gromacs");
217 #else
218     set_program_name(szProgram);
219 #endif
220
221     ster_print(out, "G  R  O  M  A  C  S");
222     fprintf(out, "\n");
223
224     bromacs(tmpstr, 1023);
225     sp_print(out, tmpstr);
226     fprintf(out, "\n");
227
228     ster_print(out, GromacsVersion());
229     fprintf(out, "\n");
230
231     /* fprintf(out,"\n");*/
232
233     /* sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
234
235        fprintf(out,"\n"); */
236
237     for (i = 0; (i < NCR); i++)
238     {
239         sp_print(out, CopyrightText[i]);
240     }
241     for (i = 0; (i < NLICENSE); i++)
242     {
243         sp_print(out, LicenseText[i]);
244     }
245
246     fprintf(out, "\n");
247
248     snprintf(buf, 256, "%s", Program());
249 #ifdef GMX_DOUBLE
250     strcat(buf, " (double precision)");
251 #endif
252     ster_print(out, buf);
253     fprintf(out, "\n");
254 }
255
256
257 void thanx(FILE *fp)
258 {
259     char cq[1024];
260     int  cqnum;
261
262     /* protect the audience from suggestive discussions */
263     cool_quote(cq, 1023, &cqnum);
264
265     if (be_cool())
266     {
267         fprintf(fp, "\ngcq#%d: %s\n\n", cqnum, cq);
268     }
269     else
270     {
271         fprintf(fp, "\n%s\n\n", cq);
272     }
273 }
274
275 typedef struct {
276     const char *key;
277     const char *author;
278     const char *title;
279     const char *journal;
280     int         volume, year;
281     const char *pages;
282 } t_citerec;
283
284 void please_cite(FILE *fp, const char *key)
285 {
286     static const t_citerec citedb[] = {
287         { "Allen1987a",
288           "M. P. Allen and D. J. Tildesley",
289           "Computer simulation of liquids",
290           "Oxford Science Publications",
291           1, 1987, "1" },
292         { "Berendsen95a",
293           "H. J. C. Berendsen, D. van der Spoel and R. van Drunen",
294           "GROMACS: A message-passing parallel molecular dynamics implementation",
295           "Comp. Phys. Comm.",
296           91, 1995, "43-56" },
297         { "Berendsen84a",
298           "H. J. C. Berendsen, J. P. M. Postma, A. DiNola and J. R. Haak",
299           "Molecular dynamics with coupling to an external bath",
300           "J. Chem. Phys.",
301           81, 1984, "3684-3690" },
302         { "Ryckaert77a",
303           "J. P. Ryckaert and G. Ciccotti and H. J. C. Berendsen",
304           "Numerical Integration of the Cartesian Equations of Motion of a System with Constraints; Molecular Dynamics of n-Alkanes",
305           "J. Comp. Phys.",
306           23, 1977, "327-341" },
307         { "Miyamoto92a",
308           "S. Miyamoto and P. A. Kollman",
309           "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithms for Rigid Water Models",
310           "J. Comp. Chem.",
311           13, 1992, "952-962" },
312         { "Cromer1968a",
313           "D. T. Cromer & J. B. Mann",
314           "X-ray scattering factors computed from numerical Hartree-Fock wave functions",
315           "Acta Cryst. A",
316           24, 1968, "321" },
317         { "Barth95a",
318           "E. Barth and K. Kuczera and B. Leimkuhler and R. D. Skeel",
319           "Algorithms for Constrained Molecular Dynamics",
320           "J. Comp. Chem.",
321           16, 1995, "1192-1209" },
322         { "Essmann95a",
323           "U. Essmann, L. Perera, M. L. Berkowitz, T. Darden, H. Lee and L. G. Pedersen ",
324           "A smooth particle mesh Ewald method",
325           "J. Chem. Phys.",
326           103, 1995, "8577-8592" },
327         { "Torda89a",
328           "A. E. Torda and R. M. Scheek and W. F. van Gunsteren",
329           "Time-dependent distance restraints in molecular dynamics simulations",
330           "Chem. Phys. Lett.",
331           157, 1989, "289-294" },
332         { "Tironi95a",
333           "I. G. Tironi and R. Sperb and P. E. Smith and W. F. van Gunsteren",
334           "Generalized reaction field method for molecular dynamics simulations",
335           "J. Chem. Phys",
336           102, 1995, "5451-5459" },
337         { "Hess97a",
338           "B. Hess and H. Bekker and H. J. C. Berendsen and J. G. E. M. Fraaije",
339           "LINCS: A Linear Constraint Solver for molecular simulations",
340           "J. Comp. Chem.",
341           18, 1997, "1463-1472" },
342         { "Hess2008a",
343           "B. Hess",
344           "P-LINCS: A Parallel Linear Constraint Solver for molecular simulation",
345           "J. Chem. Theory Comput.",
346           4, 2008, "116-122" },
347         { "Hess2008b",
348           "B. Hess and C. Kutzner and D. van der Spoel and E. Lindahl",
349           "GROMACS 4: Algorithms for highly efficient, load-balanced, and scalable molecular simulation",
350           "J. Chem. Theory Comput.",
351           4, 2008, "435-447" },
352         { "Hub2010",
353           "J. S. Hub, B. L. de Groot and D. van der Spoel",
354           "g_wham - A free weighted histogram analysis implementation including robust error and autocorrelation estimates",
355           "J. Chem. Theory Comput.",
356           6, 2010, "3713-3720"},
357         { "In-Chul99a",
358           "Y. In-Chul and M. L. Berkowitz",
359           "Ewald summation for systems with slab geometry",
360           "J. Chem. Phys.",
361           111, 1999, "3155-3162" },
362         { "DeGroot97a",
363           "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",
364           "Prediction of Protein Conformational Freedom From Distance Constrains",
365           "Proteins",
366           29, 1997, "240-251" },
367         { "Spoel98a",
368           "D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen",
369           "A systematic study of water models for molecular simulation. Derivation of models optimized for use with a reaction-field.",
370           "J. Chem. Phys.",
371           108, 1998, "10220-10230" },
372         { "Wishart98a",
373           "D. S. Wishart and A. M. Nip",
374           "Protein Chemical Shift Analysis: A Practical Guide",
375           "Biochem. Cell Biol.",
376           76, 1998, "153-163" },
377         { "Maiorov95",
378           "V. N. Maiorov and G. M. Crippen",
379           "Size-Independent Comparison of Protein Three-Dimensional Structures",
380           "PROTEINS: Struct. Funct. Gen.",
381           22, 1995, "273-283" },
382         { "Feenstra99",
383           "K. A. Feenstra and B. Hess and H. J. C. Berendsen",
384           "Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of Hydrogen-rich Systems",
385           "J. Comput. Chem.",
386           20, 1999, "786-798" },
387         { "Timneanu2004a",
388           "N. Timneanu and C. Caleman and J. Hajdu and D. van der Spoel",
389           "Auger Electron Cascades in Water and Ice",
390           "Chem. Phys.",
391           299, 2004, "277-283" },
392         { "Pascal2011a",
393           "T. A. Pascal and S. T. Lin and W. A. Goddard III",
394           "Thermodynamics of liquids: standard molar entropies and heat capacities of common solvents from 2PT molecular dynamics",
395           "Phys. Chem. Chem. Phys.",
396           13, 2011, "169-181" },
397         { "Caleman2011b",
398           "C. Caleman and P. J. van Maaren and M. Hong and J. S. Hub and L. T. da Costa and D. van der Spoel",
399           "Force Field Benchmark of Organic Liquids: Density, Enthalpy of Vaporization, Heat Capacities, Surface Tension, Isothermal Compressibility, Volumetric Expansion Coefficient, and Dielectric Constant",
400           "J. Chem. Theo. Comp.",
401           8, 2012, "61" },
402         { "Lindahl2001a",
403           "E. Lindahl and B. Hess and D. van der Spoel",
404           "GROMACS 3.0: A package for molecular simulation and trajectory analysis",
405           "J. Mol. Mod.",
406           7, 2001, "306-317" },
407         { "Wang2001a",
408           "J. Wang and W. Wang and S. Huo and M. Lee and P. A. Kollman",
409           "Solvation model based on weighted solvent accessible surface area",
410           "J. Phys. Chem. B",
411           105, 2001, "5055-5067" },
412         { "Eisenberg86a",
413           "D. Eisenberg and A. D. McLachlan",
414           "Solvation energy in protein folding and binding",
415           "Nature",
416           319, 1986, "199-203" },
417         { "Bondi1964a",
418           "A. Bondi",
419           "van der Waals Volumes and Radii",
420           "J. Phys. Chem.",
421           68, 1964, "441-451" },
422         { "Eisenhaber95",
423           "Frank Eisenhaber and Philip Lijnzaad and Patrick Argos and Chris Sander and Michael Scharf",
424           "The Double Cube Lattice Method: Efficient Approaches to Numerical Integration of Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies",
425           "J. Comp. Chem.",
426           16, 1995, "273-284" },
427         { "Hess2002",
428           "B. Hess, H. Saint-Martin and H.J.C. Berendsen",
429           "Flexible constraints: an adiabatic treatment of quantum degrees of freedom, with application to the flexible and polarizable MCDHO model for water",
430           "J. Chem. Phys.",
431           116, 2002, "9602-9610" },
432         { "Hetenyi2002b",
433           "Csaba Hetenyi and David van der Spoel",
434           "Efficient docking of peptides to proteins without prior knowledge of the binding site.",
435           "Prot. Sci.",
436           11, 2002, "1729-1737" },
437         { "Hess2003",
438           "B. Hess and R.M. Scheek",
439           "Orientation restraints in molecular dynamics simulations using time and ensemble averaging",
440           "J. Magn. Res.",
441           164, 2003, "19-27" },
442         { "Rappe1991a",
443           "A. K. Rappe and W. A. Goddard III",
444           "Charge Equillibration for Molecular Dynamics Simulations",
445           "J. Phys. Chem.",
446           95, 1991, "3358-3363" },
447         { "Mu2005a",
448           "Y. Mu, P. H. Nguyen and G. Stock",
449           "Energy landscape of a small peptide revelaed by dihedral angle principal component analysis",
450           "Prot. Struct. Funct. Bioinf.",
451           58, 2005, "45-52" },
452         { "Okabe2001a",
453           "T. Okabe and M. Kawata and Y. Okamoto and M. Mikami",
454           "Replica-exchange {M}onte {C}arlo method for the isobaric-isothermal ensemble",
455           "Chem. Phys. Lett.",
456           335, 2001, "435-439" },
457         { "Hukushima96a",
458           "K. Hukushima and K. Nemoto",
459           "Exchange Monte Carlo Method and Application to Spin Glass Simulations",
460           "J. Phys. Soc. Jpn.",
461           65, 1996, "1604-1608" },
462         { "Tropp80a",
463           "J. Tropp",
464           "Dipolar Relaxation and Nuclear Overhauser effects in nonrigid molecules: The effect of fluctuating internuclear distances",
465           "J. Chem. Phys.",
466           72, 1980, "6035-6043" },
467         { "Bultinck2002a",
468           "P. Bultinck and W. Langenaeker and P. Lahorte and F. De Proft and P. Geerlings and M. Waroquier and J. P. Tollenaere",
469           "The electronegativity equalization method I: Parametrization and validation for atomic charge calculations",
470           "J. Phys. Chem. A",
471           106, 2002, "7887-7894" },
472         { "Yang2006b",
473           "Q. Y. Yang and K. A. Sharp",
474           "Atomic charge parameters for the finite difference Poisson-Boltzmann method using electronegativity neutralization",
475           "J. Chem. Theory Comput.",
476           2, 2006, "1152-1167" },
477         { "Spoel2005a",
478           "D. van der Spoel, E. Lindahl, B. Hess, G. Groenhof, A. E. Mark and H. J. C. Berendsen",
479           "GROMACS: Fast, Flexible and Free",
480           "J. Comp. Chem.",
481           26, 2005, "1701-1719" },
482         { "Spoel2006b",
483           "D. van der Spoel, P. J. van Maaren, P. Larsson and N. Timneanu",
484           "Thermodynamics of hydrogen bonding in hydrophilic and hydrophobic media",
485           "J. Phys. Chem. B",
486           110, 2006, "4393-4398" },
487         { "Spoel2006d",
488           "D. van der Spoel and M. M. Seibert",
489           "Protein folding kinetics and thermodynamics from atomistic simulations",
490           "Phys. Rev. Letters",
491           96, 2006, "238102" },
492         { "Palmer94a",
493           "B. J. Palmer",
494           "Transverse-current autocorrelation-function calculations of the shear viscosity for molecular liquids",
495           "Phys. Rev. E",
496           49, 1994, "359-366" },
497         { "Bussi2007a",
498           "G. Bussi, D. Donadio and M. Parrinello",
499           "Canonical sampling through velocity rescaling",
500           "J. Chem. Phys.",
501           126, 2007, "014101" },
502         { "Hub2006",
503           "J. S. Hub and B. L. de Groot",
504           "Does CO2 permeate through Aquaporin-1?",
505           "Biophys. J.",
506           91, 2006, "842-848" },
507         { "Hub2008",
508           "J. S. Hub and B. L. de Groot",
509           "Mechanism of selectivity in aquaporins and aquaglyceroporins",
510           "PNAS",
511           105, 2008, "1198-1203" },
512         { "Friedrich2009",
513           "M. S. Friedrichs, P. Eastman, V. Vaidyanathan, M. Houston, S. LeGrand, A. L. Beberg, D. L. Ensign, C. M. Bruns, and V. S. Pande",
514           "Accelerating Molecular Dynamic Simulation on Graphics Processing Units",
515           "J. Comp. Chem.",
516           30, 2009, "864-872" },
517         { "Engin2010",
518           "O. Engin, A. Villa, M. Sayar and B. Hess",
519           "Driving Forces for Adsorption of Amphiphilic Peptides to Air-Water Interface",
520           "J. Phys. Chem. B",
521           114, 2010, "11093" },
522         { "Fritsch12",
523           "S. Fritsch, C. Junghans and K. Kremer",
524           "Adaptive molecular simulation study on structure formation of toluene around C60 using Gromacs",
525           "J. Chem. Theo. Comp.",
526           8, 2012, "398" },
527         { "Junghans10",
528           "C. Junghans and S. Poblete",
529           "A reference implementation of the adaptive resolution scheme in ESPResSo",
530           "Comp. Phys. Comm.",
531           181, 2010, "1449" },
532         { "Wang2010",
533           "H. Wang, F. Dommert, C.Holm",
534           "Optimizing working parameters of the smooth particle mesh Ewald algorithm in terms of accuracy and efficiency",
535           "J. Chem. Phys. B",
536           133, 2010, "034117" },
537         { "Sugita1999a",
538           "Y. Sugita, Y. Okamoto",
539           "Replica-exchange molecular dynamics method for protein folding",
540           "Chem. Phys. Lett.",
541           314, 1999, "141-151" },
542         { "Kutzner2011",
543           "C. Kutzner and J. Czub and H. Grubmuller",
544           "Keep it Flexible: Driving Macromolecular Rotary Motions in Atomistic Simulations with GROMACS",
545           "J. Chem. Theory Comput.",
546           7, 2011, "1381-1393" },
547         { "Hoefling2011",
548           "M. Hoefling, N. Lima, D. Haenni, C.A.M. Seidel, B. Schuler, H. Grubmuller",
549           "Structural Heterogeneity and Quantitative FRET Efficiency Distributions of Polyprolines through a Hybrid Atomistic Simulation and Monte Carlo Approach",
550           "PLoS ONE",
551           6, 2011, "e19791" },
552         { "Hockney1988",
553           "R. W. Hockney and J. W. Eastwood",
554           "Computer simulation using particles",
555           "IOP, Bristol",
556           1, 1988, "1" },
557         { "Ballenegger2012",
558           "V. Ballenegger, J.J. Cerda, and C. Holm",
559           "How to Convert SPME to P3M: Influence Functions and Error Estimates",
560           "J. Chem. Theory Comput.",
561           8, 2012, "936-947" },
562         { "Garmay2012",
563           "Garmay Yu, Shvetsov A, Karelov D, Lebedev D, Radulescu A, Petukhov M, Isaev-Ivanov V",
564           "Correlated motion of protein subdomains and large-scale conformational flexibility of RecA protein filament",
565           "Journal of Physics: Conference Series",
566           340, 2012, "012094" }
567     };
568 #define NSTR (int)asize(citedb)
569
570     int   j, index;
571     char *author;
572     char *title;
573 #define LINE_WIDTH 79
574
575     if (fp == NULL)
576     {
577         return;
578     }
579
580     for (index = 0; (index < NSTR) && (strcmp(citedb[index].key, key) != 0); index++)
581     {
582         ;
583     }
584
585     fprintf(fp, "\n++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++\n");
586     if (index < NSTR)
587     {
588         /* Insert newlines */
589         author = wrap_lines(citedb[index].author, LINE_WIDTH, 0, FALSE);
590         title  = wrap_lines(citedb[index].title, LINE_WIDTH, 0, FALSE);
591         fprintf(fp, "%s\n%s\n%s %d (%d) pp. %s\n",
592                 author, title, citedb[index].journal,
593                 citedb[index].volume, citedb[index].year,
594                 citedb[index].pages);
595         sfree(author);
596         sfree(title);
597     }
598     else
599     {
600         fprintf(fp, "Entry %s not found in citation database\n", key);
601     }
602     fprintf(fp, "-------- -------- --- Thank You --- -------- --------\n\n");
603     fflush(fp);
604 }
605
606 #ifdef GMX_GIT_VERSION_INFO
607 /* Version information generated at compile time. */
608 #include "gromacs/utility/gitversion.h"
609 #else
610 /* Fall back to statically defined version. */
611 static const char _gmx_ver_string[] = "VERSION " VERSION;
612 #endif
613
614 const char *GromacsVersion()
615 {
616     return _gmx_ver_string;
617 }
618
619 void gmx_print_version_info_gpu(FILE *fp);
620
621 void gmx_print_version_info(FILE *fp)
622 {
623     fprintf(fp, "Gromacs version:    %s\n", _gmx_ver_string);
624 #ifdef GMX_GIT_VERSION_INFO
625     fprintf(fp, "GIT SHA1 hash:      %s\n", _gmx_full_git_hash);
626     /* Only print out the branch information if present.
627      * The generating script checks whether the branch point actually
628      * coincides with the hash reported above, and produces an empty string
629      * in such cases. */
630     if (_gmx_central_base_hash[0] != 0)
631     {
632         fprintf(fp, "Branched from:      %s\n", _gmx_central_base_hash);
633     }
634 #endif
635
636 #ifdef GMX_DOUBLE
637     fprintf(fp, "Precision:          double\n");
638 #else
639     fprintf(fp, "Precision:          single\n");
640 #endif
641     fprintf(fp, "Memory model:       %lu bit\n", 8*sizeof(void *));
642
643 #ifdef GMX_THREAD_MPI
644     fprintf(fp, "MPI library:        thread_mpi\n");
645 #elif defined(GMX_MPI)
646     fprintf(fp, "MPI library:        MPI\n");
647 #else
648     fprintf(fp, "MPI library:        none\n");
649 #endif
650 #ifdef GMX_OPENMP
651     fprintf(fp, "OpenMP support:     enabled\n");
652 #else
653     fprintf(fp, "OpenMP support:     disabled\n");
654 #endif
655 #ifdef GMX_GPU
656     fprintf(fp, "GPU support:        enabled\n");
657 #else
658     fprintf(fp, "GPU support:        disabled\n");
659 #endif
660     /* A preprocessor trick to avoid duplicating logic from vec.h */
661 #define gmx_stringify2(x) #x
662 #define gmx_stringify(x) gmx_stringify2(x)
663     fprintf(fp, "invsqrt routine:    %s\n", gmx_stringify(gmx_invsqrt(x)));
664     fprintf(fp, "CPU acceleration:   %s\n", GMX_CPU_ACCELERATION_STRING);
665
666     fprintf(fp, "FFT library:        %s\n", gmx_fft_get_version_info());
667 #ifdef GMX_LARGEFILES
668     fprintf(fp, "Large file support: enabled\n");
669 #else
670     fprintf(fp, "Large file support: disabled\n");
671 #endif
672 #ifdef HAVE_RDTSCP
673     fprintf(fp, "RDTSCP usage:       enabled\n");
674 #else
675     fprintf(fp, "RDTSCP usage:       disabled\n");
676 #endif
677
678     fprintf(fp, "Built on:           %s\n", BUILD_TIME);
679     fprintf(fp, "Built by:           %s\n", BUILD_USER);
680     fprintf(fp, "Build OS/arch:      %s\n", BUILD_HOST);
681     fprintf(fp, "Build CPU vendor:   %s\n", BUILD_CPU_VENDOR);
682     fprintf(fp, "Build CPU brand:    %s\n", BUILD_CPU_BRAND);
683     fprintf(fp, "Build CPU family:   %d   Model: %d   Stepping: %d\n",
684             BUILD_CPU_FAMILY, BUILD_CPU_MODEL, BUILD_CPU_STEPPING);
685     /* TODO: The below strings can be quite long, so it would be nice to wrap
686      * them. Can wait for later, as the master branch has ready code to do all
687      * that. */
688     fprintf(fp, "Build CPU features: %s\n", BUILD_CPU_FEATURES);
689     fprintf(fp, "C compiler:         %s\n", BUILD_C_COMPILER);
690     fprintf(fp, "C compiler flags:   %s\n", BUILD_CFLAGS);
691     fprintf(fp, "C++ compiler:       %s\n", BUILD_CXX_COMPILER);
692     fprintf(fp, "C++ compiler flags: %s\n", BUILD_CXXFLAGS);
693 #ifdef HAVE_LIBMKL
694     /* MKL might be used for LAPACK/BLAS even if FFTs use FFTW, so keep it separate */
695     fprintf(fp, "Linked with Intel MKL version %d.%d.%d.\n",
696             __INTEL_MKL__, __INTEL_MKL_MINOR__, __INTEL_MKL_UPDATE__);
697 #endif
698 #ifdef GMX_GPU
699     gmx_print_version_info_gpu(fp);
700 #endif
701
702 }