cosmetic changes. improve programming style conformance
This commit is contained in:
29
src/atom.cpp
29
src/atom.cpp
@ -1060,12 +1060,13 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
|
||||
// use the first line to detect and validate the number of words/tokens per line
|
||||
next = strchr(buf,'\n');
|
||||
if (!next) error->all(FLERR, "Missing data in Atoms section of data file");
|
||||
*next = '\0';
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != avec->size_data_atom && nwords != avec->size_data_atom + 3)
|
||||
error->all(FLERR,"Incorrect atom format in data file");
|
||||
if ((nwords != avec->size_data_atom) && (nwords != avec->size_data_atom + 3))
|
||||
error->all(FLERR,"Incorrect atom format in data file: {}", utils::trim(buf));
|
||||
|
||||
// set bounds for my proc
|
||||
// if periodic and I am lo/hi proc, adjust bounds by EPSILON
|
||||
@ -1141,7 +1142,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
*next = '\0';
|
||||
auto values = Tokenizer(utils::trim_comment(buf)).as_vector();
|
||||
if (values.size() == 0) {
|
||||
// skip over empty of comment lines
|
||||
// skip over empty or comment lines
|
||||
} else if ((int)values.size() != nwords) {
|
||||
error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf));
|
||||
} else {
|
||||
@ -1315,7 +1316,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset,
|
||||
if (!next) error->all(FLERR, "Missing data in Angles section of data file");
|
||||
*next = '\0';
|
||||
ValueTokenizer values(utils::trim_comment(buf));
|
||||
// skip over empty of comment lines
|
||||
// skip over empty or comment lines
|
||||
if (values.has_next()) {
|
||||
try {
|
||||
values.next_int();
|
||||
@ -1399,7 +1400,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset,
|
||||
if (!next) error->all(FLERR, "Missing data in Dihedrals section of data file");
|
||||
*next = '\0';
|
||||
ValueTokenizer values(utils::trim_comment(buf));
|
||||
// skip over empty of comment lines
|
||||
// skip over empty or comment lines
|
||||
if (values.has_next()) {
|
||||
try {
|
||||
values.next_int();
|
||||
@ -1501,7 +1502,7 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset,
|
||||
if (!next) error->all(FLERR, "Missing data in Impropers section of data file");
|
||||
*next = '\0';
|
||||
ValueTokenizer values(utils::trim_comment(buf));
|
||||
// skip over empty of comment lines
|
||||
// skip over empty or comment lines
|
||||
if (values.has_next()) {
|
||||
try {
|
||||
values.next_int();
|
||||
@ -1603,7 +1604,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset)
|
||||
*next = '\0';
|
||||
auto values = Tokenizer(utils::trim_comment(buf)).as_vector();
|
||||
if (values.size() == 0) {
|
||||
// skip over empty of comment lines
|
||||
// skip over empty or comment lines
|
||||
} else if ((int)values.size() != avec_bonus->size_data_bonus) {
|
||||
error->all(FLERR, "Incorrect bonus data format in data file: {}", utils::trim(buf));
|
||||
} else {
|
||||
@ -1821,7 +1822,7 @@ void Atom::check_mass(const char *file, int line)
|
||||
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");
|
||||
error->all(file,line,"Not all per-type masses are set. Type {} is missing.", itype);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -1854,8 +1855,7 @@ int Atom::radius_consistency(int itype, double &rad)
|
||||
also return the 3 shape params for itype
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Atom::shape_consistency(int itype,
|
||||
double &shapex, double &shapey, double &shapez)
|
||||
int Atom::shape_consistency(int itype, double &shapex, double &shapey, double &shapez)
|
||||
{
|
||||
double zero[3] = {0.0, 0.0, 0.0};
|
||||
double one[3] = {-1.0, -1.0, -1.0};
|
||||
@ -1874,7 +1874,7 @@ int Atom::shape_consistency(int itype,
|
||||
one[0] = shape[0];
|
||||
one[1] = shape[1];
|
||||
one[2] = shape[2];
|
||||
} else if (one[0] != shape[0] || one[1] != shape[1] || one[2] != shape[2])
|
||||
} else if ((one[0] != shape[0]) || (one[1] != shape[1]) || (one[2] != shape[2]))
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
@ -2169,8 +2169,7 @@ void Atom::setup_sort_bins()
|
||||
if ((binsize == 0.0) && (sortfreq > 0)) {
|
||||
sortfreq = 0;
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,"No pairwise cutoff or binsize set. "
|
||||
"Atom sorting therefore disabled.");
|
||||
error->warning(FLERR,"No pairwise cutoff or binsize set. Atom sorting therefore disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2272,8 +2271,7 @@ void Atom::setup_sort_bins()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (1.0*nbinx*nbiny*nbinz > INT_MAX)
|
||||
error->one(FLERR,"Too many atom sorting bins");
|
||||
if (1.0*nbinx*nbiny*nbinz > INT_MAX) error->one(FLERR,"Too many atom sorting bins");
|
||||
|
||||
nbins = nbinx*nbiny*nbinz;
|
||||
|
||||
@ -2931,4 +2929,3 @@ double Atom::memory_usage()
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user