/* add forces */
v3_add(&(ai->f),&(ai->f),&force);
- v3_sub(&(aj->f),&(aj->f),&force); // reason: dri rij = - drj rij
+ v3_scale(&force,&force,-1.0); // reason: dri rij = - drj rij
+ v3_add(&(aj->f),&(aj->f),&force);
#ifdef DEBUG
if((ai==&(moldyn->atom[0]))|(aj==&(moldyn->atom[0]))) {
#endif
/* virial */
- virial_calc(ai,&force,&dist_ij);
+ virial_calc(aj,&force,&dist_ij);
/* energy 2bp contribution */
energy=f_r*f_c;
}
#endif
- /* virial */
- if(aj<ai)
- 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;
}
#endif
- /* virial */
- //virial_calc(ai,&force,&dist_ij);
-
/* derivative wrt j */
v3_scale(&force,&dcosdrj,fcdg*pre_dzeta);
#endif
/* virial */
- //v3_scale(&force,&force,-1.0);
- if(aj<ai)
- virial_calc(ai,&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 rik = - drk rik
#endif
/* virial */
- //v3_scale(&force,&force,-1.0);
- if(aj<ai)
- virial_calc(ai,&force,&dist_ik);
+ v3_scale(&force,&force,-1.0);
+ virial_calc(ai,&force,&dist_ik);
/* increase k counter */
exchange->kcount++;
return 0;
}
+
+int tersoff_mult_check_2b_bond(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) {
+
+ t_tersoff_mult_params *params;
+ t_3dvec dist;
+ double d;
+ u8 brand;
+
+ v3_sub(&dist,&(aj->r),&(ai->r));
+ if(bc) check_per_bound(moldyn,&dist);
+ d=v3_absolute_square(&dist);
+
+ params=moldyn->pot_params;
+ brand=ai->brand;
+
+ if(brand==aj->brand) {
+ if(d<=params->S2[brand])
+ return TRUE;
+ }
+ else {
+ if(d<=params->S2mixed)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
int tersoff_mult_3bp_j2(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
int tersoff_mult_3bp_k2(t_moldyn *moldyn,
t_atom *ai,t_atom *aj,t_atom *ak,u8 bc);
+int tersoff_mult_check_2b_bond(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
/* tersoff potential paramter defines */