]> hackdaworld.org Git - physik/posic.git/commitdiff
fixed create_lattice routine
authorhackbard <hackbard>
Wed, 29 Nov 2006 22:00:26 +0000 (22:00 +0000)
committerhackbard <hackbard>
Wed, 29 Nov 2006 22:00:26 +0000 (22:00 +0000)
moldyn.c
sic.c
visual/visual.c

index 9d782d657fbc89c5ab800ed7705de48c87739a1e..515a27315bf8455c45a59d81eb278431b7d0f44c 100644 (file)
--- 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 b5a8d93c1d46f2eb0e1266dce100b706cc21a1c2..95adb8acbc964f987aa42626beb5960fc9953a25 100644 (file)
--- 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");
index 427e765b07f4627781d14a40c3fca5d6cdff0cd8..88bc6e624dd67b91f145228917d12577c3f989d1 100644 (file)
@@ -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);