Unverified Commit 7ba6b8a0 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1604 from akohlmey/timeout-for-replica

Add support for timeouts to temper commands and a few small fixes
parents de366c27 f61cd68c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -20,9 +20,13 @@ if(PKG_KIM)
      message(FATAL_ERROR "Cannot build downloaded KIM-API library with Ninja build tool")
    endif()
    message(STATUS "KIM-API download requested - we will build our own")
    enable_language(C)
    enable_language(Fortran)
    include(CheckLanguage)
    include(ExternalProject)
    enable_language(C)
    check_language(Fortran)
    if(NOT CMAKE_Fortran_COMPILER)
      message(FATAL_ERROR "Compiling the KIM-API library requires a Fortran compiler")
    endif()
    ExternalProject_Add(kim_build
      URL https://s3.openkim.org/kim-api/kim-api-2.1.2.txz
      URL_MD5 6ac52e14ef52967fc7858220b208cba5
+6 −2
Original line number Diff line number Diff line
@@ -18,8 +18,12 @@ if(PKG_VORONOI)
    else()
      set(VORO_BUILD_CFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}")
    endif()
    string(APPEND VORO_BUILD_CFLAGS ${CMAKE_CXX_FLAGS})
    if(APPLE)
      get_filename_component(VORO_CXX ${CMAKE_CXX_COMPILER} NAME_WE)
      set(VORO_BUILD_OPTIONS CXX=${VORO_CXX} CFLAGS=${VORO_BUILD_CFLAGS})
    else()
      set(VORO_BUILD_OPTIONS CXX=${CMAKE_CXX_COMPILER} CFLAGS=${VORO_BUILD_CFLAGS})
    endif()

    ExternalProject_Add(voro_build
      URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
#if defined(MPICH) && defined(MVAPICH2_VERSION)
      char* str;
      cuda_aware_flag = 0;
      if (str = getenv("MV2_ENABLE_CUDA")
      if ((str = getenv("MV2_ENABLE_CUDA")))
        if ((strcmp(str,"1") == 0))
          cuda_aware_flag = 1;

+14 −28
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "finish.h"
#include "timer.h"
#include "error.h"
#include "utils.h"

using namespace LAMMPS_NS;

@@ -70,6 +71,10 @@ void Temper::command(int narg, char **arg)
  nevery = force->inumeric(FLERR,arg[1]);
  double temp = force->numeric(FLERR,arg[2]);

  // ignore temper command, if walltime limit was already reached

  if (timer->is_timeout()) return;

  for (whichfix = 0; whichfix < modify->nfix; whichfix++)
    if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break;
  if (whichfix == modify->nfix)
@@ -94,39 +99,18 @@ void Temper::command(int narg, char **arg)
  // fix style must be appropriate for temperature control, i.e. it needs
  // to provide a working Fix::reset_target() and must not change the volume.

  if ((strcmp(modify->fix[whichfix]->style,"nvt") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/asphere") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/asphere/omp") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/body") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/eff") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/intel") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/kk") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/kk/host") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/kk/device") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/omp") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/sphere") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"nvt/sphere/omp") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"langevin") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"langevin/drude") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"langevin/eff") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"gld") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"gle") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"rigid/nvt") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"rigid/nvt/small") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"rigid/nvt/omp") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"rigid/nvt/small/omp") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/berendsen") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/berendsen/cuda") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/csvr") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/csld") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/rescale") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/rescale/cuda") != 0) &&
      (strcmp(modify->fix[whichfix]->style,"temp/rescale/eff") != 0))
  if ((!utils::strmatch(modify->fix[whichfix]->style,"^nvt")) &&
      (!utils::strmatch(modify->fix[whichfix]->style,"^langevin")) &&
      (!utils::strmatch(modify->fix[whichfix]->style,"^gl[de]$")) &&
      (!utils::strmatch(modify->fix[whichfix]->style,"^rigid/nvt")) &&
      (!utils::strmatch(modify->fix[whichfix]->style,"^temp/")))
    error->universe_all(FLERR,"Tempering temperature fix is not supported");

  // setup for long tempering run

  update->whichflag = 1;
  timer->init_timeout();

  update->nsteps = nsteps;
  update->beginstep = update->firststep = update->ntimestep;
  update->endstep = update->laststep = update->firststep + nsteps;
@@ -233,7 +217,9 @@ void Temper::command(int narg, char **arg)

    // run for nevery timesteps

    timer->init_timeout();
    update->integrate->run(nevery);
    if (timer->is_timeout()) break;

    // compute PE
    // notify compute it will be called at next swap
+7 −1
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ void TemperGrem::command(int narg, char **arg)
  nevery = force->inumeric(FLERR,arg[1]);
  double lambda = force->numeric(FLERR,arg[2]);

  // ignore temper command, if walltime limit was already reached
  if (timer->is_timeout()) return;

  // Get and check if gREM fix exists
  for (whichfix = 0; whichfix < modify->nfix; whichfix++)
    if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break;
@@ -127,6 +130,8 @@ void TemperGrem::command(int narg, char **arg)
  // setup for long tempering run

  update->whichflag = 1;
  timer->init_timeout();

  update->nsteps = nsteps;
  update->beginstep = update->firststep = update->ntimestep;
  update->endstep = update->laststep = update->firststep + nsteps;
@@ -234,7 +239,9 @@ void TemperGrem::command(int narg, char **arg)

    // run for nevery timesteps

    timer->init_timeout();
    update->integrate->run(nevery);
    if (timer->is_timeout()) break;

    // compute PE
    // notify compute it will be called at next swap
@@ -242,7 +249,6 @@ void TemperGrem::command(int narg, char **arg)
    pe = pe_compute->compute_scalar();
    pe_compute->addstep(update->ntimestep + nevery);


    // which = which of 2 kinds of swaps to do (0,1)

    if (!ranswap) which = iswap % 2;
Loading