Clean up inputrec reading
[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, 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 _readir_h
39 #define _readir_h
40
41 #include "typedefs.h"
42 #include "string2.h"
43 #include "readinp.h"
44 #include "grompp.h"
45
46 enum {
47     eshNONE, eshHBONDS, eshALLBONDS, eshHANGLES, eshALLANGLES, eshNR
48 };
49
50 enum {
51     ecouplamVDWQ, ecouplamVDW, ecouplamQ, ecouplamNONE, ecouplamNR
52 };
53
54 typedef struct {
55     int      warnings;
56     int      nshake;
57     char    *include;
58     char    *define;
59     gmx_bool bGenVel;
60     gmx_bool bGenPairs;
61     real     tempi;
62     int      seed;
63     gmx_bool bOrire;
64     gmx_bool bMorse;
65     char    *wall_atomtype[2];
66     gmx_bool pull_start;
67     char    *couple_moltype;
68     int      couple_lam0;
69     int      couple_lam1;
70     gmx_bool bCoupleIntra;
71 } t_gromppopts;
72
73 /*! \brief Initialise object to hold strings parsed from an .mdp file */
74 extern void init_inputrec_strings();
75
76 /*! \brief Clean up object that holds strings parsed from an .mdp file */
77 void done_inputrec_strings();
78
79 extern void init_ir(t_inputrec *ir, t_gromppopts *opts);
80 /* Initiate stuff */
81
82 extern void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
83                      warninp_t wi);
84 /* Validate inputrec data.
85  * Fatal errors will be added to nerror.
86  */
87 extern int search_string(const char *s, int ng, char *gn[]);
88 /* Returns the index of string s in the index groups */
89
90 extern void double_check(t_inputrec *ir, matrix box, gmx_bool bConstr,
91                          warninp_t wi);
92 /* Do more checks */
93
94 extern void triple_check(const char *mdparin, t_inputrec *ir, gmx_mtop_t *sys,
95                          warninp_t wi);
96 /* Do even more checks */
97
98 extern void check_chargegroup_radii(const gmx_mtop_t *mtop, const t_inputrec *ir,
99                                     rvec *x,
100                                     warninp_t wi);
101 /* Even more checks, charge group radii vs. cut-off's only. */
102
103 extern void get_ir(const char *mdparin, const char *mdparout,
104                    t_inputrec *ir, t_gromppopts *opts,
105                    warninp_t wi);
106 /* Read the input file, and retrieve data for inputrec.
107  * More data are read, but the are only evaluated when the next
108  * function is called. Also prints the input file back to mdparout.
109  */
110
111 extern void do_index(const char* mdparin,
112                      const char *ndx,
113                      gmx_mtop_t *mtop,
114                      gmx_bool    bVerbose,
115                      t_inputrec *ir,
116                      rvec       *v,
117                      warninp_t   wi);
118 /* Read the index file and assign grp numbers to atoms.
119  * If v is not NULL, the velocities will be scaled to the correct number
120  * of degrees of freedom.
121  */
122
123 /* Routines In readpull.c */
124
125 extern char **read_pullparams(int *ninp_p, t_inpfile **inp,
126                               t_pull *pull, gmx_bool *bStart,
127                               warninp_t wi);
128 /* Reads the pull parameters, returns a list of the pull group names */
129
130 extern void make_pull_groups(t_pull *pull,
131                              char **pgnames,
132                              const t_blocka *grps, char **gnames);
133 /* Process the pull group parameters after reading the index groups */
134
135 extern void make_pull_coords(t_pull *pull);
136 /* Process the pull coordinates after reading the pull groups */
137
138 extern void set_pull_init(t_inputrec *ir, gmx_mtop_t *mtop, rvec *x, matrix box, real lambda,
139                           const output_env_t oenv, gmx_bool bStart);
140 /* Prints the initial pull group distances in x.
141  * If bStart adds the distance to the initial reference location.
142  */
143
144 extern int str_nelem(const char *str, int maxptr, char *ptr[]);
145 /* helper function from readir.c to convert strings */
146
147 extern void read_adressparams(int *ninp_p, t_inpfile **inp_p, t_adress *adress, warninp_t wi);
148 /* Reads in AdResS related parameters */
149
150 extern void do_adress_index(t_adress *adress, gmx_groups_t *groups, char **gnames, t_grpopts *opts, warninp_t wi);
151 /* Generate adress groups */
152
153 extern char **read_rotparams(int *ninp_p, t_inpfile **inp, t_rot *rot, warninp_t wi);
154 /* Reads enforced rotation parameters, returns a list of the rot group names */
155
156 extern void make_rotation_groups(t_rot *rot, char **rotgnames,
157                                  t_blocka *grps, char **gnames);
158 /* Process the rotation parameters after reading the index groups */
159
160 extern void set_reference_positions(t_rot *rot, rvec *x, matrix box,
161                                     const char *fn, gmx_bool bSet, warninp_t wi);
162
163 #endif  /* _readir_h */