From: hackbard Date: Mon, 10 Sep 2007 15:16:37 +0000 (+0200) Subject: Makefile: clean everything, moldyn: add time info X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd4ecbff76b2e4fc70ca88e64fb76c85fa953888;p=physik%2Fposic.git Makefile: clean everything, moldyn: add time info --- diff --git a/Makefile b/Makefile index abffa6d..bba7d4e 100644 --- a/Makefile +++ b/Makefile @@ -26,4 +26,4 @@ postproc: $(DEPS) .PHONY:clean clean: - rm -f sic postproc fluctuation_calc + rm -vf sic postproc fluctuation_calc *.o */*.o diff --git a/moldyn.c b/moldyn.c index e961ca2..92c4e58 100644 --- a/moldyn.c +++ b/moldyn.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include "moldyn.h" @@ -1348,6 +1350,7 @@ int moldyn_integrate(t_moldyn *moldyn) { char dir[128]; double ds; double energy_scale; + struct timeval t1,t2; //double tp; sched=&(moldyn->schedule); @@ -1371,6 +1374,9 @@ int moldyn_integrate(t_moldyn *moldyn) { /* energy scaling factor */ energy_scale=moldyn->count*EV; + /* get current time */ + gettimeofday(&t1,NULL); + /* calculate initial forces */ potential_force_calc(moldyn); #ifdef DEBUG @@ -1484,12 +1490,19 @@ return 0; /* display progress */ if(!(i%10)) { - printf("\rsched:%d, steps:%d, T:%3.1f/%3.1f P:%4.1f/%4.1f V:%6.1f", + /* get current time */ + gettimeofday(&t2,NULL); + + printf("\rsched:%d, steps:%d, T:%3.1f/%3.1f P:%4.1f/%4.1f V:%6.1f (%d)", sched->count,i, moldyn->t,moldyn->t_avg, moldyn->p_avg/BAR,moldyn->gp_avg/BAR, - moldyn->volume); + moldyn->volume, + (int)(t2.tv_sec-t1.tv_sec)); fflush(stdout); + + /* copy over time */ + t1=t2; } /* increase absolute time */