#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
#include <math.h>
#include "moldyn.h"
memset(moldyn,0,sizeof(t_moldyn));
+ moldyn->argc=argc;
+ moldyn->args=argv;
+
rand_init(&(moldyn->random),NULL,1);
moldyn->random.status|=RAND_STAT_VERBOSE;
char dir[128];
double ds;
double energy_scale;
+ struct timeval t1,t2;
//double tp;
sched=&(moldyn->schedule);
/* energy scaling factor */
energy_scale=moldyn->count*EV;
+ /* get current time */
+ gettimeofday(&t1,NULL);
+
/* calculate initial forces */
potential_force_calc(moldyn);
#ifdef DEBUG
if(!(i%s)) {
snprintf(dir,128,"%s/s-%07.f.save",
moldyn->vlsdir,moldyn->time);
- fd=open(dir,O_WRONLY|O_TRUNC|O_CREAT);
+ fd=open(dir,O_WRONLY|O_TRUNC|O_CREAT,
+ S_IRUSR|S_IWUSR);
if(fd<0) perror("[moldyn] save fd open");
else {
write(fd,moldyn,sizeof(t_moldyn));
/* 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->p/BAR,
- moldyn->volume);
+ moldyn->p_avg/BAR,moldyn->gp_avg/BAR,
+ moldyn->volume,
+ (int)(t2.tv_sec-t1.tv_sec));
fflush(stdout);
+
+ /* copy over time */
+ t1=t2;
}
/* increase absolute time */
return 0;
}
+/*
+ * restore function
+ */
+
+int moldyn_load(t_moldyn *moldyn) {
+
+ // later ...
+
+ return 0;
+}
+
/*
* post processing functions
*/
}
}
+int analyze_bonds(t_moldyn *moldyn) {
+
+
+
+
+ return 0;
+}
+