fix bug when reading masses

This commit is contained in:
Axel Kohlmeyer 2021-06-20 22:06:58 -04:00
parent a4c8650d2a
commit 3a079c666c
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 5 additions and 7 deletions

View File

@ -94,9 +94,7 @@ PairRANN::PairRANN(LAMMPS *lmp) : Pair(lmp)
//at least one of the following will change during fingerprint definition:
doscreen = false;
allscreen = true;
dospin = false;
}
PairRANN::~PairRANN()
@ -327,7 +325,7 @@ void PairRANN::read_file(char *filename)
linev = values.as_vector();
line1v = values1.as_vector();
if (linev[0]=="atomtypes") read_atom_types(line1v,filename,linenum);
else if (linev[0]=="mass") read_mass(line1v,filename,linenum);
else if (linev[0]=="mass") read_mass(linev,line1v,filename,linenum);
else if (linev[0]=="fingerprintsperelement") read_fpe(linev,line1v,filename,linenum);
else if (linev[0]=="fingerprints") read_fingerprints(linev,line1v,filename,linenum);
else if (linev[0]=="fingerprintconstants") read_fingerprint_constants(linev,line1v,filename,linenum);
@ -368,11 +366,11 @@ void PairRANN::read_atom_types(std::vector<std::string> line,char *filename,int
allocate(line);
}
void PairRANN::read_mass(const std::vector<std::string> &line,char *filename,int linenum) {
void PairRANN::read_mass(const std::vector<std::string> &line1, const std::vector<std::string> &line2, const char *filename,int linenum) {
if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before mass in potential file.");
for (int i=0;i<nelements;i++) {
if (line[1].compare(elements[i])==0) {
mass[i]=utils::numeric(filename,linenum,line[0].c_str(),1,lmp);
if (line1[1].compare(elements[i])==0) {
mass[i]=utils::numeric(filename,linenum,line2[0].c_str(),1,lmp);
return;
}
}

View File

@ -138,7 +138,6 @@ namespace LAMMPS_NS {
void allocate(const std::vector<std::string> &);//called after reading element list, but before reading the rest of the potential
void read_file(char *);//read potential file
void read_atom_types(std::vector<std::string>,char*,int);
void read_mass(const std::vector<std::string> &,char*,int);
void read_fpe(std::vector<std::string>,std::vector<std::string>,char*,int);//fingerprints per element. Count total fingerprints defined for each 1st element in element combinations
void read_fingerprints(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_fingerprint_constants(std::vector<std::string>,std::vector<std::string>,char*,int);
@ -148,6 +147,7 @@ namespace LAMMPS_NS {
void read_bias(std::vector<std::string>,std::vector<std::string>,FILE*,char*,int*);//biases should be formatted as properly shaped vectors
void read_activation_functions(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_screening(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_mass(const std::vector<std::string> &, const std::vector<std::string> &,const char*,int);
bool check_potential();//after finishing reading potential file
void propagateforward(double *,double **,double **,int,int);//called by compute to get force and energy
void propagateforwardspin(double *,double **,double **,double**,int,int);//called by compute to get force and energy