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:
@ -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)
|
void Atom::check_mass(const char *file, int line)
|
||||||
{
|
{
|
||||||
if (mass == NULL) return;
|
if (mass == NULL) return;
|
||||||
|
if (rmass_flag) return;
|
||||||
for (int itype = 1; itype <= ntypes; itype++)
|
for (int itype = 1; itype <= ntypes; itype++)
|
||||||
if (mass_setflag[itype] == 0)
|
if (mass_setflag[itype] == 0)
|
||||||
error->all(file,line,"Not all per-type masses are set");
|
error->all(file,line,"Not all per-type masses are set");
|
||||||
|
|||||||
@ -219,7 +219,7 @@ void Molecule::compute_mass()
|
|||||||
if (massflag) return;
|
if (massflag) return;
|
||||||
massflag = 1;
|
massflag = 1;
|
||||||
|
|
||||||
if (!rmassflag) atom->check_mass(FLERR);
|
atom->check_mass(FLERR);
|
||||||
|
|
||||||
masstotal = 0.0;
|
masstotal = 0.0;
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
@ -243,7 +243,7 @@ void Molecule::compute_com()
|
|||||||
if (!comflag) {
|
if (!comflag) {
|
||||||
comflag = 1;
|
comflag = 1;
|
||||||
|
|
||||||
if (!rmassflag) atom->check_mass(FLERR);
|
atom->check_mass(FLERR);
|
||||||
|
|
||||||
double onemass;
|
double onemass;
|
||||||
com[0] = com[1] = com[2] = 0.0;
|
com[0] = com[1] = com[2] = 0.0;
|
||||||
@ -308,7 +308,7 @@ void Molecule::compute_inertia()
|
|||||||
if (!inertiaflag) {
|
if (!inertiaflag) {
|
||||||
inertiaflag = 1;
|
inertiaflag = 1;
|
||||||
|
|
||||||
if (!rmassflag) atom->check_mass(FLERR);
|
atom->check_mass(FLERR);
|
||||||
|
|
||||||
double onemass,dx,dy,dz;
|
double onemass,dx,dy,dz;
|
||||||
for (int i = 0; i < 6; i++) itensor[i] = 0.0;
|
for (int i = 0; i < 6; i++) itensor[i] = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user