4c0b71b390dc66691e9a8753b80866f4477e00d6
[alexxy/gromacs.git] / src / gromacs / utility / pleasecite.cpp
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37 #include "gmxpre.h"
38
39 #include "pleasecite.h"
40
41 #include <cstring>
42
43 #include "gromacs/utility/arraysize.h"
44 #include "gromacs/utility/baseversion.h"
45 #include "gromacs/utility/cstringutil.h"
46 #include "gromacs/utility/smalloc.h"
47 #include "gromacs/utility/stringutil.h"
48
49 typedef struct
50 {
51     const char* key;
52     const char* author;
53     const char* title;
54     const char* journal;
55     int         volume, year;
56     const char* pages;
57 } t_citerec;
58
59 void please_cite(FILE* fp, const char* key)
60 {
61     static const t_citerec citedb[] = {
62         { "Allen1987a", "M. P. Allen and D. J. Tildesley", "Computer simulation of liquids",
63           "Oxford Science Publications", 1, 1987, "1" },
64         { "Berendsen95a", "H. J. C. Berendsen, D. van der Spoel and R. van Drunen",
65           "GROMACS: A message-passing parallel molecular dynamics implementation",
66           "Comp. Phys. Comm.", 91, 1995, "43-56" },
67         { "Berendsen84a", "H. J. C. Berendsen, J. P. M. Postma, A. DiNola and J. R. Haak",
68           "Molecular dynamics with coupling to an external bath", "J. Chem. Phys.", 81, 1984,
69           "3684-3690" },
70         { "Ryckaert77a", "J. P. Ryckaert and G. Ciccotti and H. J. C. Berendsen",
71           "Numerical Integration of the Cartesian Equations of Motion of a System with "
72           "Constraints; Molecular Dynamics of n-Alkanes",
73           "J. Comp. Phys.", 23, 1977, "327-341" },
74         { "Miyamoto92a", "S. Miyamoto and P. A. Kollman",
75           "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithms for Rigid Water Models",
76           "J. Comp. Chem.", 13, 1992, "952-962" },
77         { "Cromer1968a", "D. T. Cromer & J. B. Mann",
78           "X-ray scattering factors computed from numerical Hartree-Fock wave functions",
79           "Acta Cryst. A", 24, 1968, "321" },
80         { "Barth95a", "E. Barth and K. Kuczera and B. Leimkuhler and R. D. Skeel",
81           "Algorithms for Constrained Molecular Dynamics", "J. Comp. Chem.", 16, 1995, "1192-1209" },
82         { "Essmann95a",
83           "U. Essmann, L. Perera, M. L. Berkowitz, T. Darden, H. Lee and L. G. Pedersen ",
84           "A smooth particle mesh Ewald method", "J. Chem. Phys.", 103, 1995, "8577-8592" },
85         { "Torda89a", "A. E. Torda and R. M. Scheek and W. F. van Gunsteren",
86           "Time-dependent distance restraints in molecular dynamics simulations",
87           "Chem. Phys. Lett.", 157, 1989, "289-294" },
88         { "Tironi95a", "I. G. Tironi and R. Sperb and P. E. Smith and W. F. van Gunsteren",
89           "Generalized reaction field method for molecular dynamics simulations", "J. Chem. Phys",
90           102, 1995, "5451-5459" },
91         { "Hess97a", "B. Hess and H. Bekker and H. J. C. Berendsen and J. G. E. M. Fraaije",
92           "LINCS: A Linear Constraint Solver for molecular simulations", "J. Comp. Chem.", 18, 1997,
93           "1463-1472" },
94         { "Hess2008a", "B. Hess",
95           "P-LINCS: A Parallel Linear Constraint Solver for molecular simulation",
96           "J. Chem. Theory Comput.", 4, 2008, "116-122" },
97         { "Hess2008b", "B. Hess and C. Kutzner and D. van der Spoel and E. Lindahl",
98           "GROMACS 4: Algorithms for highly efficient, load-balanced, and scalable molecular "
99           "simulation",
100           "J. Chem. Theory Comput.", 4, 2008, "435-447" },
101         { "Hub2010", "J. S. Hub, B. L. de Groot and D. van der Spoel",
102           "g_wham - A free weighted histogram analysis implementation including robust error and "
103           "autocorrelation estimates",
104           "J. Chem. Theory Comput.", 6, 2010, "3713-3720" },
105         { "In-Chul99a", "Y. In-Chul and M. L. Berkowitz",
106           "Ewald summation for systems with slab geometry", "J. Chem. Phys.", 111, 1999,
107           "3155-3162" },
108         { "DeGroot97a",
109           "B. L. de Groot and D. M. F. van Aalten and R. M. Scheek and A. Amadei and G. Vriend and "
110           "H. J. C. Berendsen",
111           "Prediction of Protein Conformational Freedom From Distance Constrains", "Proteins", 29,
112           1997, "240-251" },
113         { "Spoel98a", "D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen",
114           "A systematic study of water models for molecular simulation. Derivation of models "
115           "optimized for use with a reaction-field.",
116           "J. Chem. Phys.", 108, 1998, "10220-10230" },
117         { "Wishart98a", "D. S. Wishart and A. M. Nip",
118           "Protein Chemical Shift Analysis: A Practical Guide", "Biochem. Cell Biol.", 76, 1998,
119           "153-163" },
120         { "Maiorov95", "V. N. Maiorov and G. M. Crippen",
121           "Size-Independent Comparison of Protein Three-Dimensional Structures",
122           "PROTEINS: Struct. Funct. Gen.", 22, 1995, "273-283" },
123         { "Feenstra99", "K. A. Feenstra and B. Hess and H. J. C. Berendsen",
124           "Improving Efficiency of Large Time-scale Molecular Dynamics Simulations of "
125           "Hydrogen-rich Systems",
126           "J. Comput. Chem.", 20, 1999, "786-798" },
127         { "Lourenco2013a",
128           "Tuanan C. Lourenco and Mariny F. C. Coelho and Teodorico C. Ramalho and David van der "
129           "Spoel and Luciano T. Costa",
130           "Insights on the Solubility of CO2 in 1-Ethyl-3-methylimidazolium "
131           "Bis(trifluoromethylsulfonyl)imide from the Microscopic Point of View",
132           "Environ. Sci. Technol.", 47, 2013, "7421-7429" },
133         { "Timneanu2004a", "N. Timneanu and C. Caleman and J. Hajdu and D. van der Spoel",
134           "Auger Electron Cascades in Water and Ice", "Chem. Phys.", 299, 2004, "277-283" },
135         { "Pascal2011a", "T. A. Pascal and S. T. Lin and W. A. Goddard III",
136           "Thermodynamics of liquids: standard molar entropies and heat capacities of common "
137           "solvents from 2PT molecular dynamics",
138           "Phys. Chem. Chem. Phys.", 13, 2011, "169-181" },
139         { "Caleman2008a", "C. Caleman and D. van der Spoel",
140           "Picosecond Melting of Ice by an Infrared Laser Pulse: A Simulation Study",
141           "Angew. Chem. Int. Ed", 47, 2008, "1417-1420" },
142         { "Caleman2011b",
143           "C. Caleman and P. J. van Maaren and M. Hong and J. S. Hub and L. T. da Costa and D. van "
144           "der Spoel",
145           "Force Field Benchmark of Organic Liquids: Density, Enthalpy of Vaporization, Heat "
146           "Capacities, Surface Tension, Isothermal Compressibility, Volumetric Expansion "
147           "Coefficient, and Dielectric Constant",
148           "J. Chem. Theo. Comp.", 8, 2012, "61" },
149         { "Lindahl2001a", "E. Lindahl and B. Hess and D. van der Spoel",
150           "GROMACS 3.0: A package for molecular simulation and trajectory analysis", "J. Mol. Mod.",
151           7, 2001, "306-317" },
152         { "Wang2001a", "J. Wang and W. Wang and S. Huo and M. Lee and P. A. Kollman",
153           "Solvation model based on weighted solvent accessible surface area", "J. Phys. Chem. B",
154           105, 2001, "5055-5067" },
155         { "Eisenberg86a", "D. Eisenberg and A. D. McLachlan",
156           "Solvation energy in protein folding and binding", "Nature", 319, 1986, "199-203" },
157         { "Bondi1964a", "A. Bondi", "van der Waals Volumes and Radii", "J. Phys. Chem.", 68, 1964,
158           "441-451" },
159         { "Eisenhaber95",
160           "Frank Eisenhaber and Philip Lijnzaad and Patrick Argos and Chris Sander and Michael "
161           "Scharf",
162           "The Double Cube Lattice Method: Efficient Approaches to Numerical Integration of "
163           "Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies",
164           "J. Comp. Chem.", 16, 1995, "273-284" },
165         { "Hess2002", "B. Hess, H. Saint-Martin and H.J.C. Berendsen",
166           "Flexible constraints: an adiabatic treatment of quantum degrees of freedom, with "
167           "application to the flexible and polarizable MCDHO model for water",
168           "J. Chem. Phys.", 116, 2002, "9602-9610" },
169         { "Hess2003", "B. Hess and R.M. Scheek",
170           "Orientation restraints in molecular dynamics simulations using time and ensemble "
171           "averaging",
172           "J. Magn. Res.", 164, 2003, "19-27" },
173         { "Rappe1991a", "A. K. Rappe and W. A. Goddard III",
174           "Charge Equillibration for Molecular Dynamics Simulations", "J. Phys. Chem.", 95, 1991,
175           "3358-3363" },
176         { "Mu2005a", "Y. Mu, P. H. Nguyen and G. Stock",
177           "Energy landscape of a small peptide revelaed by dihedral angle principal component "
178           "analysis",
179           "Prot. Struct. Funct. Bioinf.", 58, 2005, "45-52" },
180         { "Okabe2001a", "T. Okabe and M. Kawata and Y. Okamoto and M. Mikami",
181           "Replica-exchange {M}onte {C}arlo method for the isobaric-isothermal ensemble",
182           "Chem. Phys. Lett.", 335, 2001, "435-439" },
183         { "Hukushima96a", "K. Hukushima and K. Nemoto",
184           "Exchange Monte Carlo Method and Application to Spin Glass Simulations",
185           "J. Phys. Soc. Jpn.", 65, 1996, "1604-1608" },
186         { "Tropp80a", "J. Tropp",
187           "Dipolar Relaxation and Nuclear Overhauser effects in nonrigid molecules: The effect of "
188           "fluctuating internuclear distances",
189           "J. Chem. Phys.", 72, 1980, "6035-6043" },
190         { "Bultinck2002a",
191           "P. Bultinck and W. Langenaeker and P. Lahorte and F. De Proft and P. Geerlings and M. "
192           "Waroquier and J. P. Tollenaere",
193           "The electronegativity equalization method I: Parametrization and validation for atomic "
194           "charge calculations",
195           "J. Phys. Chem. A", 106, 2002, "7887-7894" },
196         { "Yang2006b", "Q. Y. Yang and K. A. Sharp",
197           "Atomic charge parameters for the finite difference Poisson-Boltzmann method using "
198           "electronegativity neutralization",
199           "J. Chem. Theory Comput.", 2, 2006, "1152-1167" },
200         { "Spoel2005a",
201           "D. van der Spoel, E. Lindahl, B. Hess, G. Groenhof, A. E. Mark and H. J. C. Berendsen",
202           "GROMACS: Fast, Flexible and Free", "J. Comp. Chem.", 26, 2005, "1701-1719" },
203         { "Spoel2006b", "D. van der Spoel, P. J. van Maaren, P. Larsson and N. Timneanu",
204           "Thermodynamics of hydrogen bonding in hydrophilic and hydrophobic media",
205           "J. Phys. Chem. B", 110, 2006, "4393-4398" },
206         { "Spoel2006d", "D. van der Spoel and M. M. Seibert",
207           "Protein folding kinetics and thermodynamics from atomistic simulations",
208           "Phys. Rev. Letters", 96, 2006, "238102" },
209         { "Palmer94a", "B. J. Palmer",
210           "Transverse-current autocorrelation-function calculations of the shear viscosity for "
211           "molecular liquids",
212           "Phys. Rev. E", 49, 1994, "359-366" },
213         { "Bussi2007a", "G. Bussi, D. Donadio and M. Parrinello",
214           "Canonical sampling through velocity rescaling", "J. Chem. Phys.", 126, 2007, "014101" },
215         { "Hub2006", "J. S. Hub and B. L. de Groot", "Does CO2 permeate through Aquaporin-1?",
216           "Biophys. J.", 91, 2006, "842-848" },
217         { "Hub2008", "J. S. Hub and B. L. de Groot",
218           "Mechanism of selectivity in aquaporins and aquaglyceroporins", "PNAS", 105, 2008,
219           "1198-1203" },
220         { "Friedrich2009",
221           "M. S. Friedrichs, P. Eastman, V. Vaidyanathan, M. Houston, S. LeGrand, A. L. Beberg, D. "
222           "L. Ensign, C. M. Bruns, and V. S. Pande",
223           "Accelerating Molecular Dynamic Simulation on Graphics Processing Units",
224           "J. Comp. Chem.", 30, 2009, "864-872" },
225         { "Engin2010", "O. Engin, A. Villa, M. Sayar and B. Hess",
226           "Driving Forces for Adsorption of Amphiphilic Peptides to Air-Water Interface",
227           "J. Phys. Chem. B", 114, 2010, "11093" },
228         { "Wang2010", "H. Wang, F. Dommert, C.Holm",
229           "Optimizing working parameters of the smooth particle mesh Ewald algorithm in terms of "
230           "accuracy and efficiency",
231           "J. Chem. Phys. B", 133, 2010, "034117" },
232         { "Sugita1999a", "Y. Sugita, Y. Okamoto",
233           "Replica-exchange molecular dynamics method for protein folding", "Chem. Phys. Lett.",
234           314, 1999, "141-151" },
235         { "Kutzner2011", "C. Kutzner and J. Czub and H. Grubmuller",
236           "Keep it Flexible: Driving Macromolecular Rotary Motions in Atomistic Simulations with "
237           "GROMACS",
238           "J. Chem. Theory Comput.", 7, 2011, "1381-1393" },
239         { "Hoefling2011",
240           "M. Hoefling, N. Lima, D. Haenni, C.A.M. Seidel, B. Schuler, H. Grubmuller",
241           "Structural Heterogeneity and Quantitative FRET Efficiency Distributions of Polyprolines "
242           "through a Hybrid Atomistic Simulation and Monte Carlo Approach",
243           "PLoS ONE", 6, 2011, "e19791" },
244         { "Hockney1988", "R. W. Hockney and J. W. Eastwood", "Computer simulation using particles",
245           "IOP, Bristol", 1, 1988, "1" },
246         { "Ballenegger2012", "V. Ballenegger, J.J. Cerda, and C. Holm",
247           "How to Convert SPME to P3M: Influence Functions and Error Estimates",
248           "J. Chem. Theory Comput.", 8, 2012, "936-947" },
249         { "Garmay2012",
250           "Garmay Yu, Shvetsov A, Karelov D, Lebedev D, Radulescu A, Petukhov M, Isaev-Ivanov V",
251           "Correlated motion of protein subdomains and large-scale conformational flexibility of "
252           "RecA protein filament",
253           "Journal of Physics: Conference Series", 340, 2012, "012094" },
254         { "Kutzner2011b", "C. Kutzner, H. Grubmuller, B. L. de Groot, and U. Zachariae",
255           "Computational Electrophysiology: The Molecular Dynamics of Ion Channel Permeation and "
256           "Selectivity in Atomistic Detail",
257           "Biophys. J.", 101, 2011, "809-817" },
258         { "Lundborg2014",
259           "M. Lundborg, R. Apostolov, D. Spangberg, A. Gardenas, D. van der Spoel and E. Lindahl",
260           "An efficient and extensible format, library, and API for binary trajectory data from "
261           "molecular simulations",
262           "J. Comput. Chem.", 35, 2014, "260-269" },
263         { "Goga2012",
264           "N. Goga and A. J. Rzepiela and A. H. de Vries and S. J. Marrink and H. J. C. Berendsen",
265           "Efficient Algorithms for Langevin and DPD Dynamics", "J. Chem. Theory Comput.", 8, 2012,
266           "3637--3649" },
267         { "Pronk2013",
268           "S. Pronk, S. Páll, R. Schulz, P. Larsson, P. Bjelkmar, R. Apostolov, M. R. Shirts, J. "
269           "C. Smith, P. M. Kasson, D. van der Spoel, B. Hess, and E. Lindahl",
270           "GROMACS 4.5: a high-throughput and highly parallel open source molecular simulation "
271           "toolkit",
272           "Bioinformatics", 29, 2013, "845-54" },
273         { "Pall2015", "S. Páll, M. J. Abraham, C. Kutzner, B. Hess, E. Lindahl",
274           "Tackling Exascale Software Challenges in Molecular Dynamics Simulations with GROMACS",
275           "In S. Markidis & E. Laure (Eds.), Solving Software Challenges for Exascale", 8759, 2015,
276           "3-27" },
277         { "Abraham2015",
278           "M. J. Abraham, T. Murtola, R. Schulz, S. Páll, J. C. Smith, B. Hess, E. Lindahl",
279           "GROMACS: High performance molecular simulations through multi-level parallelism from "
280           "laptops to supercomputers",
281           "SoftwareX", 1, 2015, "19-25" },
282         { "Ballenegger2009", "V. Ballenegger, A. Arnold, J. J. Cerdà",
283           "Simulations of non-neutral slab systems with long-range electrostatic interactions in "
284           "two-dimensional periodic boundary conditions",
285           "J. Chem. Phys", 131, 2009, "094107" },
286         { "Hub2014a", "J. S. Hub, B. L. de Groot, H. Grubmueller, G. Groenhof",
287           "Quantifying Artifacts in Ewald Simulations of Inhomogeneous Systems with a Net Charge",
288           "J. Chem. Theory Comput.", 10, 2014, "381-393" },
289         { "Spoel2018a", "D. van der Spoel, M. M. Ghahremanpour, J. Lemkul",
290           "Small Molecule Thermochemistry: A Tool For Empirical Force Field Development",
291           "J. Phys. Chem. A", 122, 2018, "8982-8988" },
292         { "Lindahl2014", "V. Lindahl, J. Lidmar, B. Hess",
293           "Accelerated weight histogram method for exploring free energy landscapes",
294           "J. Chem. Phys.", 141, 2014, "044110" },
295     };
296 #define NSTR static_cast<int>(asize(citedb))
297
298     int   index;
299     char* author;
300     char* title;
301 #define LINE_WIDTH 79
302
303     if (fp == nullptr)
304     {
305         return;
306     }
307
308     for (index = 0; index < NSTR && (strcmp(citedb[index].key, key) != 0); index++) {}
309
310     fprintf(fp, "\n++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++\n");
311     if (index < NSTR)
312     {
313         /* Insert newlines */
314         author = wrap_lines(citedb[index].author, LINE_WIDTH, 0, FALSE);
315         title  = wrap_lines(citedb[index].title, LINE_WIDTH, 0, FALSE);
316         fprintf(fp, "%s\n%s\n%s %d (%d) pp. %s\n", author, title, citedb[index].journal,
317                 citedb[index].volume, citedb[index].year, citedb[index].pages);
318         sfree(author);
319         sfree(title);
320     }
321     else
322     {
323         fprintf(fp, "Entry %s not found in citation database\n", key);
324     }
325     fprintf(fp, "-------- -------- --- Thank You --- -------- --------\n\n");
326     fflush(fp);
327 }
328
329 namespace
330 {
331
332 //! Write a message to \c fp to request citation also of the source-code DOI.
333 void writeSourceDoi(FILE* fp)
334 {
335     /* Check if we are in release mode or not.
336      * TODO The check should properly target something else than
337      * the string being empty
338      */
339     if (strlen(gmxDOI()) == 0)
340     {
341         /* Not a release build, return without printing anything */
342         return;
343     }
344     gmx::TextLineWrapper wrapper;
345     wrapper.settings().setLineLength(LINE_WIDTH);
346     wrapper.settings().setFirstLineIndent(0);
347     const std::string doiString = wrapper.wrapToString(gmxDOI());
348
349     if (fp == nullptr)
350     {
351         return;
352     }
353     fprintf(fp, "\n++++ PLEASE CITE THE DOI FOR THIS VERSION OF GROMACS ++++\n");
354     fprintf(fp, "%s%s\n", "https://doi.org/", doiString.c_str());
355     fprintf(fp, "-------- -------- --- Thank You --- -------- --------\n\n");
356     fflush(fp);
357 }
358
359 } // namespace
360
361 void pleaseCiteGromacs(FILE* fplog)
362 {
363     if (fplog == nullptr)
364     {
365         return;
366     }
367
368     please_cite(fplog, "Abraham2015");
369     please_cite(fplog, "Pall2015");
370     please_cite(fplog, "Pronk2013");
371     please_cite(fplog, "Hess2008b");
372     please_cite(fplog, "Spoel2005a");
373     please_cite(fplog, "Lindahl2001a");
374     please_cite(fplog, "Berendsen95a");
375     writeSourceDoi(fplog);
376 }