4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
34 * GROningen Mixture of Alchemy and Childrens' Stories
43 /* This file is completely threadsafe - keep it that way! */
58 static void pr_two(FILE *out
,int c
,int i
)
61 fprintf(out
,"%c0%1d",c
,i
);
63 fprintf(out
,"%c%2d",c
,i
);
66 void pr_difftime(FILE *out
,double dt
)
68 int ndays
,nhours
,nmins
,nsecs
;
72 dt
= dt
-24*3600*ndays
;
81 fprintf(out
,"%d",ndays
);
82 bPrint
=bPrint
|| (nhours
> 0);
85 pr_two(out
,'d',nhours
);
87 fprintf(out
,"%d",nhours
);
89 bPrinted
=bPrinted
|| bPrint
;
90 bPrint
=bPrint
|| (nmins
> 0);
93 pr_two(out
,'h',nmins
);
95 fprintf(out
,"%d",nmins
);
97 bPrinted
=bPrinted
|| bPrint
;
99 pr_two(out
,':',nsecs
);
101 fprintf(out
,"%ds",nsecs
);
111 /* Yes, it is bad to check the environment variable every call,
112 * but we dont call this routine often, and it avoids using
113 * a mutex for locking the variable...
116 envptr
=getenv("IAMCOOL");
118 if ((envptr
!=NULL
) && (!strcmp(envptr
,"no") || !strcmp(envptr
,"NO")))
127 void space(FILE *out
, int n
)
129 fprintf(out
,"%*s",n
,"");
132 void f(char *a
){int i
;for(i
=0;i
<(int)strlen(a
);i
++)a
[i
]=~a
[i
]; }
134 static void sp_print(FILE *out
,const char *s
)
139 space(out
,(80-slen
)/2);
140 fprintf(out
,"%s\n",s
);
143 static void ster_print(FILE *out
,const char *s
)
148 sprintf(buf
,":-) %s (-:",s
);
150 space(out
,(80-slen
)/2);
151 fprintf(out
,"%s\n",buf
);
155 static char *pukeit(char *db
,char *defstring
, char *retstring
,
156 int retsize
, int *cqnum
)
165 else if ((fp
= low_libopen(db
,FALSE
)) != NULL
) {
166 nhlp
=fget_lines(fp
,&help
);
169 *cqnum
=nhlp
*rando(&seed
);
170 if (strlen(help
[*cqnum
]) >= STRLEN
)
171 help
[*cqnum
][STRLEN
-1] = '\0';
172 strncpy(retstring
,help
[*cqnum
],retsize
);
174 for(i
=0; (i
<nhlp
); i
++)
184 char *bromacs(char *retstring
, int retsize
)
188 return pukeit("bromacs.dat",
189 "Groningen Machine for Chemical Simulation",
190 retstring
,retsize
,&dum
);
194 char *cool_quote(char *retstring
, int retsize
, int *cqnum
)
205 /* protect audience from explicit lyrics */
206 pukeit("gurgle.dat","Thanx for Using GROMACS - Have a Nice Day",
209 if (be_cool() && ((ptr
=strchr(tmpstr
,'_')) != NULL
)) {
212 sprintf(retstring
,"\"%s\" %s",tmpstr
,ptr
);
215 strncpy(retstring
,tmpstr
,1023);
221 void CopyRight(FILE *out
,char *szProgram
)
223 /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the
224 * name of a file. Otherwise, we won't be able to find the library dir.
226 #define NCR (int)asize(CopyrightText)
227 #define NGPL (int)asize(GPLText)
229 char buf
[256],tmpstr
[1024];
235 set_program_name(szProgram
);
237 ster_print(out
,"G R O M A C S");
240 ptr
=bromacs(tmpstr
,1023);
244 ster_print(out
,GromacsVersion());
247 /* fprintf(out,"\n");*/
249 /* sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
251 fprintf(out,"\n"); */
253 for(i
=0; (i
<NCR
); i
++)
254 sp_print(out
,CopyrightText
[i
]);
255 for(i
=0; (i
<NGPL
); i
++)
256 sp_print(out
,GPLText
[i
]);
260 sprintf(buf
,"%s",Program());
262 strcat(buf
," (double precision)");
275 /* protect the audience from suggestive discussions */
276 cq
=cool_quote(tmpbuf
,1023,&cqnum
);
279 snew(c
,strlen(cq
)+20);
281 sprintf(c
,"gcq#%d: %s\n",cqnum
,cq
);
283 fprintf(fp
,"\n%s\n",c
);
287 fprintf(fp
,"\n%s\n",cq
);
295 int volume
,year
,p0
,p1
;
298 void please_cite(FILE *fp
,char *key
)
300 static t_citerec citedb
[] = {
302 "H. J. C. Berendsen, D. van der Spoel and R. van Drunen",
303 "GROMACS: A message-passing parallel molecular dynamics implementation",
307 "H. J. C. Berendsen, J. P. M. Postma, A. DiNola and J. R. Haak",
308 "Molecular dynamics with coupling to an external bath",
310 81, 1984, 3684, 3690 },
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",
315 23, 1977, 327, 341 },
317 "S. Miyamoto and P. A. Kollman",
318 "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithms for Rigid Water Models",
320 13, 1992, 952, 962 },
322 "E. Barth and K. Kuczera and B. Leimkuhler and R. D. Skeel",
323 "Algorithms for Constrained Molecular Dynamics",
325 16, 1995, 1192, 1209 },
327 "U. Essman, L. Perela, M. L. Berkowitz, T. Darden, H. Lee and L. G. Pedersen ",
328 "A smooth particle mesh Ewald method",
330 103, 1995, 8577, 8592 },
332 "A. E. Torda and R. M. Scheek and W. F. van Gunsteren",
333 "Time-dependent distance restraints in molecular dynamics simulations",
335 157, 1989, 289, 294 },
337 "I. G. Tironi and R. Sperb and P. E. Smith and W. F. van Gunsteren",
338 "Generalized reaction field method for molecular dynamics simulations",
340 102, 1995, 5451, 5459 },
342 "B. Hess and H. Bekker and H. J. C. Berendsen and J. G. E. M. Fraaije",
343 "LINCS: A Linear Constraint Solver for molecular simulations",
345 18, 1997, 1463, 1472 },
347 "Y. In-Chul and M. L. Berkowitz",
348 "Ewald summation for systems with slab geometry",
350 111, 1999, 3155, 3162 },
352 "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",
353 "Prediction of Protein Conformational Freedom From Distance Constrains",
355 29, 1997, 240, 251 },
357 "D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen",
358 "A systematic study of water models for molecular simulation. Derivation of models optimized for use with a reaction-field.",
360 108, 1998, 10220, 10230 },
362 "D. S. Wishart and A. M. Nip",
363 "Protein Chemical Shift Analysis: A Practical Guide",
364 "Biochem. Cell Biol.",
365 76, 1998, 153, 163 },
367 "V. N. Maiorov and G. M. Crippen",
368 "Size-Independent Comparison of Protein Three-Dimensional Structures",
369 "PROTEINS: Struct. Funct. Gen.",
370 22, 1995, 273, 283 },
372 "K. A. Feenstra and B. Hess and H. J. C. Berendsen",
373 "Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of Hydrogen-rich Systems",
375 20, 1999, 786, 798 },
377 "E. Lindahl and B. Hess and D. van der Spoel",
378 "GROMACS 3.0: A package for molecular simulation and trajectory analysis",
382 "J. Wang and W. Wang and S. Huo and M. Lee and P. A. Kollman",
383 "Solvation model based on weighted solvent accessible surface area",
385 105, 2001, 5055, 5067 },
387 "D. Eisenberg and A. D. McLachlan",
388 "Solvation energy in protein folding and binding",
390 319, 1986, 199, 203 },
392 "Frank Eisenhaber and Philip Lijnzaad and Patrick Argos and Chris Sander and Michael Scharf",
393 "The Double Cube Lattice Method: Efficient Approaches to Numerical Integration of Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies",
395 16, 1995, 273, 284 },
397 "Csaba Hetenyi and David van der Spoel",
398 "Efficient docking of peptides to proteins without prior knowledge of the binding site.",
400 11, 2002, 1729, 1737 }
402 #define NSTR (int)asize(citedb)
407 #define LINE_WIDTH 79
409 for(index
=0; (index
<NSTR
) && (strcmp(citedb
[index
].key
,key
) != 0); index
++)
412 fprintf(fp
,"\n++++++++ PLEASE CITE THE FOLLOWING REFERENCE ++++++++\n");
414 /* Insert newlines */
415 author
= wrap_lines(citedb
[index
].author
,LINE_WIDTH
,0,FALSE
);
416 title
= wrap_lines(citedb
[index
].title
,LINE_WIDTH
,0,FALSE
);
417 fprintf(fp
,"%s\n%s\n%s %d (%d) pp. %d-%d\n",
418 author
,title
,citedb
[index
].journal
,
419 citedb
[index
].volume
,citedb
[index
].year
,
420 citedb
[index
].p0
,citedb
[index
].p1
);
425 fprintf(fp
,"Entry %s not found in citation database\n",key
);
427 fprintf(fp
,"-------- -------- --- Thank You --- -------- --------\n\n");
431 /* This routine only returns a static (constant) string, so we use a
432 * mutex to initialize it. Since the string is only written to the
433 * first time, there is no risk with multiple calls overwriting the
434 * output for each other.
436 const char *GromacsVersion()
439 /* Concatenate the version info during preprocessing */
440 static const char ver_string
[]="VERSION " VERSION
;