Better selection stdin handling.
[gromacs/qmmm-gamess-us.git] / include / nsgrid.h
blob54a0c2d776be3ad79481a86c72dea11569ccc43d
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 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
40 #include "typedefs.h"
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 #define GRID_STDDEV_FAC sqrt(3)
47 #define NSGRID_STDDEV_FAC 2.0
49 * GRID_STDDEV_FAC * stddev is used to estimate the interaction density.
50 * sqrt(3) gives a uniform load for a rectangular block of cg's.
51 * For a sphere it is not a bad approximation for 4x1x1 up to 4x2x2.
53 * The extent of the neighborsearch grid is a bit larger than sqrt(3)
54 * to account for less dense regions at the edges of the system.
57 extern t_grid *init_grid(FILE *fplog,t_forcerec *fr);
59 extern void done_grid(t_grid *grid);
61 extern void get_nsgrid_boundaries(t_grid *grid,
62 gmx_domdec_t *dd,
63 matrix box,gmx_ddbox_t *ddbox,
64 rvec *gr0,rvec *gr1,
65 int ncg,rvec *cgcm,
66 rvec grid_x0,rvec grid_x1,
67 real *grid_density);
68 /* Return the ns grid boundaries grid_x0 and grid_x1
69 * and the estimate for the grid density.
70 * For non-bounded dimensions the boundaries are determined
71 * from the average and std.dev. of cgcm.
72 * The are determined from box, unless gr0!=NULL or gr1!=NULL,
73 * then they are taken from gr0 or gr1.
74 * With dd and unbounded dimensions, the proper grid borders for cells
75 * on the edges are determined from cgcm.
78 extern void grid_first(FILE *log,t_grid *grid,
79 gmx_domdec_t *dd,const gmx_ddbox_t *ddbox,
80 int ePBC,matrix box,rvec izones_x0,rvec izones_x1,
81 real rlong,real grid_density);
83 extern void fill_grid(FILE *log,
84 gmx_domdec_zones_t *dd_zones,
85 t_grid *grid,int ncg_tot,
86 int cg0,int cg1,rvec cg_cm[]);
87 /* Allocates space on the grid for ncg_tot cg's.
88 * Fills the grid with cg's from cg0 to cg1.
89 * When cg0 is -1, contiues filling from grid->nr to cg1.
92 extern void calc_elemnr(FILE *log,t_grid *grid,int cg0,int cg1,int ncg);
94 extern void calc_ptrs(t_grid *grid);
96 extern void grid_last(FILE *log,t_grid *grid,int cg0,int cg1,int ncg);
98 extern int xyz2ci_(int nry,int nrz,int x,int y,int z);
99 #define xyz2ci(nry,nrz,x,y,z) ((nry)*(nrz)*(x)+(nrz)*(y)+(z))
100 /* Return the cell index */
102 extern void ci2xyz(t_grid *grid,int i,int *x,int *y,int *z);
104 extern void check_grid(FILE *log,t_grid *grid);
106 extern void print_grid(FILE *log,t_grid *grid);
108 extern void mv_grid(t_commrec *cr,t_grid *grid);
109 /* Move the grid over processors */
111 #ifdef __cplusplus
113 #endif