#include "potentials/tersoff.h"
#endif
+/* pse */
+#define PSE_MASS
+#include "pse.h"
+#undef PSE_MASS
+
#define ME "[mdrun]"
/*
case STAGE_SET_TIMESTEP:
psize=sizeof(t_set_timestep_params);
break;
+ case STAGE_FILL:
+ psize=sizeof(t_fill_params);
+ break;
+ case STAGE_THERMAL_INIT:
+ psize=0;
+ break;
default:
printf("%s unknown stage type: %02x\n",ME,type);
return -1;
t_chsattr_params csp;
t_set_temp_params stp;
t_set_timestep_params stsp;
+ t_fill_params fp;
/* open config file */
fd=open(mdrun->cfile,O_RDONLY);
memset(&csp,0,sizeof(t_chsattr_params));
memset(&stp,0,sizeof(t_set_temp_params));
memset(&stsp,0,sizeof(t_set_timestep_params));
+ memset(&fp,0,sizeof(t_fill_params));
// get command + args
wcnt=0;
mdrun->m2=pse_mass[mdrun->element2];
}
else if(!strncmp(word[0],"fill",6)) {
- // only lc mode by now
- mdrun->lx=atoi(word[2]);
- mdrun->ly=atoi(word[3]);
- mdrun->lz=atoi(word[4]);
- mdrun->lc=atof(word[5]);
+ fp.lx=atoi(word[2]);
+ fp.ly=atoi(word[3]);
+ fp.lz=atoi(word[4]);
+ fp.lc=atof(word[5]);
+ mdrun->lc=fp.lc;
+ if(!strncmp(word[1],"lc",2)) {
+ if(wcnt==8) {
+ fp.fill_element=atoi(word[6]);
+ fp.fill_brand=atoi(word[7]);
+ }
+ else {
+ fp.fill_element=mdrun->element1;
+ fp.fill_brand=0;
+ }
+ }
+ else {
+ switch(word[6][0]) {
+ case 'i':
+ if(word[6][1]=='r')
+ fp.p_type=PART_INSIDE_R;
+ else
+ fp.p_type=PART_INSIDE_D;
+ break;
+ case 'o':
+ if(word[6][1]=='r')
+ fp.p_type=PART_OUTSIDE_R;
+ else
+ fp.p_type=PART_OUTSIDE_D;
+ break;
+ default:
+ break;
+ }
+ }
+ if((fp.p_type==PART_INSIDE_R)||
+ (fp.p_type==PART_OUTSIDE_R)) {
+ fp.p_vals.r=atof(word[7]);
+ fp.p_vals.p.x=atof(word[8]);
+ fp.p_vals.p.y=atof(word[9]);
+ fp.p_vals.p.z=atof(word[10]);
+ }
+ if((fp.p_type==PART_INSIDE_D)||
+ (fp.p_type==PART_OUTSIDE_D)) {
+ fp.p_vals.p.x=atof(word[7]);
+ fp.p_vals.p.y=atof(word[8]);
+ fp.p_vals.p.z=atof(word[9]);
+ fp.p_vals.d.x=atof(word[10]);
+ fp.p_vals.d.y=atof(word[11]);
+ fp.p_vals.d.z=atof(word[12]);
+ }
+ fp.lattice=mdrun->lattice;
+ add_stage(mdrun,STAGE_FILL,&fp);
+ }
+ else if(!strncmp(word[0],"thermal_init",12)) {
+ add_stage(mdrun,STAGE_THERMAL_INIT,NULL);
}
else if(!strncmp(word[0],"aattr",5)) {
// for aatrib line we need a special stage
ap.count=0;
ap.runs=atoi(word[2]);
ap.dt=atof(word[3]);
+ ap.interval=atoi(word[4]);
add_stage(mdrun,STAGE_ANNEAL,&ap);
}
else if(!strncmp(word[1],"set_temp",8)) {
t_list *sl;
int steps;
u8 change_stage;
+ t_3dvec o;
t_insert_atoms_params *iap;
t_insert_mixed_atoms_params *imp;
t_anneal_params *ap;
t_set_temp_params *stp;
t_set_timestep_params *stsp;
+ t_fill_params *fp;
moldyn=ptr1;
mdrun=ptr2;
set_temperature(moldyn,
moldyn->t_ref+ap->dt);
ap->count+=1;
+ steps=ap->interval;
break;
case STAGE_CHAATTR:
stage_print(" -> change atom attributes\n\n");
mdrun->timestep=stsp->tau;
change_stage=TRUE;
break;
+ case STAGE_FILL:
+ stage_print(" -> fill lattice\n\n");
+ fp=stage->params;
+ if(fp->lattice!=ZINCBLENDE) {
+ create_lattice(moldyn,
+ fp->lattice,fp->lc,
+ mdrun->element1,
+ mdrun->m1,
+ DEFAULT_ATOM_ATTR,0,
+ fp->lx,fp->ly,fp->lz,
+ NULL,fp->p_type,
+ &(fp->p_vals));
+ }
+ else {
+ o.x=0.5*0.25*fp->lc;
+ o.y=o.x;
+ o.z=o.x;
+ create_lattice(moldyn,
+ FCC,fp->lc,
+ mdrun->element1,
+ mdrun->m1,
+ DEFAULT_ATOM_ATTR,0,
+ fp->lx,fp->ly,fp->lz,
+ &o,fp->p_type,
+ &(fp->p_vals));
+ o.x+=0.25*fp->lc;
+ o.y=o.x;
+ o.z=o.x;
+ create_lattice(moldyn,
+ FCC,fp->lc,
+ mdrun->element2,
+ mdrun->m2,
+ DEFAULT_ATOM_ATTR,1,
+ fp->lx,fp->ly,fp->lz,
+ &o,fp->p_type,
+ &(fp->p_vals));
+ }
+ moldyn_bc_check(moldyn);
+ change_stage=TRUE;
+ break;
+ case STAGE_THERMAL_INIT:
+ stage_print(" -> thermal init\n\n");
+ thermal_init(moldyn,TRUE);
+ change_stage=TRUE;
+ break;
default:
printf("%s unknwon stage type\n",ME);
break;
t_mdrun mdrun;
t_moldyn moldyn;
- t_3dvec o;
+ //t_3dvec o;
/* clear structs */
memset(&mdrun,0,sizeof(t_mdrun));
/* initial lattice and dimensions */
set_dim(&moldyn,mdrun.dim.x,mdrun.dim.y,mdrun.dim.z,mdrun.vis);
set_pbc(&moldyn,mdrun.pbcx,mdrun.pbcy,mdrun.pbcz);
+ /* replaced by fill stage !!
switch(mdrun.lattice) {
case FCC:
- create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element1,
- mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx,
- mdrun.ly,mdrun.lz,NULL);
+ create_lattice(&moldyn,FCC,mdrun.lc,mdrun.fill_element,
+ mdrun.m1,DEFAULT_ATOM_ATTR,
+ mdrun.fill_brand,mdrun.lx,
+ mdrun.ly,mdrun.lz,NULL,0,NULL);
break;
case DIAMOND:
- create_lattice(&moldyn,DIAMOND,mdrun.lc,mdrun.element1,
- mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx,
- mdrun.ly,mdrun.lz,NULL);
+ create_lattice(&moldyn,DIAMOND,mdrun.lc,
+ mdrun.fill_element,
+ mdrun.m1,DEFAULT_ATOM_ATTR,
+ mdrun.fill_brand,mdrun.lx,
+ mdrun.ly,mdrun.lz,NULL,0,NULL);
break;
case ZINCBLENDE:
o.x=0.5*0.25*mdrun.lc; o.y=o.x; o.z=o.x;
create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element1,
mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx,
- mdrun.ly,mdrun.lz,&o);
+ mdrun.ly,mdrun.lz,&o,0,NULL);
o.x+=0.25*mdrun.lc; o.y=o.x; o.z=o.x;
create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element2,
mdrun.m2,DEFAULT_ATOM_ATTR,1,mdrun.lx,
- mdrun.ly,mdrun.lz,&o);
+ mdrun.ly,mdrun.lz,&o,0,NULL);
break;
case NONE:
set_nn_dist(&moldyn,mdrun.nnd);
return -1;
}
moldyn_bc_check(&moldyn);
+ replaced by fill stage !! */
/* temperature and pressure */
set_temperature(&moldyn,mdrun.temperature);
set_pressure(&moldyn,mdrun.pressure);
+ /* replaced thermal_init stage
thermal_init(&moldyn,TRUE);
+ */
addsched:
/* first schedule */