projects
/
physik
/
posic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
well, no more segfaults -> now its getting hard to debug ...
[physik/posic.git]
/
moldyn.c
diff --git
a/moldyn.c
b/moldyn.c
index
509a45d
..
505f496
100644
(file)
--- a/
moldyn.c
+++ b/
moldyn.c
@@
-156,7
+156,7
@@
int moldyn_set_log(t_moldyn *moldyn,u8 type,char *fb,int timer) {
strncpy(moldyn->sfb,fb,63);
break;
case VISUAL_STEP:
strncpy(moldyn->sfb,fb,63);
break;
case VISUAL_STEP:
- moldyn->
m
write=timer;
+ moldyn->
v
write=timer;
strncpy(moldyn->vfb,fb,63);
visual_init(&(moldyn->vis),fb);
break;
strncpy(moldyn->vfb,fb,63);
visual_init(&(moldyn->vis),fb);
break;
@@
-234,7
+234,7
@@
int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass,
}
int add_atom(t_moldyn *moldyn,int element,double mass,u8 bnum,u8 attr,
}
int add_atom(t_moldyn *moldyn,int element,double mass,u8 bnum,u8 attr,
- t_3dvec
r,t_3dvec
v) {
+ t_3dvec
*r,t_3dvec *
v) {
t_atom *atom;
void *ptr;
t_atom *atom;
void *ptr;
@@
-248,10
+248,11
@@
int add_atom(t_moldyn *moldyn,int element,double mass,u8 bnum,u8 attr,
perror("[moldyn] realloc (add atom)");
return -1;
}
perror("[moldyn] realloc (add atom)");
return -1;
}
-
- atom=ptr;
- atom->r=r;
- atom->v=v;
+ moldyn->atom=ptr;
+
+ atom=moldyn->atom;
+ atom->r=*r;
+ atom->v=*v;
atom->element=element;
atom->bnum=bnum;
atom->attr=attr;
atom->element=element;
atom->bnum=bnum;
atom->attr=attr;
@@
-404,6
+405,9
@@
int link_cell_init(t_moldyn *moldyn) {
t_linkcell *lc;
int i;
t_linkcell *lc;
int i;
+ int fd;
+
+ fd=open("/dev/null",O_WRONLY);
lc=&(moldyn->lc);
lc=&(moldyn->lc);
@@
-418,10
+422,11
@@
int link_cell_init(t_moldyn *moldyn) {
lc->cells=lc->nx*lc->ny*lc->nz;
lc->subcell=malloc(lc->cells*sizeof(t_list));
lc->cells=lc->nx*lc->ny*lc->nz;
lc->subcell=malloc(lc->cells*sizeof(t_list));
- printf("initializing linked cells (%d)\n",lc->cells);
+ printf("
[moldyn]
initializing linked cells (%d)\n",lc->cells);
for(i=0;i<lc->cells;i++)
for(i=0;i<lc->cells;i++)
- list_init(&(lc->subcell[i]),1);
+ //list_init(&(lc->subcell[i]),1);
+ list_init(&(lc->subcell[i]),fd);
link_cell_update(moldyn);
link_cell_update(moldyn);
@@
-541,6
+546,7
@@
int moldyn_add_schedule(t_moldyn *moldyn,int runs,double tau) {
perror("[moldyn] realloc (runs)");
return -1;
}
perror("[moldyn] realloc (runs)");
return -1;
}
+ moldyn->schedule.runs=ptr;
moldyn->schedule.runs[count-1]=runs;
ptr=realloc(schedule->tau,count*sizeof(double));
moldyn->schedule.runs[count-1]=runs;
ptr=realloc(schedule->tau,count*sizeof(double));
@@
-548,6
+554,7
@@
int moldyn_add_schedule(t_moldyn *moldyn,int runs,double tau) {
perror("[moldyn] realloc (tau)");
return -1;
}
perror("[moldyn] realloc (tau)");
return -1;
}
+ moldyn->schedule.tau=ptr;
moldyn->schedule.tau[count-1]=tau;
return 0;
moldyn->schedule.tau[count-1]=tau;
return 0;
@@
-650,12
+657,13
@@
int moldyn_integrate(t_moldyn *moldyn) {
}
if(v) {
if(!(i%v)) {
}
if(v) {
if(!(i%v)) {
- visual_atoms(
moldyn->visual,i*moldyn->tau
,
+ visual_atoms(
&(moldyn->vis),moldyn->time
,
moldyn->atom,moldyn->count);
moldyn->atom,moldyn->count);
- printf("\rs
teps: %d"
,i);
+ printf("\rs
ched: %d, steps: %d",sched
,i);
fflush(stdout);
}
}
fflush(stdout);
}
}
+
}
/* check for hooks */
}
/* check for hooks */
@@
-695,15
+703,11
@@
int velocity_verlet(t_moldyn *moldyn) {
}
/* neighbour list update */
}
/* neighbour list update */
-printf("list update ...\n");
link_cell_update(moldyn);
link_cell_update(moldyn);
-printf("done\n");
/* forces depending on chosen potential */
/* forces depending on chosen potential */
-printf("calc potential/force ...\n");
potential_force_calc(moldyn);
//moldyn->potential_force_function(moldyn);
potential_force_calc(moldyn);
//moldyn->potential_force_function(moldyn);
-printf("done\n");
for(i=0;i<count;i++) {
/* again velocities */
for(i=0;i<count;i++) {
/* again velocities */