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