Unverified Commit 48894884 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

rename count_embed to numforce and move the location where numforce is set to 0

parent 9a43229c
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp)
  nmax = 0;
  rho = NULL;
  fp = NULL;
  count_embed = NULL;
  numforce = NULL;
  map = NULL;
  type2frho = NULL;

@@ -78,7 +78,7 @@ PairEAM::~PairEAM()

  memory->destroy(rho);
  memory->destroy(fp);
  memory->destroy(count_embed);
  memory->destroy(numforce);

  if (allocated) {
    memory->destroy(setflag);
@@ -153,11 +153,11 @@ void PairEAM::compute(int eflag, int vflag)
  if (atom->nmax > nmax) {
    memory->destroy(rho);
    memory->destroy(fp);
    memory->destroy(count_embed);
    memory->destroy(numforce);
    nmax = atom->nmax;
    memory->create(rho,nmax,"pair:rho");
    memory->create(fp,nmax,"pair:fp");
    memory->create(count_embed,nmax,"pair:count_embed");
    memory->create(numforce,nmax,"pair:numforce");
  }

  double **x = atom->x;
@@ -234,7 +234,6 @@ void PairEAM::compute(int eflag, int vflag)
    p = MIN(p,1.0);
    coeff = frho_spline[type2frho[type[i]]][m];
    fp[i] = (coeff[0]*p + coeff[1])*p + coeff[2];
    count_embed[i] = 0;
    if (eflag) {
      phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
      if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
@@ -260,6 +259,7 @@ void PairEAM::compute(int eflag, int vflag)

    jlist = firstneigh[i];
    jnum = numneigh[i];
    numforce[i] = 0;

    for (jj = 0; jj < jnum; jj++) {
      j = jlist[jj];
@@ -271,7 +271,7 @@ void PairEAM::compute(int eflag, int vflag)
      rsq = delx*delx + dely*dely + delz*delz;

      if (rsq < cutforcesq) {
        ++count_embed[i];
        ++numforce[i];
        jtype = type[j];
        r = sqrt(rsq);
        p = r*rdr + 1.0;
@@ -808,7 +808,7 @@ double PairEAM::single(int i, int j, int itype, int jtype,
  double r,p,rhoip,rhojp,z2,z2p,recip,phi,phip,psip;
  double *coeff;

  if (count_embed[i] > 0) {
  if (numforce[i] > 0) {
    p = rho[i]*rdrho + 1.0;
    m = static_cast<int> (p);
    m = MAX(1,MIN(m,nrho-1));
@@ -817,7 +817,7 @@ double PairEAM::single(int i, int j, int itype, int jtype,
    coeff = frho_spline[type2frho[itype]][m];
    phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
    if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
    phi *= 1.0/static_cast<double>(count_embed[i]);
    phi *= 1.0/static_cast<double>(numforce[i]);
  } else phi = 0.0;

  r = sqrt(rsq);
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ class PairEAM : public Pair {
  // per-atom arrays

  double *rho,*fp;
  int *count_embed;
  int *numforce;

  // potentials as file data

+4 −4
Original line number Diff line number Diff line
@@ -82,11 +82,11 @@ void PairEAMOpt::eval()
  if (atom->nmax > nmax) {
    memory->destroy(rho);
    memory->destroy(fp);
    memory->destroy(count_embed);
    memory->destroy(numforce);
    nmax = atom->nmax;
    memory->create(rho,nmax,"pair:rho");
    memory->create(fp,nmax,"pair:fp");
    memory->create(count_embed,nmax,"pair:count_embed");
    memory->create(numforce,nmax,"pair:numforce");
  }

  double** _noalias x = atom->x;
@@ -240,7 +240,6 @@ void PairEAMOpt::eval()
    ++m;
    coeff = frho_spline[type2frho[type[i]]][m];
    fp[i] = (coeff[0]*p + coeff[1])*p + coeff[2];
    count_embed[i] = 0;
    if (EFLAG) {
      double phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
      if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
@@ -272,6 +271,7 @@ void PairEAMOpt::eval()

    fast_gamma_t* _noalias tabssi = &tabss[itype1*ntypes*nr];
    double* _noalias scale_i = scale[itype1+1]+1;
    numforce[i] = 0;

    for (jj = 0; jj < jnum; jj++) {
      j = jlist[jj];
@@ -283,7 +283,7 @@ void PairEAMOpt::eval()
      double rsq = delx*delx + dely*dely + delz*delz;

      if (rsq < tmp_cutforcesq) {
        ++count_embed[i];
        ++numforce[i];
        jtype = type[j] - 1;
        double r = sqrt(rsq);
        double rhoip,rhojp,z2,z2p;
+4 −4
Original line number Diff line number Diff line
@@ -51,11 +51,11 @@ void PairEAMOMP::compute(int eflag, int vflag)
  if (atom->nmax > nmax) {
    memory->destroy(rho);
    memory->destroy(fp);
    memory->destroy(count_embed);
    memory->destroy(numforce);
    nmax = atom->nmax;
    memory->create(rho,nthreads*nmax,"pair:rho");
    memory->create(fp,nmax,"pair:fp");
    memory->create(count_embed,nmax,"pair:count_embed");
    memory->create(numforce,nmax,"pair:numforce");
  }

#if defined(_OPENMP)
@@ -200,7 +200,6 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
    p = MIN(p,1.0);
    coeff = frho_spline[type2frho[type[i]]][m];
    fp[i] = (coeff[0]*p + coeff[1])*p + coeff[2];
    count_embed[i] = 0;
    if (EFLAG) {
      phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
      if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
@@ -235,6 +234,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)

    jlist = firstneigh[i];
    jnum = numneigh[i];
    numforce[i] = 0;

    for (jj = 0; jj < jnum; jj++) {
      j = jlist[jj];
@@ -246,7 +246,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
      rsq = delx*delx + dely*dely + delz*delz;

      if (rsq < cutforcesq) {
        ++count_embed[i];
        ++numforce[i];
        jtype = type[j];
        r = sqrt(rsq);
        p = r*rdr + 1.0;