From c355348ff971f24b9a6fe78646a8d48b2e02a31d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 29 Jul 2020 21:31:51 -0400 Subject: [PATCH] remove local copy of "me" --- src/MISC/fix_ttm.cpp | 10 +++++----- src/MISC/fix_ttm.h | 1 - src/USER-MISC/fix_ttm_mod.cpp | 11 +++++------ src/USER-MISC/fix_ttm_mod.h | 1 - 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index feeb4d2a18..757b2a619b 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -145,7 +145,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : // set initial electron temperatures from user input file - if (me == 0) read_initial_electron_temperatures(arg[13]); + if (comm->me == 0) read_initial_electron_temperatures(arg[13]); MPI_Bcast(&T_electron[0][0][0],total_nnodes,MPI_DOUBLE,0,world); } @@ -153,7 +153,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : FixTTM::~FixTTM() { - if (nfileevery && me == 0) fclose(fp); + if (fp) fclose(fp); delete random; @@ -360,7 +360,7 @@ void FixTTM::read_initial_electron_temperatures(const char *filename) error->one(FLERR,"Fix ttm electron temperatures must be > 0.0"); T_electron[ixnode][iynode][iznode] = T_tmp; - T_initial_set[ixnode][iynode][iznode] = 1; + T_initial_set[ixnode][iynode][iznode] = 1.0; } // check completeness of input data @@ -475,7 +475,7 @@ void FixTTM::end_of_step() (T_electron_old[ixnode][iynode][right_znode] + T_electron_old[ixnode][iynode][left_znode] - 2*T_electron_old[ixnode][iynode][iznode])/dz/dz) - - (net_energy_transfer_all[ixnode][iynode][iznode])/del_vol); + (net_energy_transfer_all[ixnode][iynode][iznode])/del_vol); } } @@ -526,7 +526,7 @@ void FixTTM::end_of_step() MPI_Allreduce(&sum_mass_vsq[0][0][0],&sum_mass_vsq_all[0][0][0], total_nnodes,MPI_DOUBLE,MPI_SUM,world); - if (me == 0) { + if (comm->me == 0) { fmt::print(fp,"{}",update->ntimestep); double T_a; diff --git a/src/MISC/fix_ttm.h b/src/MISC/fix_ttm.h index e3168480b7..de8554e84f 100644 --- a/src/MISC/fix_ttm.h +++ b/src/MISC/fix_ttm.h @@ -48,7 +48,6 @@ class FixTTM : public Fix { double compute_vector(int); private: - int me; int nfileevery; int nlevels_respa; int seed; diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index bcdaa40977..15911ea6e5 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -66,7 +66,7 @@ static const char cite_fix_ttm_mod[] = /* ---------------------------------------------------------------------- */ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) + Fix(lmp, narg, arg), fp(NULL) { if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod); @@ -96,8 +96,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : nfileevery = force->inumeric(FLERR,arg[9]); if (nfileevery > 0) { if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command"); - MPI_Comm_rank(world,&me); - if (me == 0) { + if (comm->me == 0) { fp = fopen(arg[10],"w"); if (fp == NULL) { char str[128]; @@ -159,7 +158,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : atom->add_callback(0); atom->add_callback(1); // set initial electron temperatures from user input file - if (me == 0) read_initial_electron_temperatures(arg[13]); + if (comm->me == 0) read_initial_electron_temperatures(arg[13]); MPI_Bcast(&T_electron[0][0][0],total_nnodes,MPI_DOUBLE,0,world); } @@ -167,7 +166,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : FixTTMMod::~FixTTMMod() { - if (nfileevery && me == 0) fclose(fp); + if (fp) fclose(fp); delete random; delete [] gfactor1; delete [] gfactor2; @@ -806,7 +805,7 @@ void FixTTMMod::end_of_step() total_nnodes,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&t_surface_l,&surface_l, 1,MPI_INT,MPI_MIN,world); - if (me == 0) { + if (comm->me == 0) { fmt::print(fp,"{}",update->ntimestep); double T_a; for (int ixnode = 0; ixnode < nxnodes; ixnode++) diff --git a/src/USER-MISC/fix_ttm_mod.h b/src/USER-MISC/fix_ttm_mod.h index 11338be5f7..f51b79322c 100644 --- a/src/USER-MISC/fix_ttm_mod.h +++ b/src/USER-MISC/fix_ttm_mod.h @@ -53,7 +53,6 @@ class FixTTMMod : public Fix { double compute_vector(int); private: - int me; int nfileevery; int nlevels_respa; int seed;