Revised wording in pdb2gmx.c, hopefully clearer now.
[gromacs/rigid-bodies.git] / src / gmxlib / copyrite.c
blob6c1ccd9806387b6d2907fbde59ce4237ae86a3c8
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.
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
32 * And Hey:
33 * GROningen Mixture of Alchemy and Childrens' Stories
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
39 #ifdef GMX_THREADS
40 #include <thread_mpi.h>
41 #endif
43 /* This file is completely threadsafe - keep it that way! */
45 #include <string.h>
46 #include <ctype.h>
47 #include "sysstuff.h"
48 #include "smalloc.h"
49 #include "string2.h"
50 #include "macros.h"
51 #include "time.h"
52 #include "random.h"
53 #include "statutil.h"
54 #include "copyrite.h"
55 #include "strdb.h"
56 #include "futil.h"
58 static void pr_two(FILE *out,int c,int i)
60 if (i < 10)
61 fprintf(out,"%c0%1d",c,i);
62 else
63 fprintf(out,"%c%2d",c,i);
66 void pr_difftime(FILE *out,double dt)
68 int ndays,nhours,nmins,nsecs;
69 gmx_bool bPrint,bPrinted;
71 ndays = dt/(24*3600);
72 dt = dt-24*3600*ndays;
73 nhours= dt/3600;
74 dt = dt-3600*nhours;
75 nmins = dt/60;
76 dt = dt-nmins*60;
77 nsecs = dt;
78 bPrint= (ndays > 0);
79 bPrinted=bPrint;
80 if (bPrint)
81 fprintf(out,"%d",ndays);
82 bPrint=bPrint || (nhours > 0);
83 if (bPrint) {
84 if (bPrinted)
85 pr_two(out,'d',nhours);
86 else
87 fprintf(out,"%d",nhours);
89 bPrinted=bPrinted || bPrint;
90 bPrint=bPrint || (nmins > 0);
91 if (bPrint) {
92 if (bPrinted)
93 pr_two(out,'h',nmins);
94 else
95 fprintf(out,"%d",nmins);
97 bPrinted=bPrinted || bPrint;
98 if (bPrinted)
99 pr_two(out,':',nsecs);
100 else
101 fprintf(out,"%ds",nsecs);
102 fprintf(out,"\n");
106 gmx_bool be_cool(void)
108 /* Yes, it is bad to check the environment variable every call,
109 * but we dont call this routine often, and it avoids using
110 * a mutex for locking the variable...
112 #ifdef GMX_FAHCORE
113 /*be uncool*/
114 return FALSE;
115 #else
116 return (getenv("GMX_NO_QUOTES") == NULL);
117 #endif
120 void space(FILE *out, int n)
122 fprintf(out,"%*s",n,"");
125 void f(char *a)
127 int i;
128 int len=strlen(a);
130 for(i=0;i<len;i++)
131 a[i]=~a[i];
134 static void sp_print(FILE *out,const char *s)
136 int slen;
138 slen=strlen(s);
139 space(out,(80-slen)/2);
140 fprintf(out,"%s\n",s);
143 static void ster_print(FILE *out,const char *s)
145 int slen;
146 char buf[128];
148 snprintf(buf,128,":-) %s (-:",s);
149 slen=strlen(buf);
150 space(out,(80-slen)/2);
151 fprintf(out,"%s\n",buf);
155 static void pukeit(const char *db,const char *defstring, char *retstring,
156 int retsize, int *cqnum)
158 FILE *fp;
159 char **help;
160 int i,nhlp;
161 int seed;
163 if (be_cool() && ((fp = low_libopen(db,FALSE)) != NULL)) {
164 nhlp=fget_lines(fp,&help);
165 /* for libraries we can use the low-level close routines */
166 ffclose(fp);
167 seed=time(NULL);
168 *cqnum=nhlp*rando(&seed);
169 if (strlen(help[*cqnum]) >= STRLEN)
170 help[*cqnum][STRLEN-1] = '\0';
171 strncpy(retstring,help[*cqnum],retsize);
172 f(retstring);
173 for(i=0; (i<nhlp); i++)
174 sfree(help[i]);
175 sfree(help);
177 else
178 strncpy(retstring,defstring,retsize);
181 void bromacs(char *retstring, int retsize)
183 int dum;
185 pukeit("bromacs.dat",
186 "Groningen Machine for Chemical Simulation",
187 retstring,retsize,&dum);
190 void cool_quote(char *retstring, int retsize, int *cqnum)
192 char *tmpstr;
193 char *s,*ptr;
194 int tmpcq,*p;
196 if (cqnum!=NULL)
197 p = cqnum;
198 else
199 p = &tmpcq;
201 /* protect audience from explicit lyrics */
202 snew(tmpstr,retsize+1);
203 pukeit("gurgle.dat","Thanx for Using GROMACS - Have a Nice Day",
204 tmpstr,retsize-2,p);
206 if ((ptr = strchr(tmpstr,'_')) != NULL) {
207 *ptr='\0';
208 ptr++;
209 sprintf(retstring,"\"%s\" %s",tmpstr,ptr);
211 else {
212 strcpy(retstring,tmpstr);
214 sfree(tmpstr);
217 void CopyRight(FILE *out,const char *szProgram)
219 /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the
220 * name of a file. Otherwise, we won't be able to find the library dir.
222 #define NCR (int)asize(CopyrightText)
223 #ifdef GMX_FAHCORE
224 #define NGPL 0 /*FAH has an exception permission from GPL to allow digital signatures in Gromacs*/
225 #else
226 #define NGPL (int)asize(GPLText)
227 #endif
229 char buf[256],tmpstr[1024];
230 int i;
232 #ifdef GMX_FAHCORE
233 set_program_name("Gromacs");
234 #else
235 set_program_name(szProgram);
236 #endif
238 ster_print(out,"G R O M A C S");
239 fprintf(out,"\n");
241 bromacs(tmpstr,1023);
242 sp_print(out,tmpstr);
243 fprintf(out,"\n");
245 ster_print(out,GromacsVersion());
246 fprintf(out,"\n");
248 /* fprintf(out,"\n");*/
250 /* sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
252 fprintf(out,"\n"); */
254 for(i=0; (i<NCR); i++)
255 sp_print(out,CopyrightText[i]);
256 for(i=0; (i<NGPL); i++)
257 sp_print(out,GPLText[i]);
259 fprintf(out,"\n");
261 snprintf(buf,256,"%s",Program());
262 #ifdef GMX_DOUBLE
263 strcat(buf," (double precision)");
264 #endif
265 ster_print(out,buf);
266 fprintf(out,"\n");
270 void thanx(FILE *fp)
272 char cq[1024];
273 int cqnum;
275 /* protect the audience from suggestive discussions */
276 cool_quote(cq,1023,&cqnum);
278 if (be_cool())
279 fprintf(fp,"\ngcq#%d: %s\n\n",cqnum,cq);
280 else
281 fprintf(fp,"\n%s\n\n",cq);
284 typedef struct {
285 const char *key;
286 const char *author;
287 const char *title;
288 const char *journal;
289 int volume,year;
290 const char *pages;
291 } t_citerec;
293 void please_cite(FILE *fp,const char *key)
295 static const t_citerec citedb[] = {
296 { "Allen1987a",
297 "M. P. Allen and D. J. Tildesley",
298 "Computer simulation of liquids",
299 "Oxford Science Publications",
300 1, 1987, "1" },
301 { "Berendsen95a",
302 "H. J. C. Berendsen, D. van der Spoel and R. van Drunen",
303 "GROMACS: A message-passing parallel molecular dynamics implementation",
304 "Comp. Phys. Comm.",
305 91, 1995, "43-56" },
306 { "Berendsen84a",
307 "H. J. C. Berendsen, J. P. M. Postma, A. DiNola and J. R. Haak",
308 "Molecular dynamics with coupling to an external bath",
309 "J. Chem. Phys.",
310 81, 1984, "3684-3690" },
311 { "Ryckaert77a",
312 "J. P. Ryckaert and G. Ciccotti and H. J. C. Berendsen",
313 "Numerical Integration of the Cartesian Equations of Motion of a System with Constraints; Molecular Dynamics of n-Alkanes",
314 "J. Comp. Phys.",
315 23, 1977, "327-341" },
316 { "Miyamoto92a",
317 "S. Miyamoto and P. A. Kollman",
318 "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithms for Rigid Water Models",
319 "J. Comp. Chem.",
320 13, 1992, "952-962" },
321 { "Cromer1968a",
322 "D. T. Cromer & J. B. Mann",
323 "X-ray scattering factors computed from numerical Hartree-Fock wave functions",
324 "Acta Cryst. A",
325 24, 1968, "321" },
326 { "Barth95a",
327 "E. Barth and K. Kuczera and B. Leimkuhler and R. D. Skeel",
328 "Algorithms for Constrained Molecular Dynamics",
329 "J. Comp. Chem.",
330 16, 1995, "1192-1209" },
331 { "Essman95a",
332 "U. Essman, L. Perela, M. L. Berkowitz, T. Darden, H. Lee and L. G. Pedersen ",
333 "A smooth particle mesh Ewald method",
334 "J. Chem. Phys.",
335 103, 1995, "8577-8592" },
336 { "Torda89a",
337 "A. E. Torda and R. M. Scheek and W. F. van Gunsteren",
338 "Time-dependent distance restraints in molecular dynamics simulations",
339 "Chem. Phys. Lett.",
340 157, 1989, "289-294" },
341 { "Tironi95a",
342 "I. G. Tironi and R. Sperb and P. E. Smith and W. F. van Gunsteren",
343 "Generalized reaction field method for molecular dynamics simulations",
344 "J. Chem. Phys",
345 102, 1995, "5451-5459" },
346 { "Hess97a",
347 "B. Hess and H. Bekker and H. J. C. Berendsen and J. G. E. M. Fraaije",
348 "LINCS: A Linear Constraint Solver for molecular simulations",
349 "J. Comp. Chem.",
350 18, 1997, "1463-1472" },
351 { "Hess2008a",
352 "B. Hess",
353 "P-LINCS: A Parallel Linear Constraint Solver for molecular simulation",
354 "J. Chem. Theory Comput.",
355 4, 2008, "116-122" },
356 { "Hess2008b",
357 "B. Hess and C. Kutzner and D. van der Spoel and E. Lindahl",
358 "GROMACS 4: Algorithms for highly efficient, load-balanced, and scalable molecular simulation",
359 "J. Chem. Theory Comput.",
360 4, 2008, "435-447" },
361 { "Hub2010",
362 "J. S. Hub, B. L. de Groot and D. van der Spoel",
363 "g_wham - A free weighted histogram analysis implementation including robust error and autocorrelation estimates",
364 "J. Chem. Theory Comput.",
365 6, 2010, "3713-3720"},
366 { "In-Chul99a",
367 "Y. In-Chul and M. L. Berkowitz",
368 "Ewald summation for systems with slab geometry",
369 "J. Chem. Phys.",
370 111, 1999, "3155-3162" },
371 { "DeGroot97a",
372 "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",
373 "Prediction of Protein Conformational Freedom From Distance Constrains",
374 "Proteins",
375 29, 1997, "240-251" },
376 { "Spoel98a",
377 "D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen",
378 "A systematic study of water models for molecular simulation. Derivation of models optimized for use with a reaction-field.",
379 "J. Chem. Phys.",
380 108, 1998, "10220-10230" },
381 { "Wishart98a",
382 "D. S. Wishart and A. M. Nip",
383 "Protein Chemical Shift Analysis: A Practical Guide",
384 "Biochem. Cell Biol.",
385 76, 1998, "153-163" },
386 { "Maiorov95",
387 "V. N. Maiorov and G. M. Crippen",
388 "Size-Independent Comparison of Protein Three-Dimensional Structures",
389 "PROTEINS: Struct. Funct. Gen.",
390 22, 1995, "273-283" },
391 { "Feenstra99",
392 "K. A. Feenstra and B. Hess and H. J. C. Berendsen",
393 "Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of Hydrogen-rich Systems",
394 "J. Comput. Chem.",
395 20, 1999, "786-798" },
396 { "Timneanu2004a",
397 "N. Timneanu and C. Caleman and J. Hajdu and D. van der Spoel",
398 "Auger Electron Cascades in Water and Ice",
399 "Chem. Phys.",
400 299, 2004, "277-283" },
401 { "Caleman2011b",
402 "C. Caleman and M. Hong and J. S. Hub and L. T. da Costa and P. J. van Maaren and D. van der Spoel",
403 "Force Field Benchmark 1: Density, Heat of Vaporization, Heat Capacity, Surface Tension and Dielectric Constant of 152 Organic Liquids",
404 "Submitted",
405 0, 2011, "" },
406 { "Lindahl2001a",
407 "E. Lindahl and B. Hess and D. van der Spoel",
408 "GROMACS 3.0: A package for molecular simulation and trajectory analysis",
409 "J. Mol. Mod.",
410 7, 2001, "306-317" },
411 { "Wang2001a",
412 "J. Wang and W. Wang and S. Huo and M. Lee and P. A. Kollman",
413 "Solvation model based on weighted solvent accessible surface area",
414 "J. Phys. Chem. B",
415 105, 2001, "5055-5067" },
416 { "Eisenberg86a",
417 "D. Eisenberg and A. D. McLachlan",
418 "Solvation energy in protein folding and binding",
419 "Nature",
420 319, 1986, "199-203" },
421 { "Eisenhaber95",
422 "Frank Eisenhaber and Philip Lijnzaad and Patrick Argos and Chris Sander and Michael Scharf",
423 "The Double Cube Lattice Method: Efficient Approaches to Numerical Integration of Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies",
424 "J. Comp. Chem.",
425 16, 1995, "273-284" },
426 { "Hess2002",
427 "B. Hess, H. Saint-Martin and H.J.C. Berendsen",
428 "Flexible constraints: an adiabatic treatment of quantum degrees of freedom, with application to the flexible and polarizable MCDHO model for water",
429 "J. Chem. Phys.",
430 116, 2002, "9602-9610" },
431 { "Hetenyi2002b",
432 "Csaba Hetenyi and David van der Spoel",
433 "Efficient docking of peptides to proteins without prior knowledge of the binding site.",
434 "Prot. Sci.",
435 11, 2002, "1729-1737" },
436 { "Hess2003",
437 "B. Hess and R.M. Scheek",
438 "Orientation restraints in molecular dynamics simulations using time and ensemble averaging",
439 "J. Magn. Res.",
440 164, 2003, "19-27" },
441 { "Rappe1991a",
442 "A. K. Rappe and W. A. Goddard III",
443 "Charge Equillibration for Molecular Dynamics Simulations",
444 "J. Phys. Chem.",
445 95, 1991, "3358-3363" },
446 { "Mu2005a",
447 "Y. Mu, P. H. Nguyen and G. Stock",
448 "Energy landscape of a small peptide revelaed by dihedral angle principal component analysis",
449 "Prot. Struct. Funct. Bioinf.",
450 58, 2005, "45-52" },
451 { "Okabe2001a",
452 "T. Okabe and M. Kawata and Y. Okamoto and M. Mikami",
453 "Replica-exchange {M}onte {C}arlo method for the isobaric-isothermal ensemble",
454 "Chem. Phys. Lett.",
455 335, 2001, "435-439" },
456 { "Hukushima96a",
457 "K. Hukushima and K. Nemoto",
458 "Exchange Monte Carlo Method and Application to Spin Glass Simulations",
459 "J. Phys. Soc. Jpn.",
460 65, 1996, "1604-1608" },
461 { "Tropp80a",
462 "J. Tropp",
463 "Dipolar Relaxation and Nuclear Overhauser effects in nonrigid molecules: The effect of fluctuating internuclear distances",
464 "J. Chem. Phys.",
465 72, 1980, "6035-6043" },
466 { "Bultinck2002a",
467 "P. Bultinck and W. Langenaeker and P. Lahorte and F. De Proft and P. Geerlings and M. Waroquier and J. P. Tollenaere",
468 "The electronegativity equalization method I: Parametrization and validation for atomic charge calculations",
469 "J. Phys. Chem. A",
470 106, 2002, "7887-7894" },
471 { "Yang2006b",
472 "Q. Y. Yang and K. A. Sharp",
473 "Atomic charge parameters for the finite difference Poisson-Boltzmann method using electronegativity neutralization",
474 "J. Chem. Theory Comput.",
475 2, 2006, "1152-1167" },
476 { "Spoel2005a",
477 "D. van der Spoel, E. Lindahl, B. Hess, G. Groenhof, A. E. Mark and H. J. C. Berendsen",
478 "GROMACS: Fast, Flexible and Free",
479 "J. Comp. Chem.",
480 26, 2005, "1701-1719" },
481 { "Spoel2006b",
482 "D. van der Spoel, P. J. van Maaren, P. Larsson and N. Timneanu",
483 "Thermodynamics of hydrogen bonding in hydrophilic and hydrophobic media",
484 "J. Phys. Chem. B",
485 110, 2006, "4393-4398" },
486 { "Spoel2006d",
487 "D. van der Spoel and M. M. Seibert",
488 "Protein folding kinetics and thermodynamics from atomistic simulations",
489 "Phys. Rev. Letters",
490 96, 2006, "238102" },
491 { "Palmer94a",
492 "B. J. Palmer",
493 "Transverse-current autocorrelation-function calculations of the shear viscosity for molecular liquids",
494 "Phys. Rev. E",
495 49, 1994, "359-366" },
496 { "Bussi2007a",
497 "G. Bussi, D. Donadio and M. Parrinello",
498 "Canonical sampling through velocity rescaling",
499 "J. Chem. Phys.",
500 126, 2007, "014101" },
501 { "Hub2006",
502 "J. S. Hub and B. L. de Groot",
503 "Does CO2 permeate through Aquaporin-1?",
504 "Biophys. J.",
505 91, 2006, "842-848" },
506 { "Hub2008",
507 "J. S. Hub and B. L. de Groot",
508 "Mechanism of selectivity in aquaporins and aquaglyceroporins",
509 "PNAS",
510 105, 2008, "1198-1203" },
511 { "Friedrich2009",
512 "M. S. Friedrichs, P. Eastman, V. Vaidyanathan, M. Houston, S. LeGrand, A. L. Beberg, D. L. Ensign, C. M. Bruns, and V. S. Pande",
513 "Accelerating Molecular Dynamic Simulation on Graphics Processing Units",
514 "J. Comp. Chem.",
515 30, 2009, "864-872" },
516 { "Engin2010",
517 "O. Engin, A. Villa, M. Sayar and B. Hess",
518 "Driving Forces for Adsorption of Amphiphilic Peptides to Air-Water Interface",
519 "J. Phys. Chem. B",
520 0, 2010, "???" },
521 { "Wang2010",
522 "H. Wang, F. Dommert, C.Holm",
523 "Optimizing working parameters of the smooth particle mesh Ewald algorithm in terms of accuracy and efficiency",
524 "J. Chem. Phys. B",
525 133, 2010, "034117"
528 #define NSTR (int)asize(citedb)
530 int j,index;
531 char *author;
532 char *title;
533 #define LINE_WIDTH 79
535 if (fp == NULL)
536 return;
538 for(index=0; (index<NSTR) && (strcmp(citedb[index].key,key) != 0); index++)
541 fprintf(fp,"\n++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++\n");
542 if (index < NSTR) {
543 /* Insert newlines */
544 author = wrap_lines(citedb[index].author,LINE_WIDTH,0,FALSE);
545 title = wrap_lines(citedb[index].title,LINE_WIDTH,0,FALSE);
546 fprintf(fp,"%s\n%s\n%s %d (%d) pp. %s\n",
547 author,title,citedb[index].journal,
548 citedb[index].volume,citedb[index].year,
549 citedb[index].pages);
550 sfree(author);
551 sfree(title);
553 else {
554 fprintf(fp,"Entry %s not found in citation database\n",key);
556 fprintf(fp,"-------- -------- --- Thank You --- -------- --------\n\n");
557 fflush(fp);
560 #ifdef USE_VERSION_H
561 /* Version information generated at compile time. */
562 #include "version.h"
563 #else
564 /* Fall back to statically defined version. */
565 static const char _gmx_ver_string[]="VERSION " VERSION;
566 #endif
568 /* This routine only returns a static (constant) string, so we use a
569 * mutex to initialize it. Since the string is only written to the
570 * first time, there is no risk with multiple calls overwriting the
571 * output for each other.
573 const char *GromacsVersion()
575 return _gmx_ver_string;
579 void gmx_print_version_info(FILE *fp)
581 fprintf(fp, "Version: %s\n", _gmx_ver_string);
582 #ifdef USE_VERSION_H
583 fprintf(fp, "GIT SHA1 hash: %s\n", _gmx_full_git_hash);
584 /* Only print out the branch information if present.
585 * The generating script checks whether the branch point actually
586 * coincides with the hash reported above, and produces an empty string
587 * in such cases. */
588 if (_gmx_central_base_hash[0] != 0)
590 fprintf(fp, "Branched from: %s\n", _gmx_central_base_hash);
592 #endif
594 #ifdef GMX_DOUBLE
595 fprintf(fp, "Precision: double\n");
596 #else
597 fprintf(fp, "Precision: single\n");
598 #endif
600 #ifdef GMX_THREADS
601 fprintf(fp, "Parallellization: thread_mpi\n");
602 #elif defined(GMX_MPI)
603 fprintf(fp, "Parallellization: MPI\n");
604 #else
605 fprintf(fp, "Parallellization: none\n");
606 #endif
608 #ifdef GMX_FFT_FFTPACK
609 fprintf(fp, "FFT Library: fftpack\n");
610 #elif defined(GMX_FFT_FFTW2)
611 fprintf(fp, "FFT Library: fftw2\n");
612 #elif defined(GMX_FFT_FFTW3)
613 fprintf(fp, "FFT Library: fftw3\n");
614 #elif defined(GMX_FFT_MKL)
615 fprintf(fp, "FFT Library: MKL\n");
616 #else
617 fprintf(fp, "FFT Library: unknown\n");
618 #endif