]> hackdaworld.org Git - physik/posic.git/commitdiff
fixed attrr region + ifdef'ed constraints along 110 + write final save and visual...
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 29 Jul 2009 16:51:34 +0000 (18:51 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 29 Jul 2009 16:51:34 +0000 (18:51 +0200)
mdrun.c
moldyn.c

diff --git a/mdrun.c b/mdrun.c
index f0edd0bac7546bed88625c1d7a3242a0a2632650..31e5f0a162a9d0d296e4959037bc6a92b3545b52 100644 (file)
--- a/mdrun.c
+++ b/mdrun.c
@@ -420,12 +420,12 @@ int mdrun_parse_config(t_mdrun *mdrun) {
                        }
                        i=2;
                        if(cap.type&CHAATTR_REGION) {
-                               cap.x0=atof(word[1]);   
-                               cap.y0=atof(word[2]);   
-                               cap.z0=atof(word[3]);   
-                               cap.x1=atof(word[4]);   
-                               cap.y1=atof(word[5]);   
-                               cap.z1=atof(word[6]);
+                               cap.x0=atof(word[2]);   
+                               cap.y0=atof(word[3]);   
+                               cap.z0=atof(word[4]);   
+                               cap.x1=atof(word[5]);   
+                               cap.y1=atof(word[6]);   
+                               cap.z1=atof(word[7]);
                                i+=6;
                        }
                        if(cap.type&CHAATTR_ELEMENT) {
@@ -1095,22 +1095,25 @@ int chaatr(t_moldyn *moldyn,t_mdrun *mdrun) {
                                continue;
                }
                if(cap->type&CHAATTR_REGION) {
-                       if(cap->x0<atom->r.x)
+                       if(cap->x0>atom->r.x)
                                continue;
-                       if(cap->y0<atom->r.y)
+                       if(cap->y0>atom->r.y)
                                continue;
-                       if(cap->z0<atom->r.z)
+                       if(cap->z0>atom->r.z)
                                continue;
-                       if(cap->x1>atom->r.x)
+                       if(cap->x1<atom->r.x)
                                continue;
-                       if(cap->y1>atom->r.y)
+                       if(cap->y1<atom->r.y)
                                continue;
-                       if(cap->z1>atom->r.z)
+                       if(cap->z1<atom->r.z)
                                continue;
                }
+               printf("  changing attributes of atom %d (0x%x)\n",i,cap->attr);
                atom->attr=cap->attr;
        }
 
+       printf("\n\n");
+
        return 0;
 }
 
index 12cb49b4f7f1cb4fb8d8da5a80727f085dbdad4f..d3d63eb844ff7c1f0e2bd7dd59f2aa5d87d38a1f 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -78,6 +78,10 @@ int moldyn_init(t_moldyn *moldyn,int argc,char **argv) {
        pthread_mutex_init(&emutex,NULL);
 #endif
 
+#ifdef CONSTRAINT_110_5832
+       printf("\n\n\nWARNING! WARNING! WARNING!\n\n\n");
+       printf("\n\n\n!! -- constraints enabled -- !!\n\n\n");
+#endif
        return 0;
 }
 
@@ -2228,6 +2232,22 @@ printf("sched:%d, steps:%d/%d, T:%4.1f/%4.1f P:%4.1f/%4.1f V:%6.1f (%d)\n",
 
        }
 
+       /* writing a final save file! */
+       if(s) {
+               snprintf(dir,128,"%s/s-final.save",moldyn->vlsdir);
+               fd=open(dir,O_WRONLY|O_TRUNC|O_CREAT,S_IRUSR|S_IWUSR);
+               if(fd<0) perror("[moldyn] save fd open");
+               else {
+                       write(fd,moldyn,sizeof(t_moldyn));
+                       write(fd,moldyn->atom,
+                             moldyn->count*sizeof(t_atom));
+               }
+               close(fd);
+       }
+       /* writing a final visual file! */
+       if(a)
+               visual_atoms(moldyn);
+
        return 0;
 }
 
@@ -2245,6 +2265,12 @@ int velocity_verlet(t_moldyn *moldyn) {
        tau=moldyn->tau;
        tau_square=moldyn->tau_square;
 
+#ifdef CONSTRAINT_110_5832
+       if(count==5833) {
+               atom[5832].f.x=0.5*(atom[5832].f.x-atom[5832].f.y);
+               atom[5832].f.y=-atom[5832].f.x;
+       }
+#endif
        for(i=0;i<count;i++) {
                /* check whether fixed atom */
                if(atom[i].attr&ATOM_ATTR_FP)
@@ -2252,8 +2278,18 @@ int velocity_verlet(t_moldyn *moldyn) {
                /* new positions */
                h=0.5/atom[i].mass;
                v3_scale(&delta,&(atom[i].v),tau);
+#ifdef CONSTRAINT_110_5832
+               if(i==5832) {
+                       delta.y=-delta.x;
+               }
+#endif
                v3_add(&(atom[i].r),&(atom[i].r),&delta);
                v3_scale(&delta,&(atom[i].f),h*tau_square);
+#ifdef CONSTRAINT_110_5832
+               if(i==5832) {
+                       delta.y=-delta.x;
+               }
+#endif
                v3_add(&(atom[i].r),&(atom[i].r),&delta);
                //check_per_bound_and_care_for_pbc(moldyn,&(atom[i]));
                check_per_bound(moldyn,&(atom[i].r));
@@ -2280,6 +2316,12 @@ int velocity_verlet(t_moldyn *moldyn) {
        albe_potential_force_calc(moldyn);
 #endif
 
+#ifdef CONSTRAINT_110_5832
+       if(count==5833) {
+               atom[5832].f.x=0.5*(atom[5832].f.x-atom[5832].f.y);
+               atom[5832].f.y=-atom[5832].f.x;
+       }
+#endif
        for(i=0;i<count;i++) {
                /* check whether fixed atom */
                if(atom[i].attr&ATOM_ATTR_FP)
@@ -2862,7 +2904,7 @@ int moldyn_read_save_file(t_moldyn *moldyn,char *file) {
        if(fsize!=sizeof(t_moldyn)+size) {
                corr=fsize-sizeof(t_moldyn)-size;
                printf("[moldyn] WARNING: lsf (illegal file size)\n");
-               printf("  moifying offset:\n");
+               printf("  modifying offset:\n");
                printf("  - current pos: %d\n",sizeof(t_moldyn));
                printf("  - atom size: %d\n",size);
                printf("  - file size: %d\n",fsize);