X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=moldyn.c;h=d715c52a11f91aa9f43244b014c281f3c2a00cc4;hb=fe84cdc3fc897581636aff89b6f4fd12db1d2718;hp=15dcedef5fd105b05ce69e2c9d49ad5a8c4c353e;hpb=f0e4c6422ec1aff0cf86597fef919335bba75c1b;p=physik%2Fposic.git diff --git a/moldyn.c b/moldyn.c index 15dcede..d715c52 100644 --- a/moldyn.c +++ b/moldyn.c @@ -55,6 +55,11 @@ pthread_mutex_t *amutex; pthread_mutex_t emutex; #endif +/* fully constrained relaxation technique - global pointers */ +u8 crtt; +u8 *constraints; +double *trafo_angle; + /* * the moldyn functions */ @@ -78,10 +83,6 @@ int moldyn_init(t_moldyn *moldyn,int argc,char **argv) { pthread_mutex_init(&emutex,NULL); #endif -#ifdef CONSTRAINT_110_5832 - printf("\n\n\nWARNING! WARNING! WARNING!\n\n\n"); - printf("\n\n\n!! -- constraints enabled -- !!\n\n\n"); -#endif return 0; } @@ -2256,6 +2257,43 @@ printf("sched:%d, steps:%d/%d, T:%4.1f/%4.1f P:%4.1f/%4.1f V:%6.1f (%d)\n", return 0; } +/* basis trafo */ + +#define FORWARD 0 +#define BACKWARD 1 + +int basis_trafo(t_3dvec *r,u8 dir,double z,double x) { + + t_3dvec tmp; + + if(dir==FORWARD) { + if(z!=0.0) { + v3_copy(&tmp,r); + r->x=cos(z)*tmp.x-sin(z)*tmp.y; + r->y=sin(z)*tmp.x+cos(z)*tmp.y; + } + if(x!=0.0) { + v3_copy(&tmp,r); + r->y=cos(x)*tmp.y-sin(x)*tmp.z; + r->z=sin(x)*tmp.y+cos(x)*tmp.z; + } + } + else { + if(x!=0.0) { + v3_copy(&tmp,r); + r->y=cos(-x)*tmp.y-sin(-x)*tmp.z; + r->z=sin(-x)*tmp.y+cos(-x)*tmp.z; + } + if(z!=0.0) { + v3_copy(&tmp,r); + r->x=cos(-z)*tmp.x-sin(-z)*tmp.y; + r->y=sin(-z)*tmp.x+cos(-z)*tmp.y; + } + } + + return 0; +} + /* velocity verlet */ int velocity_verlet(t_moldyn *moldyn) { @@ -2270,33 +2308,34 @@ int velocity_verlet(t_moldyn *moldyn) { tau=moldyn->tau; tau_square=moldyn->tau_square; -#ifdef CONSTRAINT_110_5832 - if(count==5833) { - atom[5832].f.x=0.5*(atom[5832].f.x-atom[5832].f.y); - atom[5832].f.y=-atom[5832].f.x; - } -#endif for(i=0;iatom; + msd[0]=0; + msd[1]=0; + msd[2]=0; + a_cnt=0; + b_cnt=0; + + for(i=0;icount;i++) { + + /* care for pb crossing */ + if(atom[i].pbc[0]|atom[i].pbc[1]|atom[i].pbc[2]) { + printf("[moldyn] msd pb crossings for atom %d\n",i); + printf(" x: %d y: %d z: %d\n", + atom[i].pbc[0],atom[i].pbc[1],atom[i].pbc[2]); + } + final_r.x=atom[i].r.x+atom[i].pbc[0]*moldyn->dim.x; + final_r.y=atom[i].r.y+atom[i].pbc[1]*moldyn->dim.y; + final_r.z=atom[i].r.z+atom[i].pbc[2]*moldyn->dim.z; + /* calculate distance */ + v3_sub(&dist,&final_r,&(atom[i].r_0)); + d2=v3_absolute_square(&dist); + + if(atom[i].brand) { + b_cnt+=1; + msd[1]+=d2; + } + else { + a_cnt+=1; + msd[0]+=d2; + } + + msd[2]+=d2; + } + + msd[0]/=a_cnt; + msd[1]/=b_cnt; + msd[2]/=moldyn->count; + + return 0; +} + int bonding_analyze(t_moldyn *moldyn,double *cnt) { return 0;