4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Good ROcking Metal Altar for Chronical Sinners
33 static char *SRCID_pbc_h
= "$Id$";
36 #ident "@(#) pbc.h 1.17 2/2/97"
37 #endif /* HAVE_IDENT */
45 extern void init_pbc(matrix box
,bool bTruncOct
);
46 /* Initiate the periodic boundary conditions. Set bTruncOct to
47 * TRUE when using a truncated octahedron box.
50 extern void pbc_dx(rvec x1
, rvec x2
, rvec dx
);
51 /* Calculate the correct distance vector from x1 and x2 and put it in
52 * dx. init_pbc must be called before ever calling this routine
53 * (this is done by put_charge_groups_in_box).
56 extern bool image_rect(ivec xi
,ivec xj
,ivec box_size
,
57 real rlong2
,int *shift
,real
*r2
);
58 /* Calculate the distance between xi and xj for a rectangular box.
59 * When the distance is SMALLER than rlong2 return TRUE, return
60 * the shift code in shift and the distance in r2. When the distance is
61 * >= rlong2 return FALSE;
62 * It is assumed that rlong2 is scaled the same way as the ivecs xi and xj.
65 extern bool image_tri(ivec xi
,ivec xj
,imatrix box
,
66 real rlong2
,int *shift
,real
*r2
);
67 /* Calculate the distance between xi and xj for a triclinic box.
68 * When the distance is SMALLER than rlong2 return TRUE, return
69 * the shift code in shift and the distance in r2. When the distance is
70 * >= rlong2 return FALSE;
71 * It is assumed that rlong2 is scaled the same way as the ivecs xi and xj.
74 extern bool image_cylindric(ivec xi
,ivec xj
,ivec box_size
,real rlong2
,
76 /* Calculate the distance between xi and xj for a rectangular box
77 * using a cylindric cutoff for long-range only.
78 * When the distance is SMALLER than rlong2 (in X and Y dir.)
80 * the shift code in shift and the distance in r2. When the distance is
81 * >= rlong2 return FALSE;
82 * It is assumed that rlong2 is scaled the same way as the ivecs xi and xj.
85 extern void calc_shifts(matrix box
,rvec box_size
,rvec shift_vec
[],
87 /* This routine calculates ths shift vectors necessary to use the
88 * ns routine. Note that for the truncated octahedron case too many
89 * shift vectors can be calculated: The ones for which exactly
90 * 2 of the k,l,m indexes are not 0 (12 vectors lying along the box
91 * edges. This can be compensated for by removing all the shift_vecs with
92 * (k+l+m) even. This is a feature of the way in which the counting is
93 * done. It implies that, when using truncated octahedron,
94 * the shift codes 1,3,5,7,9,11,15,17,19,21,23,25 should never occur,
95 * that is, every second entry, EXCEPT the central box.
98 extern void calc_cgcm(FILE *log
,int cg0
,int cg1
,t_block
*cgs
,
99 rvec pos
[],rvec cg_cm
[]);
100 /* Routine to compute centers of geometry of charge groups. No periodicity
104 extern void put_charge_groups_in_box (FILE *log
,int cg0
,int cg1
,bool bTruncOct
,
105 matrix box
,rvec box_size
,t_block
*cgs
,
106 rvec pos
[],rvec shift_vec
[],
109 /* This routine puts charge groups in the periodic box, keeping them
110 * together. When bTruncOct==TRUE a truncated octahedron
111 * box is used. There are no checks: the first element of the box matrix
112 * is taken to be the box edge.
115 extern void put_atoms_in_box(int natoms
,matrix box
,rvec x
[]);
116 /* This puts ALL atoms in the box, not caring about charge gorups! */