From eba4be18c29a7bfec117f38df2a3203788be95c2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 31 Aug 2017 14:48:30 -0400 Subject: [PATCH] adapt formatting and naming conventions to fully match LAMMPS style. allow rigid and accelerated integrators. --- src/USER-MISC/temper_npt.cpp | 35 +++++++++++++++++------------------ src/USER-MISC/temper_npt.h | 35 +++++++++++++---------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index c17ce5d2ab..572a52b1a9 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -12,14 +12,9 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing Authors: Amulya K. Pervaje and Cody K. Addington + Contributing Authors: Amulya K. Pervaje and Cody K. Addington, + (North Carolina State University) Contact Email: amulyapervaje@gmail.com - temper/npt is a modification of temper that is applicable to the NPT ensemble - uses the npt acceptance criteria for parallel tempering (replica exchange) as given in - Mori, Y .; Okamoto, Y . Generalized-Ensemble Algorithms for the Isobaric–Isothermal Ensemble. J. Phys. Soc. Japan 2010, 79, 74003. - - temper/npt N M temp fix-ID seed1 seed2 pressure index(optional) - refer to documentation for temper, only difference with temper/npt is that the pressure is specified as the 7th argument, the 8th argument is the same optional index argument used in temper ------------------------------------------------------------------------- */ #include @@ -49,11 +44,11 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -TemperNpt::TemperNpt(LAMMPS *lmp) : Pointers(lmp) {} +TemperNPT::TemperNPT(LAMMPS *lmp) : Pointers(lmp) {} /* ---------------------------------------------------------------------- */ -TemperNpt::~TemperNpt() +TemperNPT::~TemperNPT() { MPI_Comm_free(&roots); if (ranswap) delete ranswap; @@ -68,14 +63,14 @@ TemperNpt::~TemperNpt() perform tempering with inter-world swaps ------------------------------------------------------------------------- */ -void TemperNpt::command(int narg, char **arg) +void TemperNPT::command(int narg, char **arg) { if (universe->nworlds == 1) error->all(FLERR,"Must have more than one processor partition to temper"); if (domain->box_exist == 0) error->all(FLERR,"temper/npt command before simulation box is defined"); if (narg != 7 && narg != 8) - error->universe_all(FLERR,"Illegal temper command"); + error->universe_all(FLERR,"Illegal temper/npt command"); int nsteps = force->inumeric(FLERR,arg[0]); nevery = force->inumeric(FLERR,arg[1]); @@ -96,15 +91,19 @@ void TemperNpt::command(int narg, char **arg) // swap frequency must evenly divide total # of timesteps if (nevery <= 0) - error->universe_all(FLERR,"Invalid frequency in temper command"); + error->universe_all(FLERR,"Invalid frequency in temper/npt command"); nswaps = nsteps/nevery; if (nswaps*nevery != nsteps) - error->universe_all(FLERR,"Non integer # of swaps in temper command"); + error->universe_all(FLERR,"Non integer # of swaps in temper/npt command"); - // 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. + // fix style must be appropriate for temperature and pressure control, + // i.e. it needs to provide a working Fix::reset_target() and must also + // change the volume. This currently only applies to fix npt and + // fix rigid/npt variants - if ((strcmp(modify->fix[whichfix]->style,"npt") != 0)) error->universe_all(FLERR,"Tempering temperature fix is not supported"); + if ((strncmp(modify->fix[whichfix]->style,"npt",3) == 0) + || (strncmp(modify->fix[whichfix]->style,"rigid/npt",9) == 0)) + error->universe_all(FLERR,"Tempering temperature fix is not supported"); // setup for long tempering run @@ -345,7 +344,7 @@ void TemperNpt::command(int narg, char **arg) scale kinetic energy via velocities a la Sugita ------------------------------------------------------------------------- */ -void TemperNpt::scale_velocities(int t_partner, int t_me) +void TemperNPT::scale_velocities(int t_partner, int t_me) { double sfactor = sqrt(set_temp[t_partner]/set_temp[t_me]); @@ -363,7 +362,7 @@ void TemperNpt::scale_velocities(int t_partner, int t_me) proc 0 prints current tempering status ------------------------------------------------------------------------- */ -void TemperNpt::print_status() +void TemperNPT::print_status() { if (universe->uscreen) { fprintf(universe->uscreen,BIGINT_FORMAT,update->ntimestep); diff --git a/src/USER-MISC/temper_npt.h b/src/USER-MISC/temper_npt.h index d05d63bff2..cbc4345995 100644 --- a/src/USER-MISC/temper_npt.h +++ b/src/USER-MISC/temper_npt.h @@ -10,20 +10,11 @@ See the README file in the top-level LAMMPS directory. - Contributing Authors: Amulya K. Pervaje and Cody K. Addington - Contact Email: amulyapervaje@gmail.com - temper/npt is a modification of temper that is applicable to the NPT ensemble - uses the npt acceptance criteria for parallel tempering (replica exchange) as given in - Mori, Y .; Okamoto, Y . Generalized-Ensemble Algorithms for the Isobaric–Isothermal Ensemble. J. Phys. Soc. Japan 2010, 79, 74003. - - temper/npt N M temp fix-ID seed1 seed2 pressure index(optional) - refer to documentation for temper, only difference with temper/npt is that the pressure is - specified as the 7th argument, the 8th argument is the same optional index argument used in temper ------------------------------------------------------------------------- */ #ifdef COMMAND_CLASS -CommandStyle(temper/npt,TemperNpt) +CommandStyle(temper/npt,TemperNPT) #else @@ -34,10 +25,10 @@ CommandStyle(temper/npt,TemperNpt) namespace LAMMPS_NS { -class TemperNpt : protected Pointers { +class TemperNPT : protected Pointers { public: - TemperNpt(class LAMMPS *); - ~TemperNpt(); + TemperNPT(class LAMMPS *); + ~TemperNPT(); void command(int, char **); private: @@ -76,10 +67,10 @@ E: Must have more than one processor partition to temper Cannot use the temper command with only one processor partition. Use the -partition command-line option. -E: TemperNpt command before simulation box is defined +E: temper/npt command before simulation box is defined -The temper command cannot be used before a read_data, read_restart, or -create_box command. +The temper/npt command cannot be used before a read_data, read_restart, +or create_box command. E: Illegal ... command @@ -89,21 +80,21 @@ command-line option when running LAMMPS to see the offending line. E: Tempering fix ID is not defined -The fix ID specified by the temper command does not exist. +The fix ID specified by the temper/npt command does not exist. -E: Invalid frequency in temper command +E: Invalid frequency in temper/npt command Nevery must be > 0. -E: Non integer # of swaps in temper command +E: Non integer # of swaps in temper/npt command -Swap frequency in temper command must evenly divide the total # of -timesteps. +Swap frequency in temper/npt command must evenly divide the total +# of timesteps. E: Tempering temperature fix is not valid The fix specified by the temper command is not one that controls -temperature (nvt or langevin). +temperature and pressure (npt). E: Too many timesteps