ad5c10f0e06185df5faac6b260a4f78d9baf04c7
[alexxy/gromacs.git] / src / gromacs / pulling / pull_internal.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, 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 /*! \libinternal \file
39  *
40  *
41  * \brief
42  * This file contains datatypes and function declarations for internal
43    use in the pull code.
44  *
45  * \author Berk Hess
46  *
47  * \inlibraryapi
48  */
49
50 #ifndef GMX_PULLING_PULL_INTERNAL_H
51 #define GMX_PULLING_PULL_INTERNAL_H
52
53 #include "gromacs/legacyheaders/typedefs.h"
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 enum {
60     epgrppbcNONE, epgrppbcREFAT, epgrppbcCOS
61 };
62
63 typedef struct
64 {
65     t_pull_group  params;
66
67     gmx_bool      bCalcCOM;   /* Calculate COM? Not if only used as cylinder group */
68     int           epgrppbc;   /* The type of pbc for this pull group, see enum above */
69
70     int           nat_loc;    /* Number of local pull atoms */
71     int           nalloc_loc; /* Allocation size for ind_loc and weight_loc */
72     atom_id      *ind_loc;    /* Local pull indices */
73     real         *weight_loc; /* Weights for the local indices */
74
75     real          mwscale;    /* mass*weight scaling factor 1/sum w m */
76     real          wscale;     /* scaling factor for the weights: sum w m/sum w w m */
77     real          invtm;      /* inverse total mass of the group: 1/wscale sum w m */
78     dvec         *mdw;        /* mass*gradient(weight) for atoms */
79     double       *dv;         /* distance to the other group along vec */
80     dvec          x;          /* center of mass before update */
81     dvec          xp;         /* center of mass after update before constraining */
82 }
83 pull_group_work_t;
84
85 typedef struct
86 {
87     t_pull_coord  params;    /* Pull coordinate (constant) parameters */
88
89     double        value_ref; /* The reference value, usually init+rate*t */
90     double        value;     /* The current value of the coordinate */
91     dvec          dr;        /* The distance from the reference group */
92     rvec          vec;       /* The pull direction */
93     double        vec_len;   /* Length of vec for direction-relative */
94     dvec          ffrad;     /* conversion factor from vec to radial force */
95     double        cyl_dev;   /* The deviation from the reference position */
96     double        f_scal;    /* Scalar force for directional pulling */
97     dvec          f;         /* force due to the pulling/constraining */
98 }
99 pull_coord_work_t;
100
101 struct pull_t
102 {
103     pull_params_t      params;       /* The pull parameters, from inputrec */
104
105     gmx_bool           bPotential;   /* Are there coordinates with potential? */
106     gmx_bool           bConstraint;  /* Are there constrained coordinates? */
107
108     int                ePBC;         /* the boundary conditions */
109     int                npbcdim;      /* do pbc in dims 0 <= dim < npbcdim */
110     gmx_bool           bRefAt;       /* do we need reference atoms for a group COM ? */
111     int                cosdim;       /* dimension for cosine weighting, -1 if none */
112
113     int                ngroup;       /* Number of pull groups */
114     int                ncoord;       /* Number of pull coordinates */
115     pull_group_work_t *group;        /* The pull group param and work data */
116     pull_group_work_t *dyna;         /* Dynamic groups for geom=cylinder */
117     pull_coord_work_t *coord;        /* The pull group param and work data */
118
119     gmx_bool           bCylinder;    /* Is group 0 a cylinder group? */
120     gmx_bool           bSetPBCatoms; /* Do we need to set x_pbc for the groups? */
121
122     rvec              *rbuf;         /* COM calculation buffer */
123     dvec              *dbuf;         /* COM calculation buffer */
124     double            *dbuf_cyl;     /* cylinder ref. groups COM calculation buffer */
125     FILE              *out_x;        /* Output file for pull data */
126     FILE              *out_f;        /* Output file for pull data */
127 };
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif