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;
int wcnt;
int i,o;
+ t_displace_atom_params dap;
t_insert_atoms_params iap;
t_continue_params cp;
t_anneal_params ap;
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]);
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;
/* 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;
}
insert_atoms(moldyn,mdrun);
iap->cnt_steps+=1;
- break;
+ break;
case STAGE_CONTINUE:
stage_print(" -> continue\n\n");
if(stage->executed==TRUE) {
}
cp=stage->params;
steps=cp->runs;
- break;
+ break;
case STAGE_ANNEAL:
stage_print(" -> anneal\n\n");
ap=stage->params;
u8 executed;
} t_stage;
+#define STAGE_DISPLACE_ATOM 0x00
#define STAGE_INSERT_ATOMS 0x01
#define STAGE_CONTINUE 0x02
#define STAGE_ANNEAL 0x03
#define SATTR_TRELAX 0x02
#define SATTR_AVGRST 0x04
+typedef struct s_displace_atom_params {
+ int nr;
+ double dx,dy,dz;
+} t_displace_atom_params;
+
typedef struct s_insert_atoms_params {
u8 type;
double x0,y0,z0,x1,y1,z1;