case STAGE_CHSATTR:
psize=sizeof(t_chsattr_params);
break;
+ case STAGE_SET_TEMP:
+ psize=sizeof(t_set_temp_params);
+ break;
+ case STAGE_SET_TIMESTEP:
+ psize=sizeof(t_set_timestep_params);
+ break;
default:
printf("%s unknown stage type: %02x\n",ME,type);
return -1;
t_anneal_params ap;
t_chaattr_params cap;
t_chsattr_params csp;
+ t_set_temp_params stp;
+ t_set_timestep_params stsp;
/* open config file */
fd=open(mdrun->cfile,O_RDONLY);
memset(&ap,0,sizeof(t_anneal_params));
memset(&cap,0,sizeof(t_chaattr_params));
memset(&csp,0,sizeof(t_chsattr_params));
+ memset(&stp,0,sizeof(t_set_temp_params));
+ memset(&stsp,0,sizeof(t_set_timestep_params));
// get command + args
wcnt=0;
ap.dt=atof(word[3]);
add_stage(mdrun,STAGE_ANNEAL,&ap);
}
+ else if(!strncmp(word[1],"set_temp",8)) {
+ if(word[2][0]=='c') {
+ stp.type=SET_TEMP_CURRENT;
+ stp.val=0.0;
+ }
+ else {
+ stp.type=SET_TEMP_VALUE;
+ stp.val=atof(word[2]);
+ }
+ add_stage(mdrun,STAGE_SET_TEMP,&stp);
+ }
+ else if(!strncmp(word[1],"set_timestep",12)) {
+ stsp.tau=atof(word[2]);
+ add_stage(mdrun,STAGE_SET_TIMESTEP,&stsp);
+ }
else {
printf("%s unknown stage type: %s\n",
ME,word[1]);
}
atom->attr=cap->attr;
}
- printf(" atom attributes: %02x\n\n",cap->attr);
return 0;
}
t_stage *stage;
t_list *sl;
int steps;
- double tau;
u8 change_stage;
t_insert_atoms_params *iap;
t_insert_mixed_atoms_params *imp;
t_continue_params *cp;
t_anneal_params *ap;
+ t_set_temp_params *stp;
+ t_set_timestep_params *stsp;
moldyn=ptr1;
mdrun=ptr2;
/* get stage description */
stage=sl->current->data;
- /* default steps and tau values */
+ /* steps in next schedule */
steps=mdrun->relax_steps;
- tau=mdrun->timestep;
/* check whether relaxation steps are necessary */
if((check_pressure(moldyn,mdrun)==TRUE)&\
ap->count+=1;
break;
case STAGE_CHAATTR:
- stage_print(" -> chaattr\n\n");
+ stage_print(" -> change atom attributes\n\n");
chaatr(moldyn,mdrun);
change_stage=TRUE;
break;
case STAGE_CHSATTR:
- stage_print(" -> chsattr\n\n");
+ stage_print(" -> change sys attributes\n\n");
chsattr(moldyn,mdrun);
change_stage=TRUE;
break;
+ case STAGE_SET_TEMP:
+ stage_print(" -> set temperature\n\n");
+ stp=stage->params;
+ if(stp->type&SET_TEMP_CURRENT) {
+ set_temperature(moldyn,moldyn->t_avg);
+ }
+ else {
+ set_temperature(moldyn,stp->val);
+ }
+ change_stage=TRUE;
+ break;
+ case STAGE_SET_TIMESTEP:
+ stage_print(" -> set timestep\n\n");
+ stsp=stage->params;
+ mdrun->timestep=stsp->tau;
+ change_stage=TRUE;
+ break;
default:
printf("%s unknwon stage type\n",ME);
break;
return 0;
}
steps=0;
- tau=mdrun->timestep;
}
}
}
/* continue simulation */
- moldyn_add_schedule(moldyn,steps,tau);
+ moldyn_add_schedule(moldyn,steps,mdrun->timestep);
return 0;
}
#define STAGE_ANNEAL 0x04
#define STAGE_CHAATTR 0x05
#define STAGE_CHSATTR 0x06
+#define STAGE_SET_TEMP 0x07
+#define STAGE_SET_TIMESTEP 0x08
typedef struct s_mdrun {
char cfile[128]; // config file
#define CHSATTR_AVGRST 0x10
#define CHSATTR_RSTEPS 0x20
+typedef struct s_set_temp_params {
+ u8 type;
+ double val;
+} t_set_temp_params;
+
+#define SET_TEMP_CURRENT 0x01
+#define SET_TEMP_VALUE 0x02
+
+typedef struct s_set_timestep_params {
+ double tau;
+} t_set_timestep_params;
+
/*
* function prototypes
*/