Merge branch 'develop' of github.com:lammps/lammps into kk_3280
This commit is contained in:
@ -58,6 +58,9 @@ PPPMDielectric::PPPMDielectric(LAMMPS *_lmp) : PPPM(_lmp)
|
||||
phi = nullptr;
|
||||
potflag = 0;
|
||||
|
||||
// no warnings about non-neutral systems from qsum_qsq()
|
||||
warn_nonneutral = 2;
|
||||
|
||||
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
|
||||
if (!avec) error->all(FLERR,"pppm/dielectric requires atom style dielectric");
|
||||
}
|
||||
@ -463,25 +466,3 @@ void PPPMDielectric::slabcorr()
|
||||
efield[i][2] += ffact * eps[i]*(dipole_all - qsum*x[i][2]);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
compute qsum,qsqsum,q2 and ignore error/warning if not charge neutral
|
||||
called whenever charges are changed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PPPMDielectric::qsum_qsq()
|
||||
{
|
||||
const double * const q = atom->q;
|
||||
const int nlocal = atom->nlocal;
|
||||
double qsum_local(0.0), qsqsum_local(0.0);
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
qsum_local += q[i];
|
||||
qsqsum_local += q[i]*q[i];
|
||||
}
|
||||
|
||||
MPI_Allreduce(&qsum_local,&qsum,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(&qsqsum_local,&qsqsum,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
q2 = qsqsum * force->qqrd2e;
|
||||
}
|
||||
|
||||
@ -34,8 +34,6 @@ class PPPMDielectric : public PPPM {
|
||||
double *phi;
|
||||
int potflag; // 1/0 if per-atom electrostatic potential phi is needed
|
||||
|
||||
void qsum_qsq();
|
||||
|
||||
protected:
|
||||
void slabcorr() override;
|
||||
|
||||
|
||||
@ -65,6 +65,9 @@ PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp)
|
||||
|
||||
mu_flag = 0;
|
||||
|
||||
// no warnings about non-neutral systems from qsum_qsq()
|
||||
warn_nonneutral = 2;
|
||||
|
||||
efield = nullptr;
|
||||
phi = nullptr;
|
||||
potflag = 0;
|
||||
@ -837,25 +840,3 @@ double PPPMDispDielectric::memory_usage()
|
||||
bytes += nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
compute qsum,qsqsum,q2 and give error/warning if not charge neutral
|
||||
called initially, when particle count changes, when charges are changed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PPPMDispDielectric::qsum_qsq()
|
||||
{
|
||||
const double * const q = atom->q;
|
||||
const int nlocal = atom->nlocal;
|
||||
double qsum_local(0.0), qsqsum_local(0.0);
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
qsum_local += q[i];
|
||||
qsqsum_local += q[i]*q[i];
|
||||
}
|
||||
|
||||
MPI_Allreduce(&qsum_local,&qsum,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(&qsqsum_local,&qsqsum,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
q2 = qsqsum * force->qqrd2e;
|
||||
}
|
||||
|
||||
@ -30,8 +30,7 @@ class PPPMDispDielectric : public PPPMDisp {
|
||||
~PPPMDispDielectric() override;
|
||||
double memory_usage() override;
|
||||
void compute(int, int) override;
|
||||
void qsum_qsq();
|
||||
void slabcorr(int);
|
||||
void slabcorr(int) override;
|
||||
|
||||
double **efield;
|
||||
double *phi;
|
||||
|
||||
@ -95,6 +95,7 @@ PairBOP::PairBOP(LAMMPS *lmp) : Pair(lmp)
|
||||
pairParameters = nullptr;
|
||||
tripletParameters = nullptr;
|
||||
bop_elements = nullptr;
|
||||
bop_masses = nullptr;
|
||||
bop_types = 0;
|
||||
|
||||
pairlist1 = nullptr;
|
||||
@ -183,6 +184,7 @@ PairBOP::~PairBOP()
|
||||
if (bop_elements)
|
||||
for (int i = 0; i < bop_types; i++) delete[] bop_elements[i];
|
||||
delete[] bop_elements;
|
||||
delete[] bop_masses;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -198,6 +200,7 @@ void PairBOP::compute(int eflag, int vflag)
|
||||
|
||||
int newton_pair = force->newton_pair;
|
||||
int nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
int *type = atom->type;
|
||||
tagint *tag = atom->tag;
|
||||
@ -221,7 +224,15 @@ void PairBOP::compute(int eflag, int vflag)
|
||||
temp_ij = BOP_index[i] + jj;
|
||||
j = ilist[neigh_index[temp_ij]];
|
||||
j_tag = tag[j];
|
||||
if (j_tag <= i_tag) continue;
|
||||
if (i_tag > j_tag) {
|
||||
if ((i_tag+j_tag) % 2 == 0) continue;
|
||||
} else if (i_tag < j_tag) {
|
||||
if ((i_tag+j_tag) % 2 == 1) continue;
|
||||
} else {
|
||||
if (x[j][2] < x[i][2]) continue;
|
||||
if (x[j][2] == x[i][2] && x[j][1] < x[i][1]) continue;
|
||||
if (x[j][2] == x[i][2] && x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue;
|
||||
}
|
||||
jtype = map[type[j]];
|
||||
int param_ij = elem2param[itype][jtype];
|
||||
sigB_0 = SigmaBo(ii,jj);
|
||||
@ -251,7 +262,15 @@ void PairBOP::compute(int eflag, int vflag)
|
||||
temp_ij = BOP_index2[i] + jj;
|
||||
j = ilist[neigh_index2[temp_ij]];
|
||||
j_tag = tag[j];
|
||||
if (j_tag <= i_tag) continue;
|
||||
if (i_tag > j_tag) {
|
||||
if ((i_tag+j_tag) % 2 == 0) continue;
|
||||
} else if (i_tag < j_tag) {
|
||||
if ((i_tag+j_tag) % 2 == 1) continue;
|
||||
} else {
|
||||
if (x[j][2] < x[i][2]) continue;
|
||||
if (x[j][2] == x[i][2] && x[j][1] < x[i][1]) continue;
|
||||
if (x[j][2] == x[i][2] && x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue;
|
||||
}
|
||||
PairList2 & p2_ij = pairlist2[temp_ij];
|
||||
dpr2 = -p2_ij.dRep / p2_ij.r;
|
||||
ftmp1 = dpr2 * p2_ij.dis[0];
|
||||
@ -344,16 +363,16 @@ void PairBOP::settings(int narg, char **arg)
|
||||
|
||||
void PairBOP::coeff(int narg, char **arg)
|
||||
{
|
||||
const int n = atom->ntypes;
|
||||
delete [] map;
|
||||
map = new int[n+1];
|
||||
const int np1 = atom->ntypes+1;
|
||||
delete[] map;
|
||||
map = new int[np1];
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
memory->destroy(cutghost);
|
||||
memory->create(setflag,n+1,n+1,"BOP:setflag");
|
||||
memory->create(cutsq,n+1,n+1,"BOP:cutsq");
|
||||
memory->create(cutghost,n+1,n+1,"BOP:cutghost");
|
||||
bytes = (n+1)*(n+1) * (sizeof (int) + 2.0*sizeof (double));
|
||||
memory->create(setflag,np1,np1,"BOP:setflag");
|
||||
memory->create(cutsq,np1,np1,"BOP:cutsq");
|
||||
memory->create(cutghost,np1,np1,"BOP:cutghost");
|
||||
bytes = np1*np1*(sizeof (int) + 2.0*sizeof (double));
|
||||
|
||||
map_element2type(narg-3, arg+3);
|
||||
|
||||
@ -365,22 +384,23 @@ void PairBOP::coeff(int narg, char **arg)
|
||||
// and check for missing elements
|
||||
|
||||
if (comm->me == 0) {
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int i = 1; i < np1; i++) {
|
||||
int j;
|
||||
if (map[i] >= 0) {
|
||||
for (j = 0; j < bop_types; j++) {
|
||||
if (strcmp(elements[map[i]],bop_elements[j]) == 0) {
|
||||
if (strcmp(elements[map[i]], bop_elements[j]) == 0) {
|
||||
map[i] = j;
|
||||
atom->set_mass(FLERR, i, bop_masses[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == bop_types)
|
||||
error->one(FLERR,"Element {} not found in bop potential file {}",
|
||||
elements[map[i]],arg[2]);
|
||||
elements[map[i]], arg[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
MPI_Bcast(map,atom->ntypes+1,MPI_INT,0,world);
|
||||
MPI_Bcast(map,np1,MPI_INT,0,world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -1844,9 +1864,10 @@ void PairBOP::read_table(char *filename)
|
||||
PotentialFileReader *reader = nullptr;
|
||||
|
||||
if (bop_elements) {
|
||||
for (int i = 0; i < bop_types; i++) delete [] bop_elements[i];
|
||||
delete [] bop_elements;
|
||||
for (int i = 0; i < bop_types; i++) delete[] bop_elements[i];
|
||||
delete[] bop_elements;
|
||||
}
|
||||
delete[] bop_masses;
|
||||
|
||||
if (comm->me == 0) {
|
||||
try {
|
||||
@ -1857,10 +1878,11 @@ void PairBOP::read_table(char *filename)
|
||||
"elements",bop_types));
|
||||
|
||||
bop_elements = new char*[bop_types];
|
||||
bop_masses = new double[bop_types];
|
||||
for (int i=0; i < bop_types; ++i) {
|
||||
ValueTokenizer values = reader->next_values(3);
|
||||
values.next_int(); // element number in PTE (ignored)
|
||||
values.next_double(); // element mass (ignored)
|
||||
values.next_int(); // element number (ignored)
|
||||
bop_masses[i] = values.next_double(); // element mass
|
||||
bop_elements[i] = utils::strdup(values.next_string());
|
||||
}
|
||||
} catch (TokenizerException &e) {
|
||||
@ -1873,8 +1895,12 @@ void PairBOP::read_table(char *filename)
|
||||
allocate();
|
||||
memory->create(rcut,npairs,"BOP:rcut");
|
||||
|
||||
// copy element labels to all MPI ranks for use with write_tables()
|
||||
if (comm->me != 0) bop_elements = new char*[bop_types];
|
||||
// copy element labels and masses to all MPI ranks for use with
|
||||
// write_tables() and to set the per-type masses
|
||||
if (comm->me != 0) {
|
||||
bop_elements = new char*[bop_types];
|
||||
bop_masses = new double[bop_types];
|
||||
}
|
||||
for (int i = 0; i < bop_types; ++i) {
|
||||
int n=0;
|
||||
if (comm->me == 0) n = strlen(bop_elements[i])+1;
|
||||
@ -1882,6 +1908,7 @@ void PairBOP::read_table(char *filename)
|
||||
if (comm->me != 0) bop_elements[i] = new char[n];
|
||||
MPI_Bcast(bop_elements[i],n,MPI_CHAR,0,world);
|
||||
}
|
||||
MPI_Bcast(bop_masses, bop_types, MPI_DOUBLE, 0, world);
|
||||
|
||||
if (comm->me == 0) {
|
||||
try {
|
||||
@ -2010,7 +2037,7 @@ void PairBOP::read_table(char *filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
delete [] singletable;
|
||||
delete[] singletable;
|
||||
|
||||
singletable = new double[nr];
|
||||
for (int i = 0; i < npairs; i++) {
|
||||
@ -2038,7 +2065,7 @@ void PairBOP::read_table(char *filename)
|
||||
p.betaP = new TabularFunction();
|
||||
(p.betaP)->set_values(nr, 0.0, rcut[i], singletable);
|
||||
}
|
||||
delete [] singletable;
|
||||
delete[] singletable;
|
||||
|
||||
singletable = new double[nBOt];
|
||||
for (int i = 0; i < npairs; i++) {
|
||||
@ -2048,7 +2075,7 @@ void PairBOP::read_table(char *filename)
|
||||
p.bo = new TabularFunction();
|
||||
(p.bo)->set_values(nBOt, 0.0, 1.0, singletable);
|
||||
}
|
||||
delete [] singletable;
|
||||
delete[] singletable;
|
||||
|
||||
nbuf = 0;
|
||||
for (int i = 0; i < bop_types; i++) {
|
||||
@ -2102,7 +2129,7 @@ void PairBOP::read_table(char *filename)
|
||||
(p.cphi)->set_values(nr, 0.0, rcut[i], singletable);
|
||||
}
|
||||
}
|
||||
delete [] singletable;
|
||||
delete[] singletable;
|
||||
}
|
||||
|
||||
memory->destroy(rcut);
|
||||
|
||||
@ -109,6 +109,7 @@ class PairBOP : public Pair {
|
||||
int npairs; // number of element pairs
|
||||
int ntriples; // number of all triples
|
||||
char **bop_elements; // names of elements in potential file
|
||||
double *bop_masses; // masses of elements in potential file
|
||||
double bytes;
|
||||
|
||||
int otfly; // = 1 faster, more memory, = 0 slower, less memory
|
||||
|
||||
@ -402,26 +402,20 @@ void AngleTable::read_table(Table *tb, char *file, char *keyword)
|
||||
|
||||
// read a,e,f table values from file
|
||||
|
||||
int cerror = 0;
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line(4);
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
tb->afile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException &) {
|
||||
++cerror;
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, "Error parsing angle table '{}' line {} of {}. {}\nLine was: {}", keyword,
|
||||
i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
}
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror)
|
||||
error->warning(FLERR, "{} of {} lines in table incomplete or could not be parsed", cerror,
|
||||
tb->ninput);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -325,20 +325,20 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
|
||||
|
||||
// read r,e,f table values from file
|
||||
|
||||
int cerror = 0;
|
||||
int r0idx = -1;
|
||||
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line(4);
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
tb->rfile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException &) {
|
||||
++cerror;
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, "Error parsing bond table '{}' line {} of {}. {}\nLine was: {}", keyword,
|
||||
i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
|
||||
if (tb->efile[i] < emin) {
|
||||
@ -373,21 +373,11 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
|
||||
if (f > fleft && f > fright) ferror++;
|
||||
}
|
||||
|
||||
if (ferror) {
|
||||
if (ferror)
|
||||
error->warning(FLERR,
|
||||
"{} of {} force values in table are inconsistent with -dE/dr.\n"
|
||||
"WARNING: Should only be flagged at inflection points",
|
||||
ferror, tb->ninput);
|
||||
}
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror) {
|
||||
error->warning(FLERR,
|
||||
"{} of {} lines in table were incomplete or could not be"
|
||||
" parsed completely",
|
||||
cerror, tb->ninput);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -1020,23 +1020,24 @@ void DihedralTable::read_table(Table *tb, char *file, char *keyword)
|
||||
// read a,e,f table values from file
|
||||
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
if (tb->f_unspecified) {
|
||||
ValueTokenizer values = reader.next_values(3);
|
||||
values.next_int();
|
||||
tb->phifile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
} else {
|
||||
ValueTokenizer values = reader.next_values(4);
|
||||
values.next_int();
|
||||
tb->phifile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
}
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, e.what());
|
||||
error->one(FLERR, "Error parsing dihedral table '{}' line {} of {}. {}\nLine was: {}",
|
||||
keyword, i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
} //for (int i = 0; (i < tb->ninput) && fp; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -395,20 +395,18 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
||||
union_int_float_t rsq_lookup;
|
||||
|
||||
int rerror = 0;
|
||||
int cerror = 0;
|
||||
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line(4);
|
||||
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
rfile = values.next_double();
|
||||
tb->efile[i] = conversion_factor * values.next_double();
|
||||
tb->ffile[i] = conversion_factor * values.next_double();
|
||||
} catch (TokenizerException &) {
|
||||
++cerror;
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, "Error parsing pair table '{}' line {} of {}. {}\nLine was: {}", keyword,
|
||||
i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
|
||||
rnew = rfile;
|
||||
@ -474,14 +472,6 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
||||
"{} of {} distance values in table {} with relative error\n"
|
||||
"WARNING: over {} to re-computed values",
|
||||
rerror, tb->ninput, EPSILONR, keyword);
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror)
|
||||
error->warning(FLERR,
|
||||
"{} of {} lines in table {} were incomplete\n"
|
||||
"WARNING: or could not be parsed completely",
|
||||
cerror, tb->ninput, keyword);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -195,6 +195,8 @@ std::string platform::os_info()
|
||||
|
||||
if (build == "6002") {
|
||||
buf = "Windows Vista";
|
||||
} else if (build == "6003") {
|
||||
buf = "Windows Server 2008";
|
||||
} else if (build == "7601") {
|
||||
buf = "Windows 7";
|
||||
} else if (build == "9200") {
|
||||
@ -227,8 +229,12 @@ std::string platform::os_info()
|
||||
buf = "Windows 10 21H1";
|
||||
} else if (build == "19044") {
|
||||
buf = "Windows 10 21H2";
|
||||
} else if (build == "20348") {
|
||||
buf = "Windows Server 2022";
|
||||
} else if (build == "22000") {
|
||||
buf = "Windows 11 21H2";
|
||||
} else if (build == "22621") {
|
||||
buf = "Windows 11 22H2";
|
||||
} else {
|
||||
const char *entry = "ProductName";
|
||||
RegGetValue(HKEY_LOCAL_MACHINE, subkey, entry, RRF_RT_REG_SZ, nullptr, &value,
|
||||
|
||||
Reference in New Issue
Block a user