2 * calcultae pair correlation function
4 * author: frank.zirkelbach@physik.uni-augsburg.de
13 #include <sys/types.h>
19 int usage(char *prog) {
22 printf(" %s <save file> <dr>\n\n",prog);
27 int main(int argc,char **argv) {
42 memset(&moldyn,0,sizeof(t_moldyn));
44 ret=moldyn_read_save_file(&moldyn,argv[1]);
46 printf("[pair corr calc] exit!\n");
51 slots=(int)(moldyn.cutoff/dr);
53 stat=(double *)malloc(3*slots*sizeof(double));
55 perror("[pair corr calc] alloc mem");
59 calculate_pair_correlation(&moldyn,dr,stat);
61 fd=open("pair_corr_func_ab.txt",
62 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
63 dprintf(fd,"# type a - type b bonds\n");
65 dprintf(fd,"%f %f\n",i*dr,stat[i]);
68 fd=open("pair_corr_func_aa.txt",
69 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
70 dprintf(fd,"# type a - type a bonds\n");
72 dprintf(fd,"%f %f\n",i*dr,stat[slots+i]);
75 fd=open("pair_corr_func_bb.txt",
76 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
77 dprintf(fd,"# type a - type b bonds\n");
79 dprintf(fd,"%f %f\n",i*dr,stat[2*slots+i]);