1 /*
2  * PCMSolver, an API for the Polarizable Continuum Model
3  * Copyright (C) 2020 Roberto Di Remigio, Luca Frediani and contributors.
4  *
5  * This file is part of PCMSolver.
6  *
7  * PCMSolver is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * PCMSolver is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with PCMSolver.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  * For information on the complete list of contributors to the
21  * PCMSolver API, see: <http://pcmsolver.readthedocs.io/>
22  */
23 
24 #pragma once
25 
26 #include <cstdio>
27 #include <ctime>
28 #include <string>
29 
30 #include "VersionInfo.hpp"
31 
32 /*! \file Citation.hpp
33  *  \brief Contains the citation text.
34  */
35 
citation_message()36 inline std::string citation_message() {
37   // clang-format off
38   const char * fmt =
39      "\n-----------------------------------------------------------------------\n"
40      "   PCMSolver: An Open Source API for the Polarizable Continuum Model\n"
41      "                   PCMSolver %s\n\n"
42      "           Git: Branch {%s}, Revision {%s}\n\n"
43      " R. Di Remigio, A. H. Steindal, K. Mozgawa, V. Weijo, H. Cao, and\n"
44      " L. Frediani, Int. J. Quantum Chem., 2019, 119 (1), e25685.\n\n"
45      " Source repository: https://github.com/PCMSolver/pcmsolver\n"
46      " Documentation: https://pcmsolver.readthedocs.io/\n"
47      " PCMSolver initialized on: %s\n"
48      "-----------------------------------------------------------------------\n";
49   // clang-format on
50   // Get current time
51   time_t rawtime;
52   struct tm * timeinfo;
53   char current_time[80];
54 
55   std::time(&rawtime);
56   timeinfo = std::localtime(&rawtime);
57 
58   std::strftime(
59       current_time, sizeof(current_time), "%A, %d %B %Y %I:%M %p", timeinfo);
60 
61   char citation[1000];
62   std::sprintf(citation,
63                fmt,
64                PROJECT_VERSION,
65                GIT_COMMIT_BRANCH,
66                GIT_COMMIT_HASH,
67                current_time);
68 
69   return std::string(citation);
70 }
71