]> hackdaworld.org Git - physik/posic.git/commitdiff
added RELPOS (insert) and TAG (aattr) feature
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 12 Jan 2010 16:39:09 +0000 (17:39 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 12 Jan 2010 16:39:09 +0000 (17:39 +0100)
mdrun.c
mdrun.h

diff --git a/mdrun.c b/mdrun.c
index 062224b99f65ff80a9b5f97c338ed184e9524538..29e5e487fcf9058048e30e522a5159ce1a20a993 100644 (file)
--- 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;o<strlen(word[i]);o++) {
                                switch(word[i][o]) {
                                        case 'b':
@@ -591,6 +597,12 @@ int mdrun_parse_config(t_mdrun *mdrun) {
                                                iap.y0=atof(word[9]);
                                                iap.z0=atof(word[10]);
                                                break;
+                                       case 'P':
+                                               iap.type=INS_RELPOS;
+                                               iap.x0=atof(word[8]);
+                                               iap.y0=atof(word[9]);
+                                               iap.z0=atof(word[10]);
+                                               break;
                                        case 'r':
                                                switch(word[8][0]) {
 
@@ -896,6 +908,7 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
                        cr_check=TRUE;
                        break;
                case INS_POS:
+               case INS_RELPOS:
                        x0=iap->x0;
                        y0=iap->y0;
                        z0=iap->z0;
@@ -911,7 +924,7 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
        while(cnt<iap->ins_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 102d00e73c4e3e51b433deddc39d1e464ee21826..0a5ceabaff4abcca73df7b7ecc4536c1fdc64fa7 100644 (file)
--- 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;