From: hackbard Date: Tue, 12 Jan 2010 16:39:09 +0000 (+0100) Subject: added RELPOS (insert) and TAG (aattr) feature X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=e6ca71aa985ab3c6885784e0cd1b8141672902fb;p=physik%2Fposic.git added RELPOS (insert) and TAG (aattr) feature --- diff --git a/mdrun.c b/mdrun.c index 062224b..29e5e48 100644 --- a/mdrun.c +++ b/mdrun.c @@ -422,6 +422,8 @@ int mdrun_parse_config(t_mdrun *mdrun) { case 'e': cap.type|=CHAATTR_ELEMENT; break; + case 'n': + cap.type|=CHAATTR_NUMBER; default: break; } @@ -440,6 +442,10 @@ int mdrun_parse_config(t_mdrun *mdrun) { cap.element=atoi(word[i]); i+=1; } + if(cap.type&CHAATTR_NUMBER) { + cap.element=atoi(word[i]); + i+=1; + } for(o=0;ox0; y0=iap->y0; z0=iap->z0; @@ -911,7 +924,7 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { while(cntins_atoms) { run=1; while(run) { - if(iap->type!=INS_POS) { + if((iap->type!=INS_POS)&&(iap->type!=INS_RELPOS)) { r.x=rand_get_double(&(moldyn->random))*x; r.y=rand_get_double(&(moldyn->random))*y; r.z=rand_get_double(&(moldyn->random))*z; @@ -921,9 +934,16 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { r.y=0.0; r.z=0.0; } - r.x+=x0; - r.y+=y0; - r.z+=z0; + if(iap->type==INS_RELPOS) { + r.x+=x0*mdrun->lc; + r.y+=y0*mdrun->lc; + r.z+=z0*mdrun->lc; + } + else { + r.x+=x0; + r.y+=y0; + r.z+=z0; + } // offset if(iap->type!=INS_TOTAL) { r.x+=o; @@ -1102,6 +1122,10 @@ int chaatr(t_moldyn *moldyn,t_mdrun *mdrun) { if(cap->element!=atom->element) continue; } + if(cap->type&CHAATTR_NUMBER) { + if(cap->element!=atom->tag) + continue; + } if(cap->type&CHAATTR_REGION) { if(cap->x0>atom->r.x) continue; diff --git a/mdrun.h b/mdrun.h index 102d00e..0a5ceab 100644 --- a/mdrun.h +++ b/mdrun.h @@ -150,6 +150,7 @@ typedef struct s_insert_mixed_atoms_params { #define INS_RECT 0x02 #define INS_SPHERE 0x03 #define INS_POS 0x04 +#define INS_RELPOS 0x05 typedef struct s_continue_params { int runs; @@ -173,6 +174,7 @@ typedef struct s_chaattr_params { #define CHAATTR_TOTALV 0x01 #define CHAATTR_REGION 0x02 #define CHAATTR_ELEMENT 0x04 +#define CHAATTR_NUMBER 0x08 typedef struct s_chsattr_params { u8 type;