diff --git a/src/DRUDE/compute_temp_drude.cpp b/src/DRUDE/compute_temp_drude.cpp index d7df6745ee..071f9b90f4 100644 --- a/src/DRUDE/compute_temp_drude.cpp +++ b/src/DRUDE/compute_temp_drude.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeTempDrude::ComputeTempDrude(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg != 3) error->all(FLERR, "Illegal compute temp command"); + if (narg != 3) error->all(FLERR, "Incorrect number of arguments for compute temp/drude"); vector_flag = 1; scalar_flag = 1; @@ -63,11 +63,13 @@ void ComputeTempDrude::init() { // Fix drude already checks that there is only one fix drude instance auto &fixes = modify->get_fix_by_style("^drude$"); - if (fixes.size() == 0) error->all(FLERR, "compute temp/drude requires fix drude"); + if (fixes.size() == 0) + error->all(FLERR, Error::NOLASTLINE, "compute temp/drude requires fix drude"); fix_drude = dynamic_cast(fixes[0]); if (!comm->ghost_velocity) - error->all(FLERR, "compute temp/drude requires ghost velocities. Use comm_modify vel yes"); + error->all(FLERR, Error::NOLASTLINE, + "compute temp/drude requires ghost velocities. Use comm_modify vel yes"); } /* ---------------------------------------------------------------------- */ @@ -170,7 +172,7 @@ void ComputeTempDrude::compute_vector() error->one(FLERR, "Drude atom for core atom ID {} is not defined", atom->tag[i]); } else { error->one(FLERR, "Drude atom ID {} for core atom ID {} is out of range", drudeid[i], - atom->tag[i]); + atom->tag[i]); } } if (rmass) { diff --git a/src/DRUDE/fix_drude.cpp b/src/DRUDE/fix_drude.cpp index 42b7d42c30..478b3ae35b 100644 --- a/src/DRUDE/fix_drude.cpp +++ b/src/DRUDE/fix_drude.cpp @@ -33,7 +33,9 @@ using namespace FixConst; FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg != 3 + atom->ntypes) error->all(FLERR,"Illegal fix drude command"); + if (narg != 3 + atom->ntypes) + error->all(FLERR,"Incorrect number of arguments ({} instead of {}) for fix drude command", + narg, 3 + atom->ntypes); comm_border = 1; // drudeid special_alter_flag = 1; @@ -49,7 +51,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) : else if (arg[i][0] == 'd' || arg[i][0] == 'D' || arg[i][0] == '2') drudetype[i-2] = DRUDE_TYPE; else - error->all(FLERR, "Illegal fix drude command"); + error->all(FLERR, i, "Unknown drude type {} for atom type {}", arg[i], i-2); } drudeid = nullptr; @@ -82,7 +84,8 @@ FixDrude::~FixDrude() void FixDrude::init() { - if (modify->get_fix_by_style("^drude$").size() > 1) error->all(FLERR,"More than one fix drude"); + if (modify->get_fix_by_style("^drude$").size() > 1) + error->all(FLERR, Error::NOLASTLINE, "More than one fix drude"); if (!rebuildflag) rebuild_special(); } @@ -106,8 +109,7 @@ void FixDrude::build_drudeid() { std::vector core_drude_vec; partner_set = new std::set[nlocal]; // Temporary sets of bond partner tags - if (atom->molecular == Atom::MOLECULAR) - { + if (atom->molecular == Atom::MOLECULAR) { // Build list of my atoms' bond partners for (int i=0; ibond_atom[i][k]); } } - } - else - { + } else { // Template case class Molecule **atommols; atommols = atom->avec->onemols; @@ -157,10 +157,10 @@ void FixDrude::build_drudeid() { // At this point each of my Drudes knows its core. // Send my list of Drudes to other procs and myself // so that each core finds its Drude. - comm->ring(drude_vec.size(), sizeof(tagint), - (char *) drude_vec.data(), + comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), 3, ring_search_drudeid, nullptr, (void *)this, 1); - delete [] partner_set; + delete[] partner_set; + // Check if all cores have a drude particle attached for (int i=0; imaxspecial < nspecmax) - error->all(FLERR, "Not enough space in special: extra/special/per/atom should be at least {}", nspecmax - nspecmax_old); + error->all(FLERR, Error::NOLASTLINE, "Not enough space for special neighbors list: " + "use extra/special/per/atom with at least a value of {}", nspecmax - nspecmax_old); // Build list of cores' special lists to communicate to ghost drude particles for (int i=0; itype[i]] != NOPOL_TYPE) { if (atom->nspecial[i] == nullptr) - error->all(FLERR, "Polarizable atoms cannot be inserted with special lists info from the molecule template"); + error->all(FLERR, Error::NOLASTLINE, "Polarizable atoms cannot be inserted " + "with special lists info from the molecule template"); drudeid[i] = atom->special[i][0]; // Drude partner should be at first place in the special list } else { drudeid[i] = 0;