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 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_virtual_c
= "$Id$";
31 int set_virtual (int *ATMS
,int N
,real margin
,t_dist
*d
,int natoms
)
33 /* Routine to add distances to virtual particle.
34 The virtual particle is placed 10A outside
35 the plane common to all atoms, straight above
36 the center of mass, which is calculated assuming
37 unit mass for all atoms.
39 Adam Kirrander 990211 */
42 real CONST
=0.0,Ki
,tmp
,len
,lb
,ub
;
44 /* Calculate the constant part */
45 for (i
=1 ; i
<N
; i
++ ) {
46 for (j
=0 ; j
<i
; j
++) {
47 tmp
= d_len(d
,natoms
,ATMS
[i
],ATMS
[j
]);
53 /* Calculate and set distances */
54 for (i
=0 ; i
<N
; i
++ ) {
56 for (j
=0 ; j
<N
; j
++) { /*Calc. variable part*/
58 tmp
= d_len(d
,natoms
,ATMS
[i
],ATMS
[j
]);
61 len
= sqrt(64.0+((Ki
-CONST
)/N
)); /*Pythagoras*/
62 lb
= (1.0-margin
)*len
;
63 ub
= (1.0+margin
)*len
;
64 set_dist(d
,natoms
,ATMS
[i
],ATMS
[N
],lb
,ub
,len
);
68 /* If number of virtual dist. should correspond to nr. atoms */
69 if (ndist
!= N
) fprintf(stderr
,"Check routine set_virtual!\n");