nur foo ...
[physik/posic.git] / moldyn.c
index f564075..881f0b6 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -344,7 +344,10 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass,
 
        switch(type) {
                case CUBIC:
-                       ret=cubic_init(a,b,c,lc,atom,NULL);
+                       origin.x=0.5*lc;
+                       origin.y=0.5*lc;
+                       origin.z=0.5*lc;
+                       ret=cubic_init(a,b,c,lc,atom,&origin);
                        break;
                case FCC:
                        ret=fcc_init(a,b,c,lc,atom,NULL);
@@ -399,8 +402,8 @@ int cubic_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin) {
        for(i=0;i<a;i++) {
                r.y=o.y;
                for(j=0;j<b;j++) {
+                       r.z=o.z;
                        for(k=0;k<c;k++) {
-                               r.z=o.z;
                                v3_copy(&(atom[count].r),&r);
                                count+=1;
                                r.z+=lc;
@@ -1149,8 +1152,10 @@ int moldyn_integrate(t_moldyn *moldyn) {
        /* energy scaling factor */
        energy_scale=moldyn->count*EV;
 
+printf("debug: %f\n",moldyn->atom[0].f.x);
        /* calculate initial forces */
        potential_force_calc(moldyn);
+printf("debug: %f\n",moldyn->atom[0].f.x);
 
        /* some stupid checks before we actually start calculating bullshit */
        if(moldyn->cutoff>0.5*moldyn->dim.x)
@@ -1232,8 +1237,8 @@ int moldyn_integrate(t_moldyn *moldyn) {
                        if(!(i%v)) {
                                visual_atoms(&(moldyn->vis),moldyn->time,
                                             moldyn->atom,moldyn->count);
-                               printf("\rsched: %d, steps: %d, debug: %f | %f",
-                                      sched->count,i,moldyn->p/ATM,moldyn->p/ATM);
+                               printf("\rsched: %d, steps: %d, debug: %f",
+                                      sched->count,i,moldyn->p/ATM);
                                fflush(stdout);
                        }
                }