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

Re-Run clang-format

parent 8fca667e
Loading
Loading
Loading
Loading
+53 −59
Original line number Diff line number Diff line
#ifndef LMP_MEAM_H
#define LMP_MEAM_H

#include <stdlib.h>
#include "memory.h"
#include <stdlib.h>

#define maxelt 5

@@ -10,10 +10,12 @@ namespace LAMMPS_NS {

typedef enum { FCC, BCC, HCP, DIM, DIA, B1, C11, L12, B2 } lattice_t;

class MEAM {
class MEAM
{
public:
  MEAM(Memory* mem);
  ~MEAM();

private:
  Memory* memory;

@@ -64,8 +66,7 @@ class MEAM {

  double Ec_meam[maxelt][maxelt], re_meam[maxelt][maxelt];
  double Omega_meam[maxelt], Z_meam[maxelt];
  double A_meam[maxelt], alpha_meam[maxelt][maxelt],
    rho0_meam[maxelt];
  double A_meam[maxelt], alpha_meam[maxelt][maxelt], rho0_meam[maxelt];
  double delta_meam[maxelt][maxelt];
  double beta0_meam[maxelt], beta1_meam[maxelt];
  double beta2_meam[maxelt], beta3_meam[maxelt];
@@ -81,11 +82,9 @@ class MEAM {

  double** phir;

  double **phirar, **phirar1, **phirar2, **phirar3, **phirar4, **phirar5,
    **phirar6;
  double **phirar, **phirar1, **phirar2, **phirar3, **phirar4, **phirar5, **phirar6;

  double attrac_meam[maxelt][maxelt],
    repuls_meam[maxelt][maxelt];
  double attrac_meam[maxelt][maxelt], repuls_meam[maxelt][maxelt];

  double Cmin_meam[maxelt][maxelt][maxelt];
  double Cmax_meam[maxelt][maxelt][maxelt];
@@ -107,20 +106,19 @@ public:

  int maxneigh;
  double *scrfcn, *dscrfcn, *fcpair;

protected:
  void meam_checkindex(int, int, int, int*, int*);
  void G_gam(double, int, double*, int*);
  void dG_gam(double, int, double*, double*);
  void getscreen(int i, double* scrfcn, double* dscrfcn, double* fcpair,
          double** x, int numneigh, int* firstneigh, int numneigh_full,
          int* firstneigh_full, int ntype, int* type, int* fmap);
  void screen(int i, int j, double** x, double rijsq, double* sij,
       int numneigh_full, int* firstneigh_full, int ntype, int* type, int* fmap);
  void calc_rho1(int i, int ntype, int* type, int* fmap, double** x,
          int numneigh, int* firstneigh, double* scrfcn, double* fcpair);
  void dsij(int i, int j, int k, int jn, int numneigh, double rij2,
     double* dsij1, double* dsij2, int ntype, int* type, int* fmap, double** x,
  void getscreen(int i, double* scrfcn, double* dscrfcn, double* fcpair, double** x, int numneigh,
                 int* firstneigh, int numneigh_full, int* firstneigh_full, int ntype, int* type, int* fmap);
  void screen(int i, int j, double** x, double rijsq, double* sij, int numneigh_full, int* firstneigh_full,
              int ntype, int* type, int* fmap);
  void calc_rho1(int i, int ntype, int* type, int* fmap, double** x, int numneigh, int* firstneigh,
                 double* scrfcn, double* fcpair);
  void dsij(int i, int j, int k, int jn, int numneigh, double rij2, double* dsij1, double* dsij2, int ntype,
            int* type, int* fmap, double** x, double* scrfcn, double* fcpair);
  void fcut(double, double*);
  void dfcut(double, double*, double*);
  void dCfunc(double, double, double, double*);
@@ -131,7 +129,8 @@ public:
  double phi_meam(double, int, int);
  void compute_reference_density();
  void get_shpfcn(double*, lattice_t);
  void get_tavref(double*, double*, double*, double*, double*, double*, double, double, double, double, double, double, double, int, int, lattice_t);
  void get_tavref(double*, double*, double*, double*, double*, double*, double, double, double, double,
                  double, double, double, int, int, lattice_t);
  void get_Zij(int*, lattice_t);
  void get_Zij2(int*, double*, double*, lattice_t, double, double);
  void get_sijk(double, int, int, int, double*);
@@ -140,26 +139,22 @@ public:
  double erose(double, double, double, double, double, double, int);
  void interpolate_meam(int);
  double compute_phi(double, int, int);

public:
  void meam_setup_global(int nelt, lattice_t* lat, double* z, int* ielement, double* atwt,
                   double* alpha, double* b0, double* b1, double* b2,
                   double* b3, double* alat, double* esub, double* asub,
                   double* t0, double* t1, double* t2, double* t3,
                   double* rozero, int* ibar);
  void meam_setup_global(int nelt, lattice_t* lat, double* z, int* ielement, double* atwt, double* alpha,
                         double* b0, double* b1, double* b2, double* b3, double* alat, double* esub,
                         double* asub, double* t0, double* t1, double* t2, double* t3, double* rozero,
                         int* ibar);
  void meam_setup_param(int which, double value, int nindex, int* index /*index(3)*/, int* errorflag);
  void meam_setup_done(double* cutmax);
  void meam_dens_setup(int atom_nmax, int nall, int n_neigh);
  void meam_dens_init(int i, int ntype, int* type, int* fmap, double** x,
                int numneigh, int* firstneigh, int numneigh_full,
                int* firstneigh_full, int fnoffset, int* errorflag);
  void meam_dens_final(int nlocal, int eflag_either, int eflag_global,
                 int eflag_atom, double* eng_vdwl, double* eatom, int ntype,
                 int* type, int* fmap, int* errorflag);
  void meam_force(int i, int eflag_either, int eflag_global,
            int eflag_atom, int vflag_atom, double* eng_vdwl, double* eatom,
            int ntype, int* type, int* fmap, double** x, int numneigh,
            int* firstneigh, int numneigh_full, int* firstneigh_full,
            int fnoffset, double** f, double** vatom,
  void meam_dens_init(int i, int ntype, int* type, int* fmap, double** x, int numneigh, int* firstneigh,
                      int numneigh_full, int* firstneigh_full, int fnoffset, int* errorflag);
  void meam_dens_final(int nlocal, int eflag_either, int eflag_global, int eflag_atom, double* eng_vdwl,
                       double* eatom, int ntype, int* type, int* fmap, int* errorflag);
  void meam_force(int i, int eflag_either, int eflag_global, int eflag_atom, int vflag_atom, double* eng_vdwl,
                  double* eatom, int ntype, int* type, int* fmap, double** x, int numneigh, int* firstneigh,
                  int numneigh_full, int* firstneigh_full, int fnoffset, double** f, double** vatom,
                  int* errorflag);
};

@@ -180,6 +175,5 @@ public:
        for (int __k = 0; __k < maxelt; __k++)                                                               \
          arr[__i][__j][__k] = v;                                                                            \
  }

};
#endif
+11 −26
Original line number Diff line number Diff line
#include "meam.h"
#include <math.h>
#include "math_special.h"
#include <math.h>

using namespace LAMMPS_NS;
// Extern "C" declaration has the form:
@@ -21,9 +21,8 @@ using namespace LAMMPS_NS;
//

void
MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global,
                 int eflag_atom, double* eng_vdwl, double* eatom, int ntype,
                 int* type, int* fmap, int* errorflag)
MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global, int eflag_atom, double* eng_vdwl,
                      double* eatom, int ntype, int* type, int* fmap, int* errorflag)
{
  int i, elti;
  int m;
@@ -43,14 +42,10 @@ MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global,
        rho3[i] = rho3[i] - 3.0 / 5.0 * arho3b[i][m] * arho3b[i][m];
      }
      for (m = 0; m < 6; m++) {
        rho2[i] =
          rho2[i] +
          this->v2D[m] * arho2[i][m] * arho2[i][m];
        rho2[i] = rho2[i] + this->v2D[m] * arho2[i][m] * arho2[i][m];
      }
      for (m = 0; m < 10; m++) {
        rho3[i] =
          rho3[i] +
          this->v3D[m] * arho3[i][m] * arho3[i][m];
        rho3[i] = rho3[i] + this->v3D[m] * arho3[i][m] * arho3[i][m];
      }

      if (rho0[i] > 0.0) {
@@ -69,9 +64,7 @@ MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global,
        }
      }

      gamma[i] = t_ave[i][0] * rho1[i] +
                 t_ave[i][1] * rho2[i] +
                 t_ave[i][2] * rho3[i];
      gamma[i] = t_ave[i][0] * rho1[i] + t_ave[i][1] * rho2[i] + t_ave[i][2] * rho3[i];

      if (rho0[i] > 0.0) {
        gamma[i] = gamma[i] / (rho0[i] * rho0[i]);
@@ -88,13 +81,9 @@ MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global,
        dGbar = 0.0;
      } else {
        if (this->mix_ref_t == 1) {
          gam = (t_ave[i][0] * shp[0] + t_ave[i][1] * shp[1] +
                 t_ave[i][2] * shp[2]) /
                (Z * Z);
          gam = (t_ave[i][0] * shp[0] + t_ave[i][1] * shp[1] + t_ave[i][2] * shp[2]) / (Z * Z);
        } else {
          gam = (this->t1_meam[elti] * shp[0] +
                 this->t2_meam[elti] * shp[1] +
                 this->t3_meam[elti] * shp[2]) /
          gam = (this->t1_meam[elti] * shp[0] + this->t2_meam[elti] * shp[1] + this->t3_meam[elti] * shp[2]) /
                (Z * Z);
        }
        G_gam(gam, this->ibar_meam[elti], &Gbar, errorflag);
@@ -106,9 +95,7 @@ MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global,
          Gbar = 1.0;
          dGbar = 0.0;
        } else {
          gam = (t_ave[i][0] * shp[0] + t_ave[i][1] * shp[1] +
                 t_ave[i][2] * shp[2]) /
                (Z * Z);
          gam = (t_ave[i][0] * shp[0] + t_ave[i][1] * shp[1] + t_ave[i][2] * shp[2]) / (Z * Z);
          dG_gam(gam, this->ibar_meam[elti], &Gbar, &dGbar);
        }
        rho_bkgd = this->rho0_meam[elti] * Z * Gbar;
@@ -196,8 +183,7 @@ MEAM::G_gam(double gamma, int ibar, double* G, int* errorflag)
      //         e.g. gsmooth_factor is 99, {:
      //         gsmooth_switchpoint = -0.99
      //         G = 0.01*(-0.99/gamma)**99
      *G = 1 / (gsmooth_factor + 1) *
           pow((gsmooth_switchpoint / gamma), gsmooth_factor);
      *G = 1 / (gsmooth_factor + 1) * pow((gsmooth_switchpoint / gamma), gsmooth_factor);
      *G = sqrt(*G);
    } else {
      *G = sqrt(1.0 + gamma);
@@ -237,8 +223,7 @@ MEAM::dG_gam(double gamma, int ibar, double* G, double* dG)
      //         e.g. gsmooth_factor is 99, {:
      //         gsmooth_switchpoint = -0.99
      //         G = 0.01*(-0.99/gamma)**99
      *G = 1 / (gsmooth_factor + 1) *
           pow((gsmooth_switchpoint / gamma), gsmooth_factor);
      *G = 1 / (gsmooth_factor + 1) * pow((gsmooth_switchpoint / gamma), gsmooth_factor);
      *G = sqrt(*G);
      *dG = -gsmooth_factor * *G / (2.0 * gamma);
    } else {
+37 −47
Original line number Diff line number Diff line
#include "meam.h"
#include <math.h>
#include "math_special.h"
#include <math.h>

using namespace LAMMPS_NS;


void
MEAM::meam_dens_setup(int atom_nmax, int nall, int n_neigh)
{
@@ -68,20 +67,16 @@ MEAM::meam_dens_setup(int atom_nmax, int nall, int n_neigh)
    rho0[i] = 0.0;
    arho2b[i] = 0.0;
    arho1[i][0] = arho1[i][1] = arho1[i][2] = 0.0;
    for (j = 0; j < 6; j++) arho2[i][j] = 0.0;
    for (j = 0; j < 10; j++) arho3[i][j] = 0.0;
    for (j = 0; j < 6; j++)
      arho2[i][j] = 0.0;
    for (j = 0; j < 10; j++)
      arho3[i][j] = 0.0;
    arho3b[i][0] = arho3b[i][1] = arho3b[i][2] = 0.0;
    t_ave[i][0] = t_ave[i][1] = t_ave[i][2] = 0.0;
    tsq_ave[i][0] = tsq_ave[i][1] = tsq_ave[i][2] = 0.0;
  }
}







//     Extern "C" declaration has the form:
//
//  void meam_dens_init_(int *, int *, int *, double *, int *, int *, int *,
@@ -101,9 +96,8 @@ MEAM::meam_dens_setup(int atom_nmax, int nall, int n_neigh)
//

void
MEAM::meam_dens_init(int i, int ntype, int* type, int* fmap, double** x,
                int numneigh, int* firstneigh, int numneigh_full,
                int* firstneigh_full, int fnoffset, int* errorflag)
MEAM::meam_dens_init(int i, int ntype, int* type, int* fmap, double** x, int numneigh, int* firstneigh,
                     int numneigh_full, int* firstneigh_full, int fnoffset, int* errorflag)
{
  *errorflag = 0;

@@ -118,9 +112,8 @@ MEAM::meam_dens_init(int i, int ntype, int* type, int* fmap, double** x,
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

void
MEAM::getscreen(int i, double* scrfcn, double* dscrfcn, double* fcpair,
          double** x, int numneigh, int* firstneigh, int numneigh_full,
          int* firstneigh_full, int ntype, int* type, int* fmap)
MEAM::getscreen(int i, double* scrfcn, double* dscrfcn, double* fcpair, double** x, int numneigh,
                int* firstneigh, int numneigh_full, int* firstneigh_full, int ntype, int* type, int* fmap)
{
  int jn, j, kn, k;
  int elti, eltj, eltk;
@@ -241,8 +234,8 @@ MEAM::getscreen(int i, double* scrfcn, double* dscrfcn, double* fcpair,
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

void
MEAM::calc_rho1(int i, int ntype, int* type, int* fmap, double** x,
          int numneigh, int* firstneigh, double* scrfcn, double* fcpair)
MEAM::calc_rho1(int i, int ntype, int* type, int* fmap, double** x, int numneigh, int* firstneigh,
                double* scrfcn, double* fcpair)
{
  int jn, j, m, n, p, elti, eltj;
  int nv2, nv3;
@@ -341,8 +334,8 @@ MEAM::calc_rho1(int i, int ntype, int* type, int* fmap, double** x,
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

void
MEAM::screen(int i, int j, double** x, double rijsq, double* sij,
       int numneigh_full, int* firstneigh_full, int ntype, int* type, int* fmap)
MEAM::screen(int i, int j, double** x, double rijsq, double* sij, int numneigh_full, int* firstneigh_full,
             int ntype, int* type, int* fmap)
//     Screening function
//     Inputs:  i = atom 1 id (integer)
//     j = atom 2 id (integer)
@@ -410,9 +403,8 @@ MEAM::screen(int i, int j, double** x, double rijsq, double* sij,
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

void
MEAM::dsij(int i, int j, int k, int jn, int numneigh, double rij2,
     double* dsij1, double* dsij2, int ntype, int* type, int* fmap, double** x,
     double* scrfcn, double* fcpair)
MEAM::dsij(int i, int j, int k, int jn, int numneigh, double rij2, double* dsij1, double* dsij2, int ntype,
           int* type, int* fmap, double** x, double* scrfcn, double* fcpair)
{
  //     Inputs: i,j,k = id's of 3 atom triplet
  //     jn = id of i-j pair
@@ -548,10 +540,8 @@ MEAM::dCfunc2(double rij2, double rik2, double rjk2, double* dCikj1, double* dCi
  b = rik2 + rjk2;
  denom = rij4 - a * a;
  denom = denom * denom;
  *dCikj1 = 4 * rij2 *
            (rij4 + rik4 + 2 * rik2 * rjk2 - 3 * rjk4 - 2 * rij2 * a) / denom;
  *dCikj2 = 4 * rij2 *
            (rij4 - 3 * rik4 + 2 * rik2 * rjk2 + rjk4 + 2 * rij2 * a) / denom;
  *dCikj1 = 4 * rij2 * (rij4 + rik4 + 2 * rik2 * rjk2 - 3 * rjk4 - 2 * rij2 * a) / denom;
  *dCikj2 = 4 * rij2 * (rij4 - 3 * rik4 + 2 * rik2 * rjk2 + rjk4 + 2 * rij2 * a) / denom;

  (void)(b);
}
+68 −111

File changed.

Preview size limit exceeded, changes collapsed.

+2 −3
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ using namespace LAMMPS_NS;

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

MEAM::MEAM(Memory *mem) : memory(mem)
MEAM::MEAM(Memory* mem)
  : memory(mem)
{
  phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = NULL;

@@ -69,5 +70,3 @@ MEAM::~MEAM()
  memory->destroy(this->dscrfcn);
  memory->destroy(this->fcpair);
}

Loading