Fixed more distcheck errors
[gromacs.git] / include / pbc.h
blobf19f793360b0d86f77608a74f1193bba6ebe08e8
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 3.2.0
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
33 * And Hey:
34 * Gromacs Runs On Most of All Computer Systems
37 #ifndef _pbc_h
38 #define _pbc_h
40 #ifdef HAVE_CONFIG_H
41 #include <config.h>
42 #endif
44 #include "sysstuff.h"
45 #include "typedefs.h"
47 #ifdef CPLUSPLUS
48 extern "C" {
49 #endif
51 #define BOX_MARGIN 0.5001
52 /* margin factor for checking if the box is too skewed */
54 #define TRICLINIC(box) (box[YY][XX]!=0 || box[ZZ][XX]!=0 || box[ZZ][YY]!=0)
56 #define NTRICIMG 14
57 #define NCUCVERT 24
58 #define NCUCEDGE 36
60 extern char *check_box(matrix box);
61 /* Returns NULL if the box is supported by Gromacs.
62 * Otherwise is returns a string with the problem.
65 extern void init_pbc(matrix box);
66 /* Initiate the periodic boundary conditions. */
68 extern int pbc_dx(const rvec x1, const rvec x2, rvec dx);
69 /* Calculate the correct distance vector from x2 to x1 and put it in dx.
70 * Returns the ishift required to shift x1 at closest distance to x2;
71 * i.e. if 0<=ishift<SHIFTS then x1 - x2 + shift_vec[ishift] = dx
72 * (see calc_shifts below on how to obtain shift_vec)
73 * init_pbc must be called before ever calling this routine
74 * (this is done by put_charge_groups_in_box).
77 extern bool image_rect(ivec xi,ivec xj,ivec box_size,
78 real rlong2,int *shift,real *r2);
79 /* Calculate the distance between xi and xj for a rectangular box.
80 * When the distance is SMALLER than rlong2 return TRUE, return
81 * the shift code in shift and the distance in r2. When the distance is
82 * >= rlong2 return FALSE;
83 * It is assumed that rlong2 is scaled the same way as the ivecs xi and xj.
86 extern bool image_tri(ivec xi,ivec xj,imatrix box,
87 real rlong2,int *shift,real *r2);
88 /* Calculate the distance between xi and xj for a triclinic box.
89 * When the distance is SMALLER than rlong2 return TRUE, return
90 * the shift code in shift and the distance in r2. When the distance is
91 * >= rlong2 return FALSE;
92 * It is assumed that rlong2 is scaled the same way as the ivecs xi and xj.
95 extern bool image_cylindric(ivec xi,ivec xj,ivec box_size,real rlong2,
96 int *shift,real *r2);
97 /* Calculate the distance between xi and xj for a rectangular box
98 * using a cylindric cutoff for long-range only.
99 * When the distance is SMALLER than rlong2 (in X and Y dir.)
100 * return TRUE, return
101 * the shift code in shift and the distance in r2. When the distance is
102 * >= rlong2 return FALSE;
103 * It is assumed that rlong2 is scaled the same way as the ivecs xi and xj.
106 extern void calc_shifts(matrix box,rvec box_size,rvec shift_vec[]);
107 /* This routine calculates ths shift vectors necessary to use the
108 * ns routine.
111 extern void calc_cgcm(FILE *log,int cg0,int cg1,t_block *cgs,
112 rvec pos[],rvec cg_cm[]);
113 /* Routine to compute centers of geometry of charge groups. No periodicity
114 * is used.
117 extern void put_charge_groups_in_box (FILE *log,int cg0,int cg1,
118 matrix box,rvec box_size,t_block *cgs,
119 rvec pos[],
120 rvec cg_cm[]);
122 /* This routine puts charge groups in the periodic box, keeping them
123 * together.
126 extern void calc_box_center(matrix box,rvec box_center);
127 /* Calculates the center of the box */
129 extern void calc_triclinic_images(matrix box,rvec img[]);
130 /* Calculates the NTRICIMG box images */
132 extern void calc_compact_unitcell_vertices(matrix box,rvec vert[]);
133 /* Calculates the NCUCVERT vertices of a compact unitcell */
135 extern int *compact_unitcell_edges(void);
136 /* Return an array of unitcell edges of length NCUCEDGE*2,
137 * this is an index in vert[], which is calculated by calc_unitcell_vertices.
138 * The index consists of NCUCEDGE pairs of vertex indices.
139 * The index does not change, so it needs to be retrieved only once.
142 extern void put_atoms_in_box(matrix box,int natoms,rvec x[]);
143 /* This puts ALL atoms in the box, not caring about charge groups!
144 * Also works for triclinic cells.
147 extern void put_atoms_in_triclinic_unitcell(matrix box,int natoms,rvec x[]);
148 /* This puts ALL atoms in the triclinic unit cell, centered around the
149 * box center as calculated by calc_box_center.
152 extern void put_atoms_in_compact_unitcell(matrix box,int natoms,rvec x[]);
153 /* This puts ALL atoms at the closest distance for the center of the box
154 * as calculated by calc_box_center.
157 extern void set_gmx_full_pbc();
158 /* Turn on full PBS calculation in the GROMACS bonded routines */
160 #ifdef CPLUSPLUS
162 #endif
164 #endif /* _pbc_h */