Commit 42531389 authored by DallasTrinkle's avatar DallasTrinkle
Browse files

Cleanup of style (removing all tabs, shortened long lines).

parent f7230006
Loading
Loading
Loading
Loading
+100 −97
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ void PairMEAMSpline::read_file(const char* filename)
    char line[MAXLINE];
    fgets(line, MAXLINE, fp);
    
    // Second line holds potential type (currently just "meam/spline") in new potential format.
    // Second line holds potential type ("meam/spline") in new potential format.
    bool isNewFormat;
    long loc = ftell(fp);
    fgets(line, MAXLINE, fp);
@@ -486,7 +486,7 @@ void PairMEAMSpline::read_file(const char* filename)
      }
    } else {
      isNewFormat = false;
      nelements = 1; // old format only handles one species anyway; this is for backwards compatibility
      nelements = 1; // old format only handles one species; (backwards compatibility)
      elements = new char*[1];
      elements[0] = new char[1];
      strcpy(elements[0], "");
@@ -607,7 +607,8 @@ double PairMEAMSpline::init_one(int i, int j)

/* ---------------------------------------------------------------------- */

int PairMEAMSpline::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
int PairMEAMSpline::pack_forward_comm(int n, int *list, double *buf,
				      int pbc_flag, int *pbc)
{
  int* list_iter = list;
  int* list_iter_end = list + n;
@@ -646,7 +647,8 @@ double PairMEAMSpline::memory_usage()


/// Parses the spline knots from a text file.
void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error, bool isNewFormat)
void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error,
					   bool isNewFormat)
{
  char line[MAXLINE];
  
@@ -761,7 +763,8 @@ void PairMEAMSpline::SplineFunction::communicate(MPI_Comm& world, int me)
/// Writes a Gnuplot script that plots the spline function.
///
/// This function is for debugging only!
void PairMEAMSpline::SplineFunction::writeGnuplot(const char* filename, const char* title) const
void PairMEAMSpline::SplineFunction::writeGnuplot(const char* filename,
						  const char* title) const
{
  FILE* fp = fopen(filename, "w");
  fprintf(fp, "#!/usr/bin/env gnuplot\n");
+85 −75
Original line number Diff line number Diff line
@@ -28,10 +28,12 @@ PairStyle(meam/spline,PairMEAMSpline)

namespace LAMMPS_NS {

/// Set this to 1 if you intend to use MEAM potentials with non-uniform spline knots.
/// Set this to 0 if you intend to use only MEAM potentials with spline knots on a uniform grid.
///
/// With SUPPORT_NON_GRID_SPLINES == 0, the code runs about 50% faster.
// Set this to 1 if you intend to use MEAM potentials with
//   non-uniform spline knots.
// Set this to 0 if you intend to use only MEAM potentials with
//   spline knots on a uniform grid.
//
// With SUPPORT_NON_GRID_SPLINES == 0, the code runs about 50% faster.

#define SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES 0

@@ -133,14 +135,16 @@ protected:
        // Do spline interpolation.
        double a = (Xs[khi] - x)/h;
        double b = 1.0 - a; // = (x - X[klo])/h
	return a * Y[klo] + b * Y[khi] + ((a*a*a - a) * Y2[klo] + (b*b*b - b) * Y2[khi])*(h*h)/6.0;
        return a * Y[klo] + b * Y[khi] +
	  ((a*a*a - a) * Y2[klo] + (b*b*b - b) * Y2[khi])*(h*h)/6.0;
#else
	// For a spline with grid points, we can directly calculate the interval X is in.
        // For a spline with regular grid, we directly calculate the interval X is in.
        int klo = (int)(x / h);
        int khi = klo + 1;
        double a = Xs[khi] - x;
        double b = h - a;
	return Y[khi] - a * Ydelta[klo] + ((a*a - hsq) * a * Y2[klo] + (b*b - hsq) * b * Y2[khi]);
        return Y[khi] - a * Ydelta[klo] +
	  ((a*a - hsq) * a * Y2[klo] + (b*b - hsq) * b * Y2[khi]);
#endif
      }
    }
@@ -171,16 +175,22 @@ protected:
        // Do spline interpolation.
        double a = (Xs[khi] - x)/h;
        double b = 1.0 - a; // = (x - X[klo])/h
	deriv = (Y[khi] - Y[klo]) / h + ((3.0*b*b - 1.0) * Y2[khi] - (3.0*a*a - 1.0) * Y2[klo]) * h / 6.0;
	return a * Y[klo] + b * Y[khi] + ((a*a*a - a) * Y2[klo] + (b*b*b - b) * Y2[khi]) * (h*h) / 6.0;
        deriv = (Y[khi] - Y[klo]) / h +
	  ((3.0*b*b - 1.0) * Y2[khi] -
	   (3.0*a*a - 1.0) * Y2[klo]) * h / 6.0;
        return a * Y[klo] + b * Y[khi] +
	  ((a*a*a - a) * Y2[klo] +
	   (b*b*b - b) * Y2[khi]) * (h*h) / 6.0;
#else
	// For a spline with grid points, we can directly calculate the interval X is in.
        // For a spline with regular grid, we directly calculate the interval X is in.
        int klo = (int)(x / h);
        int khi = klo + 1;
        double a = Xs[khi] - x;
        double b = h - a;
	deriv = Ydelta[klo] + ((3.0*b*b - hsq) * Y2[khi] - (3.0*a*a - hsq) * Y2[klo]);
	return Y[khi] - a * Ydelta[klo] + ((a*a - hsq) * a * Y2[klo] + (b*b - hsq) * b * Y2[khi]);
        deriv = Ydelta[klo] + ((3.0*b*b - hsq) * Y2[khi]
			       - (3.0*a*a - hsq) * Y2[klo]);
        return Y[khi] - a * Ydelta[klo] +
	  ((a*a - hsq) * a * Y2[klo] + (b*b - hsq) * b * Y2[khi]);
#endif
      }
    }
+9 −20
Original line number Diff line number Diff line
@@ -140,7 +140,6 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr)

        nextTwoBodyInfo->tag = j;
        nextTwoBodyInfo->r = rij;
        // nextTwoBodyInfo->f = f.eval(rij, nextTwoBodyInfo->fprime);
        nextTwoBodyInfo->f = fs[i_to_potl(j)].eval(rij, nextTwoBodyInfo->fprime);
        nextTwoBodyInfo->del[0] = jdelx / rij;
        nextTwoBodyInfo->del[1] = jdely / rij;
@@ -152,12 +151,9 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr)
                              nextTwoBodyInfo->del[1]*bondk.del[1] +
                              nextTwoBodyInfo->del[2]*bondk.del[2]);
          partial_sum += bondk.f * gs[ij_to_potl(j,bondk.tag)].eval(cos_theta);
          // double cos_theta = (nextTwoBodyInfo->del[0]*bondk.del[0] + nextTwoBodyInfo->del[1]*bondk.del[1] + nextTwoBodyInfo->del[2]*bondk.del[2]);
          // partial_sum += bondk.f * g.eval(cos_theta);
        }

        rho_value += nextTwoBodyInfo->f * partial_sum;
        // rho_value += rho.eval(rij);
        rho_value += rhos[i_to_potl(j)].eval(rij);

        numBonds++;
@@ -167,7 +163,6 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr)

    // Compute embedding energy and its derivative.
    double Uprime_i;
    // double embeddingEnergy = U.eval(rho_value, Uprime_i) - zero_atom_energy;
    double embeddingEnergy = Us[i_to_potl(i)].eval(rho_value, Uprime_i)
      - zero_atom_energies[i_to_potl(i)];
    Uprime_thr[i] = Uprime_i;
@@ -195,7 +190,6 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr)
                                  + bondj.del[1]*bondk->del[1]
                                  + bondj.del[2]*bondk->del[2]);
        double g_prime;
        // double g_value = g.eval(cos_theta, g_prime);
        double g_value = gs[ij_to_potl(j,bondk->tag)].eval(cos_theta, g_prime);
        const double f_rik_prime = bondk->fprime;
        const double f_rik = bondk->f;
@@ -301,16 +295,11 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr)
      if(rij_sq < cutforcesq) {
        double rij = sqrt(rij_sq);

        // double rho_prime;
        // rho.eval(rij, rho_prime);
        // double fpair = rho_prime * (Uprime_values[i] + Uprime_values[j]);
        double rho_prime_i,rho_prime_j;
        rhos[i_to_potl(i)].eval(rij,rho_prime_i);
        rhos[i_to_potl(j)].eval(rij,rho_prime_j);
        double fpair = rho_prime_j * Uprime_values[i] + rho_prime_i*Uprime_values[j];
        
        // double pair_pot_deriv;
        // double pair_pot = phi.eval(rij, pair_pot_deriv);
        double pair_pot_deriv;
        double pair_pot = phis[ij_to_potl(i,j)].eval(rij, pair_pot_deriv);