2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013, 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.
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.
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.
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.
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.
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.
40 #define FLAG_VOLUME 02
41 #define FLAG_ATOM_AREA 04
45 extern int nsc_dclm_pbc(rvec *coords, real *radius, int nat,
47 real *value_of_area, real **at_area,
49 real **lidots, int *nu_dots,
50 atom_id index[], int ePBC, matrix box);
54 The input requirements :
55 The arrays with atom coordinates and radii are thought to start
56 with index 0, i.e., places 0, 1, and 2 are the x-, y-, and z-
57 coordinates of the zero-th atom and place 0 in the other array
60 PLEASE TAKE INTO ACCOUNT THAT THE RADII GIVEN HERE ARE DIRECTLY
61 USED FOR SURFACE CALCULATION. NSC does not increment with a probe
64 The user can define any number of dots. The program selects a
65 dot density that is the lowest possible with at least the required
66 number of dots. The points are distributed in accordance with the
67 icosahedron-based or the dodecahedron-based method as described in
70 The output requirements are :
71 1 and 3 : pointer to an existing real
72 2 and 4 : pointer to an existing pointer to real
73 NSC allocates memory for an array
74 5 : pointer to an existing integer
76 The subroutine NSC makes use of variant 2 described in reference 1.
77 By selecting the necessary output via flags, the requirements for
78 cpu-time and computer memory can be adapted to the actual needs.
80 Example : flag = FLAG_VOLUME | FLAG_ATOM_AREA | FLAG_DOTS
81 The routine calculates the area, volume and the dot surface. The
82 program allocates arrays for the atomwise areas and for the surface
83 dots. The addresses are returned in the pointers to pointers to
85 This variant is not recommended because normally the dot surface
86 is needed for low point density (e.g.42) at which area and volume
87 are inaccurate. The sign "|" is used as binary AND !
89 flag = FLAG_VOLUME | FLAG_ATOM_AREA
90 In this case the large arrays for storing the surface dots
91 are not allocated. A large point number of the fully accessible
92 sphere can be selected. Good accuracy is already achieved with
93 600-700 points per sphere (accuracy of about 1.5 square Angstrem
95 Output pointers 4 and 5 may be NULL.
98 Only the dot surface is produced.
99 Output pointers 2 and 3 may be NULL.
101 The output pointer 1 cannot be set to NULL in any circumstances. The
102 overall area value is returned in every mode.
104 All files calling NSC should include nsc.h !!
107 Example for calling NSC (contents of user file):
112 int routine_calling_NSC(int n_atom, real *coordinates, real *radii) {
113 real area, volume, *atomwise_area, *surface_dots;
114 int i, density = 300, n_dots;
118 for (i=0; i<n_atom; i++) {
119 radii[i] += 1.4 /# add the probe radius if necessary #/
121 if (NSC(coordinates, radii, n_atom, density,
122 FLAG_AREA | FLAG_VOLUME | FLAG_DOTS,
123 &area, &atomwise_area, &volume, &surface_dots, &n_dots))
124 printf("error occured\n");
130 /# do something with areas, volume and surface dots #/