From: hackbard Date: Mon, 18 Feb 2008 18:43:06 +0000 (+0100) Subject: finished diffusion code X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=4e976ed83379d7cadc696012313abf3a31ea160f;p=physik%2Fposic.git finished diffusion code --- diff --git a/moldyn.c b/moldyn.c index f2923c3..7496223 100644 --- 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; } diff --git a/moldyn.h b/moldyn.h index 5a10197..3867fc0 100644 --- 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);