d2e0ac62df461f5b1efd76290904353eb4f86226
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / grompp-impl.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,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_GROMPP_IMPL_H
39 #define GMX_GMXPREPROCESS_GROMPP_IMPL_H
40
41 #include "gromacs/topology/atoms.h"
42 #include "gromacs/topology/block.h"
43 #include "gromacs/topology/idef.h"
44 #include "gromacs/utility/basedefinitions.h"
45 #include "gromacs/utility/real.h"
46
47 struct t_block;
48 struct t_blocka;
49
50 #define MAXSLEN 32
51
52 typedef struct {
53     bool     bSet;          /* Has this combination been set        */
54     real     c[4];          /* The non-bonded parameters            */
55 } t_nbparam;
56 /* The t_nbparam struct is used to temporary store the explicit
57  * non-bonded parameter combinations, which will be copied to t_params.
58  */
59
60 typedef struct {
61     int        a[MAXATOMLIST];   /* The atom list (eg. bonds: particle  */
62     /* i = a[0] (ai), j = a[1] (aj))    */
63     real       c[MAXFORCEPARAM]; /* Force parameters (eg. b0 = c[0])    */
64     char       s[MAXSLEN];       /* A string (instead of parameters),    *
65                                   * read from the .rtp file in pdb2gmx   */
66     const int &ai() const { return a[0]; }
67     int   &ai() { return a[0]; }
68     const int &aj() const { return a[1]; }
69     int   &aj() { return a[1]; }
70     const int &ak() const { return a[2]; }
71     int   &ak() { return a[2]; }
72     const int &al() const { return a[3]; }
73     int   &al() { return a[3]; }
74     const int &am() const { return a[4]; }
75     int   &am() { return a[4]; }
76
77     real      &c0() { return c[0]; }
78     real      &c1() { return c[1]; }
79     real      &c2() { return c[2]; }
80 } t_param;
81
82 typedef struct {        // NOLINT (clang-analyzer-optin.performance.Padding)
83     int          nr;    /* The number of bonds in this record   */
84     int          maxnr; /* The amount of elements in the array  */
85     t_param     *param; /* Array of parameters (dim: nr or nr*nr) */
86
87     /* CMAP tmp data, there are probably better places for this */
88     int         grid_spacing; /* Cmap grid spacing */
89     int         nc;           /* Number of cmap angles */
90
91     real       *cmap;         /* Temporary storage of the raw cmap grid data */
92     int         ncmap;        /* Number of allocated elements in cmap grid*/
93
94     int        *cmap_types;   /* Store the five atomtypes followed by a number that identifies the type */
95     int         nct;          /* Number of allocated elements in cmap_types */
96
97 } t_params;
98
99 typedef struct {
100     int            nr;      /* The number of exclusions             */
101     int           *e;       /* The excluded atoms                   */
102 } t_excls;
103
104 typedef struct {
105     char            **name;
106     int               nrexcl;       /* Number of exclusions per atom    */
107     bool              excl_set;     /* Have exclusions been generated?  */
108     bool              bProcessed;   /* Has the mol been processed           */
109     t_atoms           atoms;        /* Atoms                                */
110     t_block           cgs;          /* Charge groups                        */
111     t_block           mols;         /* Molecules                            */
112     t_blocka          excls;        /* Exclusions                           */
113     t_params          plist[F_NRE]; /* Parameters in old style              */
114 } t_molinfo;
115
116 typedef struct {
117     char *name;
118     int   nr;
119 } t_mols;
120
121 bool is_int(double x);
122 /* Returns TRUE when x is integer */
123
124 #endif