Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / topology / atoms.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) 2012,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 #ifndef GMX_TOPOLOGY_ATOMS_H
38 #define GMX_TOPOLOGY_ATOMS_H
39
40 #include "gromacs/utility/basedefinitions.h"
41 #include "gromacs/utility/real.h"
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 struct t_symtab;
48
49 enum {
50     eptAtom, eptNucleus, eptShell, eptBond, eptVSite, eptNR
51 };
52 /* The particle type */
53
54 typedef struct t_atom
55 {
56     real           m, q;        /* Mass and charge                      */
57     real           mB, qB;      /* Mass and charge for Free Energy calc */
58     unsigned short type;        /* Atom type                            */
59     unsigned short typeB;       /* Atom type for Free Energy calc       */
60     int            ptype;       /* Particle type                        */
61     int            resind;      /* Index into resinfo (in t_atoms)      */
62     int            atomnumber;  /* Atomic Number or NOTSET              */
63     char           elem[4];     /* Element name                         */
64 } t_atom;
65
66 typedef struct t_resinfo
67 {
68     char          **name;       /* Pointer to the residue name          */
69     int             nr;         /* Residue number                       */
70     unsigned char   ic;         /* Code for insertion of residues       */
71     int             chainnum;   /* Iincremented at TER or new chain id  */
72     char            chainid;    /* Chain identifier written/read to pdb */
73     char          **rtp;        /* rtp building block name (optional)   */
74 } t_resinfo;
75
76 typedef struct t_pdbinfo
77 {
78     int      type;              /* PDB record name                      */
79     int      atomnr;            /* PDB atom number                      */
80     char     altloc;            /* Alternate location indicator         */
81     char     atomnm[6];         /* True atom name including leading spaces */
82     real     occup;             /* Occupancy                            */
83     real     bfac;              /* B-factor                             */
84     gmx_bool bAnisotropic;      /* (an)isotropic switch                 */
85     int      uij[6];            /* Anisotropic B-factor                 */
86 } t_pdbinfo;
87
88 typedef struct t_grps
89 {
90     int   nr;                   /* Number of different groups           */
91     int  *nm_ind;               /* Index in the group names             */
92 } t_grps;
93
94 typedef struct t_atoms
95 {
96     int            nr;          /* Nr of atoms                          */
97     t_atom        *atom;        /* Array of atoms (dim: nr)             */
98                                 /* The following entries will not       */
99                                 /* always be used (nres==0)             */
100     char          ***atomname;  /* Array of pointers to atom name       */
101                                 /* use: (*(atomname[i]))                */
102     char          ***atomtype;  /* Array of pointers to atom types      */
103                                 /* use: (*(atomtype[i]))                */
104     char          ***atomtypeB; /* Array of pointers to B atom types    */
105                                 /* use: (*(atomtypeB[i]))               */
106     int              nres;      /* The number of resinfo entries        */
107     t_resinfo       *resinfo;   /* Array of residue names and numbers   */
108     t_pdbinfo       *pdbinfo;   /* PDB Information, such as aniso. Bfac */
109 } t_atoms;
110
111 typedef struct t_atomtypes
112 {
113     int           nr;           /* number of atomtypes                          */
114     real         *radius;       /* GBSA radius for each atomtype                */
115     real         *vol;          /* GBSA efective volume for each atomtype       */
116     real         *surftens;     /* implicit solvent surftens for each atomtype  */
117     real         *gb_radius;    /* GB radius for each atom type                 */
118     real         *S_hct;        /* Overlap factors for HCT/OBC GB models        */
119     int          *atomnumber;   /* Atomic number, used for QM/MM                */
120 } t_atomtypes;
121
122 #define PERTURBED(a) (((a).mB != (a).m) || ((a).qB != (a).q) || ((a).typeB != (a).type))
123
124 void init_atom(t_atoms *at);
125 void init_atomtypes(t_atomtypes *at);
126 void done_atom(t_atoms *at);
127 void done_atomtypes(t_atomtypes *at);
128
129 void init_t_atoms(t_atoms *atoms, int natoms, gmx_bool bPdbinfo);
130 /* allocate memory for the arrays, set nr to natoms and nres to 0
131  * set pdbinfo to NULL or allocate memory for it */
132
133 t_atoms *copy_t_atoms(t_atoms *src);
134 /* copy an atoms struct from src to a new one */
135
136 void add_t_atoms(t_atoms *atoms, int natom_extra, int nres_extra);
137 /* allocate extra space for more atoms and or residues */
138
139 void t_atoms_set_resinfo(t_atoms *atoms, int atom_ind, struct t_symtab *symtab,
140                          const char *resname, int resnr, unsigned char ic,
141                          int chainnum, char chainid);
142 /* Set the residue name, number, insertion code and chain identifier
143  * of atom index atom_ind.
144  */
145
146 void free_t_atoms(t_atoms *atoms, gmx_bool bFreeNames);
147 /* Free all the arrays and set the nr and nres to 0.
148  * bFreeNames tells if to free the atom and residue name strings,
149  * don't free them if they still need to be used in e.g. the topology struct.
150  */
151
152 #ifdef __cplusplus
153 }
154 #endif
155
156 #endif