Commit 5ff5bc2a authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

avoid issues detected by coverity scan

parent 02ae2d21
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ void Temper::command(int narg, char **arg)

  my_set_temp = universe->iworld;
  if (narg == 7) my_set_temp = force->inumeric(FLERR,arg[6]);
  if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds))
    error->universe_one(FLERR,"Illegal temperature index");

  // swap frequency must evenly divide total # of timesteps

+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp)
  nparams = 0;
  params = NULL;
  map = NULL;
  cutmax = 0.0;
}

/* ----------------------------------------------------------------------
+8 −6
Original line number Diff line number Diff line
@@ -113,6 +113,8 @@ void TemperGrem::command(int narg, char **arg)

  my_set_lambda = universe->iworld;
  if (narg == 8) my_set_lambda = force->inumeric(FLERR,arg[7]);
  if ((my_set_lambda < 0) || (my_set_lambda >= universe->nworlds))
    error->universe_one(FLERR,"Illegal temperature index");

  // swap frequency must evenly divide total # of timesteps

@@ -271,12 +273,6 @@ void TemperGrem::command(int narg, char **arg)
      partner = world2root[partner_world];
    }

    // compute weights
    volume = domain->xprd * domain->yprd * domain->zprd;
    enth = pe + (pressref * volume);
    weight = log(set_lambda[my_set_lambda] + (eta*(enth + h0)));
    weight_cross = log(set_lambda[partner_set_lambda] + (eta*(enth + h0)));

    // swap with a partner, only root procs in each world participate
    // hi proc sends PE to low proc
    // lo proc make Boltzmann decision on whether to swap
@@ -284,6 +280,12 @@ void TemperGrem::command(int narg, char **arg)

    swap = 0;
    if (partner != -1) {
      // compute weights
      volume = domain->xprd * domain->yprd * domain->zprd;
      enth = pe + (pressref * volume);
      weight = log(set_lambda[my_set_lambda] + (eta*(enth + h0)));
      weight_cross = log(set_lambda[partner_set_lambda] + (eta*(enth + h0)));

      if (me_universe > partner) {
        MPI_Send(&weight,1,MPI_DOUBLE,partner,0,universe->uworld);
        MPI_Send(&weight_cross,1,MPI_DOUBLE,partner,0,universe->uworld);