From: hackbard Date: Thu, 3 May 2007 09:43:08 +0000 (+0000) Subject: fixed sign X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=7fcb896467bdf236f60c4c3784a9d51214737fcb;p=physik%2Fposic.git fixed sign --- diff --git a/potentials/tersoff.c b/potentials/tersoff.c index 531d292..b6533e1 100644 --- a/potentials/tersoff.c +++ b/potentials/tersoff.c @@ -153,7 +153,7 @@ int tersoff_mult_2bp(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { /* add forces */ v3_add(&(ai->f),&(ai->f),&force); - v3_sub(&(aj->f),&(aj->f),&force); + v3_sub(&(aj->f),&(aj->f),&force); // reason: dri rij = - drj rij #ifdef DEBUG if((ai==&(moldyn->atom[0]))|(aj==&(moldyn->atom[0]))) { @@ -388,7 +388,7 @@ int tersoff_mult_3bp_j2(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { ni=*(exchange->n_i); tmp=exchange->betaini*pow(exchange->zeta_ij,ni-1.0); b=(1.0+exchange->zeta_ij*tmp); - db=chi*pow(b,-1.0/(2*ni)-1.0); + db=chi*pow(b,-1.0/(2.0*ni)-1.0); b=db*b; db*=-0.5*tmp; } @@ -397,7 +397,7 @@ int tersoff_mult_3bp_j2(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { v3_scale(&force,&(exchange->dist_ij),df_a*f_c+f_a*df_c); v3_scale(&force,&force,-0.5*b); v3_add(&(ai->f),&(ai->f),&force); - v3_sub(&(aj->f),&(aj->f),&force); + v3_sub(&(aj->f),&(aj->f),&force); // dri rij = - drj rij #ifdef DEBUG if((ai==&(moldyn->atom[0]))|(aj==&(moldyn->atom[0]))) { @@ -522,7 +522,7 @@ int tersoff_mult_3bp_k2(t_moldyn *moldyn, /* virial */ //virial_calc(ai,&force,&dist_ij); - /* derivatice wrt j */ + /* derivative wrt j */ v3_scale(&force,&dcosdrj,fcdg*pre_dzeta); /* force contribution */ @@ -540,7 +540,7 @@ int tersoff_mult_3bp_k2(t_moldyn *moldyn, //virial_calc(aj,&force,&dist_ij); /* derivative wrt k */ - v3_scale(&force,&dist_ik,dfcg); + v3_scale(&force,&dist_ik,-1.0*dfcg); // dri rij = - drj rij v3_scale(&tmp,&dcosdrk,fcdg); v3_add(&force,&force,&tmp); v3_scale(&force,&force,pre_dzeta); diff --git a/potentials/tersoff_orig.c b/potentials/tersoff_orig.c index 90121f2..69b67ac 100644 --- a/potentials/tersoff_orig.c +++ b/potentials/tersoff_orig.c @@ -310,7 +310,7 @@ int tersoff_mult_post_2bp(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { 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) */ + db=chi*pow(b,-1.0/(2.0*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); diff --git a/sic.c b/sic.c index a78f3a0..714710b 100644 --- a/sic.c +++ b/sic.c @@ -194,9 +194,17 @@ int main(int argc,char **argv) { // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, // ATOM_ATTR_2BP|ATOM_ATTR_HB, // &r,&v); + //r.z=0.27*sqrt(3.0)*LC_SI/2.0; v.z=0; + //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0; + //r.y=0; v.y=0; + //r.x=0; v.x=0; + //add_atom(&md,SI,M_SI,0, + // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, + // ATOM_ATTR_2BP|ATOM_ATTR_HB, + // &r,&v); + //r.z=-r.z; v.z=-v.z; + //r.y=0; v.y=0; //r.x=0; v.x=0; - //r.y=0; v.y=0; - //r.z=sin(M_PI*60.0/180.0)*(TM_S_SI+TM_R_SI)/4.0; v.z=0; //add_atom(&md,SI,M_SI,0, // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, // ATOM_ATTR_2BP|ATOM_ATTR_HB,