Refactored chemsnap input options

This commit is contained in:
Aidan Thompson
2020-06-13 12:50:01 -06:00
parent 7ba731c711
commit 7dd186d0ad
19 changed files with 104 additions and 86 deletions

View File

@ -74,7 +74,8 @@ SNAP keyword rmin0 0.0
SNAP keyword bzeroflag 1
SNAP keyword quadraticflag 0
SNAP keyword wselfallflag 1
SNAP keyword alloyflag 1
SNAP keyword chemflag 1
SNAP keyword bnormflag 1
# Setup output
@ -123,20 +124,20 @@ Step Temp E_pair E_mol TotEng Press
80 151.50217 -3.4614195 0 -3.4418745 3840.7205
90 177.67607 -3.464797 0 -3.4418754 3527.9794
100 195.30359 -3.4670717 0 -3.4418761 3300.3795
Loop time of 18.1983 on 1 procs for 100 steps with 512 atoms
Loop time of 18.0803 on 1 procs for 100 steps with 512 atoms
Performance: 0.237 ns/day, 101.102 hours/ns, 5.495 timesteps/s
Performance: 0.239 ns/day, 100.446 hours/ns, 5.531 timesteps/s
99.8% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 18.196 | 18.196 | 18.196 | 0.0 | 99.99
Pair | 18.078 | 18.078 | 18.078 | 0.0 | 99.99
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.00104 | 0.00104 | 0.00104 | 0.0 | 0.01
Output | 0.000262 | 0.000262 | 0.000262 | 0.0 | 0.00
Modify | 0.000576 | 0.000576 | 0.000576 | 0.0 | 0.00
Other | | 0.000486 | | | 0.00
Comm | 0.000979 | 0.000979 | 0.000979 | 0.0 | 0.01
Output | 0.000243 | 0.000243 | 0.000243 | 0.0 | 0.00
Modify | 0.000591 | 0.000591 | 0.000591 | 0.0 | 0.00
Other | | 0.000469 | | | 0.00
Nlocal: 512 ave 512 max 512 min
Histogram: 1 0 0 0 0 0 0 0 0 0

View File

@ -74,7 +74,8 @@ SNAP keyword rmin0 0.0
SNAP keyword bzeroflag 1
SNAP keyword quadraticflag 0
SNAP keyword wselfallflag 1
SNAP keyword alloyflag 1
SNAP keyword chemflag 1
SNAP keyword bnormflag 1
# Setup output
@ -123,20 +124,20 @@ Step Temp E_pair E_mol TotEng Press
80 151.54241 -3.4614247 0 -3.4418746 3847.4617
90 176.92084 -3.4646996 0 -3.4418755 3548.7811
100 193.9555 -3.4668978 0 -3.4418761 3342.8083
Loop time of 5.73708 on 4 procs for 100 steps with 512 atoms
Loop time of 4.99339 on 4 procs for 100 steps with 512 atoms
Performance: 0.753 ns/day, 31.873 hours/ns, 17.430 timesteps/s
99.3% CPU use with 4 MPI tasks x no OpenMP threads
Performance: 0.865 ns/day, 27.741 hours/ns, 20.026 timesteps/s
99.5% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 5.5736 | 5.5812 | 5.591 | 0.3 | 97.28
Pair | 4.8898 | 4.907 | 4.9329 | 0.8 | 98.27
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.14432 | 0.15366 | 0.16168 | 1.6 | 2.68
Output | 0.000187 | 0.00024775 | 0.000419 | 0.0 | 0.00
Modify | 0.000293 | 0.00038075 | 0.000582 | 0.0 | 0.01
Other | | 0.00161 | | | 0.03
Comm | 0.058815 | 0.084739 | 0.1019 | 6.1 | 1.70
Output | 0.000252 | 0.00038775 | 0.000777 | 0.0 | 0.01
Modify | 0.000262 | 0.00026675 | 0.000272 | 0.0 | 0.01
Other | | 0.001039 | | | 0.02
Nlocal: 128 ave 128 max 128 min
Histogram: 4 0 0 0 0 0 0 0 0 0

View File

@ -10,5 +10,6 @@
bzeroflag 1
quadraticflag 0
wselfallflag 1
alloyflag 1
chemflag 1
bnormflag 1

View File

@ -515,7 +515,7 @@ void PairSNAPKokkos<DeviceType>::coeff(int narg, char **arg)
Kokkos::deep_copy(d_map,h_map);
snaKK = SNAKokkos<DeviceType>(rfac0,twojmax,
rmin0,switchflag,bzeroflag,alloyflag,wselfallflag,nelements);
rmin0,switchflag,bzeroflag,chemflag,bnormflag,wselfallflag,nelements);
snaKK.grow_rij(0,0);
snaKK.init();
}
@ -584,7 +584,7 @@ void PairSNAPKokkos<DeviceType>::operator() (TagPairSNAPComputeNeigh,const typen
my_sna.inside(ii,offset) = j;
my_sna.wj(ii,offset) = d_wjelem[elem_j];
my_sna.rcutij(ii,offset) = (radi + d_radelem[elem_j])*rcutfac;
if (alloyflag)
if (chemflag)
my_sna.element(ii,offset) = elem_j;
else
my_sna.element(ii,offset) = 0;

View File

@ -210,7 +210,7 @@ inline
int switch_flag;
// Chem snap flags
int alloy_flag;
int chem_flag;
int bnorm_flag;
int nelements;
int ndoubles;

View File

@ -29,7 +29,7 @@ template<class DeviceType>
inline
SNAKokkos<DeviceType>::SNAKokkos(double rfac0_in,
int twojmax_in, double rmin0_in, int switch_flag_in, int bzero_flag_in,
int alloy_flag_in, int wselfall_flag_in, int nelements_in)
int chem_flag_in, int bnorm_flag_in, int wselfall_flag_in, int nelements_in)
{
wself = 1.0;
@ -38,13 +38,13 @@ SNAKokkos<DeviceType>::SNAKokkos(double rfac0_in,
switch_flag = switch_flag_in;
bzero_flag = bzero_flag_in;
alloy_flag = alloy_flag_in;
wselfall_flag = wselfall_flag_in;
if (alloy_flag)
chem_flag = chem_flag_in;
if (chem_flag)
nelements = nelements_in;
else
nelements = 1;
bnorm_flag = alloy_flag_in;
bnorm_flag = bnorm_flag_in;
wselfall_flag = wselfall_flag_in;
twojmax = twojmax_in;
@ -283,7 +283,7 @@ void SNAKokkos<DeviceType>::pre_ui(const typename Kokkos::TeamPolicy<DeviceType>
// if m is on the "diagonal", initialize it with the self energy.
// Otherwise zero it out
SNAcomplex init = {0., 0.};
if (m % (j+2) == 0 && (!alloy_flag || ielem == jelem || wselfall_flag)) { init = {wself, 0.0}; } //need to map iatom to element
if (m % (j+2) == 0 && (!chem_flag || ielem == jelem || wselfall_flag)) { init = {wself, 0.0}; } //need to map iatom to element
ulisttot(jelem*idxu_max+jjup, iatom) = init;
});
@ -1620,7 +1620,7 @@ int SNAKokkos<DeviceType>::compute_ncoeff()
ndoubles = nelements*nelements;
ntriples = nelements*nelements*nelements;
if (alloy_flag) ncount *= ntriples;
if (chem_flag) ncount *= ntriples;
return ncount;
}

View File

@ -34,7 +34,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
radelem(NULL), wjelem(NULL)
{
double rmin0, rfac0;
int twojmax, switchflag, bzeroflag, bnormflag;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
radelem = NULL;
wjelem = NULL;
@ -50,7 +50,8 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
bzeroflag = 1;
bnormflag = 0;
quadraticflag = 0;
alloyflag = 0;
chemflag = 0;
bnormflag = 0;
wselfallflag = 0;
nelements = 1;
@ -108,11 +109,10 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Illegal compute sna/atom command");
quadraticflag = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"alloy") == 0) {
} else if (strcmp(arg[iarg],"chem") == 0) {
if (iarg+2+ntypes > narg)
error->all(FLERR,"Illegal compute sna/atom command");
alloyflag = 1;
bnormflag = alloyflag;
chemflag = 1;
memory->create(map,ntypes+1,"compute_sna_atom:map");
nelements = force->inumeric(FLERR,arg[iarg+1]);
for(int i = 0; i < ntypes; i++) {
@ -123,6 +123,11 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
map[i+1] = jelem;
}
iarg += 2+ntypes;
} else if (strcmp(arg[iarg],"bnormflag") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute sna/atom command");
bnormflag = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"wselfall") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute sna/atom command");
@ -133,7 +138,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
snaptr = new SNA(lmp, rfac0, twojmax,
rmin0, switchflag, bzeroflag,
alloyflag, wselfallflag, nelements);
chemflag, bnormflag, wselfallflag, nelements);
ncoeff = snaptr->ncoeff;
size_peratom_cols = ncoeff;
@ -229,7 +234,7 @@ void ComputeSNAAtom::compute_peratom()
const double ztmp = x[i][2];
const int itype = type[i];
int ielem = 0;
if (alloyflag)
if (chemflag)
ielem = map[itype];
const double radi = radelem[itype];
const int* const jlist = firstneigh[i];
@ -254,7 +259,7 @@ void ComputeSNAAtom::compute_peratom()
const double rsq = delx*delx + dely*dely + delz*delz;
int jtype = type[j];
int jelem = 0;
if (alloyflag)
if (chemflag)
int jelem = map[jtype];
if (rsq < cutsq[itype][jtype] && rsq>1e-20) {
snaptr->rij[ninside][0] = delx;

View File

@ -43,7 +43,7 @@ class ComputeSNAAtom : public Compute {
double *radelem;
double *wjelem;
int * map; // map types to [0,nelements)
int nelements, alloyflag, wselfallflag;
int nelements, chemflag;
class SNA* snaptr;
double cutmax;
int quadraticflag;

View File

@ -34,7 +34,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
radelem(NULL), wjelem(NULL)
{
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
radelem = NULL;
wjelem = NULL;
@ -50,7 +50,8 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
bzeroflag = 1;
bnormflag = 0;
quadraticflag = 0;
alloyflag = 0;
chemflag = 0;
bnormflag = 0;
wselfallflag = 0;
nelements = 1;
@ -106,11 +107,10 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Illegal compute snad/atom command");
quadraticflag = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"alloy") == 0) {
} else if (strcmp(arg[iarg],"chem") == 0) {
if (iarg+2+ntypes > narg)
error->all(FLERR,"Illegal compute snad/atom command");
alloyflag = 1;
bnormflag = alloyflag;
chemflag = 1;
memory->create(map,ntypes+1,"compute_snad_atom:map");
nelements = force->inumeric(FLERR,arg[iarg+1]);
for(int i = 0; i < ntypes; i++) {
@ -131,7 +131,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
snaptr = new SNA(lmp, rfac0, twojmax,
rmin0, switchflag, bzeroflag,
alloyflag, wselfallflag, nelements);
chemflag, bnormflag, wselfallflag, nelements);
ncoeff = snaptr->ncoeff;
nperdim = ncoeff;
@ -241,7 +241,7 @@ void ComputeSNADAtom::compute_peratom()
const double ztmp = x[i][2];
const int itype = type[i];
int ielem = 0;
if (alloyflag)
if (chemflag)
ielem = map[itype];
const double radi = radelem[itype];
const int* const jlist = firstneigh[i];
@ -272,7 +272,7 @@ void ComputeSNADAtom::compute_peratom()
const double rsq = delx*delx + dely*dely + delz*delz;
int jtype = type[j];
int jelem = 0;
if (alloyflag)
if (chemflag)
jelem = map[jtype];
if (rsq < cutsq[itype][jtype]&&rsq>1e-20) {
snaptr->rij[ninside][0] = delx;

View File

@ -45,7 +45,7 @@ class ComputeSNADAtom : public Compute {
double *radelem;
double *wjelem;
int *map; // map types to [0,nelements)
int nelements, alloyflag, wselfallflag;
int nelements, chemflag;
class SNA* snaptr;
double cutmax;
int quadraticflag;

View File

@ -41,7 +41,7 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
extarray = 0;
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
radelem = NULL;
wjelem = NULL;
@ -56,7 +56,8 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
switchflag = 1;
bzeroflag = 1;
quadraticflag = 0;
alloyflag = 0;
chemflag = 0;
bnormflag = 0;
wselfallflag = 0;
nelements = 1;
@ -112,10 +113,10 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Illegal compute snap command");
quadraticflag = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"alloyflag") == 0) {
} else if (strcmp(arg[iarg],"chem") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute snap command");
alloyflag = 1;
chemflag = 1;
memory->create(map,ntypes+1,"compute_snap:map");
nelements = force->inumeric(FLERR,arg[iarg+1]);
for(int i = 0; i < ntypes; i++) {
@ -126,6 +127,11 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
map[i+1] = jelem;
}
iarg += 2+ntypes;
} else if (strcmp(arg[iarg],"bnormflag") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute snap command");
bnormflag = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"wselfallflag") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute snap command");
@ -136,7 +142,7 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
snaptr = new SNA(lmp, rfac0, twojmax,
rmin0, switchflag, bzeroflag,
alloyflag, wselfallflag, nelements);
chemflag, bnormflag, wselfallflag, nelements);
ncoeff = snaptr->ncoeff;
nperdim = ncoeff;
@ -168,7 +174,7 @@ ComputeSnap::~ComputeSnap()
memory->destroy(cutsq);
delete snaptr;
if (alloyflag) memory->destroy(map);
if (chemflag) memory->destroy(map);
}
/* ---------------------------------------------------------------------- */
@ -300,7 +306,7 @@ void ComputeSnap::compute_array()
const double ztmp = x[i][2];
const int itype = type[i];
int ielem = 0;
if (alloyflag)
if (chemflag)
ielem = map[itype];
const double radi = radelem[itype];
const int* const jlist = firstneigh[i];
@ -328,7 +334,7 @@ void ComputeSnap::compute_array()
const double rsq = delx*delx + dely*dely + delz*delz;
int jtype = type[j];
int jelem = 0;
if (alloyflag)
if (chemflag)
jelem = map[jtype];
if (rsq < cutsq[itype][jtype]&&rsq>1e-20) {
snaptr->rij[ninside][0] = delx;

View File

@ -45,7 +45,7 @@ class ComputeSnap : public Compute {
double *radelem;
double *wjelem;
int *map; // map types to [0,nelements)
int nelements, alloyflag, wselfallflag;
int nelements, chemflag;
class SNA* snaptr;
double cutmax;
int quadraticflag;

View File

@ -33,7 +33,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
radelem(NULL), wjelem(NULL)
{
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
radelem = NULL;
wjelem = NULL;
@ -49,7 +49,8 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
bzeroflag = 1;
bnormflag = 0;
quadraticflag = 0;
alloyflag = 0;
chemflag = 0;
bnormflag = 0;
wselfallflag = 0;
nelements = 1;
@ -101,11 +102,10 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Illegal compute snav/atom command");
quadraticflag = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"alloy") == 0) {
} else if (strcmp(arg[iarg],"chem") == 0) {
if (iarg+2+ntypes > narg)
error->all(FLERR,"Illegal compute sna/atom command");
alloyflag = 1;
bnormflag = alloyflag;
chemflag = 1;
memory->create(map,ntypes+1,"compute_sna_atom:map");
nelements = force->inumeric(FLERR,arg[iarg+1]);
for(int i = 0; i < ntypes; i++) {
@ -126,7 +126,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
snaptr = new SNA(lmp, rfac0, twojmax,
rmin0, switchflag, bzeroflag,
alloyflag, wselfallflag, nelements);
chemflag, bnormflag, wselfallflag, nelements);
ncoeff = snaptr->ncoeff;
nperdim = ncoeff;
@ -236,7 +236,7 @@ void ComputeSNAVAtom::compute_peratom()
const double ztmp = x[i][2];
const int itype = type[i];
int ielem = 0;
if (alloyflag)
if (chemflag)
ielem = map[itype];
const double radi = radelem[itype];
@ -265,7 +265,7 @@ void ComputeSNAVAtom::compute_peratom()
const double rsq = delx*delx + dely*dely + delz*delz;
int jtype = type[j];
int jelem = 0;
if (alloyflag)
if (chemflag)
jelem = map[jtype];
if (rsq < cutsq[itype][jtype]&&rsq>1e-20) {
snaptr->rij[ninside][0] = delx;

View File

@ -45,7 +45,7 @@ class ComputeSNAVAtom : public Compute {
double *radelem;
double *wjelem;
int *map; // map types to [0,nelements)
int nelements, alloyflag, wselfallflag;
int nelements, chemflag;
class SNA* snaptr;
int quadraticflag;
};

View File

@ -156,14 +156,14 @@ void PairSNAP::compute(int eflag, int vflag)
snaptr->inside[ninside] = j;
snaptr->wj[ninside] = wjelem[jelem];
snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac;
snaptr->element[ninside] = jelem; // element index for alloy snap
snaptr->element[ninside] = jelem;
ninside++;
}
}
// compute Ui, Yi for atom I
if (alloyflag)
if (chemflag)
snaptr->compute_ui(ninside, ielem);
else
snaptr->compute_ui(ninside, 0);
@ -176,7 +176,7 @@ void PairSNAP::compute(int eflag, int vflag)
for (int jj = 0; jj < ninside; jj++) {
int j = snaptr->inside[jj];
if(alloyflag)
if(chemflag)
snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj],
snaptr->rcutij[jj],jj, snaptr->element[jj]);
else
@ -328,17 +328,17 @@ void PairSNAP::compute_bispectrum()
snaptr->inside[ninside] = j;
snaptr->wj[ninside] = wjelem[jelem];
snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac;
snaptr->element[ninside] = jelem; // element index for alloy snap
snaptr->element[ninside] = jelem;
ninside++;
}
}
if (alloyflag)
if (chemflag)
snaptr->compute_ui(ninside, ielem);
else
snaptr->compute_ui(ninside, 0);
snaptr->compute_zi();
if (alloyflag)
if (chemflag)
snaptr->compute_bi(ielem);
else
snaptr->compute_bi(0);
@ -418,7 +418,6 @@ void PairSNAP::coeff(int narg, char **arg)
ncoeffq = (ncoeff*(ncoeff+1))/2;
int ntmp = 1+ncoeff+ncoeffq;
if (ntmp != ncoeffall) {
printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff);
error->all(FLERR,"Incorrect SNAP coeff file");
}
}
@ -461,7 +460,7 @@ void PairSNAP::coeff(int narg, char **arg)
snaptr = new SNA(lmp, rfac0, twojmax,
rmin0, switchflag, bzeroflag,
alloyflag, wselfallflag, nelements);
chemflag, bnormflag, wselfallflag, nelements);
if (ncoeff != snaptr->ncoeff) {
if (comm->me == 0)
@ -655,7 +654,8 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
bzeroflag = 1;
bnormflag = 0;
quadraticflag = 0;
alloyflag = 0;
chemflag = 0;
bnormflag = 0;
wselfallflag = 0;
chunksize = 2000;
@ -721,8 +721,10 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
bzeroflag = atoi(keyval);
else if (strcmp(keywd,"quadraticflag") == 0)
quadraticflag = atoi(keyval);
else if (strcmp(keywd,"alloyflag") == 0)
alloyflag = atoi(keyval);
else if (strcmp(keywd,"chemflag") == 0)
chemflag = atoi(keyval);
else if (strcmp(keywd,"bnormflag") == 0)
bnormflag = atoi(keyval);
else if (strcmp(keywd,"wselfallflag") == 0)
wselfallflag = atoi(keyval);
else if (strcmp(keywd,"chunksize") == 0)
@ -731,8 +733,6 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
error->all(FLERR,"Incorrect SNAP parameter file");
}
bnormflag = alloyflag;
if (rcutfacflag == 0 || twojmaxflag == 0)
error->all(FLERR,"Incorrect SNAP parameter file");

View File

@ -59,7 +59,7 @@ protected:
double** bispectrum; // bispectrum components for all atoms in list
int *map; // mapping from atom types to elements
int twojmax, switchflag, bzeroflag, bnormflag;
int alloyflag, wselfallflag;
int chemflag, wselfallflag;
int chunksize;
double rfac0, rmin0, wj1, wj2;
int rcutfacflag, twojmaxflag; // flags for required parameters

View File

@ -109,7 +109,7 @@ using namespace MathConst;
SNA::SNA(LAMMPS* lmp, double rfac0_in, int twojmax_in,
double rmin0_in, int switch_flag_in, int bzero_flag_in,
int alloy_flag_in, int wselfall_flag_in, int nelements_in) : Pointers(lmp)
int chem_flag_in, int bnorm_flag_in, int wselfall_flag_in, int nelements_in) : Pointers(lmp)
{
wself = 1.0;
@ -117,11 +117,15 @@ SNA::SNA(LAMMPS* lmp, double rfac0_in, int twojmax_in,
rmin0 = rmin0_in;
switch_flag = switch_flag_in;
bzero_flag = bzero_flag_in;
bnorm_flag = alloy_flag_in;
alloy_flag = alloy_flag_in;
chem_flag = chem_flag_in;
bnorm_flag = bnorm_flag_in;
wselfall_flag = wselfall_flag_in;
if (alloy_flag)
if (bnorm_flag != chem_flag)
lmp->error->warning(FLERR, "bnormflag and chemflag are not equal."
"This is probably not what you intended");
if (chem_flag)
nelements = nelements_in;
else
nelements = 1;
@ -351,7 +355,7 @@ void SNA::compute_ui(int jnum, int ielem)
z0 = r / tan(theta0);
compute_uarray(x, y, z, z0, r, j);
if (alloy_flag)
if (chem_flag)
add_uarraytot(r, wj[j], rcutij[j], j, element[j]);
else
add_uarraytot(r, wj[j], rcutij[j], j, 0);
@ -1688,7 +1692,7 @@ void SNA::compute_ncoeff()
ndoubles = nelements*nelements;
ntriples = nelements*nelements*nelements;
if (alloy_flag)
if (chem_flag)
ncoeff = ncount*ntriples;
else
ncoeff = ncount;

View File

@ -33,7 +33,7 @@ struct SNA_BINDICES {
class SNA : protected Pointers {
public:
SNA(LAMMPS*, double, int, double, int, int, int, int, int);
SNA(LAMMPS*, double, int, double, int, int, int, int, int, int);
SNA(LAMMPS* lmp) : Pointers(lmp) {};
~SNA();
@ -129,7 +129,7 @@ private:
int bzero_flag; // 1 if bzero subtracted from barray
double* bzero; // array of B values for isolated atoms
int bnorm_flag; // 1 if barray divided by j+1
int alloy_flag; // 1 for multi-element bispectrum components
int chem_flag; // 1 for multi-element bispectrum components
int wselfall_flag; // 1 for adding wself to all element labelings
int nelements; // number of elements
int ndoubles; // number of multi-element pairs