X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fposic.git;a=blobdiff_plain;f=potentials%2Falbe.c;h=a79f58d3268834f91aaead5cfc26ba56c6334929;hp=c2acf2f3cfe9902a8f781fe7920dad060fa637cc;hb=92ef07d77a4c879527180224acea73a3f6564497;hpb=a70de3dccbf0a01c39c2643818ec86c0b465caba diff --git a/potentials/albe.c b/potentials/albe.c index c2acf2f..a79f58d 100644 --- a/potentials/albe.c +++ b/potentials/albe.c @@ -43,34 +43,6 @@ int albe_mult_complete_params(t_albe_mult_params *p) { return 0; } -/* albe 1 body part */ -int albe_mult_1bp(t_moldyn *moldyn,t_atom *ai) { - - int brand; - t_albe_mult_params *params; - t_albe_exchange *exchange; - - brand=ai->brand; - params=moldyn->pot_params; - exchange=&(params->exchange); - - /* - * simple: point constant parameters only depending on atom i to - * their right values - */ - - exchange->gamma_i=&(params->gamma[brand]); - exchange->c_i=&(params->c[brand]); - exchange->d_i=&(params->d[brand]); - exchange->h_i=&(params->h[brand]); - - exchange->ci2=params->c[brand]*params->c[brand]; - exchange->di2=params->d[brand]*params->d[brand]; - exchange->ci2di2=exchange->ci2/exchange->di2; - - return 0; -} - /* albe 3 body potential function (first ij loop) */ int albe_mult_3bp_j1(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { @@ -92,11 +64,12 @@ int albe_mult_3bp_j1(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { */ brand=ai->brand; - - if(brand==aj->brand) + if(brand==aj->brand) { S2=params->S2[brand]; - else + } + else { S2=params->S2mixed; + } /* dist_ij, d_ij2 */ v3_sub(&dist_ij,&(aj->r),&(ai->r)); @@ -152,12 +125,25 @@ int albe_mult_3bp_k1(t_moldyn *moldyn, R=params->R[brand]; S=params->S[brand]; S2=params->S2[brand]; + /* albe needs i,k depending c,d,h and gamma values */ + exchange->gamma_i=&(params->gamma[brand]); + exchange->c_i=&(params->c[brand]); + exchange->d_i=&(params->d[brand]); + exchange->h_i=&(params->h[brand]); } else { R=params->Rmixed; S=params->Smixed; S2=params->S2mixed; + /* albe needs i,k depending c,d,h and gamma values */ + exchange->gamma_i=&(params->gamma_m); + exchange->c_i=&(params->c_mixed); + exchange->d_i=&(params->d_mixed); + exchange->h_i=&(params->h_mixed); } + exchange->ci2=*(exchange->c_i)**(exchange->c_i); + exchange->di2=*(exchange->d_i)**(exchange->d_i); + exchange->ci2di2=exchange->ci2/exchange->di2; /* dist_ik, d_ik2 */ v3_sub(&dist_ik,&(ak->r),&(ai->r)); @@ -185,11 +171,11 @@ int albe_mult_3bp_k1(t_moldyn *moldyn, cos_theta=v3_scalar_product(&dist_ij,&dist_ik)/(d_ij*d_ik); /* g_ijk */ - h_cos=*(exchange->h_i)-cos_theta; + h_cos=*(exchange->h_i)+cos_theta; // + in albe formalism d2_h_cos2=exchange->di2+(h_cos*h_cos); frac=exchange->ci2/d2_h_cos2; g=*(exchange->gamma_i)*(1.0+exchange->ci2di2-frac); - dg=-2.0*frac**(exchange->gamma_i)*h_cos/d2_h_cos2; + dg=2.0*frac**(exchange->gamma_i)*h_cos/d2_h_cos2; // + in albe f.. /* zeta sum += f_c_ik * g_ijk */ if(d_ik<=R) { @@ -205,6 +191,14 @@ int albe_mult_3bp_k1(t_moldyn *moldyn, exchange->zeta_ij+=f_c_ik*g; } +#ifdef DEBUG + if((ai==&(moldyn->atom[0]))| + (aj==&(moldyn->atom[864]))| + (ak==&(moldyn->atom[1003]))) { + printf(" -> %f %f %f\n",exchange->ci2di2,frac,h_cos); + } +#endif + /* store even more data for second k loop */ exchange->g[kcount]=g; exchange->dg[kcount]=dg; @@ -289,7 +283,7 @@ int albe_mult_3bp_j2(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { } /* force contribution */ - scale=-0.5*(f_c*(df_r+b*df_a)+df_c*(f_r+b*df_a)); + scale=-0.5*(f_c*(df_r+b*df_a)+df_c*(f_r+b*f_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 @@ -304,12 +298,12 @@ int albe_mult_3bp_j2(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { printf("total j: %f %f %f\n",aj->f.x,aj->f.y,aj->f.z); printf("energy: %f = %f %f %f %f\n",0.5*f_c*(b*f_a+f_r), f_c,b,f_a,f_r); + printf(" %f %f %f\n",exchange->zeta_ij,.0,.0); } #endif /* virial */ - if(ajdist_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; @@ -435,8 +429,7 @@ int albe_mult_3bp_k2(t_moldyn *moldyn, /* virial */ //v3_scale(&force,&force,-1.0); - if(ajkcount++;