From: hackbard Date: Tue, 12 Dec 2006 14:28:10 +0000 (+0000) Subject: fixed 2bp, todo: adjust create lattice, then go for 3bp X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=ff1bf111f517d9fa69903cd56181c1e9e38665ff;p=physik%2Fposic.git fixed 2bp, todo: adjust create lattice, then go for 3bp --- diff --git a/moldyn.c b/moldyn.c index 7ea5d50..aaab0de 100644 --- a/moldyn.c +++ b/moldyn.c @@ -99,6 +99,12 @@ int set_dim(t_moldyn *moldyn,double x,double y,double z,u8 visualize) { moldyn->vis.dim.z=z; } + printf("[moldyn] dimensions in A:\n"); + printf(" x: %f\n",moldyn->dim.x); + printf(" y: %f\n",moldyn->dim.y); + printf(" z: %f\n",moldyn->dim.z); + printf(" visualize simulation box: %s\n",visualize?"on":"off"); + return 0; } @@ -802,6 +808,7 @@ int velocity_verlet(t_moldyn *moldyn) { v3_add(&(atom[i].v),&(atom[i].v),&delta); } +moldyn_bc_check(moldyn); /* neighbour list update */ link_cell_update(moldyn); @@ -885,11 +892,12 @@ int potential_force_calc(t_moldyn *moldyn) { continue; if((jtom->attr&ATOM_ATTR_2BP)& - (itom[i].attr&ATOM_ATTR_2BP)) + (itom[i].attr&ATOM_ATTR_2BP)) { moldyn->func2b(moldyn, &(itom[i]), jtom, bc_ij); + } /* 3 body potential/force */ @@ -1212,7 +1220,7 @@ int tersoff_mult_2bp(t_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc) { /* f_a, df_a calc (again, same for ij and ji) | save for later use! */ exchange->f_a=-B*exp(-mu*d_ij); - exchange->df_a=-mu*exchange->f_a/d_ij; + exchange->df_a=mu*exchange->f_a/d_ij; /* f_c, df_c calc (again, same for ij and ji) */ if(d_ijf),&(ai->f),&force); + v3_add(&(ai->f),&(ai->f),&force); return 0; } diff --git a/sic.c b/sic.c index 1e29a85..5edb699 100644 --- a/sic.c +++ b/sic.c @@ -107,20 +107,24 @@ int main(int argc,char **argv) { set_pbc(&md,TRUE,TRUE,TRUE); /* create the lattice / place atoms */ - //printf("[sic] creating atoms\n"); - //create_lattice(&md,DIAMOND,LC_SI,SI,M_SI, - // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, - // 0,5,5,5); + printf("[sic] creating atoms\n"); + create_lattice(&md,DIAMOND,LC_SI,SI,M_SI, + ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, + 0,5,5,5); /* testing configuration */ - r.x=2.7/2; v.x=0; - r.y=0; v.y=0; - r.z=0; v.z=0; - add_atom(&md,SI,M_SI,0,ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,&r,&v); - r.x=-2.7/2; v.x=0; - r.y=0; v.y=0; - r.z=0; v.z=0; - add_atom(&md,SI,M_SI,0,ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,&r,&v); + //r.x=2.45/2; v.x=0; + //r.y=0; v.y=0; + //r.z=0; v.z=0; + //add_atom(&md,SI,M_SI,0, + // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, + // &r,&v); + //r.x=-2.45/2; v.x=0; + //r.y=0; v.y=0; + //r.z=0; v.z=0; + //add_atom(&md,SI,M_SI,0, + // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB, + // &r,&v); /* setting a nearest neighbour distance for the moldyn checks */ set_nn_dist(&md,0.25*sqrt(3.0)*LC_SI); /* diamond ! */