projects
/
physik
/
posic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
displace stage type added
[physik/posic.git]
/
mdrun.c
diff --git
a/mdrun.c
b/mdrun.c
index
b2e67f3
..
bd045fe
100644
(file)
--- a/
mdrun.c
+++ b/
mdrun.c
@@
-90,6
+90,9
@@
int add_stage(t_mdrun *mdrun,u8 type,void *params) {
t_stage *stage;
switch(type) {
t_stage *stage;
switch(type) {
+ case STAGE_DISPLACE_ATOM:
+ psize=sizeof(t_displace_atom_params);
+ break;
case STAGE_INSERT_ATOMS:
psize=sizeof(t_insert_atoms_params);
break;
case STAGE_INSERT_ATOMS:
psize=sizeof(t_insert_atoms_params);
break;
@@
-142,6
+145,7
@@
int mdrun_parse_config(t_mdrun *mdrun) {
int wcnt;
int i,o;
int wcnt;
int i,o;
+ t_displace_atom_params dap;
t_insert_atoms_params iap;
t_continue_params cp;
t_anneal_params ap;
t_insert_atoms_params iap;
t_continue_params cp;
t_anneal_params ap;
@@
-368,7
+372,14
@@
int mdrun_parse_config(t_mdrun *mdrun) {
mdrun->visualize=atoi(word[1]);
else if(!strncmp(word[0],"stage",5)) {
// for every stage line, add a stage
mdrun->visualize=atoi(word[1]);
else if(!strncmp(word[0],"stage",5)) {
// for every stage line, add a stage
- if(!strncmp(word[1],"ins_atoms",9)) {
+ if(!strncmp(word[1],"displace",8)) {
+ dap.nr=atoi(word[2]);
+ dap.dx=atof(word[3]);
+ dap.dy=atof(word[4]);
+ dap.dz=atof(word[5]);
+ add_stage(mdrun,STAGE_DISPLACE_ATOM,&dap);
+ }
+ else if(!strncmp(word[1],"ins_atoms",9)) {
iap.ins_steps=atoi(word[2]);
iap.ins_atoms=atoi(word[3]);
iap.element=atoi(word[4]);
iap.ins_steps=atoi(word[2]);
iap.ins_atoms=atoi(word[3]);
iap.element=atoi(word[4]);
@@
-494,6
+505,23
@@
int check_temperature(t_moldyn *moldyn,t_mdrun *mdrun) {
return TRUE;
}
return TRUE;
}
+int displace_atom(t_moldyn *moldyn,t_mdrun *mdrun) {
+
+ t_displace_atom_params *dap;
+ t_stage *stage;
+ t_atom *atom;
+
+ stage=mdrun->stage.current->data;
+ dap=stage->params;
+
+ atom=&(moldyn->atom[dap->nr]);
+ atom->r.x+=dap->dx;
+ atom->r.y+=dap->dy;
+ atom->r.z+=dap->dz;
+
+ return 0;
+}
+
int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
t_insert_atoms_params *iap;
int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
t_insert_atoms_params *iap;
@@
-742,6
+770,11
@@
int mdrun_hook(void *ptr1,void *ptr2) {
/* stage specific stuff */
switch(stage->type) {
/* stage specific stuff */
switch(stage->type) {
+ case STAGE_DISPLACE_ATOM:
+ stage_print(" -> displace atom\n\n");
+ displace_atom(moldyn,mdrun);
+ change_stage=TRUE;
+ break;
case STAGE_INSERT_ATOMS:
stage_print(" -> insert atoms\n\n");
iap=stage->params;
case STAGE_INSERT_ATOMS:
stage_print(" -> insert atoms\n\n");
iap=stage->params;
@@
-751,7
+784,7
@@
int mdrun_hook(void *ptr1,void *ptr2) {
}
insert_atoms(moldyn,mdrun);
iap->cnt_steps+=1;
}
insert_atoms(moldyn,mdrun);
iap->cnt_steps+=1;
-
break;
+ break;
case STAGE_CONTINUE:
stage_print(" -> continue\n\n");
if(stage->executed==TRUE) {
case STAGE_CONTINUE:
stage_print(" -> continue\n\n");
if(stage->executed==TRUE) {
@@
-760,7
+793,7
@@
int mdrun_hook(void *ptr1,void *ptr2) {
}
cp=stage->params;
steps=cp->runs;
}
cp=stage->params;
steps=cp->runs;
-
break;
+ break;
case STAGE_ANNEAL:
stage_print(" -> anneal\n\n");
ap=stage->params;
case STAGE_ANNEAL:
stage_print(" -> anneal\n\n");
ap=stage->params;