Commit cd6d2c55 authored by Sebastian Hütter's avatar Sebastian Hütter
Browse files

MEAM/C: helper function for x=1

parent 1d928409
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -234,6 +234,10 @@ static inline bool iszero(const double f) {
  return fabs(f) < 1e-20;
}

static inline bool isone(const double f) {
  return fabs(f-1.0) < 1e-20;
}

// Helper functions

static inline double fdiv_zero(const double n, const double d) {
+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ MEAM::getscreen(int i, double* scrfcn, double* dscrfcn, double* fcpair, double**
    //     Now compute derivatives
    dscrfcn[jn] = 0.0;
    sfcij = sij * fcij;
    if (!iszero(sfcij) && !iszero(sfcij - 1.0)) {
    if (!iszero(sfcij) && !isone(sfcij)) {
      for (kn = 0; kn < numneigh_full; kn++) {
        k = firstneigh_full[kn];
        if (k == j) continue;
+2 −2
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ MEAM::meam_force(int i, int eflag_either, int eflag_global, int eflag_atom, int

        //     Now compute forces on other atoms k due to change in sij

        if (iszero(sij) || iszero(sij - 1.0)) continue; //: cont jn loop
        if (iszero(sij) || isone(sij)) continue; //: cont jn loop

        double dxik(0), dyik(0), dzik(0);
        double dxjk(0), dyjk(0), dzjk(0);
@@ -429,7 +429,7 @@ MEAM::meam_force(int i, int eflag_either, int eflag_global, int eflag_atom, int

            dsij1 = 0.0;
            dsij2 = 0.0;
            if (!iszero(sij) && !iszero(sij - 1.0)) {
            if (!iszero(sij) && !isone(sij)) {
              const double rbound = rij2 * this->ebound_meam[elti][eltj];
              delc = Cmax - Cmin;
              dxjk = x[k][0] - x[j][0];
+1 −1
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ void PairMEAMC::read_files(char *globalfile, char *userfile)
    rozero[i] = atof(words[17]);
    ibar[i] = atoi(words[18]);

    if (!iszero(t0[i]-1.0))
    if (!isone(t0[i]))
      error->all(FLERR,"Unsupported parameter in MEAM potential file");

    nset++;