projects
/
physik
/
posic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Makefile: clean everything, moldyn: add time info
[physik/posic.git]
/
moldyn.c
diff --git
a/moldyn.c
b/moldyn.c
index
7d27965
..
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/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
#include <math.h>
#include "moldyn.h"
#include <math.h>
#include "moldyn.h"
@@
-24,6
+26,9
@@
int moldyn_init(t_moldyn *moldyn,int argc,char **argv) {
memset(moldyn,0,sizeof(t_moldyn));
memset(moldyn,0,sizeof(t_moldyn));
+ moldyn->argc=argc;
+ moldyn->args=argv;
+
rand_init(&(moldyn->random),NULL,1);
moldyn->random.status|=RAND_STAT_VERBOSE;
rand_init(&(moldyn->random),NULL,1);
moldyn->random.status|=RAND_STAT_VERBOSE;
@@
-1345,6
+1350,7
@@
int moldyn_integrate(t_moldyn *moldyn) {
char dir[128];
double ds;
double energy_scale;
char dir[128];
double ds;
double energy_scale;
+ struct timeval t1,t2;
//double tp;
sched=&(moldyn->schedule);
//double tp;
sched=&(moldyn->schedule);
@@
-1368,6
+1374,9
@@
int moldyn_integrate(t_moldyn *moldyn) {
/* energy scaling factor */
energy_scale=moldyn->count*EV;
/* energy scaling factor */
energy_scale=moldyn->count*EV;
+ /* get current time */
+ gettimeofday(&t1,NULL);
+
/* calculate initial forces */
potential_force_calc(moldyn);
#ifdef DEBUG
/* calculate initial forces */
potential_force_calc(moldyn);
#ifdef DEBUG
@@
-1461,7
+1470,8
@@
return 0;
if(!(i%s)) {
snprintf(dir,128,"%s/s-%07.f.save",
moldyn->vlsdir,moldyn->time);
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));
if(fd<0) perror("[moldyn] save fd open");
else {
write(fd,moldyn,sizeof(t_moldyn));
@@
-1480,12
+1490,19
@@
return 0;
/* display progress */
if(!(i%10)) {
/* 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,
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);
fflush(stdout);
+
+ /* copy over time */
+ t1=t2;
}
/* increase absolute time */
}
/* increase absolute time */
@@
-1920,6
+1937,17
@@
int moldyn_bc_check(t_moldyn *moldyn) {
return 0;
}
return 0;
}
+/*
+ * restore function
+ */
+
+int moldyn_load(t_moldyn *moldyn) {
+
+ // later ...
+
+ return 0;
+}
+
/*
* post processing functions
*/
/*
* post processing functions
*/
@@
-1942,3
+1970,11
@@
int get_line(int fd,char *line,int max) {
}
}
}
}
+int analyze_bonds(t_moldyn *moldyn) {
+
+
+
+
+ return 0;
+}
+