Valgrind suppression for OS X 10.9
[alexxy/gromacs.git] / src / gromacs / trajectoryanalysis / modules / nsc.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, 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 #include "typedefs.h"
38
39 #define FLAG_DOTS       01
40 #define FLAG_VOLUME     02
41 #define FLAG_ATOM_AREA  04
42
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47
48 int nsc_dclm_pbc(const rvec *coords, real *radius, int nat,
49                  int  densit, int mode,
50                  real *value_of_area, real **at_area,
51                  real *value_of_vol,
52                  real **lidots, int *nu_dots,
53                  atom_id index[], int ePBC, matrix box);
54
55 /*
56     User notes :
57    The input requirements :
58    The arrays with atom coordinates and radii are thought to start
59    with index 0, i.e., places 0, 1, and 2 are the x-, y-, and z-
60    coordinates of the zero-th atom and place 0 in the other array
61    is its radius.
62
63    PLEASE TAKE INTO ACCOUNT THAT THE RADII GIVEN HERE ARE DIRECTLY
64    USED FOR SURFACE CALCULATION. NSC does not increment with a probe
65    radius.
66
67    The user can define any number of dots. The program selects a
68    dot density that is the lowest possible with at least the required
69    number of dots. The points are distributed in accordance with the
70    icosahedron-based or the dodecahedron-based method as described in
71    ref. 1.
72
73    The output requirements are :
74    1 and 3 :  pointer to an existing real
75    2 and 4 :  pointer to an existing pointer to real
76              NSC allocates memory for an array
77    5       :  pointer to an existing integer
78
79    The subroutine NSC makes use of variant 2 described in reference 1.
80    By selecting the necessary output via flags, the requirements for
81    cpu-time and computer memory can be adapted to the actual needs.
82
83    Example : flag = FLAG_VOLUME | FLAG_ATOM_AREA | FLAG_DOTS
84           The routine calculates the area, volume and the dot surface. The
85           program allocates arrays for the atomwise areas and for the surface
86           dots. The addresses are returned in the pointers to pointers to
87           real.
88           This variant is not recommended because normally the dot surface
89           is needed for low point density (e.g.42) at which area and volume
90           are inaccurate. The sign "|" is used as binary AND !
91
92           flag = FLAG_VOLUME | FLAG_ATOM_AREA
93           In this case the large arrays for storing the surface dots
94           are not allocated. A large point number of the fully accessible
95           sphere can be selected. Good accuracy is already achieved with
96           600-700 points per sphere (accuracy of about 1.5 square Angstrem
97           per atomic sphere).
98           Output pointers 4 and 5 may be NULL.
99
100           flag = FLAG_DOTS
101           Only the dot surface is produced.
102           Output pointers 2 and 3 may be NULL.
103
104    The output pointer 1 cannot be set to NULL in any circumstances. The
105    overall area value is returned in every mode.
106
107    All files calling NSC should include nsc.h !!
108
109
110    Example for calling NSC (contents of user file):
111
112    ...
113    #include "nsc.h"
114
115    int routine_calling_NSC(int n_atom, real *coordinates, real *radii) {
116    real area, volume, *atomwise_area, *surface_dots;
117    int    i, density = 300, n_dots;
118
119    ...
120
121    for (i=0; i<n_atom; i++) {
122    radii[i]  += 1.4      /# add the probe radius if necessary #/
123
124    if (NSC(coordinates, radii, n_atom, density,
125           FLAG_AREA | FLAG_VOLUME | FLAG_DOTS,
126           &area, &atomwise_area, &volume, &surface_dots, &n_dots))
127     printf("error occured\n");
128     return 1;
129     }
130
131    ...
132
133    /# do something with areas, volume and surface dots #/
134
135    ...
136
137    return 0;
138    }
139
140  */
141
142 #ifdef __cplusplus
143 }
144 #endif