Merge release-4-5-patches into release-4-6
authorRoland Schulz <roland@utk.edu>
Tue, 20 Dec 2011 12:28:48 +0000 (07:28 -0500)
committerRoland Schulz <roland@utk.edu>
Tue, 20 Dec 2011 12:28:48 +0000 (07:28 -0500)
Conflicts:
admin/GerritBuild.bat
include/gstat.h
src/tools/anadih.c
src/tools/gmx_chi.c

Change-Id: If70475e8f38978aeb52652afce2ca2a62d355987

1  2 
CMakeLists.txt
admin/GerritBuild.bat
include/gstat.h
src/tools/anadih.c
src/tools/gmx_chi.c

diff --combined CMakeLists.txt
index b3f02403aff1fced8d0d107f99c8ee7bda2295d2,b56aad1bb2e38a2a20dbb71aa3c479328da4b58d..7ce8069f791046ef0e482948c0446d3fb7468580
@@@ -1,4 -1,4 +1,4 @@@
 -cmake_minimum_required(VERSION 2.6)
 +cmake_minimum_required(VERSION 2.8)
  
  project(Gromacs)
  include(Dart)
@@@ -12,7 -12,7 +12,7 @@@ mark_as_advanced(DART_ROOT
  # machine with no git. 
  #
  # NOTE: when releasing the "-dev" suffix needs to be stripped off!
 -set(PROJECT_VERSION "4.5.5-dev")
 +set(PROJECT_VERSION "4.6-dev")
  set(CUSTOM_VERSION_STRING ""
      CACHE STRING "Custom version string (if empty, use hard-coded default)")
  mark_as_advanced(CUSTOM_VERSION_STRING)
@@@ -22,8 -22,8 +22,8 @@@ endif (CUSTOM_VERSION_STRING
  set(SOVERSION 6)
  # It is a bit irritating, but this has to be set separately for now!
  SET(CPACK_PACKAGE_VERSION_MAJOR "4")
 -SET(CPACK_PACKAGE_VERSION_MINOR "5")
 -SET(CPACK_PACKAGE_VERSION_PATCH "5")
 +SET(CPACK_PACKAGE_VERSION_MINOR "6")
 +#SET(CPACK_PACKAGE_VERSION_PATCH "0")
  
  
  # Cmake modules/macros are in a subdirectory to keep this file cleaner
@@@ -194,16 -194,7 +194,16 @@@ if(GMX_MPI
          set(GMX_THREADS OFF CACHE BOOL 
              "Thread-based parallelization conflicts with MPI." FORCE)
      endif(GMX_THREADS)
 -    find_package(MPI)
 +
 +    # Work-around for Cray MPI
 +    TRY_COMPILE(MPI_FOUND ${CMAKE_BINARY_DIR}
 +      "${CMAKE_SOURCE_DIR}/cmake/TestMPI.c"
 +      COMPILE_DEFINITIONS )
 +    if(NOT MPI_FOUND)
 +      # search for normal MPI installations
 +      find_package(MPI)
 +    endif(NOT MPI_FOUND)
 +
      if(MPI_FOUND)
          set(GROMACS_C_FLAGS ${GROMACS_FLAGS} ${MPI_COMPILE_FLAGS})
        set(GROMACS_LINKER_FLAGS ${GROMACS_LINKER_FLAGS} ${MPI_LINK_FLAGS})
@@@ -483,22 -474,12 +483,22 @@@ endif(CYGWIN
  if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
      if(USE_VERSION_H)
          # We need at least git v1.5.1 be able to parse git's date output. If not 
 -        # fund or the version is too small, we can't generate version information.
 -        find_package(Git 1.5.1)
 -        # this should at some point become VERSION_LESS
 -        if(NOT Git_FOUND OR Git_VERSION STRLESS "1.5.1")
 -            message("No compatible git version found, won't be able to generate proper development version information.")
 -            set(USE_VERSION_H OFF)
 +        # found or the version is too small, we can't generate version information.
 +        find_package(Git)
 +
 +      # Find out the git version
 +      if(GIT_FOUND AND NOT GIT_VERSION)
 +        execute_process(COMMAND ${GIT_EXECUTABLE} "--version"
 +            OUTPUT_VARIABLE _exec_out
 +            OUTPUT_STRIP_TRAILING_WHITESPACE)
 +        string(REGEX REPLACE "git version (.*)" "\\1" GIT_VERSION ${_exec_out})
 +        set(GIT_VERSION ${GIT_VERSION} CACHE STRING "Git version")
 +        mark_as_advanced(GIT_VERSION)
 +      endif()
 +
 +        if(NOT GIT_FOUND OR GIT_VERSION VERSION_LESS "1.5.1")
 +          message("No compatible git version found, won't be able to generate proper development version information.")
 +          set(USE_VERSION_H OFF)
          endif()
      endif()
  else()
@@@ -539,6 -520,7 +539,6 @@@ gmx_test_large_files(GMX_LARGEFILES
  check_function_exists(fseeko     HAVE_FSEEKO)
  
  include(gmxTestSignal)
 -gmx_test_retsigtype(RETSIGTYPE)
  gmx_test_sigusr1(HAVE_SIGUSR1)
  
  include(gmxTestInline)
@@@ -560,12 -542,6 +560,6 @@@ if (${GMX_ACCELERATION} STREQUAL "auto
  
      set(GMX_ACCELERATION "SSE" CACHE STRING "Accelerated kernels. Pick one of: auto, none, SSE, BlueGene, Power6, ia64, altivec, fortran" FORCE)
      
-     if (GMX_64_BIT)
-       set(GMX_X86_64_ASM ON CACHE BOOL "Add SSE assembly files for x86_64" FORCE)
-     else (GMX_64_BIT)
-       set(GMX_IA32_ASM ON CACHE BOOL "Add SSE assembly files for i386" FORCE)
-     endif (GMX_64_BIT)
      # Determine the assembler/compiler to use
    else()
      set(GMX_ACCELERATION "none" CACHE STRING "Accelerated kernels. Pick one of: auto, none, SSE, BlueGene, Power6, ia64, altivec, fortran" FORCE)
@@@ -584,6 -560,12 +578,12 @@@ string(TOUPPER ${GMX_ACCELERATION} ${GM
  if(${GMX_ACCELERATION} STREQUAL "NONE")
    # nothing to do
  elseif(${GMX_ACCELERATION} STREQUAL "SSE")
+     
+     if (GMX_64_BIT)
+       set(GMX_X86_64_ASM ON CACHE BOOL "Add SSE assembly files for x86_64" FORCE)
+     else (GMX_64_BIT)
+       set(GMX_IA32_ASM ON CACHE BOOL "Add SSE assembly files for i386" FORCE)
+     endif (GMX_64_BIT)
  
      if(CMAKE_GENERATOR MATCHES "Visual Studio")
        option(GMX_ASM_USEASM-NASM "Use Nasm for assembly instead of compiler (necessary on windows)" ON)
diff --combined admin/GerritBuild.bat
index f603724726900c7a756afc12a570bec5c1791ded,a373642e8912ce77069d468a197f88f6fb4f9c43..a3432031173ebd10377c37afd871db628a786c5d
@@@ -1,6 -1,7 +1,6 @@@
  REM Requires Windows SDK and CMake to be in the path
  REM Run Windows SDK SetEnv script
- SetEnv && ^
- cmake -G "Visual Studio 10 Win64" -D GMX_DOUBLE=%GMX_DOUBLE% -D GMX_MPI=%GMX_MPI% -D GMX_OPENMP=%GMX_OPENMP% -DGMX_DEFAULT_SUFFIX=off -DCMAKE_BUILD_TYPE=Debug . && ^
- msbuild All_Build.vcxproj && ^
- ctest -D ExperimentalTest -C Debug -V
+ SetEnv /Release && ^
+ cmake -G "Visual Studio 10 Win64" -D GMX_DOUBLE=%GMX_DOUBLE% -D GMX_MPI=%GMX_MPI% -D GMX_OPENMP=%GMX_OPENMP% -DGMX_DEFAULT_SUFFIX=off . && ^
+ msbuild /m:2 /p:Configuration=MinSizeRel All_Build.vcxproj && ^
+ ctest -D ExperimentalTest -C MinSizeRel -V
 -
diff --combined include/gstat.h
index 719fe625125e43794b70da7347e3013086b7c9f0,147e2ae9ecb609d05c0eaff9366495a99d52b80b..7eb47ecfd45f1cf3ffd9dbb4f721eebb4b06ba9a
@@@ -240,7 -240,7 +240,7 @@@ void expfit(int n, real x[], real y[], 
  
  void ana_dih_trans(const char *fn_trans,const char *fn_histo,
                          real **dih,int nframes,int nangles,
-                         const char *grpname,real t0,real dt,gmx_bool bRb,
+                         const char *grpname,real *time,gmx_bool bRb,
                            const output_env_t oenv);
  /*
   * Analyse dihedral transitions, by counting transitions per dihedral
   * nframes   number of times frames
   * nangles   number of angles
   * grpname   a string for the header of plots
-  * t0,dt     starting time resp. time between time frames
+  * time      array (size nframes) of times of trajectory frames
   * bRb       determines whether the polymer convention is used
   *           (trans = 0)
   */
@@@ -269,9 -269,9 +269,9 @@@ void low_ana_dih_trans(gmx_bool bTrans
                              gmx_bool bHisto, const char *fn_histo, int maxchi, 
                              real **dih, int nlist, t_dlist dlist[], 
                                int nframes, int nangles, const char *grpname, 
-                              int multiplicity[], real t0, real dt, gmx_bool bRb, 
 -                              int xity[], real *time, gmx_bool bRb,
++                              int multiplicity[], real *time, gmx_bool bRb,
                                real core_frac, const output_env_t oenv); 
 -  /* as above but passes dlist so can copy occupancies into it, and xity[] 
 +  /* as above but passes dlist so can copy occupancies into it, and multiplicity[] 
     *  (1..nangles, corresp to dih[this][], so can have non-3 multiplicity of
     * rotamers. Also production of xvg output files is conditional 
     * and the fractional width of each rotamer can be set ie for a 3 fold 
@@@ -402,12 -402,12 +402,12 @@@ int pr_trans(FILE *fp,int nl,t_dlist dl
  void mk_chi_lookup (int **lookup, int maxchi, real **dih, 
                           int nlist, t_dlist dlist[]) ; 
  
 -void mk_multiplicity_lookup (int *xity, int maxchi, real **dih, 
 +void mk_multiplicity_lookup (int *multiplicity, int maxchi, real **dih, 
                                    int nlist, t_dlist dlist[],int nangle) ; 
  
  void get_chi_product_traj (real **dih,int nframes,int nangles, 
                                  int nlist,int maxchi, t_dlist dlist[], 
 -                                  real time[], int **lookup,int *xity,
 +                                  real time[], int **lookup,int *multiplicity,
                                    gmx_bool bRb,gmx_bool bNormalize,
                                  real core_frac,gmx_bool bAll,const char *fnall,
                                    const output_env_t oenv); 
diff --combined src/tools/anadih.c
index c3c32dbaff19ae14d63ec0afab02f1a0563e1cdd,59a6e8dd0d7a11ea4ef7cddc54a1f443842d15a5..0a9f5a652e1f2bef311e21ec3d3292c2ce1f4dfc
@@@ -113,35 -113,35 +113,35 @@@ static int calc_Nbin(real phi, int mult
  
  void ana_dih_trans(const char *fn_trans,const char *fn_histo,
                   real **dih,int nframes,int nangles,
-                  const char *grpname,real t0,real dt,gmx_bool bRb,
+                  const char *grpname,real *time,gmx_bool bRb,
                     const output_env_t oenv)
  {
    /* just a wrapper; declare extra args, then chuck away at end. */ 
    int maxchi = 0 ; 
    t_dlist *dlist ; 
 -  int *xity; 
 +  int *multiplicity; 
    int nlist = nangles ; 
    int k ; 
  
    snew(dlist,nlist);  
 -  snew(xity,nangles); 
 +  snew(multiplicity,nangles); 
    for(k=0; (k<nangles); k++) {
 -    xity[k]=3 ; 
 +    multiplicity[k]=3 ; 
    }
  
    low_ana_dih_trans(TRUE, fn_trans,TRUE, fn_histo, maxchi, 
                      dih, nlist, dlist, nframes,
-                   nangles, grpname, multiplicity, t0, dt, bRb, 0.5,oenv); 
 -                  nangles, grpname, xity, time, bRb, 0.5,oenv);
++                  nangles, grpname, multiplicity, time, bRb, 0.5,oenv);
    sfree(dlist); 
 -  sfree(xity); 
 +  sfree(multiplicity); 
    
  }
  
  void low_ana_dih_trans(gmx_bool bTrans, const char *fn_trans,
                       gmx_bool bHisto, const char *fn_histo, int maxchi, 
                       real **dih, int nlist, t_dlist dlist[], int nframes,
-                      int nangles, const char *grpname, int multiplicity[], 
-                      real t0, real dt, gmx_bool bRb, real core_frac,
 -                     int nangles, const char *grpname, int xity[],
++                     int nangles, const char *grpname, int multiplicity[],
+                      real *time, gmx_bool bRb, real core_frac,
                         const output_env_t oenv)
  {
    FILE *fp;
    real ttime,tt;
    real *rot_occ[NROT] ; 
    int  (*calc_bin)(real,int,real);  
+   real dt;
+   if (1 <= nframes) {
+     return;
+   }
+   /* Assumes the frames are equally spaced in time */
+   dt=(time[nframes-1]-time[0])/(nframes-1);
    
    /* Analysis of dihedral transitions */
    fprintf(stderr,"Now calculating transitions...\n");
  #ifdef OLDIE
      mind = maxd = prev = dih[i][0]; 
  #else
 -    cur_bin = calc_bin(dih[i][0],xity[i],core_frac);
 +    cur_bin = calc_bin(dih[i][0],multiplicity[i],core_frac);
      rot_occ[cur_bin][i]++ ; 
  #endif    
      for (j=1; (j<nframes); j++)
      {
 -      new_bin = calc_bin(dih[i][j],xity[i],core_frac);
 +      new_bin = calc_bin(dih[i][j],multiplicity[i],core_frac);
        rot_occ[new_bin][i]++ ; 
  #ifndef OLDIE
        if (cur_bin == 0)
      sprintf(title,"Number of transitions: %s",grpname);
      fp=xvgropen(fn_trans,title,"Time (ps)","# transitions/timeframe",oenv);
      for(j=0; (j<nframes); j++) {
-       tt = t0+j*dt;
-       fprintf(fp,"%10.3f  %10d\n",tt,tr_f[j]);
+       fprintf(fp,"%10.3f  %10d\n",time[j],tr_f[j]);
      }
      ffclose(fp);
    }
  
  }
  
 -void mk_multiplicity_lookup (int *xity, int maxchi, real **dih, 
 +void mk_multiplicity_lookup (int *multiplicity, int maxchi, real **dih, 
                             int nlist, t_dlist dlist[],int nangles) 
  {
    /* new by grs - for dihedral j (as in dih[j]) get multiplicity from dlist
 -   * and store in xity[j] 
 +   * and store in multiplicity[j] 
     */ 
  
    int j, Dih, i ; 
          ((Dih == edOmega) && (has_dihedral(edOmega,&(dlist[i])))) ||
          ((Dih  > edOmega) && (dlist[i].atm.Cn[Dih-NONCHI+3] != -1))) {
        /* default - we will correct the rest below */ 
 -      xity[j] = 3 ; 
 +      multiplicity[j] = 3 ; 
  
        /* make omegas 2fold, though doesn't make much more sense than 3 */ 
        if (Dih == edOmega && (has_dihedral(edOmega,&(dlist[i])))) {
 -        xity[j] = 2 ; 
 +        multiplicity[j] = 2 ; 
        } 
  
        /* dihedrals to aromatic rings, COO, CONH2 or guanidinium are 2fold*/
               ((strstr(name,"GLN") != NULL) && (Dih == edChi3))  ||   
               ((strstr(name,"ASN") != NULL) && (Dih == edChi2))  ||   
               ((strstr(name,"ARG") != NULL) && (Dih == edChi4))  ) {
 -          xity[j] = 2; 
 +          multiplicity[j] = 2; 
          }
        }
        j++ ; 
            j,nangles);
    /* Check for remaining dihedrals */
    for(;(j < nangles); j++)
 -    xity[j] = 3;
 +    multiplicity[j] = 3;
  
  }
  
@@@ -369,7 -375,7 +375,7 @@@ void mk_chi_lookup (int **lookup, int m
  
  void get_chi_product_traj (real **dih,int nframes,int nangles, int nlist,
                           int maxchi, t_dlist dlist[], real time[], 
 -                         int **lookup, int *xity,gmx_bool bRb, gmx_bool bNormalize,
 +                         int **lookup, int *multiplicity,gmx_bool bRb, gmx_bool bNormalize,
                           real core_frac, gmx_bool bAll, const char *fnall,
                             const output_env_t oenv) 
  {
      for (Xi = 0 ; Xi < maxchi ; Xi ++ ) {
        index = lookup[i][Xi] ; /* chi_(Xi+1) of res i (-1 if off end) */ 
        if ( index >= 0 ) {
 -      n = xity[index]; 
 +      n = multiplicity[index]; 
        nbin = n*nbin ; 
        }
      }
        bRotZero = TRUE ; 
        bHaveChi = FALSE ; 
        } else {
 -      b = calc_bin(dih[index][j],xity[index],core_frac) ; 
 +      b = calc_bin(dih[index][j],multiplicity[index],core_frac) ; 
        accum = b - 1 ; 
        if (b == 0 ) 
          bRotZero = TRUE ; 
        for (Xi = 1 ; Xi < maxchi ; Xi ++ ) {
          index = lookup[i][Xi] ; /* chi_(Xi+1) of res i (-1 if off end) */ 
          if ( index >= 0 ) {
 -          n = xity[index]; 
 +          n = multiplicity[index]; 
            b = calc_bin(dih[index][j],n,core_frac); 
            accum = n * accum + b - 1 ; 
            if (b == 0 ) 
diff --combined src/tools/gmx_chi.c
index 94db178b6b71ba096df2def57e8b4baedccd8b13,06ccfed618f37b554d52486a63747ca4aa4dd3f7..60ebc2901306767e5796a384bb400adc9ea791a2
@@@ -1040,7 -1040,9 +1040,9 @@@ int gmx_chi(int argc,char *argv[]
      "The total number of rotamer transitions per timestep", 
      "(argument [TT]-ot[tt]), the number of transitions per rotamer", 
      "(argument [TT]-rt[tt]), and the ^3J couplings (argument [TT]-jc[tt]), ", 
-     "can also be written to [TT].xvg[tt] files.[PAR]", 
+     "can also be written to [TT].xvg[tt] files. Note that the analysis",
+     "of rotamer transitions assumes that the supplied trajectory frames",
+     "are equally spaced in time.[PAR]",
  
      "If [TT]-chi_prod[tt] is set (and [TT]-maxchi[tt] > 0), cumulative rotamers, e.g.", 
      "1+9([GRK]chi[grk]1-1)+3([GRK]chi[grk]2-1)+([GRK]chi[grk]3-1) (if the residue has three 3-fold ", 
    atom_id    isize,*index;
    int        ndih,nactdih,nf;
    real       **dih,*trans_frac,*aver_angle,*time;
 -  int        i,j,**chi_lookup,*xity; 
 +  int        i,j,**chi_lookup,*multiplicity; 
    
    t_filenm  fnm[] = {
      { efSTX, "-s",  NULL,     ffREAD  },
     *
     * added multiplicity */ 
  
 -  snew(xity,ndih) ;
 -  mk_multiplicity_lookup(xity, maxchi, dih, nlist, dlist,ndih); 
 +  snew(multiplicity,ndih) ;
 +  mk_multiplicity_lookup(multiplicity, maxchi, dih, nlist, dlist,ndih); 
   
    strcpy(grpname, "All residues, "); 
    if(bPhi) 
  
    low_ana_dih_trans(bDo_ot, opt2fn("-ot",NFILE,fnm),
                    bDo_oh, opt2fn("-oh",NFILE,fnm),maxchi, 
 -                  dih, nlist, dlist, nf, nactdih, grpname, xity, 
 +                  dih, nlist, dlist, nf, nactdih, grpname, multiplicity, 
-                   *time,  dt, FALSE, core_frac,oenv) ; 
+                   time, FALSE, core_frac,oenv);
  
    /* Order parameters */  
    order_params(log,opt2fn("-o",NFILE,fnm),maxchi,nlist,dlist,
      mk_chi_lookup(chi_lookup, maxchi, dih, nlist, dlist); 
      
      get_chi_product_traj(dih,nf,nactdih,nlist,
 -                       maxchi,dlist,time,chi_lookup,xity,
 +                       maxchi,dlist,time,chi_lookup,multiplicity,
                         FALSE,bNormHisto, core_frac,bAll,
                         opt2fn("-cp",NFILE,fnm),oenv);