7e200cb7569186e70e83ebe424ad13ea3471b922
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / readir.h
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
38 #ifndef GMX_GMXPREPROCESS_READIR_H
39 #define GMX_GMXPREPROCESS_READIR_H
40
41 #include "gromacs/fileio/readinp.h"
42 #include "gromacs/math/vectypes.h"
43 #include "gromacs/utility/real.h"
44
45 namespace gmx
46 {
47 class MDModules;
48 struct MdModulesNotifier;
49 } // namespace gmx
50
51 struct gmx_mtop_t;
52 struct gmx_output_env_t;
53 struct pull_params_t;
54 struct pull_t;
55 struct t_blocka;
56 struct t_grpopts;
57 struct t_inpfile;
58 struct t_inputrec;
59 struct t_rot;
60 struct warninp;
61 typedef warninp* warninp_t;
62
63 enum
64 {
65     eshNONE,
66     eshHBONDS,
67     eshALLBONDS,
68     eshHANGLES,
69     eshALLANGLES,
70     eshNR
71 };
72
73 enum
74 {
75     ecouplamVDWQ,
76     ecouplamVDW,
77     ecouplamQ,
78     ecouplamNONE,
79     ecouplamNR
80 };
81
82 struct t_gromppopts
83 {
84     int   warnings;
85     int   nshake;
86     char* include;
87     char* define;
88     bool  bGenVel;
89     bool  bGenPairs;
90     real  tempi;
91     int   seed;
92     bool  bOrire;
93     bool  bMorse;
94     char* wall_atomtype[2];
95     char* couple_moltype;
96     int   couple_lam0;
97     int   couple_lam1;
98     bool  bCoupleIntra;
99 };
100
101 /*! \brief Initialise object to hold strings parsed from an .mdp file */
102 void init_inputrec_strings();
103
104 /*! \brief Clean up object that holds strings parsed from an .mdp file */
105 void done_inputrec_strings();
106
107 void check_ir(const char*                   mdparin,
108               const gmx::MdModulesNotifier& mdModulesNotifier,
109               t_inputrec*                   ir,
110               t_gromppopts*                 opts,
111               warninp_t                     wi);
112 /* Validate inputrec data.
113  * Fatal errors will be added to nerror.
114  */
115 int search_string(const char* s, int ng, char* gn[]);
116 /* Returns the index of string s in the index groups */
117
118 void double_check(t_inputrec* ir, matrix box, bool bHasNormalConstraints, bool bHasAnyConstraints, warninp_t wi);
119 /* Do more checks */
120
121 void triple_check(const char* mdparin, t_inputrec* ir, gmx_mtop_t* sys, warninp_t wi);
122 /* Do even more checks */
123
124 void get_ir(const char*     mdparin,
125             const char*     mdparout,
126             gmx::MDModules* mdModules,
127             t_inputrec*     ir,
128             t_gromppopts*   opts,
129             WriteMdpHeader  writeMdpHeader,
130             warninp_t       wi);
131 /* Read the input file, and retrieve data for inputrec.
132  * More data are read, but the are only evaluated when the next
133  * function is called. Also prints the input file back to mdparout.
134  */
135
136 void do_index(const char*                   mdparin,
137               const char*                   ndx,
138               gmx_mtop_t*                   mtop,
139               bool                          bVerbose,
140               const gmx::MdModulesNotifier& notifier,
141               t_inputrec*                   ir,
142               warninp_t                     wi);
143 /* Read the index file and assign grp numbers to atoms.
144  */
145
146 /* Routines In readpull.c */
147
148 char** read_pullparams(std::vector<t_inpfile>* inp, pull_params_t* pull, warninp_t wi);
149 /* Reads the pull parameters, returns a list of the pull group names */
150
151 void make_pull_groups(pull_params_t* pull, char** pgnames, const t_blocka* grps, char** gnames);
152 /* Process the pull group parameters after reading the index groups */
153
154 void make_pull_coords(pull_params_t* pull);
155 /* Process the pull coordinates after reading the pull groups */
156
157 pull_t* set_pull_init(t_inputrec* ir, const gmx_mtop_t* mtop, rvec* x, matrix box, real lambda, warninp_t wi);
158 /* Prints the initial pull group distances in x.
159  * If requested, adds the current distance to the initial reference location.
160  * Returns the pull_t pull work struct. This should be passed to finish_pull()
161  * after all modules have registered their external potentials, if present.
162  */
163
164 char** read_rotparams(std::vector<t_inpfile>* inp, t_rot* rot, warninp_t wi);
165 /* Reads enforced rotation parameters, returns a list of the rot group names */
166
167 void make_rotation_groups(t_rot* rot, char** rotgnames, t_blocka* grps, char** gnames);
168 /* Process the rotation parameters after reading the index groups */
169
170 void set_reference_positions(t_rot* rot, rvec* x, matrix box, const char* fn, bool bSet, warninp_t wi);
171
172 #endif