-
Notifications
You must be signed in to change notification settings - Fork 2
/
nblist.h
85 lines (73 loc) · 3.27 KB
/
nblist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* -------------------------------------------------------------------------- *
* copyright (c) 2014-2015 Emilio Gallicchio *
* Authors: Emilio Gallicchio <[email protected]> *
* Contributors: *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version 3 *
* as published by the Free Software Foundation. *
* *
* The program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* -------------------------------------------------------------------------- */
#ifndef LIBNBLIST_H
#define LIBNBLIST_H
#ifdef __cplusplus
extern "C" {
#endif
/* return codes */
#define NBLIST_OK 0
#define NBLIST_ERR 1
/* *
* a simple interface to create/reallocate a Verlet neighbor list *
* */
typedef struct vector_ { /* A 3D vector */
double x, y, z;
} NeighVector;
/* neighbor list structure */
typedef struct neighlist_ {
/* number of atoms */
int natoms;
/* neighbor list size */
int neighl_size;
/* number of neighbors for each atom */
int *nne;
/* where the actual atom indexes are stored */
int *neighl1;
/* pointer into neighl1 for each atom, neighbors of atom iat are retrived
as jat=neighl[iat][j] ; 0 <= i < nne[iat] */
int **neighl;
int idx_remap; /* whether (yes > 0, no = 0) to do atom indexes remapping */
int *int2ext; /* an optional map to translate from internal to external
atom indeces */
int *ext2int; /* an optional map to translate from external to internal
atom indeces */
/* flag, if not zero neighbor list contains PBC translation vectors */
int pbc;
/* same as neighl and neighl1 but stores PBC translation vectors */
NeighVector *pbc_trans1;
NeighVector **pbc_trans;
/* additional data */
int data; /* flag, if not zero additional data exists */
/* same as neighl and neighl1 but for additional data */
void **data_index1; /* pointers to anything */
void ***data_index;
} NeighList;
/* function prototypes */
/* reset neighbor list */
void nblist_reset_neighbor_list(NeighList *neigh_list);
/* delete neighbor list */
void nblist_delete_neighbor_list(NeighList *neigh_list);
/* reallocates neighbor list */
int nblist_reallocate_neighbor_list(NeighList *neigh_list,
int natoms, int size);
#ifdef __cplusplus
}
#endif
#endif