remove dead code, avoid uninitialized access
This commit is contained in:
@ -356,7 +356,6 @@ void Molecule::from_json(const std::string &molid, const json &moldata)
|
|||||||
|
|
||||||
if (moldata.contains("body") && (moldata["body"].size() == 2)) {
|
if (moldata.contains("body") && (moldata["body"].size() == 2)) {
|
||||||
bodyflag = 1;
|
bodyflag = 1;
|
||||||
const double scale5 = powint(sizescale, 5);
|
|
||||||
avec_body = dynamic_cast<AtomVecBody *>(atom->style_match("body"));
|
avec_body = dynamic_cast<AtomVecBody *>(atom->style_match("body"));
|
||||||
if (!avec_body)
|
if (!avec_body)
|
||||||
error->all(FLERR, Error::NOLASTLINE,
|
error->all(FLERR, Error::NOLASTLINE,
|
||||||
@ -2709,7 +2708,6 @@ void Molecule::special_generate()
|
|||||||
if (newton_bond) {
|
if (newton_bond) {
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
for (int j = 0; j < num_bond[i]; j++) {
|
for (int j = 0; j < num_bond[i]; j++) {
|
||||||
atom1 = i;
|
|
||||||
atom2 = bond_atom[i][j] - 1;
|
atom2 = bond_atom[i][j] - 1;
|
||||||
nspecial[i][0]++;
|
nspecial[i][0]++;
|
||||||
nspecial[atom2][0]++;
|
nspecial[atom2][0]++;
|
||||||
|
|||||||
12
src/set.cpp
12
src/set.cpp
@ -658,7 +658,7 @@ void Set::setrandom(int keyword, Action *action)
|
|||||||
bigint allcount;
|
bigint allcount;
|
||||||
MPI_Allreduce(&bcount,&allcount,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
MPI_Allreduce(&bcount,&allcount,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
|
|
||||||
bigint nsubset;
|
bigint nsubset = 0;
|
||||||
if (keyword == TYPE_RATIO) {
|
if (keyword == TYPE_RATIO) {
|
||||||
double fraction = action->dvalue1;
|
double fraction = action->dvalue1;
|
||||||
nsubset = static_cast<bigint> (fraction * allcount);
|
nsubset = static_cast<bigint> (fraction * allcount);
|
||||||
@ -2328,8 +2328,6 @@ void Set::process_spin_electron(int &iarg, int narg, char **arg, Action *action)
|
|||||||
void Set::invoke_spin_electron(Action *action)
|
void Set::invoke_spin_electron(Action *action)
|
||||||
{
|
{
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
int *spin = atom->spin;
|
|
||||||
|
|
||||||
int varflag = action->varflag;
|
int varflag = action->varflag;
|
||||||
int ispin;
|
int ispin;
|
||||||
if (!action->varflag1) ispin = action->ivalue1;
|
if (!action->varflag1) ispin = action->ivalue1;
|
||||||
@ -2457,8 +2455,6 @@ void Set::process_tri(int &iarg, int narg, char **arg, Action *action)
|
|||||||
void Set::invoke_tri(Action *action)
|
void Set::invoke_tri(Action *action)
|
||||||
{
|
{
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
int *tri = atom->tri;
|
|
||||||
|
|
||||||
auto avec_tri = dynamic_cast<AtomVecTri *>(atom->style_match("tri"));
|
auto avec_tri = dynamic_cast<AtomVecTri *>(atom->style_match("tri"));
|
||||||
|
|
||||||
int varflag = action->varflag;
|
int varflag = action->varflag;
|
||||||
@ -2510,16 +2506,16 @@ void Set::invoke_type(Action *action)
|
|||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
|
|
||||||
int varflag = action->varflag;
|
int varflag = action->varflag;
|
||||||
int itype;
|
int itype = 0;
|
||||||
if (!action->varflag1) itype = action->ivalue1;
|
if (!action->varflag1) itype = action->ivalue1;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (!select[i]) continue;
|
if (!select[i]) continue;
|
||||||
|
|
||||||
if (action->varflag) {
|
if (varflag) {
|
||||||
itype = static_cast<int> (vec1[i]);
|
itype = static_cast<int> (vec1[i]);
|
||||||
if (itype <= 0 || itype > atom->ntypes)
|
if (itype <= 0 || itype > atom->ntypes)
|
||||||
error->one(FLERR,"Invalid atom type in set command");
|
error->one(FLERR, Error::NOLASTLINE, "Invalid atom type in set command");
|
||||||
}
|
}
|
||||||
|
|
||||||
type[i] = itype;
|
type[i] = itype;
|
||||||
|
|||||||
Reference in New Issue
Block a user