]> hackdaworld.org Git - physik/posic.git/commitdiff
introduced critical max (didn't help though!)
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 18 Aug 2008 22:41:47 +0000 (00:41 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 18 Aug 2008 22:41:47 +0000 (00:41 +0200)
mdrun.c
mdrun.h

diff --git a/mdrun.c b/mdrun.c
index 31943efc65bd39680dc8dec02fec465ce39c7e90..1368880b7c62cde2eb66761bf726c962751f6cce 100644 (file)
--- a/mdrun.c
+++ b/mdrun.c
@@ -459,7 +459,8 @@ int mdrun_parse_config(t_mdrun *mdrun) {
                                imp.amount2=atoi(word[5]);
                                imp.brand1=atoi(word[6]);
                                imp.brand2=atoi(word[7]);
-                               imp.cr=atof(word[8]);
+                               imp.crmin=atof(word[8]);
+                               imp.crmax=atof(word[9]);
                                /* do this later ...
                                for(i=0;i<strlen(word[8]);i++) {
                                        switch(word[8][i]) {
@@ -489,8 +490,8 @@ int mdrun_parse_config(t_mdrun *mdrun) {
                                        }
                                }
                                */
-                               imp.attr1=ATOM_ATTR_HB|ATOM_ATTR_VA|ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP;
-                               imp.attr2=ATOM_ATTR_HB|ATOM_ATTR_VA|ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP;
+                               imp.attr1=ATOM_ATTR_HB|ATOM_ATTR_VA|ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_FP;
+                               imp.attr2=ATOM_ATTR_HB|ATOM_ATTR_VA|ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_FP;
                                add_stage(mdrun,STAGE_INSERT_MIXED_ATOMS,&imp);
                        }
 
@@ -706,7 +707,7 @@ int insert_mixed_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
        t_insert_mixed_atoms_params *imp;
        t_atom *atom;
        double x,x0,y,y0,z,z0;
-       double dmin,d,c;
+       double dmin,d,cmin,cmax;
        u8 retry;
        t_3dvec r,v,dist;
        int i;
@@ -726,7 +727,8 @@ int insert_mixed_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
        v.y=0.0;
        v.z=0.0;
 
-       c=imp->cr*imp->cr;
+       cmin=imp->crmin*imp->crmin;
+       cmax=imp->crmax*imp->crmax;
 
        while(imp->amount1|imp->amount2) {
                if(imp->amount1) {
@@ -745,20 +747,22 @@ int insert_mixed_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
                                        v3_sub(&dist,&(atom->r),&r);
                                        check_per_bound(moldyn,&dist);
                                        d=v3_absolute_square(&dist);
-                                       if(d<c) {
+                                       if(d<cmin) {
                                                retry=1;
                                                break;
                                        }
                                        if(d<dmin)
                                                dmin=d;
-                                       
                                }
+                               if(dmin!=1000.0)
+                                       if(dmin>cmax)
+                                               retry=1;
                        }
                        add_atom(moldyn,imp->element1,pse_mass[imp->element1],
                                  imp->brand1,imp->attr1,&r,&v);
                        printf("%s (mixed) atom inserted (%d): %f %f %f\n",
                                ME,imp->amount1,r.x,r.y,r.z);
-                       printf("  -> d2 = %f/%f\n",dmin,c);
+                       printf("  -> d2 = %f/%f/%f\n",dmin,cmin,cmax);
                        imp->amount1-=1;
                }
                if(imp->amount2) {
@@ -777,20 +781,22 @@ int insert_mixed_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
                                        v3_sub(&dist,&(atom->r),&r);
                                        check_per_bound(moldyn,&dist);
                                        d=v3_absolute_square(&dist);
-                                       if(d<c) {
+                                       if(d<cmin) {
                                                retry=1;
                                                break;
                                        }
                                        if(d<dmin)
                                                dmin=d;
-                                       
                                }
+                               if(dmin!=1000.0)
+                                       if(dmin>cmax)
+                                               retry=1;
                        }
                        add_atom(moldyn,imp->element2,pse_mass[imp->element2],
                                  imp->brand2,imp->attr2,&r,&v);
                        printf("%s (mixed) atom inserted (%d): %f %f %f\n",
                                ME,imp->amount2,r.x,r.y,r.z);
-                       printf("  -> d2 = %f/%f\n",dmin,c);
+                       printf("  -> d2 = %f/%f/%f\n",dmin,cmin,cmax);
                        imp->amount2-=1;
                }
        }
@@ -950,6 +956,7 @@ int mdrun_hook(void *ptr1,void *ptr2) {
                                stage_print("  -> insert mixed atoms\n\n");
                                imp=stage->params;
                                insert_mixed_atoms(moldyn,mdrun);
+                               change_stage=TRUE;
                                break;
 
 
diff --git a/mdrun.h b/mdrun.h
index b1c2e0660c52b1ee4d5fb0c7df7b4df0e4100e55..acd233184cae2c04dafc7562299dd5b92e31dfdd 100644 (file)
--- a/mdrun.h
+++ b/mdrun.h
@@ -129,7 +129,8 @@ typedef struct s_insert_mixed_atoms_params {
        u8 brand2;
        u8 attr1;
        u8 attr2;
-       double cr;
+       double crmin;
+       double crmax;
 } t_insert_mixed_atoms_params;
 
 #define INS_TOTAL                              0x01