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) {
49 memset(&moldyn,0,sizeof(t_moldyn));
51 printf("[pair corr calc] reading save file ...\n");
52 ret=moldyn_read_save_file(&moldyn,argv[j]);
54 printf("[pair corr calc] exit!\n");
59 moldyn.cutoff_square*=4;
61 slots=moldyn.cutoff/dr;
62 printf("[pair corr calc]\n");
63 printf(" slots: %d\n",slots);
64 printf(" cutoff: %f\n",moldyn.cutoff);
65 printf(" dr: %f\n",dr);
68 stat=(double *)malloc(3*slots*sizeof(double));
69 total=(double *)malloc(3*slots*sizeof(double));
72 perror("[pair corr calc] alloc mem (stat)");
76 perror("[pair corr calc] alloc mem (toal)");
79 memset(total,0,3*slots*sizeof(double));
83 link_cell_init(&moldyn,VERBOSE);
85 calculate_pair_correlation(&moldyn,dr,stat);
87 for(i=0;i<3*slots;i++)
92 fd=open("pair_corr_func.txt",
93 O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
94 dprintf(fd,"#r #ab #aa #bb\n");
96 dprintf(fd,"%f %f %f %f\n",
97 i*dr,total[i],total[slots+i],total[2*slots+i]);
103 moldyn_free_save_file(&moldyn);