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 //moldyn.cutoff_square*=4;
54 slots=moldyn.cutoff/dr;
55 printf("[pair corr calc]\n");
56 printf(" slots: %d\n",slots);
57 printf(" cutoff: %f\n",moldyn.cutoff);
58 printf(" dr: %f\n",dr);
60 stat=(double *)malloc(3*slots*sizeof(double));
62 perror("[pair corr calc] alloc mem");
66 calculate_pair_correlation(&moldyn,dr,stat);
68 fd=open("pair_corr_func_ab.txt",
69 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
70 dprintf(fd,"# type a - type b bonds\n");
72 dprintf(fd,"%f %f\n",i*dr,stat[i]);
75 fd=open("pair_corr_func_aa.txt",
76 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
77 dprintf(fd,"# type a - type a bonds\n");
79 dprintf(fd,"%f %f\n",i*dr,stat[slots+i]);
82 fd=open("pair_corr_func_bb.txt",
83 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
84 dprintf(fd,"# type a - type b bonds\n");
86 dprintf(fd,"%f %f\n",i*dr,stat[2*slots+i]);