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 <dr> <save file 1> [<save file 2> ...]\n\n",prog);
27 int main(int argc,char **argv) {
51 memset(&moldyn,0,sizeof(t_moldyn));
53 printf("[pair corr calc] reading save file ...\n");
54 ret=moldyn_read_save_file(&moldyn,argv[j]);
56 printf("[pair corr calc] exit!\n");
61 //moldyn.cutoff_square*=4;
63 moldyn.cutoff_square=36.0;
65 slots=moldyn.cutoff/dr;
66 printf("[pair corr calc]\n");
67 printf(" slots: %d\n",slots);
68 printf(" cutoff: %f\n",moldyn.cutoff);
69 printf(" dr: %f\n",dr);
72 stat=(double *)malloc(3*slots*sizeof(double));
73 total=(double *)malloc(3*slots*sizeof(double));
76 perror("[pair corr calc] alloc mem (stat)");
80 perror("[pair corr calc] alloc mem (toal)");
83 memset(total,0,3*slots*sizeof(double));
87 link_cell_init(&moldyn,VERBOSE);
89 calculate_pair_correlation(&moldyn,dr,stat);
91 for(i=0;i<3*slots;i++)
96 fd=open("pair_corr_func.txt",
97 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
98 dprintf(fd,"#r #ab #aa #bb\n");
100 dprintf(fd,"%f %f %f %f\n",
101 i*dr,total[i],total[slots+i],total[2*slots+i]);
107 moldyn_free_save_file(&moldyn);