diff --git a/patches/gromacs-2016-beta1.config b/patches/gromacs-2016-beta2.config similarity index 100% rename from patches/gromacs-2016-beta1.config rename to patches/gromacs-2016-beta2.config diff --git a/patches/gromacs-2016-beta1.diff/src/gromacs/CMakeLists.txt b/patches/gromacs-2016-beta2.diff/src/gromacs/CMakeLists.txt similarity index 88% rename from patches/gromacs-2016-beta1.diff/src/gromacs/CMakeLists.txt rename to patches/gromacs-2016-beta2.diff/src/gromacs/CMakeLists.txt index 2f8a59296e79cbc4c9f1b47034389ac8c2730816..a9f3b4fd3e47baa6409227cc6e0d9ba89d368d11 100644 --- a/patches/gromacs-2016-beta1.diff/src/gromacs/CMakeLists.txt +++ b/patches/gromacs-2016-beta2.diff/src/gromacs/CMakeLists.txt @@ -71,35 +71,6 @@ function (gmx_write_installed_header_list) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt "${_list}") endfunction() -if(GMX_USE_TNG) - option(GMX_EXTERNAL_TNG "Use external TNG instead of compiling the version shipped with GROMACS." - OFF) - # Detect TNG if GMX_EXTERNAL_TNG is explicitly ON - if(GMX_EXTERNAL_TNG) - find_package(TNG_IO 1.6.0) - if(NOT TNG_IO_FOUND) - message(FATAL_ERROR - "TNG >= 1.6.0 not found. " - "You can set GMX_EXTERNAL_TNG=OFF to compile TNG.") - endif() - include_directories(SYSTEM ${TNG_IO_INCLUDE_DIRS}) - endif() - if(NOT GMX_EXTERNAL_TNG) - include(${CMAKE_SOURCE_DIR}/src/external/tng_io/BuildTNG.cmake) - tng_get_source_list(TNG_SOURCES TNG_IO_DEFINITIONS) - list(APPEND LIBGROMACS_SOURCES ${TNG_SOURCES}) - tng_set_source_properties(WITH_ZLIB ${HAVE_ZLIB}) - - if (HAVE_ZLIB) - list(APPEND GMX_EXTRA_LIBRARIES ${ZLIB_LIBRARIES}) - include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS}) - endif() - endif() -else() - # We still need to get tng/tng_io_fwd.h from somewhere! - include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/external/tng_io/include) -endif() - add_subdirectory(gmxlib) add_subdirectory(mdlib) add_subdirectory(listed-forces) @@ -152,6 +123,9 @@ list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES} ${PROPERTY_SOU tmpi_get_source_list(THREAD_MPI_SOURCES ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/src) list(APPEND LIBGROMACS_SOURCES ${THREAD_MPI_SOURCES}) +list(APPEND LIBGROMACS_SOURCES ${TNG_SOURCES}) +tng_set_source_properties(WITH_ZLIB ${HAVE_ZLIB}) + configure_file(version.h.cmakein version.h) gmx_install_headers( analysisdata.h diff --git a/patches/gromacs-2016-beta1.diff/src/gromacs/CMakeLists.txt.preplumed b/patches/gromacs-2016-beta2.diff/src/gromacs/CMakeLists.txt.preplumed similarity index 88% rename from patches/gromacs-2016-beta1.diff/src/gromacs/CMakeLists.txt.preplumed rename to patches/gromacs-2016-beta2.diff/src/gromacs/CMakeLists.txt.preplumed index edc051fe8328dcb0f2ff5604048c6e1a07bc66b1..ab9d64df47434432144fd59dd17a67e8fec9a433 100644 --- a/patches/gromacs-2016-beta1.diff/src/gromacs/CMakeLists.txt.preplumed +++ b/patches/gromacs-2016-beta2.diff/src/gromacs/CMakeLists.txt.preplumed @@ -69,35 +69,6 @@ function (gmx_write_installed_header_list) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt "${_list}") endfunction() -if(GMX_USE_TNG) - option(GMX_EXTERNAL_TNG "Use external TNG instead of compiling the version shipped with GROMACS." - OFF) - # Detect TNG if GMX_EXTERNAL_TNG is explicitly ON - if(GMX_EXTERNAL_TNG) - find_package(TNG_IO 1.6.0) - if(NOT TNG_IO_FOUND) - message(FATAL_ERROR - "TNG >= 1.6.0 not found. " - "You can set GMX_EXTERNAL_TNG=OFF to compile TNG.") - endif() - include_directories(SYSTEM ${TNG_IO_INCLUDE_DIRS}) - endif() - if(NOT GMX_EXTERNAL_TNG) - include(${CMAKE_SOURCE_DIR}/src/external/tng_io/BuildTNG.cmake) - tng_get_source_list(TNG_SOURCES TNG_IO_DEFINITIONS) - list(APPEND LIBGROMACS_SOURCES ${TNG_SOURCES}) - tng_set_source_properties(WITH_ZLIB ${HAVE_ZLIB}) - - if (HAVE_ZLIB) - list(APPEND GMX_EXTRA_LIBRARIES ${ZLIB_LIBRARIES}) - include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS}) - endif() - endif() -else() - # We still need to get tng/tng_io_fwd.h from somewhere! - include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/external/tng_io/include) -endif() - add_subdirectory(gmxlib) add_subdirectory(mdlib) add_subdirectory(listed-forces) @@ -150,6 +121,9 @@ list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES} ${PROPERTY_SOU tmpi_get_source_list(THREAD_MPI_SOURCES ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/src) list(APPEND LIBGROMACS_SOURCES ${THREAD_MPI_SOURCES}) +list(APPEND LIBGROMACS_SOURCES ${TNG_SOURCES}) +tng_set_source_properties(WITH_ZLIB ${HAVE_ZLIB}) + configure_file(version.h.cmakein version.h) gmx_install_headers( analysisdata.h diff --git a/patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/force.cpp b/patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/force.cpp similarity index 100% rename from patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/force.cpp rename to patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/force.cpp diff --git a/patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/force.cpp.preplumed b/patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/force.cpp.preplumed similarity index 100% rename from patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/force.cpp.preplumed rename to patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/force.cpp.preplumed diff --git a/patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/minimize.cpp b/patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/minimize.cpp similarity index 98% rename from patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/minimize.cpp rename to patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/minimize.cpp index 3ce7832812fc7b72d446ab0c9985e23832d66fda..b60b809915a31afe415c189a3949b1d741c213c5 100644 --- a/patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/minimize.cpp +++ b/patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/minimize.cpp @@ -614,8 +614,10 @@ static void write_em_traj(FILE *fplog, t_commrec *cr, } } -//! Do one minimization step -static void do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, +//! \brief Do one minimization step +// +// \returns true when the step succeeded, false when a constraint error occurred +static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, gmx_bool bMolPBC, em_state_t *ems1, real a, rvec *f, em_state_t *ems2, gmx_constr_t constr, gmx_localtop_t *top, @@ -630,6 +632,8 @@ static void do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, real dvdl_constr; int nthreads gmx_unused; + bool validStep = true; + s1 = &ems1->s; s2 = &ems2->s; @@ -744,13 +748,23 @@ static void do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, { wallcycle_start(wcycle, ewcCONSTR); dvdl_constr = 0; - constrain(NULL, TRUE, TRUE, constr, &top->idef, - ir, cr, count, 0, 1.0, md, - s1->x, s2->x, NULL, bMolPBC, s2->box, - s2->lambda[efptBONDED], &dvdl_constr, - NULL, NULL, nrnb, econqCoord); + validStep = + constrain(NULL, TRUE, TRUE, constr, &top->idef, + ir, cr, count, 0, 1.0, md, + s1->x, s2->x, NULL, bMolPBC, s2->box, + s2->lambda[efptBONDED], &dvdl_constr, + NULL, NULL, nrnb, econqCoord); wallcycle_stop(wcycle, ewcCONSTR); + + // We should move this check to the different minimizers + if (!validStep && ir->eI != eiSteep) + { + gmx_fatal(FARGS, "The coordinates could not be constrained. Minimizer '%s' can not handle constraint failures, use minimizer '%s' before using '%s'.", + EI(ir->eI), EI(eiSteep), EI(ir->eI)); + } } + + return validStep; } //! Prepare EM for using domain decomposition parallellization @@ -2635,18 +2649,28 @@ double do_steep(FILE *fplog, t_commrec *cr, bAbort = (nsteps >= 0) && (count == nsteps); /* set new coordinates, except for first step */ + bool validStep = true; if (count > 0) { - do_em_step(cr, inputrec, mdatoms, fr->bMolPBC, - s_min, stepsize, s_min->f, s_try, - constr, top, nrnb, wcycle, count); + validStep = + do_em_step(cr, inputrec, mdatoms, fr->bMolPBC, + s_min, stepsize, s_min->f, s_try, + constr, top, nrnb, wcycle, count); } - evaluate_energy(fplog, cr, - top_global, s_try, top, - inputrec, nrnb, wcycle, gstat, - vsite, constr, fcd, graph, mdatoms, fr, - mu_tot, enerd, vir, pres, count, count == 0); + if (validStep) + { + evaluate_energy(fplog, cr, + top_global, s_try, top, + inputrec, nrnb, wcycle, gstat, + vsite, constr, fcd, graph, mdatoms, fr, + mu_tot, enerd, vir, pres, count, count == 0); + } + else + { + // Signal constraint error during stepping with energy=inf + s_try->epot = std::numeric_limits<real>::infinity(); + } if (MASTER(cr)) { diff --git a/patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/minimize.cpp.preplumed b/patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/minimize.cpp.preplumed similarity index 98% rename from patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/minimize.cpp.preplumed rename to patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/minimize.cpp.preplumed index 5a205694090705e66fb3b3a07da9748f185c8bd7..55200ce0ab8986d9817bad13d36f2965e2521dbf 100644 --- a/patches/gromacs-2016-beta1.diff/src/gromacs/mdlib/minimize.cpp.preplumed +++ b/patches/gromacs-2016-beta2.diff/src/gromacs/mdlib/minimize.cpp.preplumed @@ -570,8 +570,10 @@ static void write_em_traj(FILE *fplog, t_commrec *cr, } } -//! Do one minimization step -static void do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, +//! \brief Do one minimization step +// +// \returns true when the step succeeded, false when a constraint error occurred +static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, gmx_bool bMolPBC, em_state_t *ems1, real a, rvec *f, em_state_t *ems2, gmx_constr_t constr, gmx_localtop_t *top, @@ -586,6 +588,8 @@ static void do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, real dvdl_constr; int nthreads gmx_unused; + bool validStep = true; + s1 = &ems1->s; s2 = &ems2->s; @@ -700,13 +704,23 @@ static void do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, { wallcycle_start(wcycle, ewcCONSTR); dvdl_constr = 0; - constrain(NULL, TRUE, TRUE, constr, &top->idef, - ir, cr, count, 0, 1.0, md, - s1->x, s2->x, NULL, bMolPBC, s2->box, - s2->lambda[efptBONDED], &dvdl_constr, - NULL, NULL, nrnb, econqCoord); + validStep = + constrain(NULL, TRUE, TRUE, constr, &top->idef, + ir, cr, count, 0, 1.0, md, + s1->x, s2->x, NULL, bMolPBC, s2->box, + s2->lambda[efptBONDED], &dvdl_constr, + NULL, NULL, nrnb, econqCoord); wallcycle_stop(wcycle, ewcCONSTR); + + // We should move this check to the different minimizers + if (!validStep && ir->eI != eiSteep) + { + gmx_fatal(FARGS, "The coordinates could not be constrained. Minimizer '%s' can not handle constraint failures, use minimizer '%s' before using '%s'.", + EI(ir->eI), EI(eiSteep), EI(ir->eI)); + } } + + return validStep; } //! Prepare EM for using domain decomposition parallellization @@ -2561,18 +2575,28 @@ double do_steep(FILE *fplog, t_commrec *cr, bAbort = (nsteps >= 0) && (count == nsteps); /* set new coordinates, except for first step */ + bool validStep = true; if (count > 0) { - do_em_step(cr, inputrec, mdatoms, fr->bMolPBC, - s_min, stepsize, s_min->f, s_try, - constr, top, nrnb, wcycle, count); + validStep = + do_em_step(cr, inputrec, mdatoms, fr->bMolPBC, + s_min, stepsize, s_min->f, s_try, + constr, top, nrnb, wcycle, count); } - evaluate_energy(fplog, cr, - top_global, s_try, top, - inputrec, nrnb, wcycle, gstat, - vsite, constr, fcd, graph, mdatoms, fr, - mu_tot, enerd, vir, pres, count, count == 0); + if (validStep) + { + evaluate_energy(fplog, cr, + top_global, s_try, top, + inputrec, nrnb, wcycle, gstat, + vsite, constr, fcd, graph, mdatoms, fr, + mu_tot, enerd, vir, pres, count, count == 0); + } + else + { + // Signal constraint error during stepping with energy=inf + s_try->epot = std::numeric_limits<real>::infinity(); + } if (MASTER(cr)) { diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/md.cpp b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/md.cpp similarity index 99% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/md.cpp rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/md.cpp index 2bd872565f10b34eaa07f80101ae3691a30be7ca..19cea9f692a0893723599d417c950c8645abb2a5 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/md.cpp +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/md.cpp @@ -1165,6 +1165,8 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], /* PLUMED */ plumedNeedsEnergy=0; if(plumedswitch){ + int pversion=0; + plumed_cmd(plumedmain,"getApiVersion",&pversion); long int lstep=step; plumed_cmd(plumedmain,"setStepLong",&lstep); plumed_cmd(plumedmain,"setPositions",&state->x[0][0]); plumed_cmd(plumedmain,"setMasses",&mdatoms->massT[0]); @@ -1172,6 +1174,8 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], plumed_cmd(plumedmain,"setBox",&state->box[0][0]); plumed_cmd(plumedmain,"prepareCalc",NULL); plumed_cmd(plumedmain,"setStopFlag",&plumedWantsToStop); + int checkp=0; if(bCPT) checkp=1; + if(pversion>3) plumed_cmd(plumedmain,"doCheckPoint",&checkp); plumed_cmd(plumedmain,"setForces",&f[0][0]); plumed_cmd(plumedmain,"isEnergyNeeded",&plumedNeedsEnergy); clear_mat(plumed_vir); diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/md.cpp.preplumed b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/md.cpp.preplumed similarity index 100% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/md.cpp.preplumed rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/md.cpp.preplumed diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/mdrun.cpp b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/mdrun.cpp similarity index 98% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/mdrun.cpp rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/mdrun.cpp index 55f3529faaba83f8ee5e66744004b578c9bce6d5..3efc27c46d74c7714421c05a2e61d1c72371b2b2 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/mdrun.cpp +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/mdrun.cpp @@ -141,10 +141,11 @@ int gmx_mdrun(int argc, char *argv[]) "functions is read using the [TT]-tablep[tt] option.[PAR]", "When tabulated bonded functions are present in the topology,", "interaction functions are read using the [TT]-tableb[tt] option.", - "For each different tabulated interaction type the table file name is", - "modified in a different way: before the file extension an underscore is", - "appended, then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals", - "and finally the table number of the interaction type.[PAR]", + "For each different tabulated interaction type used, a table file name must", + "be given. For the topology to work, a file name given here must match a", + "character sequence before the file extension. That sequence is: an underscore,", + "then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals,", + "and finally the matching table number index used in the topology.[PAR]", "The options [TT]-px[tt] and [TT]-pf[tt] are used for writing pull COM", "coordinates and forces when pulling is selected", "in the [REF].mdp[ref] file.[PAR]", @@ -246,7 +247,7 @@ int gmx_mdrun(int argc, char *argv[]) { efXVG, "-field", "field", ffOPTWR }, { efXVG, "-table", "table", ffOPTRD }, { efXVG, "-tablep", "tablep", ffOPTRD }, - { efXVG, "-tableb", "table", ffOPTRD }, + { efXVG, "-tableb", "table", ffOPTRDMULT }, { efTRX, "-rerun", "rerun", ffOPTRD }, { efXVG, "-tpi", "tpi", ffOPTWR }, { efXVG, "-tpid", "tpidist", ffOPTWR }, diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/mdrun.cpp.preplumed b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/mdrun.cpp.preplumed similarity index 98% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/mdrun.cpp.preplumed rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/mdrun.cpp.preplumed index 9458dfbf91803983e33b4ae66f8661057fb2d4db..e56c4a14530f5317f7679cb01a585b994a40d255 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/mdrun.cpp.preplumed +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/mdrun.cpp.preplumed @@ -134,10 +134,11 @@ int gmx_mdrun(int argc, char *argv[]) "functions is read using the [TT]-tablep[tt] option.[PAR]", "When tabulated bonded functions are present in the topology,", "interaction functions are read using the [TT]-tableb[tt] option.", - "For each different tabulated interaction type the table file name is", - "modified in a different way: before the file extension an underscore is", - "appended, then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals", - "and finally the table number of the interaction type.[PAR]", + "For each different tabulated interaction type used, a table file name must", + "be given. For the topology to work, a file name given here must match a", + "character sequence before the file extension. That sequence is: an underscore,", + "then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals,", + "and finally the matching table number index used in the topology.[PAR]", "The options [TT]-px[tt] and [TT]-pf[tt] are used for writing pull COM", "coordinates and forces when pulling is selected", "in the [REF].mdp[ref] file.[PAR]", @@ -239,7 +240,7 @@ int gmx_mdrun(int argc, char *argv[]) { efXVG, "-field", "field", ffOPTWR }, { efXVG, "-table", "table", ffOPTRD }, { efXVG, "-tablep", "tablep", ffOPTRD }, - { efXVG, "-tableb", "table", ffOPTRD }, + { efXVG, "-tableb", "table", ffOPTRDMULT }, { efTRX, "-rerun", "rerun", ffOPTRD }, { efXVG, "-tpi", "tpi", ffOPTWR }, { efXVG, "-tpid", "tpidist", ffOPTWR }, diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/repl_ex.cpp b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/repl_ex.cpp similarity index 98% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/repl_ex.cpp rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/repl_ex.cpp index 2b870b96d1ec09aa25e998809568da441d706738..70d9f30b8d2b0194a2e2ab77fcae34e1b6e679a8 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/repl_ex.cpp +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/repl_ex.cpp @@ -976,6 +976,8 @@ test_for_replica_exchange(FILE *fplog, pind[i] = re->ind[i]; } + rng.restart( step, 0 ); + /* PLUMED */ int plumed_test_exchange_pattern=0; /* END PLUMED */ @@ -985,10 +987,13 @@ test_for_replica_exchange(FILE *fplog, /* multiple random switch exchange */ int nself = 0; - rng.restart( step, 0 ); for (i = 0; i < re->nex + nself; i++) { + // For now this is superfluous, but just in case we ever add more + // calls in different branches it is safer to always reset the distribution. + uniformNreplDist.reset(); + /* randomly select a pair */ /* in theory, could reduce this by identifying only which switches had a nonneglibible probability of occurring (log p > -100) and only operate on those switches */ @@ -1033,7 +1038,10 @@ test_for_replica_exchange(FILE *fplog, { prob[0] = exp(-delta); } - /* roll a number to determine if accepted */ + // roll a number to determine if accepted. For now it is superfluous to + // reset, but just in case we ever add more calls in different branches + // it is safer to always reset the distribution. + uniformRealDist.reset(); bEx[0] = uniformRealDist(rng) < prob[0]; } re->prob_sum[0] += prob[0]; @@ -1116,7 +1124,10 @@ test_for_replica_exchange(FILE *fplog, { prob[i] = exp(-delta); } - /* roll a number to determine if accepted */ + // roll a number to determine if accepted. For now it is superfluous to + // reset, but just in case we ever add more calls in different branches + // it is safer to always reset the distribution. + uniformRealDist.reset(); bEx[i] = uniformRealDist(rng) < prob[i]; } re->prob_sum[i] += prob[i]; diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/repl_ex.cpp.preplumed b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/repl_ex.cpp.preplumed similarity index 98% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/repl_ex.cpp.preplumed rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/repl_ex.cpp.preplumed index ab12fc4f1789ddbc42674ed56b6268069fdc369a..a3d89573f6936e2821da63f792bd7caed3a53537 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/repl_ex.cpp.preplumed +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/repl_ex.cpp.preplumed @@ -961,15 +961,20 @@ test_for_replica_exchange(FILE *fplog, pind[i] = re->ind[i]; } + rng.restart( step, 0 ); + if (bMultiEx) { /* multiple random switch exchange */ int nself = 0; - rng.restart( step, 0 ); for (i = 0; i < re->nex + nself; i++) { + // For now this is superfluous, but just in case we ever add more + // calls in different branches it is safer to always reset the distribution. + uniformNreplDist.reset(); + /* randomly select a pair */ /* in theory, could reduce this by identifying only which switches had a nonneglibible probability of occurring (log p > -100) and only operate on those switches */ @@ -1014,7 +1019,10 @@ test_for_replica_exchange(FILE *fplog, { prob[0] = exp(-delta); } - /* roll a number to determine if accepted */ + // roll a number to determine if accepted. For now it is superfluous to + // reset, but just in case we ever add more calls in different branches + // it is safer to always reset the distribution. + uniformRealDist.reset(); bEx[0] = uniformRealDist(rng) < prob[0]; } re->prob_sum[0] += prob[0]; @@ -1060,7 +1068,10 @@ test_for_replica_exchange(FILE *fplog, { prob[i] = exp(-delta); } - /* roll a number to determine if accepted */ + // roll a number to determine if accepted. For now it is superfluous to + // reset, but just in case we ever add more calls in different branches + // it is safer to always reset the distribution. + uniformRealDist.reset(); bEx[i] = uniformRealDist(rng) < prob[i]; } re->prob_sum[i] += prob[i]; diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/runner.cpp b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/runner.cpp similarity index 99% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/runner.cpp rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/runner.cpp index d642a42e20b80cc6b6432ed38f566d72b16012ca..b8550c39ef5f4cd8fdb54da642e1e2d8bdaaf16d 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/runner.cpp +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/runner.cpp @@ -989,7 +989,8 @@ int mdrunner(gmx_hw_opt_t *hw_opt, cr, ddxyz, &npme, inputrec, state, &bReadEkin, (Flags & MD_APPENDFILES), - (Flags & MD_APPENDFILESSET)); + (Flags & MD_APPENDFILESSET), + (Flags & MD_REPRODUCIBLE)); if (bReadEkin) { @@ -1159,7 +1160,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, init_forcerec(fplog, fr, fcd, inputrec, mtop, cr, box, opt2fn("-table", nfile, fnm), opt2fn("-tablep", nfile, fnm), - opt2fn("-tableb", nfile, fnm), + getFilenm("-tableb", nfile, fnm), nbpu_opt, FALSE, pforce); diff --git a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/runner.cpp.preplumed b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/runner.cpp.preplumed similarity index 99% rename from patches/gromacs-2016-beta1.diff/src/programs/mdrun/runner.cpp.preplumed rename to patches/gromacs-2016-beta2.diff/src/programs/mdrun/runner.cpp.preplumed index 3294776ff121cf4b9ee740de07be997e6636fe2d..ddc5895c956b11c1abdb083777dc6fce8ed9fa30 100644 --- a/patches/gromacs-2016-beta1.diff/src/programs/mdrun/runner.cpp.preplumed +++ b/patches/gromacs-2016-beta2.diff/src/programs/mdrun/runner.cpp.preplumed @@ -983,7 +983,8 @@ int mdrunner(gmx_hw_opt_t *hw_opt, cr, ddxyz, &npme, inputrec, state, &bReadEkin, (Flags & MD_APPENDFILES), - (Flags & MD_APPENDFILESSET)); + (Flags & MD_APPENDFILESSET), + (Flags & MD_REPRODUCIBLE)); if (bReadEkin) { @@ -1153,7 +1154,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, init_forcerec(fplog, fr, fcd, inputrec, mtop, cr, box, opt2fn("-table", nfile, fnm), opt2fn("-tablep", nfile, fnm), - opt2fn("-tableb", nfile, fnm), + getFilenm("-tableb", nfile, fnm), nbpu_opt, FALSE, pforce);