Merge "Merge release-4-5-patches into release-4-6" into release-4-6
authorDavid van der Spoel <davidvanderspoel@gmail.com>
Tue, 27 Nov 2012 09:46:16 +0000 (10:46 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 27 Nov 2012 09:46:16 +0000 (10:46 +0100)
CMakeLists.txt
src/config.h.cmakein
src/gmxlib/futil.c
src/tools/gmx_cluster.c
src/tools/gmx_hbond.c

index ce8335868921e2e72e00a26bcada535488585264..7fb19a985f65c8992c130094d932113b95d61fd4 100644 (file)
@@ -405,7 +405,6 @@ check_function_exists(fsync             HAVE_FSYNC)
 check_function_exists(_fileno           HAVE__FILENO)
 check_function_exists(fileno            HAVE_FILENO)
 check_function_exists(_commit           HAVE__COMMIT)
-check_function_exists(lstat             HAVE_LSTAT)
 check_function_exists(sigaction         HAVE_SIGACTION)
 check_function_exists(sysconf           HAVE_SYSCONF)
 check_function_exists(sched_setaffinity HAVE_SCHED_SETAFFINITY)
index b532adf06a5a63967942c9221623bd5b8d5ea8af..40bb5d7a2cb83dc49b0dc7a22554b755c2c0057c 100644 (file)
 /* Define to 1 if you have the _fileno() function. */
 #cmakedefine HAVE__FILENO
 
-/* Define to 1 if you have the lstat() function. */
-#cmakedefine HAVE_LSTAT
-
 /* Define to 1 if you have the sigaction() function. */
 #cmakedefine HAVE_SIGACTION
 
index 3834e36b35cf3117bb8490af74168bd46d0ef91b..ee4d0eccfe5fe4d7100962be0dd96814be8e2c80 100644 (file)
@@ -335,11 +335,7 @@ static gmx_bool gmx_is_file(const char *fname)
         {
             int status;
             struct stat st_buf;
-            #ifdef HAVE_LSTAT
-                status = lstat (fname, &st_buf);
-            #else
-                status = stat (fname, &st_buf);
-            #endif
+            status = stat (fname, &st_buf);
             if (status != 0 || !S_ISREG(st_buf.st_mode))
             {
                 return FALSE;
index 3818009b0ca04f4efb2eb53b697bedb4d2afd1c2..14a607fbd5dd970feecf227a7739e090493af7ae 100644 (file)
@@ -1237,7 +1237,7 @@ int gmx_cluster(int argc,char *argv[])
   if (bReadTraj) {
     /* don't read mass-database as masses (and top) are not used */
     read_tps_conf(ftp2fn(efTPS,NFILE,fnm),buf,&top,&ePBC,&xtps,NULL,box,
-                 bAnalyze);
+                 TRUE);
     if(bPBC) {
        gpbc = gmx_rmpbc_init(&top.idef,ePBC,top.atoms.nr,box);
     }
index cdf790cbf50fd948c3fee892bf212d6f1d34b6bf..ea53b9d95c95e2872b6d81c2999a043aee09c46b 100644 (file)
@@ -3957,61 +3957,68 @@ int gmx_hbond(int argc,char *argv[])
         if (opt2bSet("-hbm",NFILE,fnm)) {
             t_matrix mat;
             int id,ia,hh,x,y;
-      
-            mat.nx=nframes;
-            mat.ny=hb->nrhb;
-
-            snew(mat.matrix,mat.nx);
-            for(x=0; (x<mat.nx); x++) 
-                snew(mat.matrix[x],mat.ny);
-            y=0;
-            for(id=0; (id<hb->d.nrd); id++) 
-                for(ia=0; (ia<hb->a.nra); ia++) {
-                    for(hh=0; (hh<hb->maxhydro); hh++) {
-                        if (hb->hbmap[id][ia]) {
-                            if (ISHB(hb->hbmap[id][ia]->history[hh])) {
-                                /* Changed '<' into '<=' in the for-statement below.
-                                 * It fixed the previously undiscovered bug that caused
-                                 * the last occurance of an hbond/contact to not be
-                                 * set in mat.matrix. Have a look at any old -hbm-output
-                                 * and you will notice that the last column is allways empty.
-                                 * - Erik Marklund May 30, 2006
-                                 */
-                                for(x=0; (x<=hb->hbmap[id][ia]->nframes); x++) {
-                                    int nn0 = hb->hbmap[id][ia]->n0;
-                                    range_check(y,0,mat.ny);
-                                    mat.matrix[x+nn0][y] = is_hb(hb->hbmap[id][ia]->h[hh],x);
+            
+            if ((nframes > 0) && (hb->nrhb > 0))
+            {
+                mat.nx=nframes;
+                mat.ny=hb->nrhb;
+                
+                snew(mat.matrix,mat.nx);
+                for(x=0; (x<mat.nx); x++) 
+                    snew(mat.matrix[x],mat.ny);
+                y=0;
+                for(id=0; (id<hb->d.nrd); id++) 
+                    for(ia=0; (ia<hb->a.nra); ia++) {
+                        for(hh=0; (hh<hb->maxhydro); hh++) {
+                            if (hb->hbmap[id][ia]) {
+                                if (ISHB(hb->hbmap[id][ia]->history[hh])) {
+                                    /* Changed '<' into '<=' in the for-statement below.
+                                     * It fixed the previously undiscovered bug that caused
+                                     * the last occurance of an hbond/contact to not be
+                                     * set in mat.matrix. Have a look at any old -hbm-output
+                                     * and you will notice that the last column is allways empty.
+                                     * - Erik Marklund May 30, 2006
+                                     */
+                                    for(x=0; (x<=hb->hbmap[id][ia]->nframes); x++) {
+                                        int nn0 = hb->hbmap[id][ia]->n0;
+                                        range_check(y,0,mat.ny);
+                                        mat.matrix[x+nn0][y] = is_hb(hb->hbmap[id][ia]->h[hh],x);
+                                    }
+                                    y++;
                                 }
-                                y++;
                             }
                         }
                     }
+                mat.axis_x=hb->time;
+                snew(mat.axis_y,mat.ny);
+                for(j=0; j<mat.ny; j++)
+                    mat.axis_y[j]=j;
+                sprintf(mat.title,bContact ? "Contact Existence Map":
+                        "Hydrogen Bond Existence Map");
+                sprintf(mat.legend,bContact ? "Contacts" : "Hydrogen Bonds");
+                sprintf(mat.label_x,"%s",output_env_get_xvgr_tlabel(oenv));
+                sprintf(mat.label_y, bContact ? "Contact Index" : "Hydrogen Bond Index");
+                mat.bDiscrete=TRUE;
+                mat.nmap=2;
+                snew(mat.map,mat.nmap);
+                for(i=0; i<mat.nmap; i++) {
+                    mat.map[i].code.c1=hbmap[i];
+                    mat.map[i].desc=hbdesc[i];
+                    mat.map[i].rgb=hbrgb[i];
                 }
-            mat.axis_x=hb->time;
-            snew(mat.axis_y,mat.ny);
-            for(j=0; j<mat.ny; j++)
-                mat.axis_y[j]=j;
-            sprintf(mat.title,bContact ? "Contact Existence Map":
-                    "Hydrogen Bond Existence Map");
-            sprintf(mat.legend,bContact ? "Contacts" : "Hydrogen Bonds");
-            sprintf(mat.label_x,"%s",output_env_get_xvgr_tlabel(oenv));
-            sprintf(mat.label_y, bContact ? "Contact Index" : "Hydrogen Bond Index");
-            mat.bDiscrete=TRUE;
-            mat.nmap=2;
-            snew(mat.map,mat.nmap);
-            for(i=0; i<mat.nmap; i++) {
-                mat.map[i].code.c1=hbmap[i];
-                mat.map[i].desc=hbdesc[i];
-                mat.map[i].rgb=hbrgb[i];
+                fp = opt2FILE("-hbm",NFILE,fnm,"w");
+                write_xpm_m(fp, mat);
+                ffclose(fp);
+                for(x=0; x<mat.nx; x++)
+                    sfree(mat.matrix[x]);
+                sfree(mat.axis_y);
+                sfree(mat.matrix);
+                sfree(mat.map);
+            }
+            else 
+            {
+                fprintf(stderr,"No hydrogen bonds/contacts found. No hydrogen bond map will be printed.\n");
             }
-            fp = opt2FILE("-hbm",NFILE,fnm,"w");
-            write_xpm_m(fp, mat);
-            ffclose(fp);
-            for(x=0; x<mat.nx; x++)
-                sfree(mat.matrix[x]);
-            sfree(mat.axis_y);
-            sfree(mat.matrix);
-            sfree(mat.map);
         }
     }