/* zero absolute time */
moldyn->time=0.0;
- /* debugging, ignre */
+ /* debugging, ignore */
moldyn->debug=0;
/* executing the schedule */
if(!(i%v)) {
visual_atoms(&(moldyn->vis),moldyn->time,
moldyn->atom,moldyn->count);
- printf("\rsched: %d, steps: %d, theta: %d",
+ printf("\rsched: %d, steps: %d, debug: %d",
sched,i,moldyn->debug);
fflush(stdout);
}
/* 2bp post function */
if(moldyn->func2b_post) {
-printf("DEBUG: vor 2bp post\n");
moldyn->func2b_post(moldyn,
&(itom[i]),
jtom,bc_ij);
-printf("DEBUG: nach 2bp post\n");
}
}
}
+//printf("DEBUG: %.15f \n",itom[i].f.x);
}
return 0;
/* clear 3bp and 2bp post run */
exchange->run3bp=0;
exchange->run2bp_post=0;
+
+ /* reset S > r > R mark */
+ exchange->d_ij_between_rs=0;
/*
* calc of 2bp contribution of V_ij and dV_ij/ji
df_c=-0.5*sin(arg)*(M_PI/(s_r*d_ij));
/* two body contribution (ij, ji) */
v3_scale(&force,&dist_ij,-df_c*f_r-df_r*f_c);
+ /* tell 3bp that S > r > R */
+ exchange->d_ij_between_rs=1;
}
/* add forces of 2bp (ij, ji) contribution
/* Vij and dVij */
zeta=exchange->zeta_ij;
- tmp=betaini*pow(zeta,ni-1.0); /* beta^n * zeta^n-1 */
- b=(1+zeta*tmp); /* 1 + beta^n * zeta^n */
- db=chi*pow(b,-1.0/(2*ni)-1); /* chi * (...)^(-1/2n - 1) */
- b=db*b; /* b_ij */
- db*=-0.5*tmp; /* db_ij */
- v3_scale(&force,&(exchange->dzeta_ij),f_a*db);
- v3_scale(&temp,dist_ij,df_a*b);
- v3_add(&force,&force,&temp);
- v3_scale(&force,&force,f_c);
- v3_scale(&temp,dist_ij,df_c*b*f_a);
- v3_add(&force,&force,&temp);
+ if(zeta==0.0) {
+ moldyn->debug++; /* just for debugging ... */
+ db=0.0;
+ b=chi;
+ }
+ else {
+ tmp=betaini*pow(zeta,ni-1.0); /* beta^n * zeta^n-1 */
+ b=(1+zeta*tmp); /* 1 + beta^n zeta^n */
+ db=chi*pow(b,-1.0/(2*ni)-1); /* x(...)^(-1/2n - 1) */
+ b=db*b; /* b_ij */
+ db*=-0.5*tmp; /* db_ij */
+ v3_scale(&force,&(exchange->dzeta_ij),f_a*db);
+ v3_scale(&temp,dist_ij,df_a*b);
+ v3_add(&force,&force,&temp);
+ v3_scale(&force,&force,f_c);
+ v3_scale(&temp,dist_ij,df_c*b*f_a);
+ v3_add(&force,&force,&temp);
+ v3_scale(&force,&force,-0.5);
+
+ /* add force */
+ v3_add(&(ai->f),&(ai->f),&force);
+ }
/* add energy of 3bp sum */
moldyn->energy+=(0.5*f_c*b*f_a);
- /* add force (sub, as F = - dVij) */
- v3_sub(&(ai->f),&(ai->f),&force);
-
/* dVji */
zeta=exchange->zeta_ji;
- tmp=betajnj*pow(zeta,nj-1.0); /* beta^n * zeta^n-1 */
- b=(1+zeta*tmp); /* 1 + beta^n * zeta^n */
- db=chi*pow(b,-1.0/(2*nj)-1); /* chi * (...)^(-1/2n - 1) */
- b=db*b; /* b_ij */
- db*=-0.5*tmp; /* db_ij */
- v3_scale(&force,&(exchange->dzeta_ji),f_a*db);
- v3_scale(&temp,dist_ij,df_a*b);
- v3_add(&force,&force,&temp);
- v3_scale(&force,&force,f_c);
- v3_scale(&temp,dist_ij,df_c*b*f_a);
- v3_add(&force,&force,&temp);
-
- /* add force (sub, as F = - dVji) */
- v3_sub(&(ai->f),&(ai->f),&force);
+ if(zeta==0.0) {
+ // do nothing ... (db=0, b=chi)
+ moldyn->debug++;
+ }
+ else {
+ tmp=betajnj*pow(zeta,nj-1.0); /* beta^n * zeta^n-1 */
+ b=(1+zeta*tmp); /* 1 + beta^n zeta^n */
+ db=chi*pow(b,-1.0/(2*nj)-1); /* x(...)^(-1/2n - 1) */
+ b=db*b; /* b_ij */
+ db*=-0.5*tmp; /* db_ij */
+ v3_scale(&force,&(exchange->dzeta_ji),f_a*db);
+ v3_scale(&temp,dist_ij,df_a*b);
+ v3_add(&force,&force,&temp);
+ v3_scale(&force,&force,f_c);
+ v3_scale(&temp,dist_ij,0.5*df_c*b*f_a);
+ v3_add(&force,&force,&temp);
+ v3_scale(&force,&force,-0.5);
+
+ /* add force */
+ v3_sub(&(ai->f),&(ai->f),&force);
+ }
return 0;
}
/* betajnj * zeta_jk ^ nj-1 */
tmp=exchange->betajnj*pow(zeta,(n-1.0));
tmp=-chi/2.0*pow(1+tmp*zeta,-1.0/(2.0*n)-1)*tmp;
- v3_scale(&temp1,&temp1,tmp*B*exp(-mu*d_jk)*f_c_jk);
+ v3_scale(&temp1,&temp1,tmp*B*exp(-mu*d_jk)*f_c_jk*0.5);
v3_add(&(ai->f),&(ai->f),&temp1); /* -1 skipped in f_a calc ^ */
+ /* scaled with 0.5 ^ */
}
return 0;
/* misc parameters */
double tau;
+ /* testing location & velocity vector */
+ t_3dvec r,v;
+
/* values */
tau=1.0e-15; /* delta t = 1 fs */
/* cutoff radius */
printf("[sic] setting cutoff radius\n");
set_cutoff(&md,TM_S_SI);
+ //set_cutoff(&md,2*LC_SI);
/* set (initial) dimensions of simulation volume */
printf("[sic] setting dimensions\n");
- set_dim(&md,2*LC_SI,2*LC_SI,2*LC_SI,TRUE);
+ set_dim(&md,5*LC_SI,5*LC_SI,5*LC_SI,TRUE);
/* set periodic boundary conditions in all directions */
printf("[sic] setting periodic boundary conditions\n");
/* create the lattice / place atoms */
printf("[sic] creating atoms\n");
- create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
- ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
- //ATOM_ATTR_2BP|ATOM_ATTR_HB,
- 0,2,2,2);
+ //create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
+ // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
+ // //ATOM_ATTR_2BP|ATOM_ATTR_HB,
+ // 0,5,5,5);
+
+ /* testing configuration */
+ r.x=-0.55*0.25*sqrt(3.0)*LC_SI; v.x=0;
+ r.y=0; v.y=0;
+ r.z=0; v.z=0;
+ add_atom(&md,SI,M_SI,0,ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,&r,&v);
+ r.x=+0.55*0.25*sqrt(3.0)*LC_SI; v.x=0;
+ r.y=0; v.y=0;
+ r.z=0; v.z=0;
+ add_atom(&md,SI,M_SI,0,ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,&r,&v);
/* setting a nearest neighbour distance for the moldyn checks */
set_nn_dist(&md,0.25*sqrt(3.0)*LC_SI); /* diamond ! */
/* create the simulation schedule */
printf("[sic] adding schedule\n");
- moldyn_add_schedule(&md,100,1.0e-15);
+ moldyn_add_schedule(&md,1000,1.0e-15);
/* activate logging */
printf("[sic] activate logging\n");
- moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",1);
- moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",1);
+ moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",10);
+ moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",10);
/*
* let's do the actual md algorithm now