remove local copy of "me"

This commit is contained in:
Axel Kohlmeyer
2020-07-29 21:31:51 -04:00
parent 5452f72bd9
commit c355348ff9
4 changed files with 10 additions and 13 deletions

View File

@ -145,7 +145,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
// set initial electron temperatures from user input file // 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); 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() FixTTM::~FixTTM()
{ {
if (nfileevery && me == 0) fclose(fp); if (fp) fclose(fp);
delete random; 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"); error->one(FLERR,"Fix ttm electron temperatures must be > 0.0");
T_electron[ixnode][iynode][iznode] = T_tmp; 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 // check completeness of input data
@ -526,7 +526,7 @@ void FixTTM::end_of_step()
MPI_Allreduce(&sum_mass_vsq[0][0][0],&sum_mass_vsq_all[0][0][0], MPI_Allreduce(&sum_mass_vsq[0][0][0],&sum_mass_vsq_all[0][0][0],
total_nnodes,MPI_DOUBLE,MPI_SUM,world); total_nnodes,MPI_DOUBLE,MPI_SUM,world);
if (me == 0) { if (comm->me == 0) {
fmt::print(fp,"{}",update->ntimestep); fmt::print(fp,"{}",update->ntimestep);
double T_a; double T_a;

View File

@ -48,7 +48,6 @@ class FixTTM : public Fix {
double compute_vector(int); double compute_vector(int);
private: private:
int me;
int nfileevery; int nfileevery;
int nlevels_respa; int nlevels_respa;
int seed; int seed;

View File

@ -66,7 +66,7 @@ static const char cite_fix_ttm_mod[] =
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : 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); 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]); nfileevery = force->inumeric(FLERR,arg[9]);
if (nfileevery > 0) { if (nfileevery > 0) {
if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command"); if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command");
MPI_Comm_rank(world,&me); if (comm->me == 0) {
if (me == 0) {
fp = fopen(arg[10],"w"); fp = fopen(arg[10],"w");
if (fp == NULL) { if (fp == NULL) {
char str[128]; char str[128];
@ -159,7 +158,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) :
atom->add_callback(0); atom->add_callback(0);
atom->add_callback(1); atom->add_callback(1);
// set initial electron temperatures from user input file // 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); 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() FixTTMMod::~FixTTMMod()
{ {
if (nfileevery && me == 0) fclose(fp); if (fp) fclose(fp);
delete random; delete random;
delete [] gfactor1; delete [] gfactor1;
delete [] gfactor2; delete [] gfactor2;
@ -806,7 +805,7 @@ void FixTTMMod::end_of_step()
total_nnodes,MPI_DOUBLE,MPI_SUM,world); total_nnodes,MPI_DOUBLE,MPI_SUM,world);
MPI_Allreduce(&t_surface_l,&surface_l, MPI_Allreduce(&t_surface_l,&surface_l,
1,MPI_INT,MPI_MIN,world); 1,MPI_INT,MPI_MIN,world);
if (me == 0) { if (comm->me == 0) {
fmt::print(fp,"{}",update->ntimestep); fmt::print(fp,"{}",update->ntimestep);
double T_a; double T_a;
for (int ixnode = 0; ixnode < nxnodes; ixnode++) for (int ixnode = 0; ixnode < nxnodes; ixnode++)

View File

@ -53,7 +53,6 @@ class FixTTMMod : public Fix {
double compute_vector(int); double compute_vector(int);
private: private:
int me;
int nfileevery; int nfileevery;
int nlevels_respa; int nlevels_respa;
int seed; int seed;