count=a*b*c;
+ /* how many atoms do we expect */
if(type==FCC) count*=4;
-
if(type==DIAMOND) count*=8;
+ /* allocate space for atoms */
moldyn->atom=malloc(count*sizeof(t_atom));
if(moldyn->atom==NULL) {
perror("malloc (atoms)");
/* debug */
if(ret!=count) {
- printf("ok, there is something wrong ...\n");
- printf("calculated -> %d atoms\n",count);
- printf("created -> %d atoms\n",ret);
+ printf("[moldyn] creating lattice failed\n");
+ printf(" amount of atoms\n");
+ printf(" - expected: %d\n",count);
+ printf(" - created: %d\n",ret);
return -1;
}
check_per_bound(moldyn,&(moldyn->atom[count].r));
}
-
return ret;
}
dim=&(moldyn->dim);
- x=0.5*dim->x;
- y=0.5*dim->y;
- z=0.5*dim->z;
+ x=dim->x/2;
+ y=dim->y/2;
+ z=dim->z/2;
if(moldyn->status&MOLDYN_STAT_PBX) {
if(a->x>=x) a->x-=dim->x;
if(a->z>=z) a->z-=dim->z;
else if(-a->z>z) a->z+=dim->z;
}
+printf("%f %f %f\n",a->x,x,a->x/x);
return 0;
}
for(i=0;i<moldyn->count;i++) {
if(atom[i].r.x>=dim->x/2||-atom[i].r.x>dim->x/2)
printf("FATAL: atom %d: x: %.20f (%.20f)\n",
- i,atom[i].r.x*1e10,dim->x/2*1e10);
+ i,atom[i].r.x,dim->x/2);
if(atom[i].r.y>=dim->y/2||-atom[i].r.y>dim->y/2)
printf("FATAL: atom %d: y: %.20f (%.20f)\n",
- i,atom[i].r.y*1e10,dim->y/2*1e10);
+ i,atom[i].r.y,dim->y/2);
if(atom[i].r.z>=dim->z/2||-atom[i].r.z>dim->z/2)
printf("FATAL: atom %d: z: %.20f (%.20f)\n",
- i,atom[i].r.z*1e10,dim->z/2*1e10);
+ i,atom[i].r.z,dim->z/2);
}
return 0;