int count;
atom=moldyn->atom;
- count=(moldyn->count)++;
+ count=(moldyn->count)++; // asshole style!
ptr=realloc(atom,(count+1)*sizeof(t_atom));
if(!ptr) {
moldyn->atom=ptr;
atom=moldyn->atom;
+
+ /* initialize new atom */
+ memset(&(atom[count]),0,sizeof(t_atom));
atom[count].r=*r;
atom[count].v=*v;
atom[count].element=element;
int average_reset(t_moldyn *moldyn) {
+ printf("[moldyn] average reset\n");
+
/* update skip value */
moldyn->avg_skip=moldyn->total_steps;
i=((atom[count].r.x+(moldyn->dim.x/2))/lc->x);
j=((atom[count].r.y+(moldyn->dim.y/2))/lc->y);
k=((atom[count].r.z+(moldyn->dim.z/2))/lc->z);
-
+
#ifdef STATIC_LISTS
p=0;
while(lc->subcell[i+j*nx+k*nx*ny][p]!=0)
count2=27;
a=nx*ny;
+ if(i>=nx||j>=ny||k>=nz)
+ printf("[moldyn] WARNING: lcni %d/%d %d/%d %d/%d\n",
+ i,nx,j,ny,k,nz);
+
cell[0]=lc->subcell[i+j*nx+k*a];
for(ci=-1;ci<=1;ci++) {
bx=0;
/* some stupid checks before we actually start calculating bullshit */
if(moldyn->cutoff>0.5*moldyn->dim.x)
- printf("[moldyn] warning: cutoff > 0.5 x dim.x\n");
+ printf("[moldyn] WARNING: cutoff > 0.5 x dim.x\n");
if(moldyn->cutoff>0.5*moldyn->dim.y)
- printf("[moldyn] warning: cutoff > 0.5 x dim.y\n");
+ printf("[moldyn] WARNING: cutoff > 0.5 x dim.y\n");
if(moldyn->cutoff>0.5*moldyn->dim.z)
- printf("[moldyn] warning: cutoff > 0.5 x dim.z\n");
+ printf("[moldyn] WARNING: cutoff > 0.5 x dim.z\n");
ds=0.5*atom[0].f.x*moldyn->tau_square/atom[0].mass;
if(ds>0.05*moldyn->nnd)
- printf("[moldyn] warning: forces too high / tau too small!\n");
+ printf("[moldyn] WARNING: forces too high / tau too small!\n");
/* zero absolute time */
moldyn->time=0.0;
}
#endif
- /* calculate global virial */
+ /* some postprocessing */
for(i=0;i<count;i++) {
- moldyn->gvir.xx+=moldyn->atom[i].r.x*moldyn->atom[i].f.x;
- moldyn->gvir.yy+=moldyn->atom[i].r.y*moldyn->atom[i].f.y;
- moldyn->gvir.zz+=moldyn->atom[i].r.z*moldyn->atom[i].f.z;
- moldyn->gvir.xy+=moldyn->atom[i].r.y*moldyn->atom[i].f.x;
- moldyn->gvir.xz+=moldyn->atom[i].r.z*moldyn->atom[i].f.x;
- moldyn->gvir.yz+=moldyn->atom[i].r.z*moldyn->atom[i].f.y;
+ /* calculate global virial */
+ moldyn->gvir.xx+=itom[i].r.x*itom[i].f.x;
+ moldyn->gvir.yy+=itom[i].r.y*itom[i].f.y;
+ moldyn->gvir.zz+=itom[i].r.z*itom[i].f.z;
+ moldyn->gvir.xy+=itom[i].r.y*itom[i].f.x;
+ moldyn->gvir.xz+=itom[i].r.z*itom[i].f.x;
+ moldyn->gvir.yz+=itom[i].r.z*itom[i].f.y;
+
+ /* check forces regarding the given timestep */
+ if(v3_norm(&(itom[i].f))>\
+ 0.1*moldyn->nnd*itom[i].mass/moldyn->tau_square)
+ printf("[moldyn] WARNING: pfc (high force: atom %d)\n",
+ i);
}
return 0;
slots=moldyn->cutoff/dr;
o=2*slots;
+ if(slots*dr<=moldyn->cutoff)
+ printf("[moldyn] WARNING: pcc (low #slots)\n");
+
printf("[moldyn] pair correlation calc info:\n");
printf(" time: %f\n",moldyn->time);
printf(" count: %d\n",moldyn->count);
/* should never happen but it does 8) -
* related to -ffloat-store problem! */
if(s>=slots) {
- printf("[moldyn] WARNING pcc (%d/%d)\n",
+ printf("[moldyn] WARNING: pcc (%d/%d)",
s,slots);
+ printf("\n");
s=slots-1;
}
hp=hook_params;
md=moldyn;
+ tau=1.0;
+ steps=0;
+
/* switch on t scaling */
if(md->schedule.count==0)
set_pt_scale(md,0,0,T_SCALE_BERENDSEN,100.0);
moldyn_set_log(&md,SAVE_STEP,LOG_S);
moldyn_set_log(&md,CREATE_REPORT,0);
+ /* next neighbour distance for critical checking */
+ set_nn_dist(&md,0.25*ALBE_LC_SI*sqrt(3.0));
+
/*
* let's do the actual md algorithm now
*