Unverified Commit 8ec033e8 authored by Steve Plimpton's avatar Steve Plimpton Committed by GitHub
Browse files

Merge pull request #889 from akohlmey/cplusplus-compliance

Collected changes to restore C++ standard compliance
parents a7c94186 9d689182
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -61,13 +61,13 @@ namespace GPU_EXTRA {
      else
        error->all(FLERR,"Unknown error in GPU library");
    }
  };
  }

  inline void gpu_ready(LAMMPS_NS::Modify *modify, LAMMPS_NS::Error *error) {
    int ifix = modify->find_fix("package_gpu");
    if (ifix < 0)
      error->all(FLERR,"The package gpu command is required for gpu styles");
  };
  }
}

#endif
+5 −5
Original line number Diff line number Diff line
@@ -1264,15 +1264,15 @@ void *PairKIM::extract(const char *str, int &dim)
  int ier;
  int dummyint;
  int isIndexed = 0;
  int maxLine = 1024;
  const int MAXLINE = 1024;
  int rank;
  int validParam = 0;
  int numParams;
  int *speciesIndex = new int[maxLine];
  char *paramStr = new char[maxLine];
  int *speciesIndex = new int[MAXLINE];
  char *paramStr = new char[MAXLINE];
  char *paramName;
  char *indexStr;
  char message[maxLine];
  char message[MAXLINE];
  int offset;
  double* paramPtr;

@@ -1354,7 +1354,7 @@ void *PairKIM::extract(const char *str, int &dim)
  }
  kim_error(__LINE__,"get_rank",kimerror);

  int *shape = new int[maxLine];
  int *shape = new int[MAXLINE];
  dummyint = (*pkim).get_shape(paramName, shape, &kimerror);
  if (kimerror == KIM_STATUS_FAIL)
  {
+4 −4
Original line number Diff line number Diff line
@@ -2261,7 +2261,7 @@ void MSM::restriction(int n)
  double ***qgrid2 = qgrid[n+1];

  int k = 0;
  int index[p+2];
  int *index = new int[p+2];
  for (int nu=-p; nu<=p; nu++) {
    if (nu%2 == 0 && nu != 0) continue;
    phi1d[0][k] = compute_phi(nu*delxinv[n+1]/delxinv[n]);
@@ -2317,7 +2317,7 @@ void MSM::restriction(int n)
        }
        qgrid2[kp][jp][ip] += q2sum;
      }

  delete[] index;
}

/* ----------------------------------------------------------------------
@@ -2348,7 +2348,7 @@ void MSM::prolongation(int n)
  double ***v5grid2 = v5grid[n+1];

  int k = 0;
  int index[p+2];
  int *index = new int[p+2];
  for (int nu=-p; nu<=p; nu++) {
    if (nu%2 == 0 && nu != 0) continue;
    phi1d[0][k] = compute_phi(nu*delxinv[n+1]/delxinv[n]);
@@ -2420,7 +2420,7 @@ void MSM::prolongation(int n)
        }

      }

  delete[] index;
}

/* ----------------------------------------------------------------------
+20 −20
Original line number Diff line number Diff line
@@ -310,10 +310,10 @@ double PairComb3::init_one(int i, int j)

void PairComb3::read_lib()
{
  unsigned int maxlib = 1024;
  const unsigned int MAXLIB = 1024;
  int i,j,k,l,nwords,m;
  int ii,jj,kk,ll,mm,iii;
  char s[maxlib];
  char s[MAXLIB];
  char **words = new char*[80];

  // open libraray file on proc 0
@@ -327,8 +327,8 @@ void PairComb3::read_lib()
    }

    // read and store at the same time
    fgets(s,maxlib,fp);
    fgets(s,maxlib,fp);
    fgets(s,MAXLIB,fp);
    fgets(s,MAXLIB,fp);
    nwords = 0;
    words[nwords++] = strtok(s," \t\n\r\f");
    while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -339,7 +339,7 @@ void PairComb3::read_lib()
    ccutoff[4] = atof(words[4]);
    ccutoff[5] = atof(words[5]);

    fgets(s,maxlib,fp);
    fgets(s,MAXLIB,fp);
    nwords = 0;
    words[nwords++] = strtok(s," \t\n\r\f");
    while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -351,7 +351,7 @@ void PairComb3::read_lib()
    ch_a[5] = atof(words[5]);
    ch_a[6] = atof(words[6]);

    fgets(s,maxlib,fp);
    fgets(s,MAXLIB,fp);
    nwords = 0;
    words[nwords++] = strtok(s," \t\n\r\f");
    while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -359,7 +359,7 @@ void PairComb3::read_lib()
    nsplrad = atoi(words[1]);
    nspltor = atoi(words[2]);

    fgets(s,maxlib,fp);
    fgets(s,MAXLIB,fp);
    nwords = 0;
    words[nwords++] = strtok(s," \t\n\r\f");
    while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -367,7 +367,7 @@ void PairComb3::read_lib()
    maxy = atoi(words[1]);
    maxz = atoi(words[2]);

    fgets(s,maxlib,fp);
    fgets(s,MAXLIB,fp);
    nwords = 0;
    words[nwords++] = strtok(s," \t\n\r\f");
    while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -376,7 +376,7 @@ void PairComb3::read_lib()
    maxconj = atoi(words[2]);

    for (l=0; l<nsplpcn; l++) {
      fgets(s,maxlib,fp);
      fgets(s,MAXLIB,fp);
      nwords = 0;
      words[nwords++] = strtok(s," \t\n\r\f");
      while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -385,14 +385,14 @@ void PairComb3::read_lib()
      dvmaxxcn[l] = atof(words[3]);
    }

    fgets(s,maxlib,fp);
    fgets(s,MAXLIB,fp);
    nwords = 0;
    words[nwords++] = strtok(s," \t\n\r\f");
    while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
    ntab = atoi(words[0]);

    for (i=0; i<ntab+1; i++){
      fgets(s,maxlib,fp);
      fgets(s,MAXLIB,fp);
      nwords = 0;
      words[nwords++] = strtok(s," \t\n\r\f");
      while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -405,7 +405,7 @@ void PairComb3::read_lib()
      for (i=0; i<maxx+1; i++)
        for (j=0; j<maxy+1; j++)
          for (k=0; k<maxz+1; k++) {
            fgets(s,maxlib,fp);
            fgets(s,MAXLIB,fp);
            nwords = 0;
            words[nwords++] = strtok(s," \t\n\r\f");
            while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -423,7 +423,7 @@ void PairComb3::read_lib()
      for (i=0; i<maxx; i++)
        for (j=0; j<maxy; j++)
          for (k=0; k<maxz; k++) {
            fgets(s,maxlib,fp);
            fgets(s,MAXLIB,fp);
            nwords = 0;
            words[nwords++] = strtok(s," \t\n\r\f");
            while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -432,7 +432,7 @@ void PairComb3::read_lib()
           jj = atoi(words[2]);
           kk = atoi(words[3]);
           for(iii=0; iii<2; iii++) {
             fgets(s,maxlib,fp);
             fgets(s,MAXLIB,fp);
             nwords = 0;
             words[nwords++] = strtok(s," \t\n\r\f");
             while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -447,7 +447,7 @@ void PairComb3::read_lib()
      for (i=0; i<maxxc+1; i++)
        for (j=0; j<maxyc+1; j++)
          for (k=0; k<maxconj; k++) {
            fgets(s,maxlib,fp);
            fgets(s,MAXLIB,fp);
            nwords = 0;
            words[nwords++] = strtok(s," \t\n\r\f");
            while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -465,7 +465,7 @@ void PairComb3::read_lib()
      for (i=0; i<maxxc; i++)
        for (j=0; j<maxyc; j++)
          for (k=0; k<maxconj-1; k++) {
            fgets(s,maxlib,fp);
            fgets(s,MAXLIB,fp);
            nwords = 0;
            words[nwords++] = strtok(s," \t\n\r\f");
            while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -474,7 +474,7 @@ void PairComb3::read_lib()
            jj = atoi(words[2]);
            kk = atoi(words[3])-1;
            for (iii=0; iii<2; iii++) {
              fgets(s,maxlib,fp);
              fgets(s,MAXLIB,fp);
              nwords = 0;
              words[nwords++] = strtok(s," \t\n\r\f");
              while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -489,7 +489,7 @@ void PairComb3::read_lib()
      for (i=0; i<maxxc+1; i++)
        for (j=0; j<maxyc+1; j++)
          for (k=0; k<maxconj; k++) {
            fgets(s,maxlib,fp);
            fgets(s,MAXLIB,fp);
            nwords = 0;
            words[nwords++] = strtok(s," \t\n\r\f");
            while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -507,7 +507,7 @@ void PairComb3::read_lib()
      for (i=0; i<maxxc; i++)
        for (j=0; j<maxyc; j++)
          for (k=0; k<maxconj-1; k++) {
            fgets(s,maxlib,fp);
            fgets(s,MAXLIB,fp);
            nwords = 0;
            words[nwords++] = strtok(s," \t\n\r\f");
            while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
@@ -516,7 +516,7 @@ void PairComb3::read_lib()
            jj = atoi(words[2]);
            kk = atoi(words[3])-1;
            for(iii=0; iii<2; iii++) {
              fgets(s,maxlib,fp);
              fgets(s,MAXLIB,fp);
              nwords = 0;
              words[nwords++] = strtok(s," \t\n\r\f");
              while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
+10 −6
Original line number Diff line number Diff line
@@ -1349,7 +1349,7 @@ void FixGCMC::attempt_molecule_insertion()
  MathExtra::quat_to_mat(quat,rotmat);

  double insertion_energy = 0.0;
  bool procflag[natoms_per_molecule];
  bool *procflag = new bool[natoms_per_molecule];

  for (int i = 0; i < natoms_per_molecule; i++) {
    MathExtra::matvec(rotmat,onemols[imol]->x[i],molcoords[i]);
@@ -1472,6 +1472,7 @@ void FixGCMC::attempt_molecule_insertion()
    update_gas_atoms_list();
    ninsertion_successes += 1.0;
  }
  delete[] procflag;
}

/* ----------------------------------------------------------------------
@@ -1934,7 +1935,7 @@ void FixGCMC::attempt_molecule_deletion_full()
    grow_molecule_arrays(nmolq);

  int m = 0;
  int tmpmask[atom->nlocal];
  int *tmpmask = new int[atom->nlocal];
  for (int i = 0; i < atom->nlocal; i++) {
    if (atom->molecule[i] == deletion_molecule) {
      tmpmask[i] = atom->mask[i];
@@ -1982,6 +1983,7 @@ void FixGCMC::attempt_molecule_deletion_full()
    if (force->kspace) force->kspace->qsum_qsq();
  }
  update_gas_atoms_list();
  delete[] tmpmask;
}

/* ----------------------------------------------------------------------
@@ -2426,9 +2428,9 @@ void FixGCMC::update_gas_atoms_list()
      for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]);
      tagint maxmol_all;
      MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
      double comx[maxmol_all];
      double comy[maxmol_all];
      double comz[maxmol_all];
      double *comx = new double[maxmol_all];
      double *comy = new double[maxmol_all];
      double *comz = new double[maxmol_all];
      for (int imolecule = 0; imolecule < maxmol_all; imolecule++) {
        for (int i = 0; i < nlocal; i++) {
          if (molecule[i] == imolecule) {
@@ -2458,7 +2460,9 @@ void FixGCMC::update_gas_atoms_list()
          }
        }
      }

      delete[] comx;
      delete[] comy;
      delete[] comz;
    } else {
      for (int i = 0; i < nlocal; i++) {
        if (mask[i] & groupbit) {
Loading