540ab77a16b212ecc93552077e4e13a361ed9147
[alexxy/gromacs.git] / src / gromacs / legacyheaders / types / nblist.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, 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 _nblist_h
38 #define _nblist_h
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44
45 typedef unsigned long t_excl;
46
47 /* The maximum charge group size because of minimum size of t_excl
48  * could be 32 bits.
49  */
50 #define MAX_CHARGEGROUP_SIZE 32
51
52 /* The maximum charge group size for CG-CG nblists.
53  * The excl entry in t_nblist uses blocks of this size.
54  */
55 #define MAX_CGCGSIZE 32
56
57 typedef struct
58 {
59     int             igeometry;    /* The type of list (atom, water, etc.)  */
60     int             ielec;        /* Coulomb loop type index for kernels   */
61     int             ielecmod;     /* Coulomb modifier (e.g. switch/shift)  */
62     int             ivdw;         /* VdW loop type index for kernels       */
63     int             ivdwmod;      /* VdW modifier (e.g. switch/shift)      */
64     int             type;         /* Type of interaction, listed in
65                                      gmx_nblist_interaction_type           */
66
67     int             nri, maxnri;  /* Current/max number of i particles     */
68     int             nrj, maxnrj;  /* Current/max number of j particles     */
69     int             maxlen;       /* maxnr of j atoms for a single i atom  */
70     int *           iinr;         /* The i-elements                        */
71     int *           iinr_end;     /* The end atom, only with enlistCG      */
72     int *           gid;          /* Index in energy arrays                */
73     int *           shift;        /* Shift vector index                    */
74     int *           jindex;       /* Index in jjnr                         */
75     int *           jjnr;         /* The j-atom list                       */
76     int *           jjnr_end;     /* The end atom, only with enltypeCG     */
77     t_excl *        excl;         /* Exclusions, only with enltypeCG       */
78
79     /* We use separate pointers for kernels that compute both potential
80      * and force (vf suffix), only potential (v) or only force (f)
81      */
82     void *          kernelptr_vf;
83     void *          kernelptr_v;
84     void *          kernelptr_f;
85
86     /* Pad the list of neighbors for each i atom with "-1" entries up to the
87      * simd_padding_width, if it is larger than 0. This is necessary for many
88      * accelerated kernels using single-instruction multiple-data operations
89      * internally.
90      */
91     int             simd_padding_width;
92
93 } t_nblist;
94
95
96 /* For atom I =  nblist->iinr[N] (0 <= N < nblist->nri) there can be
97  * several neighborlists (N's), for different energy groups (gid) and
98  * different shifts (shift).
99  * For corresponding J atoms for each list start at:
100  * nblist->jjnr[JI]
101  * with nblist->jindex[N] <= JI < nblist->jindex[N+1]
102  *
103  * enlist is of the form enlistUNIT1_UNIT2:
104  * UNIT ATOM:  there is one atom: iinr[N] or jjnr[JI]
105  * UNIT SPC:   there are 3 atoms: iinr[N],iinr[N]+1,iinr[N]+2, jjnr analog.
106  * UNIT TIP4P: there are 4 atoms: iinr[N],...,iinr[N]+3, jjnr analog.
107  * UNIT CG:    there are N atoms: iinr[N],...,iinr_end[N]-1, jjnr analog.
108  *
109  * Clear?
110  */
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif