Convert to C++, allow multiple instances
This commit is contained in:
@ -2,7 +2,7 @@ This package implements the MEAM/C potential as a LAMMPS pair style.
|
||||
|
||||
+==============================================================================+
|
||||
|
||||
This package is a translation of the MEAM package to native C. See
|
||||
This package is a translation of the MEAM package to native C++. See
|
||||
that package as well as the Fortran code distributed in lib/meam for
|
||||
the original sources and information.
|
||||
|
||||
|
||||
@ -1,117 +1,176 @@
|
||||
#ifndef LMP_MEAM_H
|
||||
#define LMP_MEAM_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define maxelt 5
|
||||
#define maxelt 5
|
||||
|
||||
extern "C" {
|
||||
double fm_exp(double);
|
||||
}
|
||||
|
||||
typedef enum {FCC, BCC, HCP, DIM, DIA, B1, C11, L12, B2} lattice_t;
|
||||
typedef enum { FCC, BCC, HCP, DIM, DIA, B1, C11, L12, B2 } lattice_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int dim1, dim2;
|
||||
double *ptr;
|
||||
double* ptr;
|
||||
} allocatable_double_2d;
|
||||
|
||||
typedef struct {
|
||||
// cutforce = force cutoff
|
||||
// cutforcesq = force cutoff squared
|
||||
class MEAM {
|
||||
private:
|
||||
// cutforce = force cutoff
|
||||
// cutforcesq = force cutoff squared
|
||||
|
||||
double cutforce,cutforcesq;
|
||||
double cutforce, cutforcesq;
|
||||
|
||||
// Ec_meam = cohesive energy
|
||||
// re_meam = nearest-neighbor distance
|
||||
// Omega_meam = atomic volume
|
||||
// B_meam = bulk modulus
|
||||
// Z_meam = number of first neighbors for reference structure
|
||||
// ielt_meam = atomic number of element
|
||||
// A_meam = adjustable parameter
|
||||
// alpha_meam = sqrt(9*Omega*B/Ec)
|
||||
// rho0_meam = density scaling parameter
|
||||
// delta_meam = heat of formation for alloys
|
||||
// beta[0-3]_meam = electron density constants
|
||||
// t[0-3]_meam = coefficients on densities in Gamma computation
|
||||
// rho_ref_meam = background density for reference structure
|
||||
// ibar_meam(i) = selection parameter for Gamma function for elt i,
|
||||
// lattce_meam(i,j) = lattce configuration for elt i or alloy (i,j)
|
||||
// neltypes = maximum number of element type defined
|
||||
// eltind = index number of pair (similar to Voigt notation; ij = ji)
|
||||
// phir = pair potential function array
|
||||
// phirar[1-6] = spline coeffs
|
||||
// attrac_meam = attraction parameter in Rose energy
|
||||
// repuls_meam = repulsion parameter in Rose energy
|
||||
// nn2_meam = 1 if second nearest neighbors are to be computed, else 0
|
||||
// zbl_meam = 1 if zbl potential for small r to be use, else 0
|
||||
// emb_lin_neg = 1 if linear embedding function for rhob to be used, else 0
|
||||
// bkgd_dyn = 1 if reference densities follows Dynamo, else 0
|
||||
// Cmin_meam, Cmax_meam = min and max values in screening cutoff
|
||||
// rc_meam = cutoff distance for meam
|
||||
// delr_meam = cutoff region for meam
|
||||
// ebound_meam = factor giving maximum boundary of sceen fcn ellipse
|
||||
// augt1 = flag for whether t1 coefficient should be augmented
|
||||
// ialloy = flag for newer alloy formulation (as in dynamo code)
|
||||
// mix_ref_t = flag to recover "old" way of computing t in reference config
|
||||
// erose_form = selection parameter for form of E_rose function
|
||||
// gsmooth_factor = factor determining length of G smoothing region
|
||||
// vind[23]D = Voight notation index maps for 2 and 3D
|
||||
// v2D,v3D = array of factors to apply for Voight notation
|
||||
// Ec_meam = cohesive energy
|
||||
// re_meam = nearest-neighbor distance
|
||||
// Omega_meam = atomic volume
|
||||
// B_meam = bulk modulus
|
||||
// Z_meam = number of first neighbors for reference structure
|
||||
// ielt_meam = atomic number of element
|
||||
// A_meam = adjustable parameter
|
||||
// alpha_meam = sqrt(9*Omega*B/Ec)
|
||||
// rho0_meam = density scaling parameter
|
||||
// delta_meam = heat of formation for alloys
|
||||
// beta[0-3]_meam = electron density constants
|
||||
// t[0-3]_meam = coefficients on densities in Gamma computation
|
||||
// rho_ref_meam = background density for reference structure
|
||||
// ibar_meam(i) = selection parameter for Gamma function for elt i,
|
||||
// lattce_meam(i,j) = lattce configuration for elt i or alloy (i,j)
|
||||
// neltypes = maximum number of element type defined
|
||||
// eltind = index number of pair (similar to Voigt notation; ij = ji)
|
||||
// phir = pair potential function array
|
||||
// phirar[1-6] = spline coeffs
|
||||
// attrac_meam = attraction parameter in Rose energy
|
||||
// repuls_meam = repulsion parameter in Rose energy
|
||||
// nn2_meam = 1 if second nearest neighbors are to be computed, else 0
|
||||
// zbl_meam = 1 if zbl potential for small r to be use, else 0
|
||||
// emb_lin_neg = 1 if linear embedding function for rhob to be used, else 0
|
||||
// bkgd_dyn = 1 if reference densities follows Dynamo, else 0
|
||||
// Cmin_meam, Cmax_meam = min and max values in screening cutoff
|
||||
// rc_meam = cutoff distance for meam
|
||||
// delr_meam = cutoff region for meam
|
||||
// ebound_meam = factor giving maximum boundary of sceen fcn ellipse
|
||||
// augt1 = flag for whether t1 coefficient should be augmented
|
||||
// ialloy = flag for newer alloy formulation (as in dynamo code)
|
||||
// mix_ref_t = flag to recover "old" way of computing t in reference config
|
||||
// erose_form = selection parameter for form of E_rose function
|
||||
// gsmooth_factor = factor determining length of G smoothing region
|
||||
// vind[23]D = Voight notation index maps for 2 and 3D
|
||||
// v2D,v3D = array of factors to apply for Voight notation
|
||||
|
||||
// nr,dr = pair function discretization parameters
|
||||
// nrar,rdrar = spline coeff array parameters
|
||||
// nr,dr = pair function discretization parameters
|
||||
// nrar,rdrar = spline coeff array parameters
|
||||
|
||||
double Ec_meam[maxelt+1][maxelt+1],re_meam[maxelt+1][maxelt+1];
|
||||
double Omega_meam[maxelt+1],Z_meam[maxelt+1];
|
||||
double A_meam[maxelt+1],alpha_meam[maxelt+1][maxelt+1],rho0_meam[maxelt+1];
|
||||
double delta_meam[maxelt+1][maxelt+1];
|
||||
double beta0_meam[maxelt+1],beta1_meam[maxelt+1];
|
||||
double beta2_meam[maxelt+1],beta3_meam[maxelt+1];
|
||||
double t0_meam[maxelt+1],t1_meam[maxelt+1];
|
||||
double t2_meam[maxelt+1],t3_meam[maxelt+1];
|
||||
double rho_ref_meam[maxelt+1];
|
||||
int ibar_meam[maxelt+1],ielt_meam[maxelt+1];
|
||||
lattice_t lattce_meam[maxelt+1][maxelt+1];
|
||||
int nn2_meam[maxelt+1][maxelt+1];
|
||||
int zbl_meam[maxelt+1][maxelt+1];
|
||||
int eltind[maxelt+1][maxelt+1];
|
||||
double Ec_meam[maxelt + 1][maxelt + 1], re_meam[maxelt + 1][maxelt + 1];
|
||||
double Omega_meam[maxelt + 1], Z_meam[maxelt + 1];
|
||||
double A_meam[maxelt + 1], alpha_meam[maxelt + 1][maxelt + 1],
|
||||
rho0_meam[maxelt + 1];
|
||||
double delta_meam[maxelt + 1][maxelt + 1];
|
||||
double beta0_meam[maxelt + 1], beta1_meam[maxelt + 1];
|
||||
double beta2_meam[maxelt + 1], beta3_meam[maxelt + 1];
|
||||
double t0_meam[maxelt + 1], t1_meam[maxelt + 1];
|
||||
double t2_meam[maxelt + 1], t3_meam[maxelt + 1];
|
||||
double rho_ref_meam[maxelt + 1];
|
||||
int ibar_meam[maxelt + 1], ielt_meam[maxelt + 1];
|
||||
lattice_t lattce_meam[maxelt + 1][maxelt + 1];
|
||||
int nn2_meam[maxelt + 1][maxelt + 1];
|
||||
int zbl_meam[maxelt + 1][maxelt + 1];
|
||||
int eltind[maxelt + 1][maxelt + 1];
|
||||
int neltypes;
|
||||
|
||||
allocatable_double_2d phir; // [:,:]
|
||||
|
||||
allocatable_double_2d phirar,phirar1,phirar2,phirar3,phirar4,phirar5,phirar6; // [:,:]
|
||||
allocatable_double_2d phirar, phirar1, phirar2, phirar3, phirar4, phirar5,
|
||||
phirar6; // [:,:]
|
||||
|
||||
double attrac_meam[maxelt+1][maxelt+1],repuls_meam[maxelt+1][maxelt+1];
|
||||
double attrac_meam[maxelt + 1][maxelt + 1],
|
||||
repuls_meam[maxelt + 1][maxelt + 1];
|
||||
|
||||
double Cmin_meam[maxelt+1][maxelt+1][maxelt+1];
|
||||
double Cmax_meam[maxelt+1][maxelt+1][maxelt+1];
|
||||
double rc_meam,delr_meam,ebound_meam[maxelt+1][maxelt+1];
|
||||
double Cmin_meam[maxelt + 1][maxelt + 1][maxelt + 1];
|
||||
double Cmax_meam[maxelt + 1][maxelt + 1][maxelt + 1];
|
||||
double rc_meam, delr_meam, ebound_meam[maxelt + 1][maxelt + 1];
|
||||
int augt1, ialloy, mix_ref_t, erose_form;
|
||||
int emb_lin_neg, bkgd_dyn;
|
||||
double gsmooth_factor;
|
||||
int vind2D[3+1][3+1],vind3D[3+1][3+1][3+1];
|
||||
int v2D[6+1],v3D[10+1];
|
||||
int vind2D[3 + 1][3 + 1], vind3D[3 + 1][3 + 1][3 + 1];
|
||||
int v2D[6 + 1], v3D[10 + 1];
|
||||
|
||||
int nr,nrar;
|
||||
double dr,rdrar;
|
||||
} meam_data_t;
|
||||
int nr, nrar;
|
||||
double dr, rdrar;
|
||||
public:
|
||||
void meam_checkindex(int, int, int, int*, int*);
|
||||
void meam_setup_param_(int*, double*, int*, int*, int*);
|
||||
void meam_dens_final_(int*, int*, int*, int*, int*, double*, double*, int*, int*, int*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, int*);
|
||||
void G_gam(double, int, double, double*, int*);
|
||||
void dG_gam(double, int, double, double*, double*);
|
||||
void meam_dens_init_(int*, int*, int*, int*, int*, double*, int*, int*, int*, int*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, int*);
|
||||
void getscreen(int, int, double*, double*, double*, double*, int, int*, int, int*, int, int*, int*);
|
||||
void screen(int, int, int, double*, double, double*, int, int*, int, int*, int*);
|
||||
void calc_rho1(int, int, int, int*, int*, double*, int, int*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*);
|
||||
void dsij(int, int, int, int, int, int, double, double*, double*, int, int*, int*, double*, double*, double*);
|
||||
void fcut(double, double*);
|
||||
void dfcut(double, double*, double*);
|
||||
void dCfunc(double, double, double, double*);
|
||||
void dCfunc2(double, double, double, double*, double*);
|
||||
|
||||
extern meam_data_t meam_data;
|
||||
void meam_force_(int*, int*, int*, int*, int*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, int*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, int*);
|
||||
void meam_cleanup_();
|
||||
void meam_setup_done_(double*);
|
||||
void alloyparams();
|
||||
void compute_pair_meam();
|
||||
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_Zij(int*, lattice_t);
|
||||
void get_Zij2(int*, double*, double*, lattice_t, double, double);
|
||||
void get_sijk(double, int, int, int, double*);
|
||||
void get_densref(double, int, int, double*, double*, double*, double*, double*, double*, double*, double*);
|
||||
double zbl(double, int, int);
|
||||
double erose(double, double, double, double, double, double, int);
|
||||
void interpolate_meam(int);
|
||||
double compute_phi(double, int, int);
|
||||
void meam_setup_global_(int*, int*, double*, int*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, int*);
|
||||
|
||||
};
|
||||
|
||||
// Functions we need for compat
|
||||
#ifndef max
|
||||
#define max(a,b) \
|
||||
({ __typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a > _b ? _a : _b; })
|
||||
#define max(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) \
|
||||
({ __typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a < _b ? _a : _b; })
|
||||
#define min(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define iszero(f) (fabs(f)<1e-20)
|
||||
#define iszero(f) (fabs(f) < 1e-20)
|
||||
|
||||
#define setall2d(arr, v) {for(int __i=1;__i<=maxelt;__i++) for(int __j=1;__j<=maxelt;__j++) arr[__i][__j] = v;}
|
||||
#define setall3d(arr, v) {for(int __i=1;__i<=maxelt;__i++) for(int __j=1;__j<=maxelt;__j++) for(int __k=1;__k<=maxelt;__k++) arr[__i][__j][__k] = v;}
|
||||
#define setall2d(arr, v) \
|
||||
{ \
|
||||
for (int __i = 1; __i <= maxelt; __i++) \
|
||||
for (int __j = 1; __j <= maxelt; __j++) \
|
||||
arr[__i][__j] = v; \
|
||||
}
|
||||
#define setall3d(arr, v) \
|
||||
{ \
|
||||
for (int __i = 1; __i <= maxelt; __i++) \
|
||||
for (int __j = 1; __j <= maxelt; __j++) \
|
||||
for (int __k = 1; __k <= maxelt; __k++) \
|
||||
arr[__i][__j][__k] = v; \
|
||||
}
|
||||
|
||||
/*
|
||||
Fortran Array Semantics in C.
|
||||
@ -124,34 +183,37 @@ Fortran Array Semantics in C.
|
||||
|
||||
// we receive a pointer to the first element, and F dimensions is ptr(a,b,c)
|
||||
// we know c data structure is ptr[c][b][a]
|
||||
#define arrdim2v(ptr,a,b) \
|
||||
const int DIM1__##ptr = a; const int DIM2__##ptr = b;\
|
||||
(void)(DIM1__##ptr); (void)(DIM2__##ptr);
|
||||
#define arrdim3v(ptr,a,b,c) \
|
||||
const int DIM1__##ptr = a; const int DIM2__##ptr = b; const int DIM3__##ptr = c;\
|
||||
#define arrdim2v(ptr, a, b) \
|
||||
const int DIM1__##ptr = a; \
|
||||
const int DIM2__##ptr = b; \
|
||||
(void)(DIM1__##ptr); \
|
||||
(void)(DIM2__##ptr);
|
||||
#define arrdim3v(ptr, a, b, c) \
|
||||
const int DIM1__##ptr = a; \
|
||||
const int DIM2__##ptr = b; \
|
||||
const int DIM3__##ptr = c; \
|
||||
(void)(DIM1__##ptr); (void)(DIM2__##ptr; (void)(DIM3__##ptr);
|
||||
|
||||
|
||||
// access data with same index as used in fortran (1-based)
|
||||
#define arr1v(ptr,i) \
|
||||
ptr[i-1]
|
||||
#define arr2v(ptr,i,j) \
|
||||
ptr[(DIM1__##ptr)*(j-1) + (i-1)]
|
||||
#define arr3v(ptr,i,j,k) \
|
||||
ptr[(i-1) + (j-1)*(DIM1__##ptr) + (k-1)*(DIM1__##ptr)*(DIM2__##ptr)]
|
||||
#define arr1v(ptr, i) ptr[i - 1]
|
||||
#define arr2v(ptr, i, j) ptr[(DIM1__##ptr) * (j - 1) + (i - 1)]
|
||||
#define arr3v(ptr, i, j, k) \
|
||||
ptr[(i - 1) + (j - 1) * (DIM1__##ptr) + \
|
||||
(k - 1) * (DIM1__##ptr) * (DIM2__##ptr)]
|
||||
|
||||
// allocatable arrays via special type
|
||||
#define allocate_2d(arr,cols,rows) \
|
||||
arr.dim1 = cols; arr.dim2=rows; arr.ptr=(double*)calloc((size_t)(cols)*(size_t)(rows),sizeof(double));
|
||||
#define allocated(a) \
|
||||
(a.ptr!=NULL)
|
||||
#define deallocate(a) \
|
||||
({free(a.ptr); a.ptr=NULL;})
|
||||
#define allocate_2d(arr, cols, rows) \
|
||||
arr.dim1 = cols; \
|
||||
arr.dim2 = rows; \
|
||||
arr.ptr = (double*)calloc((size_t)(cols) * (size_t)(rows), sizeof(double));
|
||||
#define allocated(a) (a.ptr != NULL)
|
||||
#define meam_deallocate(a) \
|
||||
({ \
|
||||
free(a.ptr); \
|
||||
a.ptr = NULL; \
|
||||
})
|
||||
// access data with same index as used in fortran (1-based)
|
||||
#define arr2(arr,i,j) \
|
||||
arr.ptr[(arr.dim1)*(j-1) + (i-1)]
|
||||
|
||||
|
||||
|
||||
#define arr2(arr, i, j) arr.ptr[(arr.dim1) * (j - 1) + (i - 1)]
|
||||
|
||||
|
||||
#endif
|
||||
@ -1,17 +1,15 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
|
||||
void
|
||||
meam_cleanup_(void)
|
||||
MEAM::meam_cleanup_(void)
|
||||
{
|
||||
|
||||
deallocate(meam_data.phirar6);
|
||||
deallocate(meam_data.phirar5);
|
||||
deallocate(meam_data.phirar4);
|
||||
deallocate(meam_data.phirar3);
|
||||
deallocate(meam_data.phirar2);
|
||||
deallocate(meam_data.phirar1);
|
||||
deallocate(meam_data.phirar);
|
||||
deallocate(meam_data.phir);
|
||||
}
|
||||
meam_deallocate(this->phirar6);
|
||||
meam_deallocate(this->phirar5);
|
||||
meam_deallocate(this->phirar4);
|
||||
meam_deallocate(this->phirar3);
|
||||
meam_deallocate(this->phirar2);
|
||||
meam_deallocate(this->phirar1);
|
||||
meam_deallocate(this->phirar);
|
||||
meam_deallocate(this->phir);
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
|
||||
meam_data_t meam_data = {};
|
||||
}
|
||||
@ -1,15 +1,6 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
#include <math.h>
|
||||
|
||||
void G_gam(double Gamma, int ibar, double gsmooth_factor, double* G,
|
||||
int* errorflag);
|
||||
void dG_gam(double Gamma, int ibar, double gsmooth_factor, double* G,
|
||||
double* dG);
|
||||
|
||||
// in meam_setup_done
|
||||
void get_shpfcn(double* s /* s(3) */, lattice_t latt);
|
||||
|
||||
// Extern "C" declaration has the form:
|
||||
//
|
||||
// void meam_dens_final_(int *, int *, int *, int *, int *, double *, double *,
|
||||
@ -28,7 +19,7 @@ void get_shpfcn(double* s /* s(3) */, lattice_t latt);
|
||||
//
|
||||
|
||||
void
|
||||
meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
MEAM::meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
int* eflag_atom, double* eng_vdwl, double* eatom, int* ntype,
|
||||
int* type, int* fmap, double* Arho1, double* Arho2,
|
||||
double* Arho2b, double* Arho3, double* Arho3b, double* t_ave,
|
||||
@ -67,23 +58,23 @@ meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
for (m = 1; m <= 6; m++) {
|
||||
arr1v(rho2, i) =
|
||||
arr1v(rho2, i) +
|
||||
meam_data.v2D[m] * arr2v(Arho2, m, i) * arr2v(Arho2, m, i);
|
||||
this->v2D[m] * arr2v(Arho2, m, i) * arr2v(Arho2, m, i);
|
||||
}
|
||||
for (m = 1; m <= 10; m++) {
|
||||
arr1v(rho3, i) =
|
||||
arr1v(rho3, i) +
|
||||
meam_data.v3D[m] * arr2v(Arho3, m, i) * arr2v(Arho3, m, i);
|
||||
this->v3D[m] * arr2v(Arho3, m, i) * arr2v(Arho3, m, i);
|
||||
}
|
||||
|
||||
if (arr1v(rho0, i) > 0.0) {
|
||||
if (meam_data.ialloy == 1) {
|
||||
if (this->ialloy == 1) {
|
||||
arr2v(t_ave, 1, i) = arr2v(t_ave, 1, i) / arr2v(tsq_ave, 1, i);
|
||||
arr2v(t_ave, 2, i) = arr2v(t_ave, 2, i) / arr2v(tsq_ave, 2, i);
|
||||
arr2v(t_ave, 3, i) = arr2v(t_ave, 3, i) / arr2v(tsq_ave, 3, i);
|
||||
} else if (meam_data.ialloy == 2) {
|
||||
arr2v(t_ave, 1, i) = meam_data.t1_meam[elti];
|
||||
arr2v(t_ave, 2, i) = meam_data.t2_meam[elti];
|
||||
arr2v(t_ave, 3, i) = meam_data.t3_meam[elti];
|
||||
} else if (this->ialloy == 2) {
|
||||
arr2v(t_ave, 1, i) = this->t1_meam[elti];
|
||||
arr2v(t_ave, 2, i) = this->t2_meam[elti];
|
||||
arr2v(t_ave, 3, i) = this->t3_meam[elti];
|
||||
} else {
|
||||
arr2v(t_ave, 1, i) = arr2v(t_ave, 1, i) / arr1v(rho0, i);
|
||||
arr2v(t_ave, 2, i) = arr2v(t_ave, 2, i) / arr1v(rho0, i);
|
||||
@ -99,56 +90,56 @@ meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
arr1v(Gamma, i) = arr1v(Gamma, i) / (arr1v(rho0, i) * arr1v(rho0, i));
|
||||
}
|
||||
|
||||
Z = meam_data.Z_meam[elti];
|
||||
Z = this->Z_meam[elti];
|
||||
|
||||
G_gam(arr1v(Gamma, i), meam_data.ibar_meam[elti],
|
||||
meam_data.gsmooth_factor, &G, errorflag);
|
||||
G_gam(arr1v(Gamma, i), this->ibar_meam[elti],
|
||||
this->gsmooth_factor, &G, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
get_shpfcn(shp, meam_data.lattce_meam[elti][elti]);
|
||||
if (meam_data.ibar_meam[elti] <= 0) {
|
||||
get_shpfcn(shp, this->lattce_meam[elti][elti]);
|
||||
if (this->ibar_meam[elti] <= 0) {
|
||||
Gbar = 1.0;
|
||||
dGbar = 0.0;
|
||||
} else {
|
||||
if (meam_data.mix_ref_t == 1) {
|
||||
if (this->mix_ref_t == 1) {
|
||||
gam = (arr2v(t_ave, 1, i) * shp[1] + arr2v(t_ave, 2, i) * shp[2] +
|
||||
arr2v(t_ave, 3, i) * shp[3]) /
|
||||
(Z * Z);
|
||||
} else {
|
||||
gam = (meam_data.t1_meam[elti] * shp[1] +
|
||||
meam_data.t2_meam[elti] * shp[2] +
|
||||
meam_data.t3_meam[elti] * shp[3]) /
|
||||
gam = (this->t1_meam[elti] * shp[1] +
|
||||
this->t2_meam[elti] * shp[2] +
|
||||
this->t3_meam[elti] * shp[3]) /
|
||||
(Z * Z);
|
||||
}
|
||||
G_gam(gam, meam_data.ibar_meam[elti], meam_data.gsmooth_factor, &Gbar,
|
||||
G_gam(gam, this->ibar_meam[elti], this->gsmooth_factor, &Gbar,
|
||||
errorflag);
|
||||
}
|
||||
arr1v(rho, i) = arr1v(rho0, i) * G;
|
||||
|
||||
if (meam_data.mix_ref_t == 1) {
|
||||
if (meam_data.ibar_meam[elti] <= 0) {
|
||||
if (this->mix_ref_t == 1) {
|
||||
if (this->ibar_meam[elti] <= 0) {
|
||||
Gbar = 1.0;
|
||||
dGbar = 0.0;
|
||||
} else {
|
||||
gam = (arr2v(t_ave, 1, i) * shp[1] + arr2v(t_ave, 2, i) * shp[2] +
|
||||
arr2v(t_ave, 3, i) * shp[3]) /
|
||||
(Z * Z);
|
||||
dG_gam(gam, meam_data.ibar_meam[elti], meam_data.gsmooth_factor,
|
||||
dG_gam(gam, this->ibar_meam[elti], this->gsmooth_factor,
|
||||
&Gbar, &dGbar);
|
||||
}
|
||||
rho_bkgd = meam_data.rho0_meam[elti] * Z * Gbar;
|
||||
rho_bkgd = this->rho0_meam[elti] * Z * Gbar;
|
||||
} else {
|
||||
if (meam_data.bkgd_dyn == 1) {
|
||||
rho_bkgd = meam_data.rho0_meam[elti] * Z;
|
||||
if (this->bkgd_dyn == 1) {
|
||||
rho_bkgd = this->rho0_meam[elti] * Z;
|
||||
} else {
|
||||
rho_bkgd = meam_data.rho_ref_meam[elti];
|
||||
rho_bkgd = this->rho_ref_meam[elti];
|
||||
}
|
||||
}
|
||||
rhob = arr1v(rho, i) / rho_bkgd;
|
||||
denom = 1.0 / rho_bkgd;
|
||||
|
||||
dG_gam(arr1v(Gamma, i), meam_data.ibar_meam[elti],
|
||||
meam_data.gsmooth_factor, &G, &dG);
|
||||
dG_gam(arr1v(Gamma, i), this->ibar_meam[elti],
|
||||
this->gsmooth_factor, &G, &dG);
|
||||
|
||||
arr1v(dGamma1, i) = (G - 2 * dG * arr1v(Gamma, i)) * denom;
|
||||
|
||||
@ -161,30 +152,30 @@ meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
// dGamma3 is nonzero only if we are using the "mixed" rule for
|
||||
// computing t in the reference system (which is not correct, but
|
||||
// included for backward compatibility
|
||||
if (meam_data.mix_ref_t == 1) {
|
||||
if (this->mix_ref_t == 1) {
|
||||
arr1v(dGamma3, i) = arr1v(rho0, i) * G * dGbar / (Gbar * Z * Z) * denom;
|
||||
} else {
|
||||
arr1v(dGamma3, i) = 0.0;
|
||||
}
|
||||
|
||||
B = meam_data.A_meam[elti] * meam_data.Ec_meam[elti][elti];
|
||||
B = this->A_meam[elti] * this->Ec_meam[elti][elti];
|
||||
|
||||
if (!iszero(rhob)) {
|
||||
if (meam_data.emb_lin_neg == 1 && rhob <= 0) {
|
||||
if (this->emb_lin_neg == 1 && rhob <= 0) {
|
||||
arr1v(fp, i) = -B;
|
||||
} else {
|
||||
arr1v(fp, i) = B * (log(rhob) + 1.0);
|
||||
}
|
||||
if (*eflag_either != 0) {
|
||||
if (*eflag_global != 0) {
|
||||
if (meam_data.emb_lin_neg == 1 && rhob <= 0) {
|
||||
if (this->emb_lin_neg == 1 && rhob <= 0) {
|
||||
*eng_vdwl = *eng_vdwl - B * rhob;
|
||||
} else {
|
||||
*eng_vdwl = *eng_vdwl + B * rhob * log(rhob);
|
||||
}
|
||||
}
|
||||
if (*eflag_atom != 0) {
|
||||
if (meam_data.emb_lin_neg == 1 && rhob <= 0) {
|
||||
if (this->emb_lin_neg == 1 && rhob <= 0) {
|
||||
arr1v(eatom, i) = arr1v(eatom, i) - B * rhob;
|
||||
} else {
|
||||
arr1v(eatom, i) = arr1v(eatom, i) + B * rhob * log(rhob);
|
||||
@ -192,7 +183,7 @@ meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (meam_data.emb_lin_neg == 1) {
|
||||
if (this->emb_lin_neg == 1) {
|
||||
arr1v(fp, i) = -B;
|
||||
} else {
|
||||
arr1v(fp, i) = B;
|
||||
@ -205,7 +196,7 @@ meam_dens_final_(int* nlocal, int* nmax, int* eflag_either, int* eflag_global,
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
G_gam(double Gamma, int ibar, double gsmooth_factor, double* G, int* errorflag)
|
||||
MEAM::G_gam(double Gamma, int ibar, double gsmooth_factor, double* G, int* errorflag)
|
||||
{
|
||||
// Compute G(Gamma) based on selection flag ibar:
|
||||
// 0 => G = sqrt(1+Gamma)
|
||||
@ -246,7 +237,7 @@ G_gam(double Gamma, int ibar, double gsmooth_factor, double* G, int* errorflag)
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
dG_gam(double Gamma, int ibar, double gsmooth_factor, double* G, double* dG)
|
||||
MEAM::dG_gam(double Gamma, int ibar, double gsmooth_factor, double* G, double* dG)
|
||||
{
|
||||
// Compute G(Gamma) and dG(gamma) based on selection flag ibar:
|
||||
// 0 => G = sqrt(1+Gamma)
|
||||
@ -289,4 +280,3 @@ dG_gam(double Gamma, int ibar, double gsmooth_factor, double* G, double* dG)
|
||||
}
|
||||
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
}
|
||||
@ -1,27 +1,6 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
#include <math.h>
|
||||
|
||||
void getscreen(int i, int nmax, 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 calc_rho1(int i, int nmax, int ntype, int* type, int* fmap, double* x,
|
||||
int numneigh, int* firstneigh, double* scrfcn, double* fcpair,
|
||||
double* rho0, double* arho1, double* arho2, double* arho2b,
|
||||
double* arho3, double* arho3b, double* t_ave, double* tsq_ave);
|
||||
|
||||
void screen(int i, int j, int nmax, double* x, double rijsq, double* sij,
|
||||
int numneigh_full, int* firstneigh_full, int ntype, int* type,
|
||||
int* fmap);
|
||||
void dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
double* dsij1, double* dsij2, int ntype, int* type, int* fmap,
|
||||
double* x, double* scrfcn, double* fcpair);
|
||||
void fcut(double xi, double* fc);
|
||||
void dfcut(double xi, double* fc, double* dfc);
|
||||
void dCfunc(double rij2, double rik2, double rjk2, double* dCikj);
|
||||
void dCfunc2(double rij2, double rik2, double rjk2, double* dCikj1,
|
||||
double* dCikj2);
|
||||
|
||||
// Extern "C" declaration has the form:
|
||||
//
|
||||
// void meam_dens_init_(int *, int *, int *, double *, int *, int *, int *,
|
||||
@ -41,7 +20,7 @@ void dCfunc2(double rij2, double rik2, double rjk2, double* dCikj1,
|
||||
//
|
||||
|
||||
void
|
||||
meam_dens_init_(int* i, int* nmax, int* ntype, int* type, int* fmap, double* x,
|
||||
MEAM::meam_dens_init_(int* i, int* nmax, int* ntype, int* type, int* fmap, double* x,
|
||||
int* numneigh, int* firstneigh, int* numneigh_full,
|
||||
int* firstneigh_full, double* scrfcn, double* dscrfcn,
|
||||
double* fcpair, double* rho0, double* arho1, double* arho2,
|
||||
@ -62,7 +41,7 @@ meam_dens_init_(int* i, int* nmax, int* ntype, int* type, int* fmap, double* x,
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
MEAM::getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
double* x, int numneigh, int* firstneigh, int numneigh_full,
|
||||
int* firstneigh_full, int ntype, int* type, int* fmap)
|
||||
{
|
||||
@ -81,7 +60,7 @@ getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
/*unused:double dC1a,dC1b,dC2a,dC2b;*/
|
||||
double rnorm, fc, dfc, drinv;
|
||||
|
||||
drinv = 1.0 / meam_data.delr_meam;
|
||||
drinv = 1.0 / this->delr_meam;
|
||||
elti = arr1v(fmap, arr1v(type, i));
|
||||
|
||||
if (elti > 0) {
|
||||
@ -105,12 +84,12 @@ getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
delzij = zjtmp - zitmp;
|
||||
rij2 = delxij * delxij + delyij * delyij + delzij * delzij;
|
||||
rij = sqrt(rij2);
|
||||
if (rij > meam_data.rc_meam) {
|
||||
if (rij > this->rc_meam) {
|
||||
fcij = 0.0;
|
||||
dfcij = 0.0;
|
||||
sij = 0.0;
|
||||
} else {
|
||||
rnorm = (meam_data.rc_meam - rij) * drinv;
|
||||
rnorm = (this->rc_meam - rij) * drinv;
|
||||
screen(i, j, nmax, x, rij2, &sij, numneigh_full, firstneigh_full,
|
||||
ntype, type, fmap);
|
||||
dfcut(rnorm, &fc, &dfc);
|
||||
@ -123,7 +102,7 @@ getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
sfcij = sij * fcij;
|
||||
if (iszero(sfcij) || iszero(sfcij - 1.0))
|
||||
goto LABEL_100;
|
||||
rbound = meam_data.ebound_meam[elti][eltj] * rij2;
|
||||
rbound = this->ebound_meam[elti][eltj] * rij2;
|
||||
for (kn = 1; kn <= numneigh_full; kn++) {
|
||||
k = arr1v(firstneigh_full, kn);
|
||||
if (k == j)
|
||||
@ -154,8 +133,8 @@ getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
if (a <= 0.0)
|
||||
continue;
|
||||
cikj = (2.0 * (xik + xjk) + a - 2.0) / a;
|
||||
Cmax = meam_data.Cmax_meam[elti][eltj][eltk];
|
||||
Cmin = meam_data.Cmin_meam[elti][eltj][eltk];
|
||||
Cmax = this->Cmax_meam[elti][eltj][eltk];
|
||||
Cmin = this->Cmin_meam[elti][eltj][eltk];
|
||||
if (cikj >= Cmax) {
|
||||
continue;
|
||||
// Note that cikj may be slightly negative (within numerical
|
||||
@ -189,7 +168,7 @@ getscreen(int i, int nmax, double* scrfcn, double* dscrfcn, double* fcpair,
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
calc_rho1(int i, int nmax, int ntype, int* type, int* fmap, double* x,
|
||||
MEAM::calc_rho1(int i, int nmax, int ntype, int* type, int* fmap, double* x,
|
||||
int numneigh, int* firstneigh, double* scrfcn, double* fcpair,
|
||||
double* rho0, double* arho1, double* arho2, double* arho2b,
|
||||
double* arho3, double* arho3b, double* t_ave, double* tsq_ave)
|
||||
@ -222,65 +201,65 @@ calc_rho1(int i, int nmax, int ntype, int* type, int* fmap, double* x,
|
||||
delij[2] = arr2v(x, 2, j) - ytmp;
|
||||
delij[3] = arr2v(x, 3, j) - ztmp;
|
||||
rij2 = delij[1] * delij[1] + delij[2] * delij[2] + delij[3] * delij[3];
|
||||
if (rij2 < meam_data.cutforcesq) {
|
||||
if (rij2 < this->cutforcesq) {
|
||||
eltj = arr1v(fmap, arr1v(type, j));
|
||||
rij = sqrt(rij2);
|
||||
ai = rij / meam_data.re_meam[elti][elti] - 1.0;
|
||||
aj = rij / meam_data.re_meam[eltj][eltj] - 1.0;
|
||||
ro0i = meam_data.rho0_meam[elti];
|
||||
ro0j = meam_data.rho0_meam[eltj];
|
||||
rhoa0j = ro0j * fm_exp(-meam_data.beta0_meam[eltj] * aj) * sij;
|
||||
rhoa1j = ro0j * fm_exp(-meam_data.beta1_meam[eltj] * aj) * sij;
|
||||
rhoa2j = ro0j * fm_exp(-meam_data.beta2_meam[eltj] * aj) * sij;
|
||||
rhoa3j = ro0j * fm_exp(-meam_data.beta3_meam[eltj] * aj) * sij;
|
||||
rhoa0i = ro0i * fm_exp(-meam_data.beta0_meam[elti] * ai) * sij;
|
||||
rhoa1i = ro0i * fm_exp(-meam_data.beta1_meam[elti] * ai) * sij;
|
||||
rhoa2i = ro0i * fm_exp(-meam_data.beta2_meam[elti] * ai) * sij;
|
||||
rhoa3i = ro0i * fm_exp(-meam_data.beta3_meam[elti] * ai) * sij;
|
||||
if (meam_data.ialloy == 1) {
|
||||
rhoa1j = rhoa1j * meam_data.t1_meam[eltj];
|
||||
rhoa2j = rhoa2j * meam_data.t2_meam[eltj];
|
||||
rhoa3j = rhoa3j * meam_data.t3_meam[eltj];
|
||||
rhoa1i = rhoa1i * meam_data.t1_meam[elti];
|
||||
rhoa2i = rhoa2i * meam_data.t2_meam[elti];
|
||||
rhoa3i = rhoa3i * meam_data.t3_meam[elti];
|
||||
ai = rij / this->re_meam[elti][elti] - 1.0;
|
||||
aj = rij / this->re_meam[eltj][eltj] - 1.0;
|
||||
ro0i = this->rho0_meam[elti];
|
||||
ro0j = this->rho0_meam[eltj];
|
||||
rhoa0j = ro0j * fm_exp(-this->beta0_meam[eltj] * aj) * sij;
|
||||
rhoa1j = ro0j * fm_exp(-this->beta1_meam[eltj] * aj) * sij;
|
||||
rhoa2j = ro0j * fm_exp(-this->beta2_meam[eltj] * aj) * sij;
|
||||
rhoa3j = ro0j * fm_exp(-this->beta3_meam[eltj] * aj) * sij;
|
||||
rhoa0i = ro0i * fm_exp(-this->beta0_meam[elti] * ai) * sij;
|
||||
rhoa1i = ro0i * fm_exp(-this->beta1_meam[elti] * ai) * sij;
|
||||
rhoa2i = ro0i * fm_exp(-this->beta2_meam[elti] * ai) * sij;
|
||||
rhoa3i = ro0i * fm_exp(-this->beta3_meam[elti] * ai) * sij;
|
||||
if (this->ialloy == 1) {
|
||||
rhoa1j = rhoa1j * this->t1_meam[eltj];
|
||||
rhoa2j = rhoa2j * this->t2_meam[eltj];
|
||||
rhoa3j = rhoa3j * this->t3_meam[eltj];
|
||||
rhoa1i = rhoa1i * this->t1_meam[elti];
|
||||
rhoa2i = rhoa2i * this->t2_meam[elti];
|
||||
rhoa3i = rhoa3i * this->t3_meam[elti];
|
||||
}
|
||||
arr1v(rho0, i) = arr1v(rho0, i) + rhoa0j;
|
||||
arr1v(rho0, j) = arr1v(rho0, j) + rhoa0i;
|
||||
// For ialloy = 2, use single-element value (not average)
|
||||
if (meam_data.ialloy != 2) {
|
||||
if (this->ialloy != 2) {
|
||||
arr2v(t_ave, 1, i) =
|
||||
arr2v(t_ave, 1, i) + meam_data.t1_meam[eltj] * rhoa0j;
|
||||
arr2v(t_ave, 1, i) + this->t1_meam[eltj] * rhoa0j;
|
||||
arr2v(t_ave, 2, i) =
|
||||
arr2v(t_ave, 2, i) + meam_data.t2_meam[eltj] * rhoa0j;
|
||||
arr2v(t_ave, 2, i) + this->t2_meam[eltj] * rhoa0j;
|
||||
arr2v(t_ave, 3, i) =
|
||||
arr2v(t_ave, 3, i) + meam_data.t3_meam[eltj] * rhoa0j;
|
||||
arr2v(t_ave, 3, i) + this->t3_meam[eltj] * rhoa0j;
|
||||
arr2v(t_ave, 1, j) =
|
||||
arr2v(t_ave, 1, j) + meam_data.t1_meam[elti] * rhoa0i;
|
||||
arr2v(t_ave, 1, j) + this->t1_meam[elti] * rhoa0i;
|
||||
arr2v(t_ave, 2, j) =
|
||||
arr2v(t_ave, 2, j) + meam_data.t2_meam[elti] * rhoa0i;
|
||||
arr2v(t_ave, 2, j) + this->t2_meam[elti] * rhoa0i;
|
||||
arr2v(t_ave, 3, j) =
|
||||
arr2v(t_ave, 3, j) + meam_data.t3_meam[elti] * rhoa0i;
|
||||
arr2v(t_ave, 3, j) + this->t3_meam[elti] * rhoa0i;
|
||||
}
|
||||
if (meam_data.ialloy == 1) {
|
||||
if (this->ialloy == 1) {
|
||||
arr2v(tsq_ave, 1, i) =
|
||||
arr2v(tsq_ave, 1, i) +
|
||||
meam_data.t1_meam[eltj] * meam_data.t1_meam[eltj] * rhoa0j;
|
||||
this->t1_meam[eltj] * this->t1_meam[eltj] * rhoa0j;
|
||||
arr2v(tsq_ave, 2, i) =
|
||||
arr2v(tsq_ave, 2, i) +
|
||||
meam_data.t2_meam[eltj] * meam_data.t2_meam[eltj] * rhoa0j;
|
||||
this->t2_meam[eltj] * this->t2_meam[eltj] * rhoa0j;
|
||||
arr2v(tsq_ave, 3, i) =
|
||||
arr2v(tsq_ave, 3, i) +
|
||||
meam_data.t3_meam[eltj] * meam_data.t3_meam[eltj] * rhoa0j;
|
||||
this->t3_meam[eltj] * this->t3_meam[eltj] * rhoa0j;
|
||||
arr2v(tsq_ave, 1, j) =
|
||||
arr2v(tsq_ave, 1, j) +
|
||||
meam_data.t1_meam[elti] * meam_data.t1_meam[elti] * rhoa0i;
|
||||
this->t1_meam[elti] * this->t1_meam[elti] * rhoa0i;
|
||||
arr2v(tsq_ave, 2, j) =
|
||||
arr2v(tsq_ave, 2, j) +
|
||||
meam_data.t2_meam[elti] * meam_data.t2_meam[elti] * rhoa0i;
|
||||
this->t2_meam[elti] * this->t2_meam[elti] * rhoa0i;
|
||||
arr2v(tsq_ave, 3, j) =
|
||||
arr2v(tsq_ave, 3, j) +
|
||||
meam_data.t3_meam[elti] * meam_data.t3_meam[elti] * rhoa0i;
|
||||
this->t3_meam[elti] * this->t3_meam[elti] * rhoa0i;
|
||||
}
|
||||
arr1v(arho2b, i) = arr1v(arho2b, i) + rhoa2j;
|
||||
arr1v(arho2b, j) = arr1v(arho2b, j) + rhoa2i;
|
||||
@ -321,7 +300,7 @@ calc_rho1(int i, int nmax, int ntype, int* type, int* fmap, double* x,
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
screen(int i, int j, int nmax, double* x, double rijsq, double* sij,
|
||||
MEAM::screen(int i, int j, int nmax, 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)
|
||||
@ -345,7 +324,7 @@ screen(int i, int j, int nmax, double* x, double rijsq, double* sij,
|
||||
elti = arr1v(fmap, arr1v(type, j));
|
||||
|
||||
// if rjksq > ebound*rijsq, atom k is definitely outside the ellipse
|
||||
rbound = meam_data.ebound_meam[elti][eltj] * rijsq;
|
||||
rbound = this->ebound_meam[elti][eltj] * rijsq;
|
||||
|
||||
for (nk = 1; nk <= numneigh_full; nk++) {
|
||||
k = arr1v(firstneigh_full, nk);
|
||||
@ -372,8 +351,8 @@ screen(int i, int j, int nmax, double* x, double rijsq, double* sij,
|
||||
if (a <= 0.0)
|
||||
continue;
|
||||
cikj = (2.0 * (xik + xjk) + a - 2.0) / a;
|
||||
Cmax = meam_data.Cmax_meam[elti][eltj][eltk];
|
||||
Cmin = meam_data.Cmin_meam[elti][eltj][eltk];
|
||||
Cmax = this->Cmax_meam[elti][eltj][eltk];
|
||||
Cmin = this->Cmin_meam[elti][eltj][eltk];
|
||||
if (cikj >= Cmax)
|
||||
continue;
|
||||
// note that cikj may be slightly negative (within numerical
|
||||
@ -394,7 +373,7 @@ screen(int i, int j, int nmax, double* x, double rijsq, double* sij,
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
MEAM::dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
double* dsij1, double* dsij2, int ntype, int* type, int* fmap, double* x,
|
||||
double* scrfcn, double* fcpair)
|
||||
{
|
||||
@ -416,13 +395,13 @@ dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
elti = arr1v(fmap, arr1v(type, i));
|
||||
eltj = arr1v(fmap, arr1v(type, j));
|
||||
eltk = arr1v(fmap, arr1v(type, k));
|
||||
Cmax = meam_data.Cmax_meam[elti][eltj][eltk];
|
||||
Cmin = meam_data.Cmin_meam[elti][eltj][eltk];
|
||||
Cmax = this->Cmax_meam[elti][eltj][eltk];
|
||||
Cmin = this->Cmin_meam[elti][eltj][eltk];
|
||||
|
||||
*dsij1 = 0.0;
|
||||
*dsij2 = 0.0;
|
||||
if (!iszero(sij) && !iszero(sij - 1.0)) {
|
||||
rbound = rij2 * meam_data.ebound_meam[elti][eltj];
|
||||
rbound = rij2 * this->ebound_meam[elti][eltj];
|
||||
delc = Cmax - Cmin;
|
||||
dxjk = arr2v(x, 1, k) - arr2v(x, 1, j);
|
||||
dyjk = arr2v(x, 2, k) - arr2v(x, 2, j);
|
||||
@ -456,7 +435,7 @@ dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
fcut(double xi, double* fc)
|
||||
MEAM::fcut(double xi, double* fc)
|
||||
{
|
||||
// cutoff function
|
||||
double a;
|
||||
@ -477,7 +456,7 @@ fcut(double xi, double* fc)
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
dfcut(double xi, double* fc, double* dfc)
|
||||
MEAM::dfcut(double xi, double* fc, double* dfc)
|
||||
{
|
||||
// cutoff function and its derivative
|
||||
double a, a3, a4;
|
||||
@ -501,7 +480,7 @@ dfcut(double xi, double* fc, double* dfc)
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
dCfunc(double rij2, double rik2, double rjk2, double* dCikj)
|
||||
MEAM::dCfunc(double rij2, double rik2, double rjk2, double* dCikj)
|
||||
{
|
||||
// Inputs: rij,rij2,rik2,rjk2
|
||||
// Outputs: dCikj = derivative of Cikj w.r.t. rij
|
||||
@ -518,7 +497,7 @@ dCfunc(double rij2, double rik2, double rjk2, double* dCikj)
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
||||
void
|
||||
dCfunc2(double rij2, double rik2, double rjk2, double* dCikj1, double* dCikj2)
|
||||
MEAM::dCfunc2(double rij2, double rik2, double rjk2, double* dCikj1, double* dCikj2)
|
||||
{
|
||||
// Inputs: rij,rij2,rik2,rjk2
|
||||
// Outputs: dCikj1 = derivative of Cikj w.r.t. rik
|
||||
@ -541,4 +520,3 @@ dCfunc2(double rij2, double rik2, double rjk2, double* dCikj1, double* dCikj2)
|
||||
}
|
||||
|
||||
// ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
}
|
||||
@ -1,15 +1,6 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
#include <math.h>
|
||||
|
||||
// in meam_setup_done
|
||||
void get_shpfcn(double* s /* s(3) */, lattice_t latt);
|
||||
|
||||
// in meam_dens_init
|
||||
void dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
double* dsij1, double* dsij2, int ntype, int* type, int* fmap,
|
||||
double* x, double* scrfcn, double* fcpair);
|
||||
|
||||
// Extern "C" declaration has the form:
|
||||
//
|
||||
// void meam_force_(int *, int *, int *, double *, int *, int *, int *, double
|
||||
@ -32,7 +23,7 @@ void dsij(int i, int j, int k, int jn, int nmax, int numneigh, double rij2,
|
||||
//
|
||||
|
||||
void
|
||||
meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
MEAM::meam_force_(int* iptr, int* nmax, 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,
|
||||
@ -113,27 +104,27 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
delij[2] = arr2v(x, 2, j) - yitmp;
|
||||
delij[3] = arr2v(x, 3, j) - zitmp;
|
||||
rij2 = delij[1] * delij[1] + delij[2] * delij[2] + delij[3] * delij[3];
|
||||
if (rij2 < meam_data.cutforcesq) {
|
||||
if (rij2 < this->cutforcesq) {
|
||||
rij = sqrt(rij2);
|
||||
r = rij;
|
||||
|
||||
// Compute phi and phip
|
||||
ind = meam_data.eltind[elti][eltj];
|
||||
pp = rij * meam_data.rdrar + 1.0;
|
||||
ind = this->eltind[elti][eltj];
|
||||
pp = rij * this->rdrar + 1.0;
|
||||
kk = (int)pp;
|
||||
kk = min(kk, meam_data.nrar - 1);
|
||||
kk = min(kk, this->nrar - 1);
|
||||
pp = pp - kk;
|
||||
pp = min(pp, 1.0);
|
||||
phi = ((arr2(meam_data.phirar3, kk, ind) * pp +
|
||||
arr2(meam_data.phirar2, kk, ind)) *
|
||||
phi = ((arr2(this->phirar3, kk, ind) * pp +
|
||||
arr2(this->phirar2, kk, ind)) *
|
||||
pp +
|
||||
arr2(meam_data.phirar1, kk, ind)) *
|
||||
arr2(this->phirar1, kk, ind)) *
|
||||
pp +
|
||||
arr2(meam_data.phirar, kk, ind);
|
||||
phip = (arr2(meam_data.phirar6, kk, ind) * pp +
|
||||
arr2(meam_data.phirar5, kk, ind)) *
|
||||
arr2(this->phirar, kk, ind);
|
||||
phip = (arr2(this->phirar6, kk, ind) * pp +
|
||||
arr2(this->phirar5, kk, ind)) *
|
||||
pp +
|
||||
arr2(meam_data.phirar4, kk, ind);
|
||||
arr2(this->phirar4, kk, ind);
|
||||
recip = 1.0 / r;
|
||||
|
||||
if (*eflag_either != 0) {
|
||||
@ -149,30 +140,30 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
// write(1,*) "force_meamf: phip: ",phip
|
||||
|
||||
// Compute pair densities and derivatives
|
||||
invrei = 1.0 / meam_data.re_meam[elti][elti];
|
||||
invrei = 1.0 / this->re_meam[elti][elti];
|
||||
ai = rij * invrei - 1.0;
|
||||
ro0i = meam_data.rho0_meam[elti];
|
||||
rhoa0i = ro0i * fm_exp(-meam_data.beta0_meam[elti] * ai);
|
||||
drhoa0i = -meam_data.beta0_meam[elti] * invrei * rhoa0i;
|
||||
rhoa1i = ro0i * fm_exp(-meam_data.beta1_meam[elti] * ai);
|
||||
drhoa1i = -meam_data.beta1_meam[elti] * invrei * rhoa1i;
|
||||
rhoa2i = ro0i * fm_exp(-meam_data.beta2_meam[elti] * ai);
|
||||
drhoa2i = -meam_data.beta2_meam[elti] * invrei * rhoa2i;
|
||||
rhoa3i = ro0i * fm_exp(-meam_data.beta3_meam[elti] * ai);
|
||||
drhoa3i = -meam_data.beta3_meam[elti] * invrei * rhoa3i;
|
||||
ro0i = this->rho0_meam[elti];
|
||||
rhoa0i = ro0i * fm_exp(-this->beta0_meam[elti] * ai);
|
||||
drhoa0i = -this->beta0_meam[elti] * invrei * rhoa0i;
|
||||
rhoa1i = ro0i * fm_exp(-this->beta1_meam[elti] * ai);
|
||||
drhoa1i = -this->beta1_meam[elti] * invrei * rhoa1i;
|
||||
rhoa2i = ro0i * fm_exp(-this->beta2_meam[elti] * ai);
|
||||
drhoa2i = -this->beta2_meam[elti] * invrei * rhoa2i;
|
||||
rhoa3i = ro0i * fm_exp(-this->beta3_meam[elti] * ai);
|
||||
drhoa3i = -this->beta3_meam[elti] * invrei * rhoa3i;
|
||||
|
||||
if (elti != eltj) {
|
||||
invrej = 1.0 / meam_data.re_meam[eltj][eltj];
|
||||
invrej = 1.0 / this->re_meam[eltj][eltj];
|
||||
aj = rij * invrej - 1.0;
|
||||
ro0j = meam_data.rho0_meam[eltj];
|
||||
rhoa0j = ro0j * fm_exp(-meam_data.beta0_meam[eltj] * aj);
|
||||
drhoa0j = -meam_data.beta0_meam[eltj] * invrej * rhoa0j;
|
||||
rhoa1j = ro0j * fm_exp(-meam_data.beta1_meam[eltj] * aj);
|
||||
drhoa1j = -meam_data.beta1_meam[eltj] * invrej * rhoa1j;
|
||||
rhoa2j = ro0j * fm_exp(-meam_data.beta2_meam[eltj] * aj);
|
||||
drhoa2j = -meam_data.beta2_meam[eltj] * invrej * rhoa2j;
|
||||
rhoa3j = ro0j * fm_exp(-meam_data.beta3_meam[eltj] * aj);
|
||||
drhoa3j = -meam_data.beta3_meam[eltj] * invrej * rhoa3j;
|
||||
ro0j = this->rho0_meam[eltj];
|
||||
rhoa0j = ro0j * fm_exp(-this->beta0_meam[eltj] * aj);
|
||||
drhoa0j = -this->beta0_meam[eltj] * invrej * rhoa0j;
|
||||
rhoa1j = ro0j * fm_exp(-this->beta1_meam[eltj] * aj);
|
||||
drhoa1j = -this->beta1_meam[eltj] * invrej * rhoa1j;
|
||||
rhoa2j = ro0j * fm_exp(-this->beta2_meam[eltj] * aj);
|
||||
drhoa2j = -this->beta2_meam[eltj] * invrej * rhoa2j;
|
||||
rhoa3j = ro0j * fm_exp(-this->beta3_meam[eltj] * aj);
|
||||
drhoa3j = -this->beta3_meam[eltj] * invrej * rhoa3j;
|
||||
} else {
|
||||
rhoa0j = rhoa0i;
|
||||
drhoa0j = drhoa0i;
|
||||
@ -184,19 +175,19 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
drhoa3j = drhoa3i;
|
||||
}
|
||||
|
||||
if (meam_data.ialloy == 1) {
|
||||
rhoa1j = rhoa1j * meam_data.t1_meam[eltj];
|
||||
rhoa2j = rhoa2j * meam_data.t2_meam[eltj];
|
||||
rhoa3j = rhoa3j * meam_data.t3_meam[eltj];
|
||||
rhoa1i = rhoa1i * meam_data.t1_meam[elti];
|
||||
rhoa2i = rhoa2i * meam_data.t2_meam[elti];
|
||||
rhoa3i = rhoa3i * meam_data.t3_meam[elti];
|
||||
drhoa1j = drhoa1j * meam_data.t1_meam[eltj];
|
||||
drhoa2j = drhoa2j * meam_data.t2_meam[eltj];
|
||||
drhoa3j = drhoa3j * meam_data.t3_meam[eltj];
|
||||
drhoa1i = drhoa1i * meam_data.t1_meam[elti];
|
||||
drhoa2i = drhoa2i * meam_data.t2_meam[elti];
|
||||
drhoa3i = drhoa3i * meam_data.t3_meam[elti];
|
||||
if (this->ialloy == 1) {
|
||||
rhoa1j = rhoa1j * this->t1_meam[eltj];
|
||||
rhoa2j = rhoa2j * this->t2_meam[eltj];
|
||||
rhoa3j = rhoa3j * this->t3_meam[eltj];
|
||||
rhoa1i = rhoa1i * this->t1_meam[elti];
|
||||
rhoa2i = rhoa2i * this->t2_meam[elti];
|
||||
rhoa3i = rhoa3i * this->t3_meam[elti];
|
||||
drhoa1j = drhoa1j * this->t1_meam[eltj];
|
||||
drhoa2j = drhoa2j * this->t2_meam[eltj];
|
||||
drhoa3j = drhoa3j * this->t3_meam[eltj];
|
||||
drhoa1i = drhoa1i * this->t1_meam[elti];
|
||||
drhoa2i = drhoa2i * this->t2_meam[elti];
|
||||
drhoa3i = drhoa3i * this->t3_meam[elti];
|
||||
}
|
||||
|
||||
nv2 = 1;
|
||||
@ -212,12 +203,12 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
for (n = 1; n <= 3; n++) {
|
||||
for (p = n; p <= 3; p++) {
|
||||
for (q = p; q <= 3; q++) {
|
||||
arg = delij[n] * delij[p] * delij[q] * meam_data.v3D[nv3];
|
||||
arg = delij[n] * delij[p] * delij[q] * this->v3D[nv3];
|
||||
arg1i3 = arg1i3 + arr2v(Arho3, nv3, i) * arg;
|
||||
arg1j3 = arg1j3 - arr2v(Arho3, nv3, j) * arg;
|
||||
nv3 = nv3 + 1;
|
||||
}
|
||||
arg = delij[n] * delij[p] * meam_data.v2D[nv2];
|
||||
arg = delij[n] * delij[p] * this->v2D[nv2];
|
||||
arg1i2 = arg1i2 + arr2v(Arho2, nv2, i) * arg;
|
||||
arg1j2 = arg1j2 + arr2v(Arho2, nv2, j) * arg;
|
||||
nv2 = nv2 + 1;
|
||||
@ -254,9 +245,9 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
drho2drm2[m] = 0.0;
|
||||
for (n = 1; n <= 3; n++) {
|
||||
drho2drm1[m] = drho2drm1[m] +
|
||||
arr2v(Arho2, meam_data.vind2D[m][n], i) * delij[n];
|
||||
arr2v(Arho2, this->vind2D[m][n], i) * delij[n];
|
||||
drho2drm2[m] = drho2drm2[m] -
|
||||
arr2v(Arho2, meam_data.vind2D[m][n], j) * delij[n];
|
||||
arr2v(Arho2, this->vind2D[m][n], j) * delij[n];
|
||||
}
|
||||
drho2drm1[m] = a2 * rhoa2j * drho2drm1[m];
|
||||
drho2drm2[m] = -a2 * rhoa2i * drho2drm2[m];
|
||||
@ -278,11 +269,11 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
nv2 = 1;
|
||||
for (n = 1; n <= 3; n++) {
|
||||
for (p = n; p <= 3; p++) {
|
||||
arg = delij[n] * delij[p] * meam_data.v2D[nv2];
|
||||
arg = delij[n] * delij[p] * this->v2D[nv2];
|
||||
drho3drm1[m] = drho3drm1[m] +
|
||||
arr2v(Arho3, meam_data.vind3D[m][n][p], i) * arg;
|
||||
arr2v(Arho3, this->vind3D[m][n][p], i) * arg;
|
||||
drho3drm2[m] = drho3drm2[m] +
|
||||
arr2v(Arho3, meam_data.vind3D[m][n][p], j) * arg;
|
||||
arr2v(Arho3, this->vind3D[m][n][p], j) * arg;
|
||||
nv2 = nv2 + 1;
|
||||
}
|
||||
}
|
||||
@ -300,7 +291,7 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
t2j = arr2v(t_ave, 2, j);
|
||||
t3j = arr2v(t_ave, 3, j);
|
||||
|
||||
if (meam_data.ialloy == 1) {
|
||||
if (this->ialloy == 1) {
|
||||
|
||||
a1i = 0.0;
|
||||
a1j = 0.0;
|
||||
@ -321,20 +312,20 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
if (!iszero(arr2v(tsq_ave, 3, j)))
|
||||
a3j = drhoa0i * sij / arr2v(tsq_ave, 3, j);
|
||||
|
||||
dt1dr1 = a1i * (meam_data.t1_meam[eltj] -
|
||||
t1i * pow(meam_data.t1_meam[eltj], 2));
|
||||
dt1dr2 = a1j * (meam_data.t1_meam[elti] -
|
||||
t1j * pow(meam_data.t1_meam[elti], 2));
|
||||
dt2dr1 = a2i * (meam_data.t2_meam[eltj] -
|
||||
t2i * pow(meam_data.t2_meam[eltj], 2));
|
||||
dt2dr2 = a2j * (meam_data.t2_meam[elti] -
|
||||
t2j * pow(meam_data.t2_meam[elti], 2));
|
||||
dt3dr1 = a3i * (meam_data.t3_meam[eltj] -
|
||||
t3i * pow(meam_data.t3_meam[eltj], 2));
|
||||
dt3dr2 = a3j * (meam_data.t3_meam[elti] -
|
||||
t3j * pow(meam_data.t3_meam[elti], 2));
|
||||
dt1dr1 = a1i * (this->t1_meam[eltj] -
|
||||
t1i * pow(this->t1_meam[eltj], 2));
|
||||
dt1dr2 = a1j * (this->t1_meam[elti] -
|
||||
t1j * pow(this->t1_meam[elti], 2));
|
||||
dt2dr1 = a2i * (this->t2_meam[eltj] -
|
||||
t2i * pow(this->t2_meam[eltj], 2));
|
||||
dt2dr2 = a2j * (this->t2_meam[elti] -
|
||||
t2j * pow(this->t2_meam[elti], 2));
|
||||
dt3dr1 = a3i * (this->t3_meam[eltj] -
|
||||
t3i * pow(this->t3_meam[eltj], 2));
|
||||
dt3dr2 = a3j * (this->t3_meam[elti] -
|
||||
t3j * pow(this->t3_meam[elti], 2));
|
||||
|
||||
} else if (meam_data.ialloy == 2) {
|
||||
} else if (this->ialloy == 2) {
|
||||
|
||||
dt1dr1 = 0.0;
|
||||
dt1dr2 = 0.0;
|
||||
@ -352,17 +343,17 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
if (!iszero(arr1v(rho0, j)))
|
||||
aj = drhoa0i * sij / arr1v(rho0, j);
|
||||
|
||||
dt1dr1 = ai * (meam_data.t1_meam[elti] - t1i);
|
||||
dt1dr2 = aj * (meam_data.t1_meam[elti] - t1j);
|
||||
dt2dr1 = ai * (meam_data.t2_meam[elti] - t2i);
|
||||
dt2dr2 = aj * (meam_data.t2_meam[elti] - t2j);
|
||||
dt3dr1 = ai * (meam_data.t3_meam[elti] - t3i);
|
||||
dt3dr2 = aj * (meam_data.t3_meam[elti] - t3j);
|
||||
dt1dr1 = ai * (this->t1_meam[elti] - t1i);
|
||||
dt1dr2 = aj * (this->t1_meam[elti] - t1j);
|
||||
dt2dr1 = ai * (this->t2_meam[elti] - t2i);
|
||||
dt2dr2 = aj * (this->t2_meam[elti] - t2j);
|
||||
dt3dr1 = ai * (this->t3_meam[elti] - t3i);
|
||||
dt3dr2 = aj * (this->t3_meam[elti] - t3j);
|
||||
}
|
||||
|
||||
// Compute derivatives of total density wrt rij, sij and rij(3)
|
||||
get_shpfcn(shpi, meam_data.lattce_meam[elti][elti]);
|
||||
get_shpfcn(shpj, meam_data.lattce_meam[eltj][eltj]);
|
||||
get_shpfcn(shpi, this->lattce_meam[elti][elti]);
|
||||
get_shpfcn(shpj, this->lattce_meam[eltj][eltj]);
|
||||
drhodr1 =
|
||||
arr1v(dGamma1, i) * drho0dr1 +
|
||||
arr1v(dGamma2, i) * (dt1dr1 * arr1v(rho1, i) + t1i * drho1dr1 +
|
||||
@ -405,7 +396,7 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
drho3ds1 = a3 * rhoa3j * arg1i3 - a3a * rhoa3j * arg3i3;
|
||||
drho3ds2 = a3 * rhoa3i * arg1j3 - a3a * rhoa3i * arg3j3;
|
||||
|
||||
if (meam_data.ialloy == 1) {
|
||||
if (this->ialloy == 1) {
|
||||
|
||||
a1i = 0.0;
|
||||
a1j = 0.0;
|
||||
@ -426,20 +417,20 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
if (!iszero(arr2v(tsq_ave, 3, j)))
|
||||
a3j = rhoa0i / arr2v(tsq_ave, 3, j);
|
||||
|
||||
dt1ds1 = a1i * (meam_data.t1_meam[eltj] -
|
||||
t1i * pow(meam_data.t1_meam[eltj], 2));
|
||||
dt1ds2 = a1j * (meam_data.t1_meam[elti] -
|
||||
t1j * pow(meam_data.t1_meam[elti], 2));
|
||||
dt2ds1 = a2i * (meam_data.t2_meam[eltj] -
|
||||
t2i * pow(meam_data.t2_meam[eltj], 2));
|
||||
dt2ds2 = a2j * (meam_data.t2_meam[elti] -
|
||||
t2j * pow(meam_data.t2_meam[elti], 2));
|
||||
dt3ds1 = a3i * (meam_data.t3_meam[eltj] -
|
||||
t3i * pow(meam_data.t3_meam[eltj], 2));
|
||||
dt3ds2 = a3j * (meam_data.t3_meam[elti] -
|
||||
t3j * pow(meam_data.t3_meam[elti], 2));
|
||||
dt1ds1 = a1i * (this->t1_meam[eltj] -
|
||||
t1i * pow(this->t1_meam[eltj], 2));
|
||||
dt1ds2 = a1j * (this->t1_meam[elti] -
|
||||
t1j * pow(this->t1_meam[elti], 2));
|
||||
dt2ds1 = a2i * (this->t2_meam[eltj] -
|
||||
t2i * pow(this->t2_meam[eltj], 2));
|
||||
dt2ds2 = a2j * (this->t2_meam[elti] -
|
||||
t2j * pow(this->t2_meam[elti], 2));
|
||||
dt3ds1 = a3i * (this->t3_meam[eltj] -
|
||||
t3i * pow(this->t3_meam[eltj], 2));
|
||||
dt3ds2 = a3j * (this->t3_meam[elti] -
|
||||
t3j * pow(this->t3_meam[elti], 2));
|
||||
|
||||
} else if (meam_data.ialloy == 2) {
|
||||
} else if (this->ialloy == 2) {
|
||||
|
||||
dt1ds1 = 0.0;
|
||||
dt1ds2 = 0.0;
|
||||
@ -457,12 +448,12 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
if (!iszero(arr1v(rho0, j)))
|
||||
aj = rhoa0i / arr1v(rho0, j);
|
||||
|
||||
dt1ds1 = ai * (meam_data.t1_meam[eltj] - t1i);
|
||||
dt1ds2 = aj * (meam_data.t1_meam[elti] - t1j);
|
||||
dt2ds1 = ai * (meam_data.t2_meam[eltj] - t2i);
|
||||
dt2ds2 = aj * (meam_data.t2_meam[elti] - t2j);
|
||||
dt3ds1 = ai * (meam_data.t3_meam[eltj] - t3i);
|
||||
dt3ds2 = aj * (meam_data.t3_meam[elti] - t3j);
|
||||
dt1ds1 = ai * (this->t1_meam[eltj] - t1i);
|
||||
dt1ds2 = aj * (this->t1_meam[elti] - t1j);
|
||||
dt2ds1 = ai * (this->t2_meam[eltj] - t2i);
|
||||
dt2ds2 = aj * (this->t2_meam[elti] - t2j);
|
||||
dt3ds1 = ai * (this->t3_meam[eltj] - t3i);
|
||||
dt3ds2 = aj * (this->t3_meam[elti] - t3j);
|
||||
}
|
||||
|
||||
drhods1 =
|
||||
@ -602,4 +593,3 @@ meam_force_(int* iptr, int* nmax, int* eflag_either, int* eflag_global,
|
||||
// else if elti=0, this is not a meam atom
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
#include <math.h>
|
||||
|
||||
@ -18,7 +17,7 @@ extern "C" {
|
||||
//
|
||||
|
||||
void
|
||||
meam_setup_global_(int* nelt, int* lat, double* z, int* ielement, double* atwt,
|
||||
MEAM::meam_setup_global_(int* nelt, int* 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,
|
||||
@ -28,72 +27,71 @@ meam_setup_global_(int* nelt, int* lat, double* z, int* ielement, double* atwt,
|
||||
int i;
|
||||
double tmplat[maxelt];
|
||||
|
||||
meam_data.neltypes = *nelt;
|
||||
this->neltypes = *nelt;
|
||||
|
||||
for (i = 1; i <= *nelt; i++) {
|
||||
if (arr1v(lat, i) == 0)
|
||||
meam_data.lattce_meam[i][i] = FCC;
|
||||
this->lattce_meam[i][i] = FCC;
|
||||
else if (arr1v(lat, i) == 1)
|
||||
meam_data.lattce_meam[i][i] = BCC;
|
||||
this->lattce_meam[i][i] = BCC;
|
||||
else if (arr1v(lat, i) == 2)
|
||||
meam_data.lattce_meam[i][i] = HCP;
|
||||
this->lattce_meam[i][i] = HCP;
|
||||
else if (arr1v(lat, i) == 3)
|
||||
meam_data.lattce_meam[i][i] = DIM;
|
||||
this->lattce_meam[i][i] = DIM;
|
||||
else if (arr1v(lat, i) == 4)
|
||||
meam_data.lattce_meam[i][i] = DIA;
|
||||
this->lattce_meam[i][i] = DIA;
|
||||
else {
|
||||
// unknown
|
||||
}
|
||||
|
||||
meam_data.Z_meam[i] = arr1v(z, i);
|
||||
meam_data.ielt_meam[i] = arr1v(ielement, i);
|
||||
meam_data.alpha_meam[i][i] = arr1v(alpha, i);
|
||||
meam_data.beta0_meam[i] = arr1v(b0, i);
|
||||
meam_data.beta1_meam[i] = arr1v(b1, i);
|
||||
meam_data.beta2_meam[i] = arr1v(b2, i);
|
||||
meam_data.beta3_meam[i] = arr1v(b3, i);
|
||||
this->Z_meam[i] = arr1v(z, i);
|
||||
this->ielt_meam[i] = arr1v(ielement, i);
|
||||
this->alpha_meam[i][i] = arr1v(alpha, i);
|
||||
this->beta0_meam[i] = arr1v(b0, i);
|
||||
this->beta1_meam[i] = arr1v(b1, i);
|
||||
this->beta2_meam[i] = arr1v(b2, i);
|
||||
this->beta3_meam[i] = arr1v(b3, i);
|
||||
tmplat[i] = arr1v(alat, i);
|
||||
meam_data.Ec_meam[i][i] = arr1v(esub, i);
|
||||
meam_data.A_meam[i] = arr1v(asub, i);
|
||||
meam_data.t0_meam[i] = arr1v(t0, i);
|
||||
meam_data.t1_meam[i] = arr1v(t1, i);
|
||||
meam_data.t2_meam[i] = arr1v(t2, i);
|
||||
meam_data.t3_meam[i] = arr1v(t3, i);
|
||||
meam_data.rho0_meam[i] = arr1v(rozero, i);
|
||||
meam_data.ibar_meam[i] = arr1v(ibar, i);
|
||||
this->Ec_meam[i][i] = arr1v(esub, i);
|
||||
this->A_meam[i] = arr1v(asub, i);
|
||||
this->t0_meam[i] = arr1v(t0, i);
|
||||
this->t1_meam[i] = arr1v(t1, i);
|
||||
this->t2_meam[i] = arr1v(t2, i);
|
||||
this->t3_meam[i] = arr1v(t3, i);
|
||||
this->rho0_meam[i] = arr1v(rozero, i);
|
||||
this->ibar_meam[i] = arr1v(ibar, i);
|
||||
|
||||
if (meam_data.lattce_meam[i][i] == FCC)
|
||||
meam_data.re_meam[i][i] = tmplat[i] / sqrt(2.0);
|
||||
else if (meam_data.lattce_meam[i][i] == BCC)
|
||||
meam_data.re_meam[i][i] = tmplat[i] * sqrt(3.0) / 2.0;
|
||||
else if (meam_data.lattce_meam[i][i] == HCP)
|
||||
meam_data.re_meam[i][i] = tmplat[i];
|
||||
else if (meam_data.lattce_meam[i][i] == DIM)
|
||||
meam_data.re_meam[i][i] = tmplat[i];
|
||||
else if (meam_data.lattce_meam[i][i] == DIA)
|
||||
meam_data.re_meam[i][i] = tmplat[i] * sqrt(3.0) / 4.0;
|
||||
if (this->lattce_meam[i][i] == FCC)
|
||||
this->re_meam[i][i] = tmplat[i] / sqrt(2.0);
|
||||
else if (this->lattce_meam[i][i] == BCC)
|
||||
this->re_meam[i][i] = tmplat[i] * sqrt(3.0) / 2.0;
|
||||
else if (this->lattce_meam[i][i] == HCP)
|
||||
this->re_meam[i][i] = tmplat[i];
|
||||
else if (this->lattce_meam[i][i] == DIM)
|
||||
this->re_meam[i][i] = tmplat[i];
|
||||
else if (this->lattce_meam[i][i] == DIA)
|
||||
this->re_meam[i][i] = tmplat[i] * sqrt(3.0) / 4.0;
|
||||
else {
|
||||
// error
|
||||
}
|
||||
}
|
||||
|
||||
// Set some defaults
|
||||
meam_data.rc_meam = 4.0;
|
||||
meam_data.delr_meam = 0.1;
|
||||
setall2d(meam_data.attrac_meam, 0.0);
|
||||
setall2d(meam_data.repuls_meam, 0.0);
|
||||
setall3d(meam_data.Cmax_meam, 2.8);
|
||||
setall3d(meam_data.Cmin_meam, 2.0);
|
||||
setall2d(meam_data.ebound_meam, pow(2.8, 2) / (4.0 * (2.8 - 1.0)));
|
||||
setall2d(meam_data.delta_meam, 0.0);
|
||||
setall2d(meam_data.nn2_meam, 0);
|
||||
setall2d(meam_data.zbl_meam, 1);
|
||||
meam_data.gsmooth_factor = 99.0;
|
||||
meam_data.augt1 = 1;
|
||||
meam_data.ialloy = 0;
|
||||
meam_data.mix_ref_t = 0;
|
||||
meam_data.emb_lin_neg = 0;
|
||||
meam_data.bkgd_dyn = 0;
|
||||
meam_data.erose_form = 0;
|
||||
}
|
||||
this->rc_meam = 4.0;
|
||||
this->delr_meam = 0.1;
|
||||
setall2d(this->attrac_meam, 0.0);
|
||||
setall2d(this->repuls_meam, 0.0);
|
||||
setall3d(this->Cmax_meam, 2.8);
|
||||
setall3d(this->Cmin_meam, 2.0);
|
||||
setall2d(this->ebound_meam, pow(2.8, 2) / (4.0 * (2.8 - 1.0)));
|
||||
setall2d(this->delta_meam, 0.0);
|
||||
setall2d(this->nn2_meam, 0);
|
||||
setall2d(this->zbl_meam, 1);
|
||||
this->gsmooth_factor = 99.0;
|
||||
this->augt1 = 1;
|
||||
this->ialloy = 0;
|
||||
this->mix_ref_t = 0;
|
||||
this->emb_lin_neg = 0;
|
||||
this->bkgd_dyn = 0;
|
||||
this->erose_form = 0;
|
||||
}
|
||||
@ -1,10 +1,9 @@
|
||||
extern "C" {
|
||||
#include "meam.h"
|
||||
|
||||
//
|
||||
// do a sanity check on index parameters
|
||||
void
|
||||
meam_checkindex(int num, int lim, int nidx, int* idx /*idx(3)*/, int* ierr)
|
||||
MEAM::meam_checkindex(int num, int lim, int nidx, int* idx /*idx(3)*/, int* ierr)
|
||||
{
|
||||
//: idx[0..2]
|
||||
*ierr = 0;
|
||||
@ -58,7 +57,7 @@ meam_checkindex(int num, int lim, int nidx, int* idx /*idx(3)*/, int* ierr)
|
||||
// 20 = bkgd_dyn
|
||||
|
||||
void
|
||||
meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
MEAM::meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
int* index /*index(3)*/, int* errorflag)
|
||||
{
|
||||
//: index[0..2]
|
||||
@ -74,7 +73,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(2, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.Ec_meam[index[0]][index[1]] = value;
|
||||
this->Ec_meam[index[0]][index[1]] = value;
|
||||
break;
|
||||
|
||||
// 1 = alpha_meam
|
||||
@ -82,7 +81,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(2, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.alpha_meam[index[0]][index[1]] = value;
|
||||
this->alpha_meam[index[0]][index[1]] = value;
|
||||
break;
|
||||
|
||||
// 2 = rho0_meam
|
||||
@ -90,7 +89,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(1, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.rho0_meam[index[0]] = value;
|
||||
this->rho0_meam[index[0]] = value;
|
||||
break;
|
||||
|
||||
// 3 = delta_meam
|
||||
@ -98,7 +97,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(2, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.delta_meam[index[0]][index[1]] = value;
|
||||
this->delta_meam[index[0]][index[1]] = value;
|
||||
break;
|
||||
|
||||
// 4 = lattce_meam
|
||||
@ -109,23 +108,23 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
val = (int)value;
|
||||
|
||||
if (val == 0)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = FCC;
|
||||
this->lattce_meam[index[0]][index[1]] = FCC;
|
||||
else if (val == 1)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = BCC;
|
||||
this->lattce_meam[index[0]][index[1]] = BCC;
|
||||
else if (val == 2)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = HCP;
|
||||
this->lattce_meam[index[0]][index[1]] = HCP;
|
||||
else if (val == 3)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = DIM;
|
||||
this->lattce_meam[index[0]][index[1]] = DIM;
|
||||
else if (val == 4)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = DIA;
|
||||
this->lattce_meam[index[0]][index[1]] = DIA;
|
||||
else if (val == 5)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = B1;
|
||||
this->lattce_meam[index[0]][index[1]] = B1;
|
||||
else if (val == 6)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = C11;
|
||||
this->lattce_meam[index[0]][index[1]] = C11;
|
||||
else if (val == 7)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = L12;
|
||||
this->lattce_meam[index[0]][index[1]] = L12;
|
||||
else if (val == 8)
|
||||
meam_data.lattce_meam[index[0]][index[1]] = B2;
|
||||
this->lattce_meam[index[0]][index[1]] = B2;
|
||||
break;
|
||||
|
||||
// 5 = attrac_meam
|
||||
@ -133,7 +132,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(2, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.attrac_meam[index[0]][index[1]] = value;
|
||||
this->attrac_meam[index[0]][index[1]] = value;
|
||||
break;
|
||||
|
||||
// 6 = repuls_meam
|
||||
@ -141,7 +140,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(2, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.repuls_meam[index[0]][index[1]] = value;
|
||||
this->repuls_meam[index[0]][index[1]] = value;
|
||||
break;
|
||||
|
||||
// 7 = nn2_meam
|
||||
@ -151,7 +150,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
return;
|
||||
i1 = min(index[0], index[1]);
|
||||
i2 = max(index[0], index[1]);
|
||||
meam_data.nn2_meam[i1][i2] = (int)value;
|
||||
this->nn2_meam[i1][i2] = (int)value;
|
||||
break;
|
||||
|
||||
// 8 = Cmin_meam
|
||||
@ -159,7 +158,7 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(3, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.Cmin_meam[index[0]][index[1]][index[2]] = value;
|
||||
this->Cmin_meam[index[0]][index[1]][index[2]] = value;
|
||||
break;
|
||||
|
||||
// 9 = Cmax_meam
|
||||
@ -167,27 +166,27 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(3, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.Cmax_meam[index[0]][index[1]][index[2]] = value;
|
||||
this->Cmax_meam[index[0]][index[1]][index[2]] = value;
|
||||
break;
|
||||
|
||||
// 10 = rc_meam
|
||||
case 10:
|
||||
meam_data.rc_meam = value;
|
||||
this->rc_meam = value;
|
||||
break;
|
||||
|
||||
// 11 = delr_meam
|
||||
case 11:
|
||||
meam_data.delr_meam = value;
|
||||
this->delr_meam = value;
|
||||
break;
|
||||
|
||||
// 12 = augt1
|
||||
case 12:
|
||||
meam_data.augt1 = (int)value;
|
||||
this->augt1 = (int)value;
|
||||
break;
|
||||
|
||||
// 13 = gsmooth
|
||||
case 13:
|
||||
meam_data.gsmooth_factor = value;
|
||||
this->gsmooth_factor = value;
|
||||
break;
|
||||
|
||||
// 14 = re_meam
|
||||
@ -195,22 +194,22 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
meam_checkindex(2, maxelt, nindex, index, errorflag);
|
||||
if (*errorflag != 0)
|
||||
return;
|
||||
meam_data.re_meam[index[0]][index[1]] = value;
|
||||
this->re_meam[index[0]][index[1]] = value;
|
||||
break;
|
||||
|
||||
// 15 = ialloy
|
||||
case 15:
|
||||
meam_data.ialloy = (int)value;
|
||||
this->ialloy = (int)value;
|
||||
break;
|
||||
|
||||
// 16 = mixture_ref_t
|
||||
case 16:
|
||||
meam_data.mix_ref_t = (int)value;
|
||||
this->mix_ref_t = (int)value;
|
||||
break;
|
||||
|
||||
// 17 = erose_form
|
||||
case 17:
|
||||
meam_data.erose_form = (int)value;
|
||||
this->erose_form = (int)value;
|
||||
break;
|
||||
|
||||
// 18 = zbl_meam
|
||||
@ -220,21 +219,20 @@ meam_setup_param_(int* which_p, double* value_p, int* nindex_p,
|
||||
return;
|
||||
i1 = min(index[0], index[1]);
|
||||
i2 = max(index[0], index[1]);
|
||||
meam_data.zbl_meam[i1][i2] = (int)value;
|
||||
this->zbl_meam[i1][i2] = (int)value;
|
||||
break;
|
||||
|
||||
// 19 = emb_lin_neg
|
||||
case 19:
|
||||
meam_data.emb_lin_neg = (int)value;
|
||||
this->emb_lin_neg = (int)value;
|
||||
break;
|
||||
|
||||
// 20 = bkgd_dyn
|
||||
case 20:
|
||||
meam_data.bkgd_dyn = (int)value;
|
||||
this->bkgd_dyn = (int)value;
|
||||
break;
|
||||
|
||||
default:
|
||||
*errorflag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,7 +34,6 @@ using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
|
||||
enum{FCC,BCC,HCP,DIM,DIAMOND,B1,C11,L12,B2};
|
||||
static const int nkeywords = 21;
|
||||
static const char *keywords[] = {
|
||||
"Ec","alpha","rho0","delta","lattce",
|
||||
@ -78,7 +77,7 @@ PairMEAMC::PairMEAMC(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
PairMEAMC::~PairMEAMC()
|
||||
{
|
||||
meam_cleanup_();
|
||||
meam_inst.meam_cleanup_();
|
||||
|
||||
memory->destroy(rho);
|
||||
memory->destroy(rho0);
|
||||
@ -237,7 +236,7 @@ void PairMEAMC::compute(int eflag, int vflag)
|
||||
for (ii = 0; ii < inum_half; ii++) {
|
||||
i = ilist_half[ii];
|
||||
ifort = i+1;
|
||||
meam_dens_init_(&ifort,&nmax,&ntype,type,fmap,&x[0][0],
|
||||
meam_inst.meam_dens_init_(&ifort,&nmax,&ntype,type,fmap,&x[0][0],
|
||||
&numneigh_half[i],firstneigh_half[i],
|
||||
&numneigh_full[i],firstneigh_full[i],
|
||||
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
||||
@ -254,7 +253,7 @@ void PairMEAMC::compute(int eflag, int vflag)
|
||||
|
||||
comm->reverse_comm_pair(this);
|
||||
|
||||
meam_dens_final_(&nlocal,&nmax,&eflag_either,&eflag_global,&eflag_atom,
|
||||
meam_inst.meam_dens_final_(&nlocal,&nmax,&eflag_either,&eflag_global,&eflag_atom,
|
||||
&eng_vdwl,eatom,&ntype,type,fmap,
|
||||
&arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],
|
||||
&arho3b[0][0],&t_ave[0][0],&tsq_ave[0][0],gamma,dgamma1,
|
||||
@ -279,7 +278,7 @@ void PairMEAMC::compute(int eflag, int vflag)
|
||||
for (ii = 0; ii < inum_half; ii++) {
|
||||
i = ilist_half[ii];
|
||||
ifort = i+1;
|
||||
meam_force_(&ifort,&nmax,&eflag_either,&eflag_global,&eflag_atom,
|
||||
meam_inst.meam_force_(&ifort,&nmax,&eflag_either,&eflag_global,&eflag_atom,
|
||||
&vflag_atom,&eng_vdwl,eatom,&ntype,type,fmap,&x[0][0],
|
||||
&numneigh_half[i],firstneigh_half[i],
|
||||
&numneigh_full[i],firstneigh_full[i],
|
||||
@ -368,7 +367,7 @@ void PairMEAMC::coeff(int narg, char **arg)
|
||||
// tell MEAM package that setup is done
|
||||
|
||||
read_files(arg[2],arg[2+nelements+1]);
|
||||
meam_setup_done_(&cutmax);
|
||||
meam_inst.meam_setup_done_(&cutmax);
|
||||
|
||||
// read args that map atom types to MEAM elements
|
||||
// map[i] = which element the Ith atom type is, -1 if not mapped
|
||||
@ -567,7 +566,7 @@ void PairMEAMC::read_files(char *globalfile, char *userfile)
|
||||
else if (strcmp(words[1],"bcc") == 0) lat[i] = BCC;
|
||||
else if (strcmp(words[1],"hcp") == 0) lat[i] = HCP;
|
||||
else if (strcmp(words[1],"dim") == 0) lat[i] = DIM;
|
||||
else if (strcmp(words[1],"dia") == 0) lat[i] = DIAMOND;
|
||||
else if (strcmp(words[1],"dia") == 0) lat[i] = DIA;
|
||||
else error->all(FLERR,"Unrecognized lattice type in MEAM file 1");
|
||||
|
||||
// store parameters
|
||||
@ -600,7 +599,7 @@ void PairMEAMC::read_files(char *globalfile, char *userfile)
|
||||
|
||||
// pass element parameters to MEAM package
|
||||
|
||||
meam_setup_global_(&nelements,lat,z,ielement,atwt,alpha,b0,b1,b2,b3,
|
||||
meam_inst.meam_setup_global_(&nelements,lat,z,ielement,atwt,alpha,b0,b1,b2,b3,
|
||||
alat,esub,asub,t0,t1,t2,t3,rozero,ibar);
|
||||
|
||||
// set element masses
|
||||
@ -704,7 +703,7 @@ void PairMEAMC::read_files(char *globalfile, char *userfile)
|
||||
else if (strcmp(params[nparams-1],"bcc") == 0) value = BCC;
|
||||
else if (strcmp(params[nparams-1],"hcp") == 0) value = HCP;
|
||||
else if (strcmp(params[nparams-1],"dim") == 0) value = DIM;
|
||||
else if (strcmp(params[nparams-1],"dia") == 0) value = DIAMOND;
|
||||
else if (strcmp(params[nparams-1],"dia") == 0) value = DIA;
|
||||
else if (strcmp(params[nparams-1],"b1") == 0) value = B1;
|
||||
else if (strcmp(params[nparams-1],"c11") == 0) value = C11;
|
||||
else if (strcmp(params[nparams-1],"l12") == 0) value = L12;
|
||||
@ -716,7 +715,7 @@ void PairMEAMC::read_files(char *globalfile, char *userfile)
|
||||
// pass single setting to MEAM package
|
||||
|
||||
int errorflag = 0;
|
||||
meam_setup_param_(&which,&value,&nindex,index,&errorflag);
|
||||
meam_inst.meam_setup_param_(&which,&value,&nindex,index,&errorflag);
|
||||
if (errorflag) {
|
||||
char str[128];
|
||||
sprintf(str,"MEAM library error %d",errorflag);
|
||||
|
||||
@ -20,41 +20,8 @@ PairStyle(meam/c,PairMEAMC)
|
||||
#ifndef LMP_PAIR_MEAMC_H
|
||||
#define LMP_PAIR_MEAMC_H
|
||||
|
||||
extern "C" {
|
||||
void meam_setup_global_(int *, int *, double *, int *, double *, double *,
|
||||
double *, double *, double *, double *, double *,
|
||||
double *, double *, double *, double *, double *,
|
||||
double *, double *, int *);
|
||||
void meam_setup_param_(int *, double *, int *, int *, int *);
|
||||
void meam_setup_done_(double *);
|
||||
|
||||
void meam_dens_init_(int *, int *, int *, int *, int *,
|
||||
double *, int *, int *, int *, int *,
|
||||
double *, double *, double *, double *,
|
||||
double *, double *,
|
||||
double *, double *, double *, double *, double *,
|
||||
int *);
|
||||
|
||||
void meam_dens_final_(int *, int *, int *, int *, int *, double *, double *,
|
||||
int *, int *, int *,
|
||||
double *, double *, double *, double *,
|
||||
double *, double *, double *,
|
||||
double *, double *, double *, double *,
|
||||
double *, double *,
|
||||
double *, double *, double *, double *, int *);
|
||||
|
||||
void meam_force_(int *, int *, int *, int *, int *, int *,
|
||||
double *, double *, int *, int *, int *,
|
||||
double *, int *, int *, int *, int *, double *, double *,
|
||||
double *, double *, double *, double *, double *, double *,
|
||||
double *, double *, double *, double *, double *, double *,
|
||||
double *, double *, double *, double *, double *, double *, int *);
|
||||
|
||||
void meam_cleanup_();
|
||||
}
|
||||
|
||||
|
||||
#include "pair.h"
|
||||
#include "meam.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
@ -76,6 +43,7 @@ class PairMEAMC : public Pair {
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
MEAM meam_inst;
|
||||
double cutmax; // max cutoff for all elements
|
||||
int nelements; // # of unique elements
|
||||
char **elements; // names of unique elements
|
||||
|
||||
Reference in New Issue
Block a user