Merge "Autogenerate gromacs.7 from programs.txt" into release-4-6
authorDavid van der Spoel <davidvanderspoel@gmail.com>
Sun, 15 Jul 2012 12:44:04 +0000 (14:44 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 15 Jul 2012 12:44:04 +0000 (14:44 +0200)
19 files changed:
CMakeLists.txt
admin/programs.txt
include/gmxfio.h
include/xdrf.h
src/gmxlib/gmxfio.c
src/gmxlib/libxdrf.c
src/gmxlib/maths.c
src/gmxlib/selection/compiler.c
src/gmxlib/sfactor.c
src/gmxlib/trxio.c
src/kernel/pdb2top.c
src/mdlib/domdec_setup.c
src/mdlib/mdebin.c
src/mdlib/minimize.c
src/mdlib/shakef.c
src/tools/CMakeLists.txt
src/tools/gmx_hbond.c
src/tools/gmx_lie.c
src/tools/gmx_trjcat.c

index 1c2f7838a166fdac59cf842c5afd4ac9d0ad0788..16830abb7b19655bb5f76ae800fb3590c8737e0c 100644 (file)
@@ -36,7 +36,7 @@ SET(CPACK_PACKAGE_VERSION_MINOR "6")
 # Cmake modules/macros are in a subdirectory to keep this file cleaner
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
 set(CMAKE_INSTALL_PREFIX "/usr/local/gromacs" CACHE STRING "Installation prefix (installation will need write permissions here)" FORCE)
 endif()
 
@@ -46,10 +46,15 @@ endif(NOT CMAKE_BUILD_TYPE)
 
 enable_language(C)
 
+set(GMX_USE_RELATIVE_INSTALL_PATH OFF CACHE STRING "Use relative paths not absolute paths for cmake install. Has only an effect on cpack.")
+mark_as_advanced(GMX_USE_RELATIVE_INSTALL_PATH)
+
 set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
 set(CPACK_PACKAGE_VENDOR "gromacs.org")
 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gromacs - a toolkit for high-performance molecular simulation")
-set(CPACK_SET_DESTDIR "ON")
+if (NOT GMX_USE_RELATIVE_INSTALL_PATH)
+    set(CPACK_SET_DESTDIR "ON")
+endif()
 set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
 set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/admin/InstallWelcome.txt")
 # Its GPL/LGPL, so they do not have to agree to a license for mere usage, but some installers require this...
@@ -704,6 +709,13 @@ elseif(${GMX_ACCELERATION} STREQUAL "BLUEGENE")
     set(GMX_X11 OFF CACHE BOOL "X11 not compatible with BlueGene, disabled!" FORCE)
     set(GMX_THREAD_MPI OFF CACHE BOOL "Thread-MPI not compatible with BlueGene, disabled!" FORCE)
     set(GMX_MPI ON CACHE BOOL "Use MPI on BlueGene" FORCE)
+# Access to /etc/passwd is not available on the back end of BlueGene,
+# despite being detected by CMake. This can cause linker warnings
+# about harmless things in src/gmxlib/string2.h.
+    set(HAVE_PWD_H OFF)
+# The automatic testing for endianness does not work for the BlueGene cross-compiler
+    set(GMX_IEEE754_BIG_ENDIAN_BYTE_ORDER 1 CACHE INTERNAL "BlueGene has big endian FP byte order (by default)" FORCE)
+    set(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER 1 CACHE INTERNAL "BlueGene has big endian FP word order (by default)" FORCE)
 elseif(${GMX_ACCELERATION} STREQUAL "POWER6")
     set(GMX_POWER6 1)
     set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Do not use software reciprocal square root on Power6" FORCE)
@@ -978,15 +990,21 @@ endif()
 ########################################################################
 # Specify install locations and which subdirectories to process        #
 ########################################################################
-if ( DEFINED GMXLIB )
-    set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GMXLIB}")
+if (GMX_USE_RELATIVE_INSTALL_PATH)
+    set(GMX_INSTALL_PREFIX "" CACHE STRING "Prefix gets appended to CMAKE_INSTALL_PREFIX. For cpack it sets the root folder of the archive.")
+    mark_as_advanced(GMX_INSTALL_PREFIX)
 else()
-    set(LIB_INSTALL_DIR  ${CMAKE_INSTALL_PREFIX}/lib)
+    set(GMX_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
+endif()
+
+if ( NOT DEFINED GMXLIB )
+    set(GMXLIB lib)
 endif()
-set(BIN_INSTALL_DIR  ${CMAKE_INSTALL_PREFIX}/bin)
-set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/gromacs)
-set(MAN_INSTALL_DIR  ${CMAKE_INSTALL_PREFIX}/share/man)
-set(INCL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include)
+set(LIB_INSTALL_DIR "${GMX_INSTALL_PREFIX}${GMXLIB}")
+set(BIN_INSTALL_DIR  ${GMX_INSTALL_PREFIX}bin)
+set(DATA_INSTALL_DIR ${GMX_INSTALL_PREFIX}share/gromacs)
+set(MAN_INSTALL_DIR  ${GMX_INSTALL_PREFIX}share/man)
+set(INCL_INSTALL_DIR ${GMX_INSTALL_PREFIX}include)
 
 set(GMXLIBDIR        ${DATA_INSTALL_DIR}/top)
 
@@ -996,7 +1014,7 @@ set(GMXLIBDIR        ${DATA_INSTALL_DIR}/top)
 if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
     set(CMAKE_SKIP_BUILD_RPATH  FALSE)
     set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-    set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
+    set(CMAKE_INSTALL_RPATH "\\\$ORIGIN/../${GMXLIB}")
     set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 endif()
 
index 049c549581887bd69961973938ea07b09ca52937..bee575792fffe20763105ac73012e34ee624bc4c 100644 (file)
@@ -79,6 +79,7 @@ g_polystat|calculates static properties of polymers
 g_rdf|calculates radial distribution functions
 g_rotacf|calculates the rotational correlation function for molecules
 g_rotmat|plots the rotation matrix for fitting to a reference structure
+g_sans|computes the small angle neutron scattering spectra
 g_traj|plots x, v, f, box, temperature and rotational energy
 g_vanhove|calculates Van Hove displacement functions
 END
@@ -109,6 +110,9 @@ END
 HEAD|Kinetic properties
 g_bar|calculates free energy difference estimates through Bennett's acceptance ratio
 g_current|calculate current autocorrelation function of system
+g_dos|analyzes density of states and properties based on that
+g_dyecoupl|extracts dye dynamics from trajectories
+g_kinetics|analyzes kinetic constants from properties based on the Eyring model
 g_principal|calculate principal axes of inertion for a group of atoms
 g_tcaf|calculates viscosities of liquids
 g_traj|plots x, v, f, box, temperature and rotational energy
index da5acaa199d93ab0f1155efeabf3253b9ae0cdae..ef56ebc8a166fa02c3dbd3edf7796bfc48bcd136 100644 (file)
@@ -218,7 +218,7 @@ int gmx_fio_get_file_md5(t_fileio *fio, gmx_off_t offset,
 
 int xtc_seek_frame(t_fileio *fio, int frame, int natoms);
 
-int xtc_seek_time(t_fileio *fio, real time, int natoms);
+int xtc_seek_time(t_fileio *fio, real time, int natoms,gmx_bool bSeekForwardOnly);
 
        
 /* Add this to the comment string for debugging */
index ba3ac55893173afb52579db754a20de74e385f0c..c77e7dfe00c17257874ce0fdd622250f01a45a36 100644 (file)
@@ -103,7 +103,7 @@ int xdr_gmx_large_int(XDR *xdrs,gmx_large_int_t *i,const char *warn);
 
 float xdr_xtc_estimate_dt(FILE *fp, XDR *xdrs, int natoms, gmx_bool * bOK);
 
-int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms);
+  int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms,gmx_bool bSeekForwardOnly);
 
 
 int xdr_xtc_seek_frame(int frame, FILE *fp, XDR *xdrs, int natoms);
index 3efa33b010369b975f5c6201f4ed8a78d87364fb..d693ae20b67d72add62695cd0481e11c0e0b4c38 100644 (file)
@@ -1145,12 +1145,12 @@ int xtc_seek_frame(t_fileio *fio, int frame, int natoms)
     return ret;
 }
 
-int xtc_seek_time(t_fileio *fio, real time, int natoms)
+int xtc_seek_time(t_fileio *fio, real time, int natoms,gmx_bool bSeekForwardOnly)
 {
     int ret;
 
     gmx_fio_lock(fio);
-    ret=xdr_xtc_seek_time(time, fio->fp, fio->xdr, natoms);
+    ret=xdr_xtc_seek_time(time, fio->fp, fio->xdr, natoms, bSeekForwardOnly);
     gmx_fio_unlock(fio);
 
     return ret;
index 00b4a7efec42ee109781eee34a928d8f5c1178ac..354b821172d22188573f30e08637843787b0154e 100644 (file)
@@ -1683,7 +1683,7 @@ xdr_xtc_seek_frame(int frame, FILE *fp, XDR *xdrs, int natoms)
 
      
 
-int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms)
+int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms,gmx_bool bSeekForwardOnly)
 {
     float t;
     float dt;
@@ -1693,6 +1693,10 @@ int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms)
     int res;
     int dt_sign = 0;
 
+    if (bSeekForwardOnly)
+    {
+        low = gmx_ftell(fp);
+    }
     if (gmx_fseek(fp,0,SEEK_END))
     {
         return -1;
@@ -1705,7 +1709,7 @@ int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms)
     /* round to int  */
     high /= XDR_INT_SIZE;
     high *= XDR_INT_SIZE;
-    offset = ((high / 2) / XDR_INT_SIZE) * XDR_INT_SIZE;
+    offset = (((high-low) / 2) / XDR_INT_SIZE) * XDR_INT_SIZE;
 
     if (gmx_fseek(fp,offset,SEEK_SET))
     {
index 427ab74173a4ccc4adb1736ea05ab5af3ad222f3..b327777992480f6d29c7a1e6a426772c8479f617 100644 (file)
@@ -195,7 +195,9 @@ double gmx_erf(double x)
     
     conv.d=x;
     
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
     hx=conv.i[0];
 #else
     hx=conv.i[1];
@@ -255,7 +257,9 @@ double gmx_erf(double x)
 
     conv.d = x;
 
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
     conv.i[1] = 0;
 #else
     conv.i[0] = 0;
@@ -285,7 +289,9 @@ double gmx_erfc(double x)
     
     conv.d = x;
     
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
     hx=conv.i[0];
 #else
     hx=conv.i[1];
@@ -356,7 +362,9 @@ double gmx_erfc(double x)
 
         conv.d = x;
 
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
         conv.i[1] = 0;
 #else
         conv.i[0] = 0;
index 69fae3347bd35a80d8fdf6fbe9dc031cbde67080..a1c426168fd39b7e6792c4d3ca43f9bf30a02a9f 100644 (file)
@@ -1970,10 +1970,17 @@ evaluate_gmx_boolean_minmax_grps(t_selelem *sel, gmx_ana_index_t *g,
             {
                 gmx_ana_index_reserve(sel->child->v.u.g, gmin->isize);
                 gmx_ana_index_copy(sel->child->v.u.g, gmin, FALSE);
-                if (sel->child->u.cgrp.isize > 0)
+                if (sel->child->u.cgrp.nalloc_index > 0)
                 {
+                    /* Keep the name as in evaluate_boolean_static_part(). */
+                    char *name = sel->child->u.cgrp.name;
                     gmx_ana_index_reserve(&sel->child->u.cgrp, gmin->isize);
                     gmx_ana_index_copy(&sel->child->u.cgrp, gmin, FALSE);
+                    sel->child->u.cgrp.name = name;
+                }
+                else
+                {
+                    sel->child->u.cgrp.isize = sel->child->v.u.g->isize;
                 }
             }
             break;
index 2efcde366ea7ee0dff9a16dc8831f211422ab3ae..70c9dde017a9be9641de8e22515d5d6a223127f6 100644 (file)
@@ -240,29 +240,27 @@ extern gmx_structurefactors_t *gmx_structurefactors_init(const char *datfn) {
     char line[STRLEN];
     gmx_structurefactors *gsf;
     double a1,a2,a3,a4,b1,b2,b3,b4,c;
-    int n,p;
+    int p;
     int i;
     int nralloc=10;
     int line_no;
     char atomn[32];
     fp=libopen(datfn);
     line_no = 0;
-
     snew(gsf,1);
 
     snew(gsf->atomnm,nralloc);
     snew(gsf->a,nralloc);
     snew(gsf->b,nralloc);
     snew(gsf->c,nralloc);
-    snew(gsf->n,nralloc);
     snew(gsf->p,nralloc);
+    gsf->n=NULL;
     gsf->nratoms=line_no;
     while(get_a_line(fp,line,STRLEN)) {
         i=line_no;
-        if (sscanf(line,"%s %d %d %lf %lf %lf %lf %lf %lf %lf %lf %lf",
-                   atomn,&p,&n,&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&c) == 12) {
+        if (sscanf(line,"%s %d %lf %lf %lf %lf %lf %lf %lf %lf %lf",
+                   atomn,&p,&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&c) == 11) {
             gsf->atomnm[i]=strdup(atomn);
-            gsf->n[i]=n;
             gsf->p[i]=p;
             snew(gsf->a[i],4);
             snew(gsf->b[i],4);
@@ -283,7 +281,6 @@ extern gmx_structurefactors_t *gmx_structurefactors_init(const char *datfn) {
                 srenew(gsf->a,nralloc);
                 srenew(gsf->b,nralloc);
                 srenew(gsf->c,nralloc);
-                srenew(gsf->n,nralloc);
                 srenew(gsf->p,nralloc);
             }
         }
@@ -296,7 +293,6 @@ extern gmx_structurefactors_t *gmx_structurefactors_init(const char *datfn) {
     srenew(gsf->a,gsf->nratoms);
     srenew(gsf->b,gsf->nratoms);
     srenew(gsf->c,gsf->nratoms);
-    srenew(gsf->n,gsf->nratoms);
     srenew(gsf->p,gsf->nratoms);
 
     fclose(fp);
@@ -631,7 +627,6 @@ extern void gmx_structurefactors_done(gmx_structurefactors_t *gsf){
        sfree(sf->b);
        sfree(sf->atomnm);
        sfree(sf->p);
-       sfree(sf->n);
        sfree(sf->c);
 
        sfree(sf);
index c16770b9b83c3e64be0a9ff4ca18b8eaf3316f2e..9a298797ba4edb799ea27d64b091ab93f8557a7d 100644 (file)
@@ -716,8 +716,9 @@ gmx_bool read_next_frame(const output_env_t oenv,t_trxstatus *status,t_trxframe
        * accuracy of the control over -b and -e options.
        */
         if (bTimeSet(TBEGIN) && (fr->time < rTimeValue(TBEGIN))) {
-            if (xtc_seek_time(status->fio, rTimeValue(TBEGIN),fr->natoms)) {
-                gmx_fatal(FARGS,"Specified frame doesn't exist or file not seekable");
+          if (xtc_seek_time(status->fio, rTimeValue(TBEGIN),fr->natoms,TRUE)) {
+            gmx_fatal(FARGS,"Specified frame (time %f) doesn't exist or file corrupt/inconsistent.",
+                      rTimeValue(TBEGIN));
             }
             initcount(status);
         }
index 8e1bde9cdd4cc4e0a96a304643cecc7d816969b8..2c0fd13010487d4c50fd05699340ba59db080afa 100644 (file)
@@ -1023,11 +1023,11 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp,
 
     if (bRM && ((tern >= 0 && ntdb[tern] == NULL) ||
                 (terc >= 0 && ctdb[terc] == NULL))) {
-        gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Edit a .n.tdb and/or .c.tdb file.");
+        gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Fix your terminal residues so that they match the residue database (.rtp) entries, or provide terminal database entries (.tdb).");
     }
     if (bRM && ((tern >= 0 && ntdb[tern]->nhack == 0) ||
                 (terc >= 0 && ctdb[terc]->nhack == 0))) {
-        gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends. Select a proper terminal entry.");
+        gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends. Fix your coordinate file, add a new terminal database entry (.tdb), or select the proper existing terminal entry.");
     }
   }
   
index b069d9c6dd27c5baac3d64e87f59ea570c461137..bd771a5045d1d599c1c4d5703890f79aae158134 100644 (file)
@@ -716,15 +716,26 @@ real dd_choose_grid(FILE *fplog,
                 if (cr->nnodes <= 18)
                 {
                     cr->npmenodes = 0;
+                    if (fplog)
+                    {
+                        fprintf(fplog,"Using %d separate PME nodes, as there are too few total\n nodes for efficient splitting\n",cr->npmenodes);
+                    }
                 }
                 else
                 {
                     cr->npmenodes = guess_npme(fplog,mtop,ir,box,cr->nnodes);
+                    if (fplog)
+                    {
+                        fprintf(fplog,"Using %d separate PME nodes, as guessed by mdrun\n",cr->npmenodes);
+                    }
                 }
             }
-            if (fplog)
+            else
             {
-                fprintf(fplog,"Using %d separate PME nodes\n",cr->npmenodes);
+                if (fplog)
+                {
+                    fprintf(fplog,"Using %d separate PME nodes, per user request\n",cr->npmenodes);
+                }
             }
         }
         
index bc1627371d53de498f9cedb1c3c419df5b3af9bb..7c13b9e147a0be5adc6e116ffbe860449b40c4bf 100644 (file)
@@ -577,9 +577,13 @@ t_mdebin *init_mdebin(ener_file_t fp_ene,
     md->dhc=NULL;
     if (ir->fepvals->separate_dhdl_file == esepdhdlfileNO )
     {
-        snew(md->dhc, 1);
+        /* Currently dh histograms are only written with dynamics */
+        if (EI_DYNAMICS(ir->eI))
+        {
+            snew(md->dhc, 1);
 
-        mde_delta_h_coll_init(md->dhc, ir);
+            mde_delta_h_coll_init(md->dhc, ir);
+        }
         md->fp_dhdl = NULL;
     }
     else
index 927141031215b8370a8980483c8b70d0e0fffc0a..145e7bbd5bc2f16f32f5c086beb0a35a581624ba 100644 (file)
@@ -1384,6 +1384,7 @@ double do_lbfgs(FILE *fplog,t_commrec *cr,
   int    start,end,number_steps;
   gmx_mdoutf_t *outf;
   int    i,k,m,n,nfmax,gf,step;
+  int    mdof_flags;
   /* not used */
   real   terminate;
 
@@ -1543,7 +1544,18 @@ double do_lbfgs(FILE *fplog,t_commrec *cr,
     do_x = do_per_step(step,inputrec->nstxout);
     do_f = do_per_step(step,inputrec->nstfout);
 
-    write_traj(fplog,cr,outf,MDOF_X | MDOF_F,
+    mdof_flags = 0;
+    if (do_x)
+    {
+        mdof_flags |= MDOF_X;
+    }
+
+    if (do_f)
+    {
+        mdof_flags |= MDOF_F;
+    }
+
+    write_traj(fplog,cr,outf,mdof_flags,
                top_global,step,(real)step,state,state,f,f,NULL,NULL);
 
     /* Do the linesearching in the direction dx[point][0..(n-1)] */
index f6fd555c4ead46f2c4d9b0665462c46f67bfa916..7f003fe670973bc10d0704008fe898334425aa1a 100644 (file)
@@ -150,7 +150,7 @@ void cshake(atom_id iatom[],int ncon,int *nnit,int maxnit,
           rrpr    = rijx*tx+rijy*ty+rijz*tz;
        
           if (rrpr < toler*mytol) 
-              error=ll;
+              error=ll+1;
           else {
               acor      = omega*diff*m2[ll]/rrpr;
               lagr[ll] += acor;
index 32638c62439820517aab7219cc51736debfb2f7a..8833688a6279746412f8ab11548c236009e8128d 100644 (file)
@@ -65,7 +65,9 @@ set(GMX_TOOLS_PROGRAMS_NOT_FOR_INSTALLATION
 
 foreach(TOOL ${GMX_TOOLS_PROGRAMS} ${GMX_TOOLS_PROGRAMS_NOT_FOR_INSTALLATION})
     add_executable(${TOOL} ${TOOL}.c)
-    gmx_add_man_page(${TOOL})
+    if (NOT ${TOOL} STREQUAL "g_options")
+        gmx_add_man_page(${TOOL})
+    endif()
     target_link_libraries(${TOOL} gmxana)
     set_target_properties(${TOOL} PROPERTIES OUTPUT_NAME "${TOOL}${GMX_BINARY_SUFFIX}")
 endforeach(TOOL ${GMX_TOOLS_PROGRAMS}) 
index e7e31384f5798f484ed0ea94a15d32aaf069ef6d..375f6df2df610003d398e0c4cc818cbb01da364c 100644 (file)
@@ -796,12 +796,15 @@ static void add_hbond(t_hbdata *hb,int d,int a,int h,int grpd,int grpa,
                   grpa,hb->a.grp[ia],a+1);
 
     if (bMerge)
-        if ((daSwap = isInterchangable(hb, d, a, grpd, grpa) || bContact) && d>a)
+    {
+        
+        if (isInterchangable(hb, d, a, grpd, grpa) && d>a)
             /* Then swap identity so that the id of d is lower then that of a.
              *
              * This should really be redundant by now, as is_hbond() now ought to return
              * hbNo in the cases where this conditional is TRUE. */
         {
+            daSwap = TRUE;
             k = d;
             d = a;
             a = k;
@@ -818,6 +821,7 @@ static void add_hbond(t_hbdata *hb,int d,int a,int h,int grpd,int grpa,
                 gmx_fatal(FARGS,"Inconsistent acceptor groups, %d iso %d, atom %d",
                           grpa,hb->a.grp[ia],a+1);
         }
+    }
 
     if (hb->hbmap) {
         /* Loop over hydrogens to find which hydrogen is in this particular HB */
@@ -1437,12 +1441,13 @@ static int is_hbond(t_hbdata *hb,int grpd,int grpa,int d,int a,
     rvec_sub(x[d],x[a],r_da);
     /* Insert projection code here */
 
-    /* if (d>a && ((isInterchangable(hb, d, a, grpd, grpa) && bMerge) || bContact)) */
-/*         /\* Then this hbond will be found again, or it has already been found. *\/ */
-/*         return hbNo; */
-
+    if (bMerge && d>a && isInterchangable(hb, d, a, grpd, grpa))
+    {
+        /* Then this hbond/contact will be found again, or it has already been found. */
+        /*return hbNo;*/
+    }
     if (bBox){
-        if (d>a && bMerge && (bContact || isInterchangable(hb, d, a, grpd, grpa))) { /* acceptor is also a donor and vice versa? */
+        if (d>a && bMerge && isInterchangable(hb, d, a, grpd, grpa)) { /* acceptor is also a donor and vice versa? */
             /* return hbNo; */
             daSwap = TRUE; /* If so, then their history should be filed with donor and acceptor swapped. */
         }
@@ -1456,7 +1461,7 @@ static int is_hbond(t_hbdata *hb,int grpd,int grpa,int d,int a,
     rda2 = iprod(r_da,r_da);
   
     if (bContact) {
-        if (daSwap)
+        if (daSwap && grpa == grpd)
             return hbNo;
         if (rda2 <= rc2){
             if (hb->bGem){
@@ -2182,7 +2187,7 @@ static void parallel_print(int *data, int nThreads)
         fprintf(stderr, "%-7i",data[i]);
 }
 
-static void normalizeACF(real *ct, real *gt, int len)
+static void normalizeACF(real *ct, real *gt, int nhb, int len)
 {
     real ct_fac, gt_fac;
     int i;
@@ -2190,7 +2195,8 @@ static void normalizeACF(real *ct, real *gt, int len)
     /* Xu and Berne use the same normalization constant */
 
     ct_fac = 1.0/ct[0];
-    gt_fac = (gt!=NULL && gt[0]!=0) ? 1.0/gt[0] : 0;
+    gt_fac = (nhb == 0) ? 0 : 1.0/(real)nhb;
+    
     printf("Normalization for c(t) = %g for gh(t) = %g\n",ct_fac,gt_fac);
     for (i=0; i<len; i++)
     {
@@ -2397,8 +2403,7 @@ static void do_hbac(const char *fn,t_hbdata *hb,
         {
             sfree(dondata);
         }
-
-        normalizeACF(ct, NULL, nn);
+        normalizeACF(ct, NULL, 0, nn);
         snew(ctdouble, nn);
         snew(timedouble, nn);
         for (j=0; j<nn; j++)
@@ -2618,7 +2623,7 @@ static void do_hbac(const char *fn,t_hbdata *hb,
             sfree(dondata);
         }
 
-        normalizeACF(ct, NULL, nn);
+        normalizeACF(ct, NULL, 0, nn);
 
         fprintf(stderr, "\n\nACF successfully calculated.\n");
 
@@ -2764,7 +2769,7 @@ static void do_hbac(const char *fn,t_hbdata *hb,
         fprintf(stderr,"\n");
         sfree(h);
         sfree(g);
-        normalizeACF(ct, gt, nn);
+        normalizeACF(ct, ght, nhb, nn);
 
         /* Determine tail value for statistics */
         tail  = 0;
@@ -3954,7 +3959,7 @@ int gmx_hbond(int argc,char *argv[])
             int id,ia,hh,x,y;
       
             mat.nx=nframes;
-            mat.ny=(bContact ? hb->nrdist : hb->nrhb);
+            mat.ny=hb->nrhb;
 
             snew(mat.matrix,mat.nx);
             for(x=0; (x<mat.nx); x++) 
index 8c33e0008a8b9a78ee4cde445a41e72922706996..2eff860505275b9ee6ac99bbe12f05c431cbf5df 100644 (file)
@@ -173,9 +173,9 @@ int gmx_lie(int argc,char *argv[])
   snew(fr,1);
   out = xvgropen(ftp2fn(efXVG,NFILE,fnm),"LIE free energy estimate",
                 "Time (ps)","DGbind (kJ/mol)",oenv);
-  do {
-    bCont = do_enx(fp,fr);
-    ct    = check_times(fr->t);
+  while(do_enx(fp,fr))
+  {
+    ct = check_times(fr->t);
     if (ct == 0) {
       lie = calc_lie(ld,fr->ener,lie_lj,lie_qq,fac_lj,fac_qq);
       lieaver += lie;
@@ -183,7 +183,7 @@ int gmx_lie(int argc,char *argv[])
       nframes ++;
       fprintf(out,"%10g  %10g\n",fr->t,lie);
     }
-  } while (bCont);
+  }
   close_enx(fp);
   ffclose(out);
   fprintf(stderr,"\n");
index cbac2309df0abb0534b328f1c72d5e0f1403b5ac..46c5576a7210c24089fb67e1ccb81733349b0a5c 100644 (file)
@@ -684,7 +684,7 @@ int gmx_trjcat(int argc, char *argv[])
                 {
                     searchtime = last_frame_time;
                 }
-                if (xtc_seek_time(stfio,searchtime,fr.natoms))
+                if (xtc_seek_time(stfio,searchtime,fr.natoms,TRUE))
                 {
                     gmx_fatal(FARGS,"Error seeking to append position.");
                 }