More progress
This commit is contained in:
@ -46,6 +46,8 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp)
|
||||
radelem = nullptr;
|
||||
wjelem = nullptr;
|
||||
coeffelem = nullptr;
|
||||
rinnerelem = nullptr;
|
||||
drinnerelem = nullptr;
|
||||
|
||||
beta_max = 0;
|
||||
beta = nullptr;
|
||||
@ -62,6 +64,8 @@ PairSNAP::~PairSNAP()
|
||||
memory->destroy(radelem);
|
||||
memory->destroy(wjelem);
|
||||
memory->destroy(coeffelem);
|
||||
memory->destroy(rinnerelem);
|
||||
memory->destroy(drinnerelem);
|
||||
|
||||
memory->destroy(beta);
|
||||
memory->destroy(bispectrum);
|
||||
@ -151,6 +155,12 @@ void PairSNAP::compute(int eflag, int vflag)
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jelem];
|
||||
snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac;
|
||||
if (switchinnerflag) {
|
||||
snaptr->rinnerij[ninside] = 0.5*(rinnerelem[ielem]+rinnerelem[jelem]);
|
||||
snaptr->rinnerij[ninside] = 0.5*(drinnerelem[ielem]+drinnerelem[jelem]);
|
||||
// snaptr->rinnerij[ninside] = 0.0;
|
||||
// snaptr->drinnerij[ninside] = 1.5;
|
||||
}
|
||||
if (chemflag) snaptr->element[ninside] = jelem;
|
||||
ninside++;
|
||||
}
|
||||
@ -179,8 +189,7 @@ void PairSNAP::compute(int eflag, int vflag)
|
||||
else
|
||||
snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj],
|
||||
snaptr->rcutij[jj], jj, 0,
|
||||
// snaptr->rinnerij[jj], snaptr->drinnerij[jj],jj);
|
||||
0.0, 1.0);
|
||||
snaptr->rinnerij[jj], snaptr->drinnerij[jj]);
|
||||
|
||||
snaptr->compute_deidrj(fij);
|
||||
|
||||
@ -328,6 +337,12 @@ void PairSNAP::compute_bispectrum()
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jelem];
|
||||
snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac;
|
||||
if (switchinnerflag) {
|
||||
snaptr->rinnerij[ninside] = 0.5*(rinnerelem[ielem]+rinnerelem[jelem]);
|
||||
snaptr->rinnerij[ninside] = 0.5*(drinnerelem[ielem]+drinnerelem[jelem]);
|
||||
// snaptr->rinnerij[ninside] = 0.0;
|
||||
// snaptr->drinnerij[ninside] = 1.5;
|
||||
}
|
||||
if (chemflag) snaptr->element[ninside] = jelem;
|
||||
ninside++;
|
||||
}
|
||||
@ -512,9 +527,13 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
||||
memory->destroy(radelem);
|
||||
memory->destroy(wjelem);
|
||||
memory->destroy(coeffelem);
|
||||
memory->destroy(rinnerelem);
|
||||
memory->destroy(drinnerelem);
|
||||
memory->create(radelem,nelements,"pair:radelem");
|
||||
memory->create(wjelem,nelements,"pair:wjelem");
|
||||
memory->create(coeffelem,nelements,ncoeffall,"pair:coeffelem");
|
||||
memory->create(rinnerelem,nelements,"pair:rinnerelem");
|
||||
memory->create(drinnerelem,nelements,"pair:drinnerelem");
|
||||
|
||||
// initialize checklist for all required nelements
|
||||
|
||||
@ -630,10 +649,15 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
||||
chemflag = 0;
|
||||
bnormflag = 0;
|
||||
wselfallflag = 0;
|
||||
switchinnerflag = 1;
|
||||
switchinnerflag = 0;
|
||||
chunksize = 32768;
|
||||
parallel_thresh = 8192;
|
||||
|
||||
// set local input checks
|
||||
|
||||
int rinnerflag = 0;
|
||||
int drinnerflag = 0;
|
||||
|
||||
// open SNAP parameter file on proc 0
|
||||
|
||||
FILE *fpparam;
|
||||
@ -667,7 +691,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
||||
}
|
||||
|
||||
if (words.size() == 0) continue;
|
||||
if (words.size() != 2)
|
||||
if (words.size() < 2)
|
||||
error->all(FLERR,"Incorrect format in SNAP parameter file");
|
||||
|
||||
auto keywd = words[0];
|
||||
@ -698,11 +722,25 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
||||
bnormflag = utils::inumeric(FLERR,keyval,false,lmp);
|
||||
else if (keywd == "wselfallflag")
|
||||
wselfallflag = utils::inumeric(FLERR,keyval,false,lmp);
|
||||
else if (keywd == "switchinnerflag")
|
||||
switchinnerflag = utils::inumeric(FLERR,keyval,false,lmp);
|
||||
else if (keywd == "chunksize")
|
||||
chunksize = utils::inumeric(FLERR,keyval,false,lmp);
|
||||
else if (keywd == "parallelthresh")
|
||||
parallel_thresh = utils::inumeric(FLERR,keyval,false,lmp);
|
||||
else
|
||||
else if (keywd == "rinner") {
|
||||
for (int ielem = 0; ielem < nelements; ielem++) {
|
||||
rinnerelem[ielem] = utils::numeric(FLERR,keyval,false,lmp);
|
||||
keyval = strtok(nullptr,"' \t\n\r\f");
|
||||
}
|
||||
rinnerflag = 1;
|
||||
} else if (keywd == "drinner") {
|
||||
for (int ielem = 0; ielem < nelements; ielem++) {
|
||||
drinnerelem[ielem] = utils::numeric(FLERR,keyval,false,lmp);
|
||||
keyval = strtok(nullptr,"' \t\n\r\f");
|
||||
}
|
||||
drinnerflag = 1;
|
||||
} else
|
||||
error->all(FLERR,"Unknown parameter '{}' in SNAP parameter file", keywd);
|
||||
}
|
||||
|
||||
@ -712,6 +750,11 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
||||
if (chemflag && nelemtmp != nelements)
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
|
||||
if (switchinnerflag && !(rinnerflag && drinnerflag))
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
|
||||
if (!switchinnerflag && (rinnerflag || drinnerflag))
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -59,7 +59,9 @@ class PairSNAP : public Pair {
|
||||
double **scale; // for thermodynamic integration
|
||||
int twojmax, switchflag, bzeroflag, bnormflag;
|
||||
int chemflag, wselfallflag;
|
||||
int switchinnerflag;
|
||||
int switchinnerflag; // inner cutoff switch
|
||||
double *rinnerelem; // element inner cutoff
|
||||
double *drinnerelem; // element inner cutoff range
|
||||
int chunksize,parallel_thresh;
|
||||
double rfac0, rmin0, wj1, wj2;
|
||||
int rcutfacflag, twojmaxflag; // flags for required parameters
|
||||
|
||||
@ -178,7 +178,7 @@ SNA::~SNA()
|
||||
memory->destroy(rinnerij);
|
||||
memory->destroy(drinnerij);
|
||||
}
|
||||
if (chem_flag) memory->destroy(element);
|
||||
if (chem_flag) memory->destroy(element);
|
||||
memory->destroy(ulist_r_ij);
|
||||
memory->destroy(ulist_i_ij);
|
||||
delete[] idxz;
|
||||
@ -376,8 +376,7 @@ void SNA::compute_ui(int jnum, int ielem)
|
||||
if (chem_flag)
|
||||
add_uarraytot(r, wj[j], rcutij[j], j, element[j], rinnerij[j], drinnerij[j]);
|
||||
else
|
||||
// add_uarraytot(r, wj[j], rcutij[j], j, 0, rinnerij[j], drinnerij[j]);
|
||||
add_uarraytot(r, wj[j], rcutij[j], j, 0, 0.0, 1.0);
|
||||
add_uarraytot(r, wj[j], rcutij[j], j, 0, rinnerij[j], drinnerij[j]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -61,23 +61,31 @@ class SNA : protected Pointers {
|
||||
|
||||
double compute_sfac_inner(double, double, double);
|
||||
double compute_dsfac_inner(double, double, double);
|
||||
|
||||
|
||||
// public bispectrum data
|
||||
|
||||
int twojmax;
|
||||
double *blist;
|
||||
double **dblist;
|
||||
|
||||
// short neighbor list data
|
||||
|
||||
void grow_rij(int);
|
||||
int nmax; // allocated size of short lists
|
||||
|
||||
double **rij; // short rij list
|
||||
int *inside; // short neighbor list
|
||||
double *wj; // short weight list
|
||||
double *rcutij; // short cutoff list
|
||||
double *rcutij; // short cutoff list
|
||||
|
||||
// only allocated for switch_inner_flag=1
|
||||
|
||||
double *rinnerij; // short inner cutoff list
|
||||
double *drinnerij;// short inner range list
|
||||
|
||||
// only allocated for chem_flag=1
|
||||
|
||||
int *element; // short element list [0,nelements)
|
||||
int nmax; // allocated size of short lists
|
||||
|
||||
void grow_rij(int);
|
||||
|
||||
int twojmax;
|
||||
double *ylist_r, *ylist_i;
|
||||
int idxcg_max, idxu_max, idxz_max, idxb_max;
|
||||
|
||||
private:
|
||||
double rmin0, rfac0;
|
||||
@ -103,6 +111,9 @@ class SNA : protected Pointers {
|
||||
double **dulist_r, **dulist_i;
|
||||
int elem_duarray; // element of j in derivative
|
||||
|
||||
double *ylist_r, *ylist_i;
|
||||
int idxcg_max, idxu_max, idxz_max, idxb_max;
|
||||
|
||||
void create_twojmax_arrays();
|
||||
void destroy_twojmax_arrays();
|
||||
void init_clebsch_gordan();
|
||||
|
||||
Reference in New Issue
Block a user