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 * GRowing Old MAkes el Chrono Sweat
29 static char *SRCID_vcm_c
= "$Id$";
37 void calc_vcm(FILE *log
,int homenr
,int start
,real mass
[],rvec v
[],rvec vcm
)
45 for(i
=start
; (i
<start
+homenr
); i
++) {
56 void do_stopcm(FILE *log
,int homenr
,int start
,rvec v
[],rvec mvcm
,
57 real tm
,real invmass
[])
66 for(i
=start
; (i
<start
+homenr
); i
++)
71 void check_cm(FILE *log
,rvec mvcm
,real tm
)
75 real ekcm
=0,max_vcm
=0;
77 for(m
=0; (m
<DIM
); m
++) {
79 max_vcm
=max(max_vcm
,fabs(vcm
[m
]));
84 fprintf(log
,"Large VCM: (%12.5f, %12.5f, %12.5f), ekin-cm: %12.5f\n",
85 vcm
[XX
],vcm
[YY
],vcm
[ZZ
],ekcm
);
89 void do_stoprot(FILE *log
, int natoms
, rvec box
, rvec x
[], real mass
[])
91 static atom_id
*index
=NULL
;
92 static rvec
*old_x
=NULL
;
96 for (i
=0; (i
<DIM
); i
++)
97 half_box
[i
]=box
[i
]*0.5;
100 for (i
=0; (i
<natoms
); i
++)
104 /* first center on origin (do_fit does not do this!) */
105 reset_x(natoms
,index
,natoms
,index
,x
,mass
);
108 /* do least squares fit to previous structure */
109 do_fit(natoms
,mass
,old_x
,x
);
111 /* no previous structure, make room to copy this one */
114 /* save structure for next fit and move structure back to center of box */
115 for (i
=0; (i
<natoms
); i
++) {
116 copy_rvec(x
[i
],old_x
[i
]);
117 rvec_inc(x
[i
],half_box
);