Merge release-5-0 into master
authorTeemu Murtola <teemu.murtola@gmail.com>
Mon, 30 Jun 2014 14:10:49 +0000 (17:10 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Mon, 30 Jun 2014 14:14:50 +0000 (17:14 +0300)
Conflicts:
CMakeLists.txt (version only)
src/gromacs/fileio/tngio.h (includes only)
src/gromacs/fileio/tngio_for_tools.h (includes only)
src/gromacs/gmxlib/gmx_thread_affinity.c
            (took variable rename from 5.0, other changes from master
             kept)
src/gromacs/gmxpreprocess/hackblock.c (includes only)
src/gromacs/gmxpreprocess/pdb2top.cpp
            (took 5.0 removal of unused parameter)
src/gromacs/mdlib/constr.c (includes only)
src/gromacs/utility/fatalerror.cpp
            (applied similar error message change to basenetwork.cpp)

Change-Id: I7137225e37828a19c4b92aa2ec055e7177aa5676

74 files changed:
1  2 
CMakeLists.txt
src/external/tng_io/src/lib/md5.c
src/gromacs/CMakeLists.txt
src/gromacs/essentialdynamics/edsam.c
src/gromacs/fft/fft5d.cpp
src/gromacs/fileio/CMakeLists.txt
src/gromacs/fileio/gmxfio.c
src/gromacs/fileio/md5.c
src/gromacs/fileio/tngio.cpp
src/gromacs/fileio/tngio.h
src/gromacs/fileio/tngio_for_tools.cpp
src/gromacs/fileio/tngio_for_tools.h
src/gromacs/fileio/tpxio.c
src/gromacs/gmxana/gmx_current.c
src/gromacs/gmxana/gmx_hbond.c
src/gromacs/gmxana/gmx_make_edi.c
src/gromacs/gmxana/gmx_pme_error.cpp
src/gromacs/gmxana/gmx_tune_pme.c
src/gromacs/gmxlib/bondfree.c
src/gromacs/gmxlib/checkpoint.cpp
src/gromacs/gmxlib/copyrite.cpp
src/gromacs/gmxlib/ewald_util.c
src/gromacs/gmxlib/gmx_detect_hardware.cpp
src/gromacs/gmxlib/gmx_omp_nthreads.c
src/gromacs/gmxlib/gmx_thread_affinity.c
src/gromacs/gmxlib/main.cpp
src/gromacs/gmxlib/mvdata.c
src/gromacs/gmxlib/network.c
src/gromacs/gmxlib/nonbonded/nb_free_energy.c
src/gromacs/gmxlib/nrnb.c
src/gromacs/gmxlib/orires.c
src/gromacs/gmxlib/txtdump.c
src/gromacs/gmxpreprocess/gen_ad.c
src/gromacs/gmxpreprocess/hackblock.c
src/gromacs/gmxpreprocess/hackblock.h
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/pgutil.c
src/gromacs/gmxpreprocess/readir.c
src/gromacs/legacyheaders/constr.h
src/gromacs/legacyheaders/network.h
src/gromacs/legacyheaders/types/inputrec.h
src/gromacs/mdlib/constr.c
src/gromacs/mdlib/domdec.c
src/gromacs/mdlib/domdec_con.c
src/gromacs/mdlib/domdec_setup.c
src/gromacs/mdlib/force.c
src/gromacs/mdlib/forcerec.c
src/gromacs/mdlib/mdebin.c
src/gromacs/mdlib/mdebin_bar.c
src/gromacs/mdlib/minimize.c
src/gromacs/mdlib/nbnxn_atomdata.c
src/gromacs/mdlib/nbnxn_search.c
src/gromacs/mdlib/pme.c
src/gromacs/mdlib/pme_pp.c
src/gromacs/mdlib/qmmm.c
src/gromacs/mdlib/shellfc.c
src/gromacs/mdlib/sim_util.c
src/gromacs/mdlib/tables.c
src/gromacs/mdlib/update.c
src/gromacs/selection/evaluate.cpp
src/gromacs/selection/params.cpp
src/gromacs/selection/parsetree.cpp
src/gromacs/selection/parsetree.h
src/gromacs/selection/selectioncollection.cpp
src/gromacs/selection/selelem.h
src/gromacs/selection/tests/selectioncollection.cpp
src/gromacs/swap/swapcoords.c
src/gromacs/timing/wallcycle.c
src/gromacs/tools/compare.c
src/gromacs/utility/basenetwork.cpp
src/programs/mdrun/mdrun.cpp
src/programs/mdrun/pme_loadbal.c
src/programs/mdrun/runner.cpp
tests/CppCheck.cmake

diff --cc CMakeLists.txt
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 375cd6c7c8eeb1a0baadad41c801d6072aed3040,1f439c537aba1467d33471c63d22032fd114265f..578b8f57edb3bd1c328cade6a75dac4e403987c4
  #ifndef GMX_FILEIO_TNGIO_H
  #define GMX_FILEIO_TNGIO_H
  
- #include "external/tng_io/include/tng_io_fwd.h"
 -#include "gromacs/legacyheaders/typedefs.h"
+ #include "tng/tng_io_fwd.h"
  
 +#include "gromacs/legacyheaders/types/inputrec.h"
 +#include "gromacs/math/vectypes.h"
 +#include "gromacs/utility/real.h"
 +
  #ifdef __cplusplus
  extern "C" {
  #endif
index 93a3b130a9dd959457480ef7d42a14b921c7f293,1c579a6f81744798b72b727f3771e90fc305a132..f540cbdec1d0c25d5d5614c88ef58b2ab2f2380d
  #include "trx.h"
  
  #ifdef GMX_USE_TNG
- #include "../../external/tng_io/include/tng_io.h"
+ #include "tng/tng_io.h"
  #endif
  
 -#include "gromacs/legacyheaders/types/atoms.h"
 -#include "gromacs/legacyheaders/physics.h"
 -#include "gromacs/legacyheaders/gmx_fatal.h"
 -
 +#include "gromacs/math/units.h"
  #include "gromacs/utility/common.h"
 +#include "gromacs/utility/fatalerror.h"
  #include "gromacs/utility/smalloc.h"
  
  void gmx_prepare_tng_writing(const char              *filename,
index 6dbfee17080b28fa1de5f743b32f74aac8d3a64c,f0a31eb250354fce3f5faf692e88e1cdb598760f..c4993a272597c699af2e7447b9246e6040b04d1d
  #ifndef GMX_FILEIO_TNGIO_FOR_TOOLS_H
  #define GMX_FILEIO_TNGIO_FOR_TOOLS_H
  
 -#include "gromacs/legacyheaders/typedefs.h"
 +#include <stdio.h>
 +
- #include "external/tng_io/include/tng_io_fwd.h"
+ #include "tng/tng_io_fwd.h"
  
 +#include "gromacs/legacyheaders/types/simple.h"
 +#include "gromacs/utility/basedefinitions.h"
 +#include "gromacs/utility/real.h"
 +
  #ifdef __cplusplus
  extern "C" {
  #endif
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 8814ec410f72b9c3bb89b871ba7bb76d995063a5,90970b6bd29aeb590e2d3bd0686aeb16ba2b11d1..319249506bb52fde70a220f2373667fd154f8275
@@@ -372,11 -369,11 +372,11 @@@ gmx_set_thread_affinity(FIL
   * Note that this will only work on Linux as we use a GNU feature.
   */
  void
 -gmx_check_thread_affinity_set(FILE            gmx_unused *fplog,
 -                              const t_commrec gmx_unused *cr,
 -                              gmx_hw_opt_t    gmx_unused *hw_opt,
 -                              int             gmx_unused  nthreads_hw_avail,
 -                              gmx_bool        gmx_unused  bAfterOpenmpInit)
 +gmx_check_thread_affinity_set(FILE            *fplog,
 +                              const t_commrec *cr,
 +                              gmx_hw_opt_t    *hw_opt,
-                               int  gmx_unused  ncpus,
++                              int  gmx_unused  nthreads_hw_avail,
 +                              gmx_bool         bAfterOpenmpInit)
  {
  #ifdef HAVE_SCHED_GETAFFINITY
      cpu_set_t mask_current;
Simple merge
Simple merge
Simple merge
index bba7805fb74a88edb74174ec5c280092130a7797,2bf8f90e3f8bd8bc60baf5462c60e5cf98e73781..30698281a799775b4de918e0507b0545f41fc972
@@@ -175,8 -177,13 +177,12 @@@ gmx_nb_free_energy_kernel(const t_nblis
      bDoPotential        = kernel_data->flags & GMX_NONBONDED_DO_POTENTIAL;
  
      rcoulomb            = fr->rcoulomb;
 -    sh_ewald            = fr->ic->sh_ewald;
      rvdw                = fr->rvdw;
      sh_invrc6           = fr->ic->sh_invrc6;
+     sh_lj_ewald         = fr->ic->sh_lj_ewald;
+     ewclj               = fr->ewaldcoeff_lj;
+     ewclj2              = ewclj*ewclj;
+     ewclj6              = ewclj2*ewclj2*ewclj2;
  
      if (fr->coulomb_modifier == eintmodPOTSWITCH)
      {
Simple merge
Simple merge
Simple merge
Simple merge
index c7919872c1786e63e063223499e88cc63bc7b08f,0e4e1c1cfa988a8723208fb7e5620eda7d03d1f0..0da489f4a2c03b340025e8630579e40eaf1cda54
@@@ -42,7 -42,9 +42,8 @@@
  #include <string.h>
  #include "hackblock.h"
  #include "gromacs/utility/smalloc.h"
 -#include "vec.h"
 -#include "macros.h"
 +#include "gromacs/math/vec.h"
+ #include "names.h"
  
  /* these MUST correspond to the enum in hackblock.h */
  const char *btsNames[ebtsNR] = { "bonds", "angles", "dihedrals", "impropers", "exclusions", "cmap" };
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index f0ae524c17e90888af94adc4c77852e65d7df0d1,8db571ea9c36902f880ea3b13cfa4da5daef71a1..5e5e5f3d855276c3ab6e01a433652d1a97207829
@@@ -116,27 -134,9 +116,27 @@@ void gmx_sumd_sim(int nr, double r[], c
  #define gmx_sum_sim   gmx_sumf_sim
  #endif
  
 +gmx_bool gmx_fexist_master(const char *fname, struct t_commrec *cr);
 +/* Return TRUE when fname exists, FALSE otherwise, bcast from master to others */
 +
 +void
 +gmx_fatal_collective(int f_errno, const char *file, int line,
 +                     const struct t_commrec *cr, struct gmx_domdec_t *dd,
 +                     const char *fmt, ...);
 +/* As gmx_fatal declared in utility/fatalerror.h,
 + * but only the master process prints the error message.
 + * This should only be called one of the following two situations:
 + * 1) On all nodes in cr->mpi_comm_mysim, with cr!=NULL,dd==NULL.
 + * 2) On all nodes in dd->mpi_comm_all,   with cr==NULL,dd!=NULL.
 + * This will call MPI_Finalize instead of MPI_Abort when possible,
 + * This is useful for handling errors in code that is executed identically
 + * for all processes.
 + */
 +
 +/* This doesn't currently work if enabled (needs some header cleanup). */
  #ifdef DEBUG_GMX
  #define debug_gmx() do { FILE *fp = debug ? debug : stderr; \
-                          if (bDebugMode()) { fprintf(fp, "NODEID=%d, %s  %d\n", gmx_mpi_initialized() ? gmx_node_rank() : -1, __FILE__, __LINE__); } fflush(fp); } while (0)
+                          if (bDebugMode()) { fprintf(fp, "rank=%d, %s  %d\n", gmx_mpi_initialized() ? gmx_node_rank() : -1, __FILE__, __LINE__); } fflush(fp); } while (0)
  #else
  #define debug_gmx()
  #endif
index 2aa97ffd231ef0fcbc3739a95e9430791313c927,fa8275083dd126e2334755dcbc796210799e48de..d3df9392e44b29be77958f98efe7a6ba0afcd2e3
@@@ -38,7 -38,7 +38,8 @@@
  #include <config.h>
  #endif
  
+ #include <assert.h>
 +#include <stdlib.h>
  
  #include "gromacs/fileio/confio.h"
  #include "types/commrec.h"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 8e74d6bf82da1c18ee0590abcdf385a8a58f18d5,0000000000000000000000000000000000000000..adc27e7c8ddf38ea5a6d004fcfe53bc9d9522f66
mode 100644,000000..100644
--- /dev/null
@@@ -1,254 -1,0 +1,254 @@@
-         std::fprintf(stderr, "Halting parallel program %s on node %d out of %d\n",
 +/*
 + * This file is part of the GROMACS molecular simulation package.
 + *
 + * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
 + * Copyright (c) 2001-2004, The GROMACS development team.
 + * Copyright (c) 2013,2014, by the GROMACS development team, led by
 + * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 + * and including many others, as listed in the AUTHORS file in the
 + * top-level source directory and at http://www.gromacs.org.
 + *
 + * GROMACS is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU Lesser General Public License
 + * as published by the Free Software Foundation; either version 2.1
 + * of the License, or (at your option) any later version.
 + *
 + * GROMACS is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with GROMACS; if not, see
 + * http://www.gnu.org/licenses, or write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
 + *
 + * If you want to redistribute modifications to GROMACS, please
 + * consider that scientific software is very special. Version
 + * control is crucial - bugs must be traceable. We will be happy to
 + * consider code for inclusion in the official distribution, but
 + * derived work must not be called official GROMACS. Details are found
 + * in the README & COPYING files - if they are missing, get the
 + * official version at http://www.gromacs.org.
 + *
 + * To help us fund GROMACS development, we humbly ask that you cite
 + * the research papers on the package. Check out http://www.gromacs.org.
 + */
 +#include "basenetwork.h"
 +
 +#include "config.h"
 +
 +#include <cctype>
 +#include <cstdio>
 +#include <cstdlib>
 +#include <cstring>
 +
 +#include <algorithm>
 +#include <exception>
 +
 +#ifdef HAVE_UNISTD_H
 +#include <unistd.h>
 +#endif
 +
 +#include "gromacs/utility/cstringutil.h"
 +#include "gromacs/utility/fatalerror.h"
 +#include "gromacs/utility/gmxmpi.h"
 +#include "gromacs/utility/programcontext.h"
 +
 +int gmx_gethostname(char *name, size_t len)
 +{
 +    if (len < 8)
 +    {
 +        gmx_incons("gmx_gethostname called with len<8");
 +    }
 +#if defined(HAVE_UNISTD_H) && !defined(__native_client__)
 +    if (gethostname(name, len-1) != 0)
 +    {
 +        std::strncpy(name, "unknown", 8);
 +        return -1;
 +    }
 +    return 0;
 +#else
 +    std::strncpy(name, "unknown", 8);
 +    return -1;
 +#endif
 +}
 +
 +gmx_bool gmx_mpi_initialized(void)
 +{
 +#ifndef GMX_MPI
 +    return 0;
 +#else
 +    int n;
 +    MPI_Initialized(&n);
 +
 +    return n;
 +#endif
 +}
 +
 +int gmx_node_num(void)
 +{
 +#ifndef GMX_MPI
 +    return 1;
 +#else
 +    int i;
 +    (void) MPI_Comm_size(MPI_COMM_WORLD, &i);
 +    return i;
 +#endif
 +}
 +
 +int gmx_node_rank(void)
 +{
 +#ifndef GMX_MPI
 +    return 0;
 +#else
 +    int i;
 +    (void) MPI_Comm_rank(MPI_COMM_WORLD, &i);
 +    return i;
 +#endif
 +}
 +
 +static int mpi_hostname_hash(void)
 +{
 +    int hash_int;
 +
 +#ifndef GMX_LIB_MPI
 +    /* We have a single physical node */
 +    hash_int = 0;
 +#else
 +    int  resultlen;
 +    char mpi_hostname[MPI_MAX_PROCESSOR_NAME];
 +
 +    /* This procedure can only differentiate nodes with different names.
 +     * Architectures where different physical nodes have identical names,
 +     * such as IBM Blue Gene, should use an architecture specific solution.
 +     */
 +    MPI_Get_processor_name(mpi_hostname, &resultlen);
 +
 +    /* The string hash function returns an unsigned int. We cast to an int.
 +     * Negative numbers are converted to positive by setting the sign bit to 0.
 +     * This makes the hash one bit smaller.
 +     * A 63-bit hash (with 64-bit int) should be enough for unique node hashes,
 +     * even on a million node machine. 31 bits might not be enough though!
 +     */
 +    hash_int =
 +        (int)gmx_string_fullhash_func(mpi_hostname, gmx_string_hash_init);
 +    if (hash_int < 0)
 +    {
 +        hash_int -= INT_MIN;
 +    }
 +#endif
 +
 +    return hash_int;
 +}
 +
 +#if defined GMX_LIB_MPI && defined GMX_TARGET_BGQ
 +#include <spi/include/kernel/location.h>
 +
 +static int bgq_nodenum(void)
 +{
 +    int           hostnum;
 +    Personality_t personality;
 +    Kernel_GetPersonality(&personality, sizeof(personality));
 +    /* Each MPI rank has a unique coordinate in a 6-dimensional space
 +       (A,B,C,D,E,T), with dimensions A-E corresponding to different
 +       physical nodes, and T within each node. Each node has sixteen
 +       physical cores, each of which can have up to four hardware
 +       threads, so 0 <= T <= 63 (but the maximum value of T depends on
 +       the confituration of ranks and OpenMP threads per
 +       node). However, T is irrelevant for computing a suitable return
 +       value for gmx_hostname_num().
 +     */
 +    hostnum  = personality.Network_Config.Acoord;
 +    hostnum *= personality.Network_Config.Bnodes;
 +    hostnum += personality.Network_Config.Bcoord;
 +    hostnum *= personality.Network_Config.Cnodes;
 +    hostnum += personality.Network_Config.Ccoord;
 +    hostnum *= personality.Network_Config.Dnodes;
 +    hostnum += personality.Network_Config.Dcoord;
 +    hostnum *= personality.Network_Config.Enodes;
 +    hostnum += personality.Network_Config.Ecoord;
 +
 +    if (debug)
 +    {
 +        std::fprintf(debug,
 +                     "Torus ID A: %d / %d B: %d / %d C: %d / %d D: %d / %d E: %d / %d\n"
 +                     "Node ID T: %d / %d core: %d / %d hardware thread: %d / %d\n",
 +                     personality.Network_Config.Acoord,
 +                     personality.Network_Config.Anodes,
 +                     personality.Network_Config.Bcoord,
 +                     personality.Network_Config.Bnodes,
 +                     personality.Network_Config.Ccoord,
 +                     personality.Network_Config.Cnodes,
 +                     personality.Network_Config.Dcoord,
 +                     personality.Network_Config.Dnodes,
 +                     personality.Network_Config.Ecoord,
 +                     personality.Network_Config.Enodes,
 +                     Kernel_ProcessorCoreID(),
 +                     16,
 +                     Kernel_ProcessorID(),
 +                     64,
 +                     Kernel_ProcessorThreadID(),
 +                     4);
 +    }
 +    return hostnum;
 +}
 +#endif
 +
 +int gmx_physicalnode_id_hash(void)
 +{
 +    int hash;
 +
 +#ifndef GMX_MPI
 +    hash = 0;
 +#else
 +#ifdef GMX_THREAD_MPI
 +    /* thread-MPI currently puts the thread number in the process name,
 +     * we might want to change this, as this is inconsistent with what
 +     * most MPI implementations would do when running on a single node.
 +     */
 +    hash = 0;
 +#else
 +#ifdef GMX_TARGET_BGQ
 +    hash = bgq_nodenum();
 +#else
 +    hash = mpi_hostname_hash();
 +#endif
 +#endif
 +#endif
 +
 +    if (debug)
 +    {
 +        fprintf(debug, "In gmx_physicalnode_id_hash: hash %d\n", hash);
 +    }
 +
 +    return hash;
 +}
 +
 +#ifdef GMX_LIB_MPI
 +void gmx_abort(int errorno)
 +{
 +    const char *programName = "GROMACS";
 +    try
 +    {
 +        programName = gmx::getProgramContext().displayName();
 +    }
 +    catch (const std::exception &)
 +    {
 +    }
 +    const int nnodes   = gmx_node_num();
 +    const int noderank = gmx_node_rank();
 +    if (nnodes > 1)
 +    {
++        std::fprintf(stderr, "Halting parallel program %s on rank %d out of %d\n",
 +                     programName, noderank, nnodes);
 +    }
 +    else
 +    {
 +        std::fprintf(stderr, "Halting program %s\n", programName);
 +    }
 +
 +    MPI_Abort(MPI_COMM_WORLD, errorno);
 +    std::exit(errorno);
 +}
 +#endif
Simple merge
Simple merge
index 603f24470354e8ff8f1b1a10852c69c1b533185c,923f0f654461ddd943684299ef919dfc18229d4f..85a2d17991d301bafce2149a26b8617fdd3f1ddb
@@@ -1206,8 -1210,23 +1206,16 @@@ int mdrunner(gmx_hw_opt_t *hw_opt
                            "      Verlet cut-off scheme.\n");
  #endif
          }
+         if (inputrec->eI == eiSD2)
+         {
+             md_print_warn(cr, fplog, "The stochastic dynamics integrator %s is deprecated, since\n"
+                           "it is slower than integrator %s and is slightly less accurate\n"
+                           "with constraints. Use the %s integrator.",
+                           ei_names[inputrec->eI], ei_names[eiSD1], ei_names[eiSD1]);
+         }
      }
  
 -    /* Check for externally set OpenMP affinity and turn off internal
 -     * pinning if any is found. We need to do this check early to tell
 -     * thread-MPI whether it should do pinning when spawning threads.
 -     * TODO: the above no longer holds, we should move these checks down
 -     */
 -    gmx_omp_check_thread_affinity(fplog, cr, hw_opt);
 -
      /* Check and update the hardware options for internal consistency */
      check_and_update_hw_opt_1(hw_opt, SIMMASTER(cr));
  
index 8ca224cb9d9250cd9627441b1e409d0c0456b68a,9d4a3d52eea87c8c01698bb68ecab161639120be..7e2581c235487e32a2de2ef16f6989dd29529f40
@@@ -70,12 -68,12 +70,13 @@@ if (CPPCHECK_EXECUTABLE AND UNIX
          set(_outputopt --xml)
      endif()
      set(_common_flags
 -        --enable=style -DLINUX
 +        --enable=style -DLINUX -DHAVE_UNISTD_H
          -I src/gromacs/legacyheaders -I src
          -I src/external/thread_mpi/include
+         -I src/external/tng_io/include
          -I ${CMAKE_BINARY_DIR}/src -I ${CMAKE_BINARY_DIR}/src/gromacs/utility
          --quiet
 +        --inline-suppr
          ${_outputopt})
      set(_c_flags
          --suppress=variableScope