From: hackbard Date: Sat, 3 May 2008 14:08:14 +0000 (+0200) Subject: added position insertion method + fixed positioning X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=d1ceb8d3fc8e7a2e067f7576b3e787928d556277;p=physik%2Fposic.git added position insertion method + fixed positioning --- diff --git a/mdrun.c b/mdrun.c index e5feda3..b2e67f3 100644 --- a/mdrun.c +++ b/mdrun.c @@ -372,7 +372,6 @@ int mdrun_parse_config(t_mdrun *mdrun) { iap.ins_steps=atoi(word[2]); iap.ins_atoms=atoi(word[3]); iap.element=atoi(word[4]); - iap.element=atoi(word[4]); iap.brand=atoi(word[5]); for(i=0;ilattice) { + case CUBIC: + o=0.5*mdrun->lc; + break; + case FCC: + o=0.25*mdrun->lc; + break; + case DIAMOND: + case ZINCBLENDE: + o=0.125*mdrun->lc; + break; + default: + break; + } switch(iap->type) { case INS_TOTAL: x=moldyn->dim.x; - x0=0.0; + x0=-x/2.0; y=moldyn->dim.y; - y0=0.0; + y0=-y/2.0; z=moldyn->dim.z; - z0=0.0; + z0=-z/2.0; cr_check=TRUE; break; case INS_REGION: @@ -522,6 +549,12 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { z0=iap->z0; cr_check=TRUE; break; + case INS_POS: + x0=iap->x0; + y0=iap->y0; + z0=iap->z0; + cr_check=FALSE; + break; default: printf("%s unknown insertion mode: %02x\n", ME,iap->type); @@ -532,9 +565,25 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { while(cntins_atoms) { run=1; while(run) { - r.x=(rand_get_double(&(moldyn->random))-0.5)*x+x0; - r.y=(rand_get_double(&(moldyn->random))-0.5)*y+y0; - r.z=(rand_get_double(&(moldyn->random))-0.5)*z+z0; + if(iap->type!=INS_POS) { + r.x=rand_get_double(&(moldyn->random))*x; + r.y=rand_get_double(&(moldyn->random))*y; + r.z=rand_get_double(&(moldyn->random))*z; + } + else { + r.x=0.0; + r.y=0.0; + r.z=0.0; + } + r.x+=x0; + r.y+=y0; + r.z+=z0; + // offset + if(iap->type!=INS_TOTAL) { + r.x+=o; + r.y+=o; + r.z+=o; + } run=0; if(cr_check==TRUE) { dmin=1000; // for sure too high! @@ -719,7 +768,9 @@ int mdrun_hook(void *ptr1,void *ptr2) { change_stage=TRUE; break; } - set_temperature(moldyn,moldyn->t_ref+ap->dt); + if(moldyn->t_ref+ap->dt>=0.0) + set_temperature(moldyn, + moldyn->t_ref+ap->dt); ap->count+=1; break; case STAGE_CHAATTR: diff --git a/mdrun.h b/mdrun.h index 83a8196..fa16906 100644 --- a/mdrun.h +++ b/mdrun.h @@ -116,6 +116,7 @@ typedef struct s_insert_atoms_params { #define INS_TOTAL 0x01 #define INS_REGION 0x02 +#define INS_POS 0x03 typedef struct s_continue_params { int runs;