double s_r;
double arg;
+ printf("WARNING! - tersoff_mult_2bp is obsolete.\n");
+ printf("WARNING! - repulsive part handled in 3bp/j2 routine.\n");
+
/* use newtons third law */
if(ai<aj) return 0;
#endif
/* virial */
- //virial_calc(ai,&force,&dist_ij);
- //virial_calc(aj,&force,&dist_ij);
- //ai->virial.xx-=force.x*dist_ij.x;
- //ai->virial.yy-=force.y*dist_ij.y;
- //ai->virial.zz-=force.z*dist_ij.z;
- //ai->virial.xy-=force.x*dist_ij.y;
- //ai->virial.xz-=force.x*dist_ij.z;
- //ai->virial.yz-=force.y*dist_ij.z;
+ virial_calc(ai,&force,&dist_ij);
/* energy 2bp contribution */
moldyn->energy+=f_r*f_c;
t_tersoff_exchange *exchange;
t_3dvec force;
double f_a,df_a,b,db,f_c,df_c;
+ double f_r,df_r;
+ double scale;
double mu,B,chi;
+ double lambda,A;
double d_ij;
unsigned char brand;
double ni,tmp;
S=params->S[brand];
R=params->R[brand];
B=params->B[brand];
+ A=params->A[brand];
mu=params->mu[brand];
+ lambda=params->lambda[brand];
chi=1.0;
}
else {
S=params->Smixed;
R=params->Rmixed;
B=params->Bmixed;
+ A=params->Amixed;
mu=params->mu_m;
+ lambda=params->lambda_m;
chi=params->chi;
}
f_a=-B*exp(-mu*d_ij);
df_a=mu*f_a/d_ij;
+ /* f_r, df_r */
+ f_r=A*exp(-lambda*d_ij);
+ df_r=lambda*f_r/d_ij;
+
/* b, db */
if(exchange->zeta_ij==0.0) {
b=chi;
}
/* force contribution */
- v3_scale(&force,&(exchange->dist_ij),df_a*f_c+f_a*df_c);
- v3_scale(&force,&force,-0.5*b);
+ scale=-0.5*(f_c*(df_r+b*df_a)+df_c*(f_r+b*df_a));
+ v3_scale(&force,&(exchange->dist_ij),scale);
v3_add(&(ai->f),&(ai->f),&force);
v3_sub(&(aj->f),&(aj->f),&force); // dri rij = - drj rij
#endif
/* virial */
- //virial_calc(ai,&force,&(exchange->dist_ij));
- //virial_calc(aj,&force,&(exchange->dist_ij));
+ virial_calc(ai,&force,&(exchange->dist_ij));
/* dzeta prefactor = - 0.5 f_c f_a db */
exchange->pre_dzeta=-0.5*f_a*f_c*db;
/* energy contribution */
- moldyn->energy+=0.5*f_c*b*f_a;
+ moldyn->energy+=0.5*f_c*(b*f_a+f_r);
/* reset k counter for second k loop */
exchange->kcount=0;
#endif
/* virial */
- //virial_calc(aj,&force,&dist_ij);
+ //v3_scale(&force,&force,-1.0);
+ virial_calc(ai,&force,&dist_ij);
/* derivative wrt k */
- v3_scale(&force,&dist_ik,-1.0*dfcg); // dri rij = - drj rij
+ v3_scale(&force,&dist_ik,-1.0*dfcg); // dri rik = - drk rik
v3_scale(&tmp,&dcosdrk,fcdg);
v3_add(&force,&force,&tmp);
v3_scale(&force,&force,pre_dzeta);
#endif
/* virial */
- virial_calc(ak,&force,&dist_ik);
+ //v3_scale(&force,&force,-1.0);
+ virial_calc(ai,&force,&dist_ik);
/* increase k counter */
exchange->kcount++;