]> hackdaworld.org Git - physik/posic.git/commitdiff
start of diffusion calc function
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 17 Feb 2008 13:33:15 +0000 (14:33 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 17 Feb 2008 13:33:15 +0000 (14:33 +0100)
moldyn.c

index 80cf5721a195991a0fa0bdf7a7aca18c83ea8337..93c72daa1dccc633c766794a777446d20aacf164 100644 (file)
--- 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;i<moldyn->count;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;