From: hackbard Date: Tue, 2 Oct 2007 13:41:38 +0000 (+0200) Subject: energy_scale bug + log count bug fixed X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=10645866d8c186ee58a40ff17a60ddb444fb4b82;p=physik%2Fposic.git energy_scale bug + log count bug fixed --- diff --git a/moldyn.c b/moldyn.c index 92c4e58..415581c 100644 --- a/moldyn.c +++ b/moldyn.c @@ -1371,9 +1371,6 @@ int moldyn_integrate(t_moldyn *moldyn) { moldyn->tau_square=moldyn->tau*moldyn->tau; moldyn->cutoff_square=moldyn->cutoff*moldyn->cutoff; - /* energy scaling factor */ - energy_scale=moldyn->count*EV; - /* get current time */ gettimeofday(&t1,NULL); @@ -1413,6 +1410,9 @@ return 0; moldyn->tau_square=moldyn->tau*moldyn->tau; moldyn->time_steps=sched->runs[sched->count]; + /* energy scaling factor (might change!) */ + energy_scale=moldyn->count*EV; + /* integration according to schedule */ for(i=0;itime_steps;i++) { @@ -1435,7 +1435,7 @@ return 0; /* check for log & visualization */ if(e) { - if(!(i%e)) + if(!(moldyn->total_steps%e)) dprintf(moldyn->efd, "%f %f %f %f\n", moldyn->time,moldyn->ekin/energy_scale, @@ -1443,7 +1443,7 @@ return 0; get_total_energy(moldyn)/energy_scale); } if(m) { - if(!(i%m)) { + if(!(moldyn->total_steps%m)) { momentum=get_total_p(moldyn); dprintf(moldyn->mfd, "%f %f %f %f %f\n",moldyn->time, @@ -1452,7 +1452,7 @@ return 0; } } if(p) { - if(!(i%p)) { + if(!(moldyn->total_steps%p)) { dprintf(moldyn->pfd, "%f %f %f %f %f\n",moldyn->time, moldyn->p/BAR,moldyn->p_avg/BAR, @@ -1460,14 +1460,14 @@ return 0; } } if(t) { - if(!(i%t)) { + if(!(moldyn->total_steps%t)) { dprintf(moldyn->tfd, "%f %f %f\n", moldyn->time,moldyn->t,moldyn->t_avg); } } if(s) { - if(!(i%s)) { + if(!(moldyn->total_steps%s)) { snprintf(dir,128,"%s/s-%07.f.save", moldyn->vlsdir,moldyn->time); fd=open(dir,O_WRONLY|O_TRUNC|O_CREAT, @@ -1482,14 +1482,14 @@ return 0; } } if(v) { - if(!(i%v)) { + if(!(moldyn->total_steps%v)) { visual_atoms(&(moldyn->vis),moldyn->time, moldyn->atom,moldyn->count); } } /* display progress */ - if(!(i%10)) { + if(!(moldyn->total_steps%10)) { /* get current time */ gettimeofday(&t2,NULL);