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_testacf_c
= "$Id$";
40 int main(int argc
,char *argv
[])
43 static char *desc
[] = {
44 "testac tests the functioning of the GROMACS acf routines"
46 static int nframes
= 1024;
47 static int datatp
= 0;
48 static real a
=0.02*M_PI
;
50 { "-np", FALSE
, etINT
, &nframes
,
51 "Number of data points" },
52 { "-dtp",FALSE
, etINT
, &datatp
,
53 "Which data: 0=all 0.0, 1=all 1.0, 2=cos(a t), 3=random, 4=cos(a t)+random, 5=sin(a t)/(a t)" }
55 static char *str
[] = {
64 { efXVG
, "-d", "acf-data", ffWRITE
},
65 { efXVG
, "-c", "acf-corr", ffWRITE
},
66 { efXVG
, "-comb", "acf-comb.xvg", ffWRITE
}
68 #define NFILE asize(fnm)
74 CopyRight(stderr
,argv
[0]);
76 ppa
= add_acf_pargs(&npargs
,pa
);
77 parse_common_args(&argc
,argv
,PCA_CAN_TIME
| PCA_CAN_VIEW
,TRUE
,
78 NFILE
,fnm
,npargs
,ppa
,asize(desc
),desc
,0,NULL
);
82 fp
= xvgropen(opt2fn("-d",NFILE
,fnm
),"testac","x","y");
83 for(i
=0; (i
<nframes
); i
++) {
93 data
[i
] = 2*rando(&seed
)-1.0;
96 data
[i
] = cos(x
)+2*rando(&seed
)-1.0;
102 data
[i
] = sin(x
)/(x
);
104 /* Data remains 0.0 */
107 fprintf(fp
,"%10g %10g\n",x
,data
[i
]);
112 do_autocorr(opt2fn("-c",NFILE
,fnm
),str
[datatp
],
113 nframes
,1,&data
,a
,eacNormal
,FALSE
);
115 nlag
= get_acfnout();
116 fp
= xvgropen(opt2fn("-comb",NFILE
,fnm
),"testac","x","y");
117 for(i
=0; (i
<nlag
); i
++) {
118 fprintf(fp
,"%10g %10g %10g\n",a
*i
,data2
[i
],data
[i
]);
122 xvgr_file(opt2fn("-c",NFILE
,fnm
),"-nxy");