From: hackbard Date: Wed, 29 Nov 2006 22:00:26 +0000 (+0000) Subject: fixed create_lattice routine X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=a40aa116ffcefe415a0146c9ea10918ce5b4f888;p=physik%2Fposic.git fixed create_lattice routine --- diff --git a/moldyn.c b/moldyn.c index 9d782d6..515a273 100644 --- a/moldyn.c +++ b/moldyn.c @@ -185,17 +185,15 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass, int count; int ret; t_3dvec origin; - t_atom *atom; count=a*b*c; - atom=moldyn->atom; if(type==FCC) count*=4; if(type==DIAMOND) count*=8; - atom=malloc(count*sizeof(t_atom)); - if(atom==NULL) { + moldyn->atom=malloc(count*sizeof(t_atom)); + if(moldyn->atom==NULL) { perror("malloc (atoms)"); return -1; } @@ -204,10 +202,10 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass, switch(type) { case FCC: - ret=fcc_init(a,b,c,lc,atom,&origin); + ret=fcc_init(a,b,c,lc,moldyn->atom,&origin); break; case DIAMOND: - ret=diamond_init(a,b,c,lc,atom,&origin); + ret=diamond_init(a,b,c,lc,moldyn->atom,&origin); break; default: printf("unknown lattice type (%02x)\n",type); @@ -225,10 +223,10 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass, moldyn->count=count; while(count) { - atom[count-1].element=element; - atom[count-1].mass=mass; - atom[count-1].attr=attr; - atom[count-1].bnum=bnum; + moldyn->atom[count-1].element=element; + moldyn->atom[count-1].mass=mass; + moldyn->atom[count-1].attr=attr; + moldyn->atom[count-1].bnum=bnum; count-=1; } diff --git a/sic.c b/sic.c index b5a8d93..95adb8a 100644 --- a/sic.c +++ b/sic.c @@ -14,9 +14,6 @@ #include "posic.h" -#define TRUE 1 -#define FALSE 0 - int main(int argc,char **argv) { /* main moldyn structure */ @@ -25,7 +22,7 @@ int main(int argc,char **argv) { /* potential parameters */ t_lj_params lj; t_ho_params ho; - //t_tersoff_mult_params tp; + t_tersoff_mult_params tp; /* misc variables, mainly to initialize stuff */ t_3dvec r,v; @@ -76,13 +73,14 @@ int main(int argc,char **argv) { /* create the lattice / place atoms */ printf("[sic] creating atoms\n"); - memset(&v,0,sizeof(t_3dvec)); - r.y=0; - r.z=0; - r.x=0.23*sqrt(3.0)*LC_SI/2.0; - add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v); - r.x=-r.x; - add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v); + //memset(&v,0,sizeof(t_3dvec)); + //r.y=0; + //r.z=0; + //r.x=0.23*sqrt(3.0)*LC_SI/2.0; + //add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v); + //r.x=-r.x; + //add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v); + create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,ATOM_ATTR_2BP,0,10,10,10); /* set temperature */ printf("[sic] setting temperature\n"); diff --git a/visual/visual.c b/visual/visual.c index 427e765..88bc6e6 100644 --- a/visual/visual.c +++ b/visual/visual.c @@ -92,6 +92,7 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { dprintf(v->fd,"rotate y 10\n"); dprintf(v->fd,"set ambient 20\n"); dprintf(v->fd,"set specular on\n"); + dprintf(v->fd,"set boundbox on\n"); //dprintf(v->fd,"label\n"); sprintf(file,"%s-%.15f.ppm",v->fb,time); dprintf(v->fd,"write ppm %s\n",file);