#include "albe.h"
/* create mixed terms from parameters and set them */
-int albe_mult_complete_params(t_albe_mult_params *p) {
+int albe_mult_set_params(t_moldyn *moldyn,int element1,int element2) {
- printf("[moldyn] albe parameter completion\n");
+ t_albe_mult_params *p;
+
+ // set cutoff before parameters (actually only necessary for some pots)
+ if(moldyn->cutoff==0.0) {
+ printf("[albe] WARNING: no cutoff!\n");
+ return -1;
+ }
+
+ /* alloc mem for potential parameters */
+ moldyn->pot_params=malloc(sizeof(t_albe_mult_params));
+ if(moldyn->pot_params==NULL) {
+ perror("[albe] pot params alloc");
+ return -1;
+ }
+
+ /* these are now albe parameters */
+ p=moldyn->pot_params;
+
+ // only 1 combination by now :p
+ switch(element1) {
+ case SI:
+ /* type: silicon */
+ p->S[0]=ALBE_S_SI;
+ p->R[0]=ALBE_R_SI;
+ p->A[0]=ALBE_A_SI;
+ p->B[0]=ALBE_B_SI;
+ p->r0[0]=ALBE_R0_SI;
+ p->lambda[0]=ALBE_LAMBDA_SI;
+ p->mu[0]=ALBE_MU_SI;
+ p->gamma[0]=ALBE_GAMMA_SI;
+ p->c[0]=ALBE_C_SI;
+ p->d[0]=ALBE_D_SI;
+ p->h[0]=ALBE_H_SI;
+ switch(element2) {
+ case C:
+ /* type: carbon */
+ p->S[1]=ALBE_S_C;
+ p->R[1]=ALBE_R_C;
+ p->A[1]=ALBE_A_C;
+ p->B[1]=ALBE_B_C;
+ p->r0[1]=ALBE_R0_C;
+ p->lambda[1]=ALBE_LAMBDA_C;
+ p->mu[1]=ALBE_MU_C;
+ p->gamma[1]=ALBE_GAMMA_C;
+ p->c[1]=ALBE_C_C;
+ p->d[1]=ALBE_D_C;
+ p->h[1]=ALBE_H_C;
+ /* mixed type: silicon carbide */
+ p->Smixed=ALBE_S_SIC;
+ p->Rmixed=ALBE_R_SIC;
+ p->Amixed=ALBE_A_SIC;
+ p->Bmixed=ALBE_B_SIC;
+ p->r0_mixed=ALBE_R0_SIC;
+ p->lambda_m=ALBE_LAMBDA_SIC;
+ p->mu_m=ALBE_MU_SIC;
+ p->gamma_m=ALBE_GAMMA_SIC;
+ p->c_mixed=ALBE_C_SIC;
+ p->d_mixed=ALBE_D_SIC;
+ p->h_mixed=ALBE_H_SIC;
+ break;
+ default:
+ printf("[albe] WARNING: element2\n");
+ return -1;
+ }
+ break;
+ default:
+ printf("[albe] WARNING: element1\n");
+ return -1;
+ }
+
+ printf("[albe] parameter completion\n");
p->S2[0]=p->S[0]*p->S[0];
p->S2[1]=p->S[1]*p->S[1];
p->S2mixed=p->Smixed*p->Smixed;
- printf("[moldyn] albe mult parameter info:\n");
+ printf("[albe] mult parameter info:\n");
printf(" S (A) | %f | %f | %f\n",p->S[0],p->S[1],p->Smixed);
printf(" R (A) | %f | %f | %f\n",p->R[0],p->R[1],p->Rmixed);
printf(" A (eV) | %f | %f | %f\n",p->A[0]/EV,p->A[1]/EV,p->Amixed/EV);
return 0;
}
+
+int albe_mult_check_2b_bond(t_moldyn *moldyn,t_atom *itom,t_atom *jtom,u8 bc) {
+
+ t_albe_mult_params *params;
+ t_3dvec dist;
+ double d;
+ u8 brand;
+
+ v3_sub(&dist,&(jtom->r),&(itom->r));
+ if(bc) check_per_bound(moldyn,&dist);
+ d=v3_absolute_square(&dist);
+
+ params=moldyn->pot_params;
+ brand=itom->brand;
+
+ if(brand==jtom->brand) {
+ if(d<=params->S2[brand])
+ return TRUE;
+ }
+ else {
+ if(d<=params->S2mixed)
+ return TRUE;
+ }
+
+ return FALSE;
+}