]> hackdaworld.org Git - physik/posic.git/commitdiff
testing
authorhackbard <hackbard>
Fri, 31 Mar 2006 15:13:08 +0000 (15:13 +0000)
committerhackbard <hackbard>
Fri, 31 Mar 2006 15:13:08 +0000 (15:13 +0000)
math/math.c
moldyn.c
posic.c
posic.h
visual/visual.c

index 6488248a39235d38d8e74aaa03933128a046f5ce..6f4345e0124460ebbcb63a0482df9e367e592629 100644 (file)
@@ -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;
index 08901c783452a006b638787351b735e20e2a56c3..3d669d223401ddd8fe9277e9ea07654186e7018e 100644 (file)
--- 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 04d9b7f1ff23bc0d3f5dcf504ff9f6f83b461979..926e20c4e43ee38965e0bb62e01b87b09f7b858d 100644 (file)
--- 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 854dfb88bb6c20be4fb4f6ede5a192edb2d87ebb..6a8131d0ebc0cfe90aabf8f9476e874d632ed982 100644 (file)
--- a/posic.h
+++ b/posic.h
 #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
 
index 7b7862e02bf15d0a06e4dd5158d489d43b90d26f..9d0f5a2ca85b76092d0931292dc2388a1e8e0b31 100644 (file)
@@ -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);