forked from lijiext/lammps
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:
parent
f7077d9672
commit
d0470799ac
|
@ -1514,12 +1514,13 @@ void Atom::set_mass(double *values)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
check that all masses have been set
|
||||
check that all per-atom-type masses have been set
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::check_mass(const char *file, int line)
|
||||
{
|
||||
if (mass == NULL) return;
|
||||
if (rmass_flag) return;
|
||||
for (int itype = 1; itype <= ntypes; itype++)
|
||||
if (mass_setflag[itype] == 0)
|
||||
error->all(file,line,"Not all per-type masses are set");
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue