]> hackdaworld.org Git - physik/posic.git/commitdiff
added normalization to pair correlation calc
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 17 Feb 2008 18:16:52 +0000 (19:16 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 17 Feb 2008 18:16:52 +0000 (19:16 +0100)
moldyn.c
pair_corr_calc_script
pair_correlation_calc.c

index 93c72daa1dccc633c766794a777446d20aacf164..f2923c3fbc52831fdd38bfa4b70833d431b635e6 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -2375,13 +2375,13 @@ int calculate_pair_correlation(t_moldyn *moldyn,double dr,void *ptr) {
        unsigned char bc;
        t_3dvec dist;
        double d;
-       //double norm;
+       double norm;
        int o,s;
        unsigned char ibrand;
 
        lc=&(moldyn->lc);
 
-       slots=moldyn->cutoff/dr;
+       slots=2.0*moldyn->cutoff/dr;
        o=2*slots;
 
        if(slots*dr<=moldyn->cutoff)
@@ -2458,7 +2458,7 @@ int calculate_pair_correlation(t_moldyn *moldyn,double dr,void *ptr) {
                                d=v3_absolute_square(&dist);
 
                                /* ignore if greater or equal cutoff */
-                               if(d>=moldyn->cutoff_square)
+                               if(d>=4.0*moldyn->cutoff_square)
                                        continue;
 
                                /* fill the slots */
@@ -2494,16 +2494,17 @@ int calculate_pair_correlation(t_moldyn *moldyn,double dr,void *ptr) {
                }
        }
 
-       /* normalization 
+       /* normalization */
        for(i=1;i<slots;i++) {
-                // normalization: 4 pi r r dr
+                // normalization: 4 pi r^2 dr
                 // here: not double counting pairs -> 2 pi r r dr
-               norm=2*M_PI*moldyn->count*(i*dr*i*dr)*dr;
+                // ... and actually it's a constant times r^2
+               norm=i*i*dr*dr;
                stat[i]/=norm;
                stat[slots+i]/=norm;
                stat[o+i]/=norm;
        }
-       */
+       /* */
 
        if(ptr==NULL) {
                /* todo: store/print pair correlation function */
index f2c64ece8a477c45333026930f809be179dab50e..7f25a7433ef3bf78b7abfca79bb4f33e08389dff 100755 (executable)
@@ -39,11 +39,12 @@ set ytic auto
 set title 'Pair correlation function' 
 set xlabel 'r [A]' 
 set ylabel 'g(r) [a.u.]' 
+unset ytics
 set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 
 set output '$pdir/pair_corr.eps' 
 EOF
 
-echo -en "plot [1.5:3.0] " >> $pfile
+echo -en "plot [1.5:6.0] " >> $pfile
 
 komma=0
 
index f04c4e48c4081b50856eca067bacc84cd9426d76..e5903aaeaa3e5a2379f589048476d587560cbe99 100644 (file)
@@ -52,7 +52,7 @@ int main(int argc,char **argv) {
        //moldyn.cutoff_square*=4;
 
        dr=atof(argv[2]);
-       slots=moldyn.cutoff/dr;
+       slots=2.0*moldyn.cutoff/dr;
        printf("[pair corr calc]\n");
        printf("  slots: %d\n",slots);
        printf("  cutoff: %f\n",moldyn.cutoff);