]> hackdaworld.org Git - physik/posic.git/commitdiff
finished diffusion code
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 18 Feb 2008 18:43:06 +0000 (19:43 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 18 Feb 2008 18:43:06 +0000 (19:43 +0100)
moldyn.c
moldyn.h

index f2923c3fbc52831fdd38bfa4b70833d431b635e6..7496223be1207d14f86ccc8d7010befdb9d8b725 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -2350,10 +2350,15 @@ int calculate_diffusion_coefficient(t_moldyn *moldyn,double *dc) {
                }
                else {
                        a_cnt+=1;
+                       dc[0]+=d2;
                }
 
                dc[2]+=d2;
-       }       
+       }
+
+       dc[0]*=(1.0/(6.0*moldyn->time*a_cnt));
+       dc[1]*=(1.0/(6.0*moldyn->time*b_cnt));
+       dc[2]*=(1.0/(6.0*moldyn->time*moldyn->count));
                
        return 0;
 }
index 5a10197199f678df1670ce62fc33868a3382bad4..3867fc0f604814b69425dd08463ee5b00f5096ea 100644 (file)
--- a/moldyn.h
+++ b/moldyn.h
@@ -491,6 +491,7 @@ int moldyn_load(t_moldyn *moldyn);
 int get_line(int fd,char *line,int max);
 
 int pair_correlation_init(t_moldyn *moldyn,double dr);
+int calculate_diffusion_coefficient(t_moldyn *moldyn,double *dc);
 int calculate_pair_correlation(t_moldyn *moldyn,double dr,void *ptr);
 
 int visual_init(t_moldyn *moldyn,char *filebase);