Makefile: clean everything, moldyn: add time info
[physik/posic.git] / moldyn.c
index e961ca2..92c4e58 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -13,6 +13,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
 #include <math.h>
 
 #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 */