consistently check for all per-atom-type masses being set only when per-atom masses are not set

rather than placing an if statement around every incidence of calling atom->check_mass() to ensure it is only called when per atom masses are not set, we place that check _inside_ Atom::check_mass(). This avoids unexpected error messages.
This commit is contained in:
Axel Kohlmeyer
2017-06-28 06:26:21 -04:00
parent f7077d9672
commit d0470799ac
2 changed files with 5 additions and 4 deletions

View File

@ -219,7 +219,7 @@ void Molecule::compute_mass()
if (massflag) return;
massflag = 1;
if (!rmassflag) atom->check_mass(FLERR);
atom->check_mass(FLERR);
masstotal = 0.0;
for (int i = 0; i < natoms; i++) {
@ -243,7 +243,7 @@ void Molecule::compute_com()
if (!comflag) {
comflag = 1;
if (!rmassflag) atom->check_mass(FLERR);
atom->check_mass(FLERR);
double onemass;
com[0] = com[1] = com[2] = 0.0;
@ -308,7 +308,7 @@ void Molecule::compute_inertia()
if (!inertiaflag) {
inertiaflag = 1;
if (!rmassflag) atom->check_mass(FLERR);
atom->check_mass(FLERR);
double onemass,dx,dy,dz;
for (int i = 0; i < 6; i++) itensor[i] = 0.0;