enabled GMX_PREFER_STATIC_LIBS CMake option for CYGWIN
[gromacs.git] / include / nsgrid.h
blob0c427cc5600063f6ab2a963287044979e522a827
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #include "typedefs.h"
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
42 #define GRID_STDDEV_FAC sqrt(3)
43 #define NSGRID_STDDEV_FAC 2.0
45 * GRID_STDDEV_FAC * stddev is used to estimate the interaction density.
46 * sqrt(3) gives a uniform load for a rectangular block of cg's.
47 * For a sphere it is not a bad approximation for 4x1x1 up to 4x2x2.
49 * The extent of the neighborsearch grid is a bit larger than sqrt(3)
50 * to account for less dense regions at the edges of the system.
53 t_grid *init_grid(FILE *fplog,t_forcerec *fr);
55 void done_grid(t_grid *grid);
57 void get_nsgrid_boundaries(t_grid *grid,
58 gmx_domdec_t *dd,
59 matrix box,gmx_ddbox_t *ddbox,
60 rvec *gr0,rvec *gr1,
61 int ncg,rvec *cgcm,
62 rvec grid_x0,rvec grid_x1,
63 real *grid_density);
64 /* Return the ns grid boundaries grid_x0 and grid_x1
65 * and the estimate for the grid density.
66 * For non-bounded dimensions the boundaries are determined
67 * from the average and std.dev. of cgcm.
68 * The are determined from box, unless gr0!=NULL or gr1!=NULL,
69 * then they are taken from gr0 or gr1.
70 * With dd and unbounded dimensions, the proper grid borders for cells
71 * on the edges are determined from cgcm.
74 void grid_first(FILE *log,t_grid *grid,
75 gmx_domdec_t *dd,const gmx_ddbox_t *ddbox,
76 int ePBC,matrix box,rvec izones_x0,rvec izones_x1,
77 real rlong,real grid_density);
79 void fill_grid(FILE *log,
80 gmx_domdec_zones_t *dd_zones,
81 t_grid *grid,int ncg_tot,
82 int cg0,int cg1,rvec cg_cm[]);
83 /* Allocates space on the grid for ncg_tot cg's.
84 * Fills the grid with cg's from cg0 to cg1.
85 * When cg0 is -1, contiues filling from grid->nr to cg1.
88 void calc_elemnr(FILE *log,t_grid *grid,int cg0,int cg1,int ncg);
90 void calc_ptrs(t_grid *grid);
92 void grid_last(FILE *log,t_grid *grid,int cg0,int cg1,int ncg);
94 int xyz2ci_(int nry,int nrz,int x,int y,int z);
95 #define xyz2ci(nry,nrz,x,y,z) ((nry)*(nrz)*(x)+(nrz)*(y)+(z))
96 /* Return the cell index */
98 void ci2xyz(t_grid *grid,int i,int *x,int *y,int *z);
100 void check_grid(FILE *log,t_grid *grid);
102 void print_grid(FILE *log,t_grid *grid);
104 void mv_grid(t_commrec *cr,t_grid *grid);
105 /* Move the grid over processors */
107 #ifdef __cplusplus
109 #endif