File size: 2,041 Bytes
7d2290f | 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 | #ifndef FREESASA_NB_H
#define FREESASA_NB_H
#include <stdlib.h>
#include "coord.h"
/**
@file
@author Simon Mitternacht
Functions to compute neighbor lists. The function
freesasa_nb_contact() is mainly intended for checking consistency,
in performance-critical code it is advisible to use the struct (as
demonstrated in sasa_lr.c and sasa_sr.c).
*/
/** Neighbor list */
typedef struct {
int n; /**< number of elements */
int **nb; /**< neighbors to each element */
int *nn; /**< number of neighbors to each element */
double **xyd; /**< distance between neighbors in xy-plane */
double **xd; /**< signed distance between neighbors along x-axis */
double **yd; /**< signed distance between neighbors along y-axis */
int *capacity; /**< keeps track of memory chunks (don't change this) */
} nb_list;
/**
Creates a neigbor list based on a set of coordinates with
corresponding sphere radii.
Implemented using cell lists, giving O(N) performance. Should be
freed with freesasa_nb_free(). For efficient calculations
using this list the members of the returned struct should be used
directly and not freesasa_nb_contact().
@param coord a set of coordinates
@param radii radii for the coordinates
@return a neigbor list. Returns NULL if either argument is null or
if there were any problems constructing the list (see error
messages).
*/
nb_list *
freesasa_nb_new(const coord_t *coord,
const double *radii);
/**
Frees a neigbor list created by freesasa_nb_new().
@param nb The neigbor list to free
*/
void freesasa_nb_free(nb_list *nb);
/**
Checks if two atoms are in contact. Only included for reference.
@param nb The neigbor list
@param i Index of first coordinate
@param j Index of second coordinate
@return 1 if contact, 0 else.
*/
int freesasa_nb_contact(const nb_list *nb,
int i,
int j);
#endif /* FREESASA_NB_H */
|