From: hackbard Date: Fri, 31 Mar 2006 15:13:08 +0000 (+0000) Subject: testing X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=83775c491117faa149281d0302fc8b8064d6b080;p=physik%2Fposic.git testing --- diff --git a/math/math.c b/math/math.c index 6488248..6f4345e 100644 --- a/math/math.c +++ b/math/math.c @@ -84,11 +84,11 @@ int v3_per_bound(t_3dvec *a,t_3dvec *dim) { y=0.5*dim->y; z=0.5*dim->z; - if(a->x>x) a->x-=dim->x; + if(a->x>=x) a->x-=dim->x; else if(-a->x>x) a->x+=dim->x; - if(a->y>y) a->y-=dim->y; + if(a->y>=y) a->y-=dim->y; else if(-a->y>y) a->y+=dim->y; - if(a->z>z) a->z-=dim->z; + if(a->z>=z) a->z-=dim->z; else if(-a->z>z) a->z+=dim->z; return 0; diff --git a/moldyn.c b/moldyn.c index 08901c7..3d669d2 100644 --- a/moldyn.c +++ b/moldyn.c @@ -199,9 +199,10 @@ int moldyn_integrate(t_moldyn *moldyn) { /* check for visualiziation */ // to be continued ... - if(!(i%100)) + if(!(i%1)) { visual_atoms(moldyn->visual,i*moldyn->tau, moldyn->atom,moldyn->count); + } } return 0; @@ -321,7 +322,7 @@ int force_lennard_jones(t_moldyn *moldyn) { h1*=h2; /* 1/r^14 */ h1*=sig12; h2*=sig6; - d=-12.0*h1+6.0*h2; + d=12.0*h1-6.0*h2; d*=eps; v3_scale(&force,&distance,d); v3_add(&(atom[j].f),&(atom[j].f),&force); diff --git a/posic.c b/posic.c index 04d9b7f..926e20c 100644 --- a/posic.c +++ b/posic.c @@ -51,12 +51,25 @@ int main(int argc,char **argv) { t=TEMPERATURE; printf("placing silicon atoms ... "); - count=create_lattice(DIAMOND,Si,M_SI,LC_SI,a,b,c,&si); - printf("(%d) ok!\n",count); + //count=create_lattice(DIAMOND,Si,M_SI,LC_SI,a,b,c,&si); + //printf("(%d) ok!\n",count); + count=2; + si=malloc(2*sizeof(t_atom)); + si[0].r.x=2.0; + si[0].r.y=0; + si[0].r.z=0; + si[0].element=Si; + si[0].mass=14.0; + si[1].r.x=-2.0; + si[1].r.y=0; + si[1].r.z=0; + si[1].element=Si; + si[1].mass=14.0; printf("setting thermal fluctuations\n"); - thermal_init(si,&random,count,t); - + //thermal_init(si,&random,count,t); + v3_zero(&(si[0].v)); + v3_zero(&(si[1].v)); /* check kinetic energy */ @@ -73,7 +86,8 @@ int main(int argc,char **argv) { md.atom=si; md.potential=potential_lennard_jones; md.force=force_lennard_jones; - md.cutoff_square=((LC_SI/4.0)*(LC_SI/4.0)); + //md.cutoff_square=((LC_SI/4.0)*(LC_SI/4.0)); + md.cutoff_square=36.0; md.pot_params=&lj; md.integrate=velocity_verlet; md.time_steps=RUNS; @@ -85,7 +99,7 @@ int main(int argc,char **argv) { help=lj.sigma6*lj.sigma6; lj.sigma6*=help; lj.sigma12=lj.sigma6*lj.sigma6; - lj.epsilon=1; + lj.epsilon=10000; u=get_e_pot(&md); diff --git a/posic.h b/posic.h index 854dfb8..6a8131d 100644 --- a/posic.h +++ b/posic.h @@ -17,14 +17,14 @@ #ifndef POSIC_H #define POSIC_H -#define RUNS 15000 -#define TAU 0.000001 +#define RUNS 200 +#define TAU 0.001 #define TEMPERATURE 273.0 -#define LEN_X 1 -#define LEN_Y 1 -#define LEN_Z 1 +#define LEN_X 15 +#define LEN_Y 15 +#define LEN_Z 15 #define R_CUTOFF 20 diff --git a/visual/visual.c b/visual/visual.c index 7b7862e..9d0f5a2 100644 --- a/visual/visual.c +++ b/visual/visual.c @@ -78,8 +78,8 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { /* script file update */ dprintf(v->fd,"load xyz %s\n",file); dprintf(v->fd,"spacefill 200\n"); - dprintf(v->fd,"rotate x 100\n"); - dprintf(v->fd,"rotate y 10\n"); + //dprintf(v->fd,"rotate x 100\n"); + //dprintf(v->fd,"rotate y 10\n"); dprintf(v->fd,"set ambient 20\n"); dprintf(v->fd,"set specular on\n"); sprintf(file,"%s-%.15f.ppm",v->fb,time);