Added class for generating standard CP2K input
[alexxy/gromacs.git] / src / gromacs / applied_forces / qmmm / qmmmtypes.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2021, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*! \internal \file
36  * \brief
37  * Declares structers and types needed to evaluate forces and energies for QM/MM
38  *
39  * \author Dmitry Morozov <dmitry.morozov@jyu.fi>
40  * \author Christian Blau <blau@kth.se>
41  * \ingroup module_applied_forces
42  */
43 #ifndef GMX_APPLIED_FORCES_QMMMTYPES_H
44 #define GMX_APPLIED_FORCES_QMMMTYPES_H
45
46 #include <memory>
47 #include <string>
48 #include <vector>
49
50 #include "gromacs/math/vectypes.h"
51 #include "gromacs/utility/classhelpers.h"
52 #include "gromacs/utility/enumerationhelpers.h"
53 #include "gromacs/utility/real.h"
54
55 namespace gmx
56 {
57
58 /*! \internal
59  * \brief Helper structure with indexes of broken bonds between QM and MM
60  * Used to determine and store pair of QM and MM atoms between which chemical bond is broken
61  */
62 struct LinkFrontier
63 {
64     //! Global index of QM atom at Frontier
65     index qm;
66     //! Global index of MM atom at Frontier
67     index mm;
68 };
69
70 /*! \brief Enumerator for supported QM methods
71  * Also could be INPUT which means external input file provided
72  * with the name determined by QMMMParameters::qminputfilename_
73  */
74 enum class QMMMQMMethod
75 {
76     PBE,   //!< DFT with PBE functional
77     BLYP,  //!< DFT with BLYP functional
78     INPUT, //!< User provides suitable input file for QM package
79     Count
80 };
81
82 //! The names of the supported QM methods
83 static const EnumerationArray<QMMMQMMethod, const char*> c_qmmmQMMethodNames = {
84     { "PBE", "BLYP", "INPUT" }
85 };
86
87 //! symbols of the elements in periodic table
88 const std::vector<std::string> periodic_system = {
89     "X  ", "H  ", "He ", "Li ", "Be ", "B  ", "C  ", "N  ", "O  ", "F  ", "Ne ", "Na ", "Mg ",
90     "Al ", "Si ", "P  ", "S  ", "Cl ", "Ar ", "K  ", "Ca ", "Sc ", "Ti ", "V  ", "Cr ", "Mn ",
91     "Fe ", "Co ", "Ni ", "Cu ", "Zn ", "Ga ", "Ge ", "As ", "Se ", "Br ", "Kr "
92 };
93
94 /*! \internal
95  * \brief Holding all parameters needed for QM/MM simulation.
96  * Also used for setting all default parameter values.
97  */
98 struct QMMMParameters
99 {
100     //! Indicate if QM/MM is active (default false)
101     bool active_ = false;
102     //! Indices of the atoms that are part of the QM region (default whole System)
103     std::vector<index> qmIndices_;
104     //! Indices of the atoms that are part of the MM region (default no MM atoms)
105     std::vector<index> mmIndices_;
106     //! Vector with pairs of indicies defining broken bonds in QMMM (default determined from topology)
107     std::vector<LinkFrontier> link_;
108     //! Vector with atomic numbers of all atoms in the system (default determined from topology)
109     std::vector<int> atomNumbers_;
110     //! Total charge of QM system (default 0)
111     int qmCharge_ = 0;
112     //! Total multiplicity of QM system (default 1)
113     int qmMult_ = 1;
114     //! Method used for QM calculation (default DFT with PBE functional)
115     QMMMQMMethod qmMethod_ = QMMMQMMethod::PBE;
116     //! String containing name of the input file for CP2K (default "topol-qmmm.inp")
117     std::string qmInputFileName_ = "topol-qmmm.inp";
118     //! String containing name of the PDB file for CP2K input (default "topol-qmmm.pdb")
119     std::string qmPdbFileName_ = "topol-qmmm.pdb";
120     //! String containing whole CP2K input which can be stored inside *.tpr
121     std::string qmInput_;
122     //! String containing PDB file for CP2K input which can be stored inside *.tpr
123     std::string qmPdb_;
124     //! Matrix that contains vectors defining QM box
125     matrix qmBox_;
126     //! Matrix that contains vectors defining QM box
127     RVec qmTrans_;
128
129     //! Constructor with default initializers for arrays
130     QMMMParameters() :
131         qmBox_{ { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 } }, qmTrans_{ 0.0, 0.0, 0.0 }
132     {
133     }
134
135     GMX_DISALLOW_COPY_AND_ASSIGN(QMMMParameters);
136 };
137
138 } // namespace gmx
139
140 #endif // GMX_APPLIED_FORCES_QMMMTYPES_H