projects
/
physik
/
posic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
increased relaxation steps + introduced average reset + added critical
[physik/posic.git]
/
sic.c
diff --git
a/sic.c
b/sic.c
index
e1103bd
..
a7613e2
100644
(file)
--- a/
sic.c
+++ b/
sic.c
@@
-40,7
+40,7
@@
int insert_atoms(t_moldyn *moldyn) {
int i,j;
u8 run;
t_3dvec r,v,dist;
int i,j;
u8 run;
t_3dvec r,v,dist;
- double d;
+ double d
,dmin
;
t_atom *atom;
t_atom *atom;
@@
-83,6
+83,7
@@
int insert_atoms(t_moldyn *moldyn) {
r.z+=INS_OFFSET;
/* assume valid coordinates */
run=0;
r.z+=INS_OFFSET;
/* assume valid coordinates */
run=0;
+ dmin=10000000000.0; // for sure too high!
for(i=0;i<moldyn->count;i++) {
atom=&(moldyn->atom[i]);
v3_sub(&dist,&(atom->r),&r);
for(i=0;i<moldyn->count;i++) {
atom=&(moldyn->atom[i]);
v3_sub(&dist,&(atom->r),&r);
@@
-94,6
+95,8
@@
int insert_atoms(t_moldyn *moldyn) {
run=1;
break;
}
run=1;
break;
}
+ if(d<dmin)
+ dmin=d;
}
}
add_atom(moldyn,INS_TYPE,INS_MASS,INS_BRAND,
}
}
add_atom(moldyn,INS_TYPE,INS_MASS,INS_BRAND,
@@
-101,6
+104,8
@@
int insert_atoms(t_moldyn *moldyn) {
//ATOM_ATTR_HB|ATOM_ATTR_VB,
ATOM_ATTR_HB,
&r,&v);
//ATOM_ATTR_HB|ATOM_ATTR_VB,
ATOM_ATTR_HB,
&r,&v);
+ printf(" %02d: atom %d | %f %f %f | %f\n",
+ j,moldyn->count-1,r.x,r.y,r.z,dmin);
}
return 0;
}
return 0;
@@
-112,6
+117,7
@@
int sic_hook(void *moldyn,void *hook_params) {
t_moldyn *md;
int steps;
double tau;
t_moldyn *md;
int steps;
double tau;
+ double dt;
hp=hook_params;
md=moldyn;
hp=hook_params;
md=moldyn;
@@
-129,12
+135,15
@@
int sic_hook(void *moldyn,void *hook_params) {
/* act according to state */
switch(hp->state) {
case STATE_INSERT:
/* act according to state */
switch(hp->state) {
case STATE_INSERT:
+ /* assigne values */
+ steps=INS_RELAX;
+ tau=INS_TAU;
/* check temperature */
/* check temperature */
- if(md->t_avg-md->t_ref>INS_DELTA_TC) {
- steps=INS_RELAX;
- tau=INS_TAU;
+ dt=md->t_avg-md->t_ref;
+ if(dt<0)
+ dt=-dt;
+ if(dt>INS_DELTA_TC)
break;
break;
- }
/* insert atoms */
hp->insert_count+=1;
printf(" ### insert atoms (%d/%d) ###\n",
/* insert atoms */
hp->insert_count+=1;
printf(" ### insert atoms (%d/%d) ###\n",
@@
-145,11
+154,15
@@
int sic_hook(void *moldyn,void *hook_params) {
hp->state=STATE_POSTRUN;
break;
case STATE_POSTRUN:
hp->state=STATE_POSTRUN;
break;
case STATE_POSTRUN:
- /* settings */
- if(md->t-md->t_ref>POST_DELTA_TC) {
- steps=POST_RELAX;
- tau=POST_TAU;
- }
+ /* assigne values */
+ steps=POST_RELAX;
+ tau=POST_TAU;
+ /* check temperature */
+ dt=md->t_avg-md->t_ref;
+ if(dt<0)
+ dt=-dt;
+ if(dt>INS_DELTA_TC)
+ break;
/* decrease temperature */
hp->postrun_count+=1;
printf(" ### postrun (%d/%d) ###\n",
/* decrease temperature */
hp->postrun_count+=1;
printf(" ### postrun (%d/%d) ###\n",
@@
-163,6
+176,9
@@
int sic_hook(void *moldyn,void *hook_params) {
break;
}
break;
}
+ /* reset the average counters */
+ average_reset(md);
+
/* add schedule */
moldyn_add_schedule(md,steps,tau);
/* add schedule */
moldyn_add_schedule(md,steps,tau);