X-Git-Url: https://www.hackdaworld.org/gitweb/?a=blobdiff_plain;f=moldyn.c;h=93c72daa1dccc633c766794a777446d20aacf164;hb=9b3b22db2ac62d0fc45a072749bdb4ad70d10f99;hp=80cf5721a195991a0fa0bdf7a7aca18c83ea8337;hpb=7cf0ffe2454e4d683acdd29560868dda8a3cf3b6;p=physik%2Fposic.git diff --git a/moldyn.c b/moldyn.c index 80cf572..93c72da 100644 --- a/moldyn.c +++ b/moldyn.c @@ -2322,6 +2322,42 @@ int pair_correlation_init(t_moldyn *moldyn,double dr) { return 0; } +int calculate_diffusion_coefficient(t_moldyn *moldyn,double *dc) { + + int i; + t_atom *atom; + t_3dvec dist; + double d2; + int a_cnt; + int b_cnt; + + atom=moldyn->atom; + dc[0]=0; + dc[1]=0; + dc[2]=0; + a_cnt=0; + b_cnt=0; + + for(i=0;icount;i++) { + + v3_sub(&dist,&(atom[i].r),&(atom[i].r_0)); + check_per_bound(moldyn,&dist); + d2=v3_absolute_square(&dist); + + if(atom[i].brand) { + b_cnt+=1; + dc[1]+=d2; + } + else { + a_cnt+=1; + } + + dc[2]+=d2; + } + + return 0; +} + int calculate_pair_correlation(t_moldyn *moldyn,double dr,void *ptr) { int slots;