update whitespace and argument formats for longer source lines
This commit is contained in:
214
src/molecule.cpp
214
src/molecule.cpp
@ -57,8 +57,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) :
|
|||||||
|
|
||||||
id = utils::strdup(arg[0]);
|
id = utils::strdup(arg[0]);
|
||||||
if (!utils::is_id(id))
|
if (!utils::is_id(id))
|
||||||
error->all(FLERR,"Molecule template ID must have only "
|
error->all(FLERR,"Molecule template ID must have only alphanumeric or underscore characters");
|
||||||
"alphanumeric or underscore characters");
|
|
||||||
|
|
||||||
// parse args until reach unknown arg (next file)
|
// parse args until reach unknown arg (next file)
|
||||||
|
|
||||||
@ -130,8 +129,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) :
|
|||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fp = fopen(arg[ifile],"r");
|
fp = fopen(arg[ifile],"r");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
error->one(FLERR,"Cannot open molecule file {}: {}",
|
error->one(FLERR,"Cannot open molecule file {}: {}",arg[ifile], utils::getsyserror());
|
||||||
arg[ifile], utils::getsyserror());
|
|
||||||
}
|
}
|
||||||
read(0);
|
read(0);
|
||||||
if (me == 0) fclose(fp);
|
if (me == 0) fclose(fp);
|
||||||
@ -496,8 +494,7 @@ void Molecule::read(int flag)
|
|||||||
if (nmatch != nwant)
|
if (nmatch != nwant)
|
||||||
error->one(FLERR,"Invalid header line format in molecule file");
|
error->one(FLERR,"Invalid header line format in molecule file");
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->one(FLERR, "Invalid header in molecule file\n"
|
error->one(FLERR,"Invalid header in molecule file: {}", e.what());
|
||||||
"{}", e.what());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,11 +615,9 @@ void Molecule::read(int flag)
|
|||||||
// Error: Either a too long/short section or a typo in the keyword
|
// Error: Either a too long/short section or a typo in the keyword
|
||||||
|
|
||||||
if (utils::strmatch(keyword,"^[A-Za-z ]+$"))
|
if (utils::strmatch(keyword,"^[A-Za-z ]+$"))
|
||||||
error->one(FLERR,"Unknown section '{}' in molecule "
|
error->one(FLERR,"Unknown section '{}' in molecule file\n",keyword);
|
||||||
"file\n",keyword);
|
|
||||||
else error->one(FLERR,"Unexpected line in molecule file "
|
else error->one(FLERR,"Unexpected line in molecule file "
|
||||||
"while looking for the next "
|
"while looking for the next section:\n{}",line);
|
||||||
"section:\n{}",line);
|
|
||||||
}
|
}
|
||||||
keyword = parse_keyword(1,line);
|
keyword = parse_keyword(1,line);
|
||||||
}
|
}
|
||||||
@ -648,8 +643,7 @@ void Molecule::read(int flag)
|
|||||||
|
|
||||||
if (bondflag && specialflag == 0) {
|
if (bondflag && specialflag == 0) {
|
||||||
if (domain->box_exist == 0)
|
if (domain->box_exist == 0)
|
||||||
error->all(FLERR,"Cannot auto-generate special bonds before "
|
error->all(FLERR,"Cannot auto-generate special bonds before simulation box is defined");
|
||||||
"simulation box is defined");
|
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
special_generate();
|
special_generate();
|
||||||
@ -691,8 +685,7 @@ void Molecule::coords(char *line)
|
|||||||
|
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 4)
|
if (values.count() != 4)
|
||||||
error->all(FLERR,"Invalid line in Coords section of "
|
error->all(FLERR,"Invalid line in Coords section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
|
|
||||||
int iatom = values.next_int() - 1;
|
int iatom = values.next_int() - 1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
@ -707,19 +700,16 @@ void Molecule::coords(char *line)
|
|||||||
x[iatom][2] *= sizescale;
|
x[iatom][2] *= sizescale;
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR,"Invalid line in Coords section of "
|
error->all(FLERR,"Invalid line in Coords section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++)
|
||||||
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Coords "
|
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Coords section of molecule file",i+1);
|
||||||
"section of molecule file",i+1);
|
|
||||||
|
|
||||||
if (domain->dimension == 2) {
|
if (domain->dimension == 2) {
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++)
|
||||||
if (x[i][2] != 0.0)
|
if (x[i][2] != 0.0)
|
||||||
error->all(FLERR,"Z coord in molecule file for atom {} "
|
error->all(FLERR,"Z coord in molecule file for atom {} must be 0.0 for 2d-simulation",i+1);
|
||||||
"must be 0.0 for 2d-simulation.",i+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,8 +727,7 @@ void Molecule::types(char *line)
|
|||||||
|
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 2)
|
if (values.count() != 2)
|
||||||
error->all(FLERR,"Invalid line in Types section of "
|
error->all(FLERR,"Invalid line in Types section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
|
|
||||||
int iatom = values.next_int() - 1;
|
int iatom = values.next_int() - 1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
@ -748,17 +737,14 @@ void Molecule::types(char *line)
|
|||||||
type[iatom] += toffset;
|
type[iatom] += toffset;
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Types section of "
|
error->all(FLERR,"Invalid line in Types section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}", e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Types "
|
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Types section of molecule file",i+1);
|
||||||
"section of molecule file",i+1);
|
|
||||||
|
|
||||||
if ((type[i] <= 0) || (domain->box_exist && (type[i] > atom->ntypes)))
|
if ((type[i] <= 0) || (domain->box_exist && (type[i] > atom->ntypes)))
|
||||||
error->all(FLERR,"Invalid atom type {} for atom {} "
|
error->all(FLERR,"Invalid atom type {} for atom {} in molecule file",type[i],i+1);
|
||||||
"in molecule file",type[i],i+1);
|
|
||||||
|
|
||||||
ntypes = MAX(ntypes,type[i]);
|
ntypes = MAX(ntypes,type[i]);
|
||||||
}
|
}
|
||||||
@ -777,8 +763,7 @@ void Molecule::molecules(char *line)
|
|||||||
readline(line);
|
readline(line);
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 2)
|
if (values.count() != 2)
|
||||||
error->all(FLERR,"Invalid line in Molecules section of "
|
error->all(FLERR,"Invalid line in Molecules section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
|
|
||||||
int iatom = values.next_int() - 1;
|
int iatom = values.next_int() - 1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
@ -788,19 +773,17 @@ void Molecule::molecules(char *line)
|
|||||||
// molecule[iatom] += moffset; // placeholder for possible molecule offset
|
// molecule[iatom] += moffset; // placeholder for possible molecule offset
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Molecules section of "
|
error->all(FLERR,"Invalid line in Molecules section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++) {
|
||||||
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Molecules "
|
if (count[i] == 0)
|
||||||
"section of molecule file",i+1);
|
error->all(FLERR,"Atom {} missing in Molecules section of molecule file",i+1);
|
||||||
|
}
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++) {
|
||||||
if (molecule[i] < 0)
|
if (molecule[i] < 0)
|
||||||
error->all(FLERR,"Invalid molecule ID {} for atom {} "
|
error->all(FLERR,"Invalid molecule ID {} for atom {} in molecule file",molecule[i],i+1);
|
||||||
"in molecule file",molecule[i],i+1);
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++)
|
||||||
nmolecules = MAX(nmolecules,molecule[i]);
|
nmolecules = MAX(nmolecules,molecule[i]);
|
||||||
}
|
}
|
||||||
@ -818,22 +801,20 @@ void Molecule::fragments(char *line)
|
|||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
|
|
||||||
if ((int)values.count() > natoms+1)
|
if ((int)values.count() > natoms+1)
|
||||||
error->all(FLERR,"Too many atoms per fragment in Fragments "
|
error->all(FLERR,"Too many atoms per fragment in Fragments section of molecule file");
|
||||||
"section of molecule file");
|
|
||||||
|
|
||||||
fragmentnames[i] = values.next_string();
|
fragmentnames[i] = values.next_string();
|
||||||
|
|
||||||
while (values.has_next()) {
|
while (values.has_next()) {
|
||||||
int iatom = values.next_int()-1;
|
int iatom = values.next_int()-1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
error->all(FLERR,"Invalid atom ID {} for fragment {} in "
|
error->all(FLERR,"Invalid atom ID {} for fragment {} in Fragments section of "
|
||||||
"Fragments section of molecule file",
|
"molecule file", iatom+1, fragmentnames[i]);
|
||||||
iatom+1, fragmentnames[i]);
|
|
||||||
fragmentmask[i][iatom] = 1;
|
fragmentmask[i][iatom] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid atom ID in Fragments section of "
|
error->all(FLERR,"Invalid atom ID in Fragments section of "
|
||||||
"molecule file: {}\n{}", e.what(),line);
|
"molecule file: {}\n{}", e.what(),line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -851,8 +832,7 @@ void Molecule::charges(char *line)
|
|||||||
|
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if ((int)values.count() != 2)
|
if ((int)values.count() != 2)
|
||||||
error->all(FLERR,"Invalid line in Charges section of "
|
error->all(FLERR,"Invalid line in Charges section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
|
|
||||||
int iatom = values.next_int() - 1;
|
int iatom = values.next_int() - 1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
@ -862,13 +842,13 @@ void Molecule::charges(char *line)
|
|||||||
q[iatom] = values.next_double();
|
q[iatom] = values.next_double();
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Charges section of "
|
error->all(FLERR,"Invalid line in Charges section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}.\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++) {
|
||||||
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Charges "
|
if (count[i] == 0)
|
||||||
"section of molecule file",i+1);
|
error->all(FLERR,"Atom {} missing in Charges section of molecule file",i+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -885,8 +865,7 @@ void Molecule::diameters(char *line)
|
|||||||
|
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 2)
|
if (values.count() != 2)
|
||||||
error->all(FLERR,"Invalid line in Diameters section of "
|
error->all(FLERR,"Invalid line in Diameters section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
int iatom = values.next_int() - 1;
|
int iatom = values.next_int() - 1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
error->all(FLERR,"Invalid atom index in Diameters section of molecule file");
|
error->all(FLERR,"Invalid atom index in Diameters section of molecule file");
|
||||||
@ -897,16 +876,14 @@ void Molecule::diameters(char *line)
|
|||||||
maxradius = MAX(maxradius,radius[iatom]);
|
maxradius = MAX(maxradius,radius[iatom]);
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Diameters section of "
|
error->all(FLERR,"Invalid line in Diameters section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
if (count[i] == 0) error->all(FLERR,"Atom {} missing in Diameters "
|
if (count[i] == 0)
|
||||||
"section of molecule file",i+1);
|
error->all(FLERR,"Atom {} missing in Diameters section of molecule file",i+1);
|
||||||
if (radius[i] < 0.0)
|
if (radius[i] < 0.0)
|
||||||
error->all(FLERR,"Invalid atom diameter {} for atom {} "
|
error->all(FLERR,"Invalid atom diameter {} for atom {} in molecule file", radius[i], i+1);
|
||||||
"in molecule file", radius[i], i+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,8 +900,7 @@ void Molecule::masses(char *line)
|
|||||||
|
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 2)
|
if (values.count() != 2)
|
||||||
error->all(FLERR,"Invalid line in Masses section of "
|
error->all(FLERR,"Invalid line in Masses section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
|
|
||||||
int iatom = values.next_int() - 1;
|
int iatom = values.next_int() - 1;
|
||||||
if (iatom < 0 || iatom >= natoms)
|
if (iatom < 0 || iatom >= natoms)
|
||||||
@ -934,8 +910,7 @@ void Molecule::masses(char *line)
|
|||||||
rmass[iatom] *= sizescale*sizescale*sizescale;
|
rmass[iatom] *= sizescale*sizescale*sizescale;
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Masses section of "
|
error->all(FLERR,"Invalid line in Masses section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
@ -972,15 +947,13 @@ void Molecule::bonds(int flag, char *line)
|
|||||||
try {
|
try {
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 4)
|
if (values.count() != 4)
|
||||||
error->all(FLERR,"Invalid line in Bonds section of "
|
error->all(FLERR,"Invalid line in Bonds section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
values.next_int();
|
values.next_int();
|
||||||
itype = values.next_int();
|
itype = values.next_int();
|
||||||
atom1 = values.next_tagint();
|
atom1 = values.next_tagint();
|
||||||
atom2 = values.next_tagint();
|
atom2 = values.next_tagint();
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Bonds section of "
|
error->all(FLERR,"Invalid line in Bonds section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itype += boffset;
|
itype += boffset;
|
||||||
@ -1042,16 +1015,14 @@ void Molecule::angles(int flag, char *line)
|
|||||||
try {
|
try {
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 5)
|
if (values.count() != 5)
|
||||||
error->all(FLERR,"Invalid line in Angles section of "
|
error->all(FLERR,"Invalid line in Angles section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
values.next_int();
|
values.next_int();
|
||||||
itype = values.next_int();
|
itype = values.next_int();
|
||||||
atom1 = values.next_tagint();
|
atom1 = values.next_tagint();
|
||||||
atom2 = values.next_tagint();
|
atom2 = values.next_tagint();
|
||||||
atom3 = values.next_tagint();
|
atom3 = values.next_tagint();
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Angles section of "
|
error->all(FLERR,"Invalid line in Angles section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itype += aoffset;
|
itype += aoffset;
|
||||||
@ -1128,8 +1099,7 @@ void Molecule::dihedrals(int flag, char *line)
|
|||||||
try {
|
try {
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 6)
|
if (values.count() != 6)
|
||||||
error->all(FLERR,"Invalid line in Dihedrals section of "
|
error->all(FLERR,"Invalid line in Dihedrals section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
|
|
||||||
values.next_int();
|
values.next_int();
|
||||||
itype = values.next_int();
|
itype = values.next_int();
|
||||||
@ -1138,8 +1108,7 @@ void Molecule::dihedrals(int flag, char *line)
|
|||||||
atom3 = values.next_tagint();
|
atom3 = values.next_tagint();
|
||||||
atom4 = values.next_tagint();
|
atom4 = values.next_tagint();
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Dihedrals section of "
|
error->all(FLERR,"Invalid line in Dihedrals section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itype += doffset;
|
itype += doffset;
|
||||||
@ -1150,8 +1119,7 @@ void Molecule::dihedrals(int flag, char *line)
|
|||||||
(atom4 <= 0) || (atom4 > natoms) ||
|
(atom4 <= 0) || (atom4 > natoms) ||
|
||||||
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
|
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
|
||||||
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
|
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
|
||||||
error->all(FLERR,
|
error->all(FLERR,"Invalid atom ID in dihedrals section of molecule file");
|
||||||
"Invalid atom ID in dihedrals section of molecule file");
|
|
||||||
if ((itype <= 0) || (domain->box_exist && (itype > atom->ndihedraltypes)))
|
if ((itype <= 0) || (domain->box_exist && (itype > atom->ndihedraltypes)))
|
||||||
error->all(FLERR,"Invalid dihedral type in Dihedrals section of molecule file");
|
error->all(FLERR,"Invalid dihedral type in Dihedrals section of molecule file");
|
||||||
|
|
||||||
@ -1230,8 +1198,7 @@ void Molecule::impropers(int flag, char *line)
|
|||||||
try {
|
try {
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 6)
|
if (values.count() != 6)
|
||||||
error->all(FLERR,"Invalid line in Impropers section of "
|
error->all(FLERR,"Invalid line in Impropers section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
values.next_int();
|
values.next_int();
|
||||||
itype = values.next_int();
|
itype = values.next_int();
|
||||||
atom1 = values.next_tagint();
|
atom1 = values.next_tagint();
|
||||||
@ -1239,8 +1206,7 @@ void Molecule::impropers(int flag, char *line)
|
|||||||
atom3 = values.next_tagint();
|
atom3 = values.next_tagint();
|
||||||
atom4 = values.next_tagint();
|
atom4 = values.next_tagint();
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Impropers section of "
|
error->all(FLERR,"Invalid line in Impropers section of molecule file: {}\n{}",e.what(),line);
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itype += ioffset;
|
itype += ioffset;
|
||||||
@ -1251,8 +1217,7 @@ void Molecule::impropers(int flag, char *line)
|
|||||||
(atom4 <= 0) || (atom4 > natoms) ||
|
(atom4 <= 0) || (atom4 > natoms) ||
|
||||||
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
|
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
|
||||||
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
|
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
|
||||||
error->all(FLERR,
|
error->all(FLERR,"Invalid atom ID in impropers section of molecule file");
|
||||||
"Invalid atom ID in impropers section of molecule file");
|
|
||||||
if ((itype <= 0) || (domain->box_exist && (itype > atom->nimpropertypes)))
|
if ((itype <= 0) || (domain->box_exist && (itype > atom->nimpropertypes)))
|
||||||
error->all(FLERR,"Invalid improper type in Impropers section of molecule file");
|
error->all(FLERR,"Invalid improper type in Impropers section of molecule file");
|
||||||
|
|
||||||
@ -1325,14 +1290,13 @@ void Molecule::nspecial_read(int flag, char *line)
|
|||||||
try {
|
try {
|
||||||
ValueTokenizer values(utils::trim_comment(line));
|
ValueTokenizer values(utils::trim_comment(line));
|
||||||
if (values.count() != 4)
|
if (values.count() != 4)
|
||||||
error->all(FLERR,"Invalid line in Special Bond Counts section of "
|
error->all(FLERR,"Invalid line in Special Bond Counts section of molecule file: {}",line);
|
||||||
"molecule file: {}",line);
|
|
||||||
values.next_int();
|
values.next_int();
|
||||||
c1 = values.next_tagint();
|
c1 = values.next_tagint();
|
||||||
c2 = values.next_tagint();
|
c2 = values.next_tagint();
|
||||||
c3 = values.next_tagint();
|
c3 = values.next_tagint();
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Special Bond Counts section of "
|
error->all(FLERR,"Invalid line in Special Bond Counts section of "
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
"molecule file: {}\n{}",e.what(),line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1358,8 +1322,7 @@ void Molecule::special_read(char *line)
|
|||||||
int nwords = values.count();
|
int nwords = values.count();
|
||||||
|
|
||||||
if (nwords != nspecial[i][2]+1)
|
if (nwords != nspecial[i][2]+1)
|
||||||
error->all(FLERR,"Molecule file special list "
|
error->all(FLERR,"Molecule file special list does not match special count");
|
||||||
"does not match special count");
|
|
||||||
|
|
||||||
values.next_int(); // ignore
|
values.next_int(); // ignore
|
||||||
|
|
||||||
@ -1367,12 +1330,11 @@ void Molecule::special_read(char *line)
|
|||||||
special[i][m-1] = values.next_tagint();
|
special[i][m-1] = values.next_tagint();
|
||||||
if (special[i][m-1] <= 0 || special[i][m-1] > natoms ||
|
if (special[i][m-1] <= 0 || special[i][m-1] > natoms ||
|
||||||
special[i][m-1] == i+1)
|
special[i][m-1] == i+1)
|
||||||
error->all(FLERR,"Invalid atom index in Special Bonds "
|
error->all(FLERR,"Invalid atom index in Special Bonds section of molecule file");
|
||||||
"section of molecule file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid line in Special Bonds section of "
|
error->all(FLERR,"Invalid line in Special Bonds section of "
|
||||||
"molecule file: {}\n{}",e.what(),line);
|
"molecule file: {}\n{}",e.what(),line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1502,8 +1464,7 @@ void Molecule::shakeflag_read(char *line)
|
|||||||
shake_flag[i] = values.next_int();
|
shake_flag[i] = values.next_int();
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid Shake Flags section in molecule file\n"
|
error->all(FLERR,"Invalid Shake Flags section in molecule file: {}", e.what());
|
||||||
"{}", e.what());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++)
|
for (int i = 0; i < natoms; i++)
|
||||||
@ -1572,8 +1533,7 @@ void Molecule::shakeatom_read(char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR,"Invalid shake atom in molecule file\n"
|
error->all(FLERR,"Invalid shake atom in molecule file: {}", e.what());
|
||||||
"{}", e.what());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
@ -1642,8 +1602,7 @@ void Molecule::shaketype_read(char *line)
|
|||||||
error->all(FLERR,"Invalid shake type data in molecule file");
|
error->all(FLERR,"Invalid shake type data in molecule file");
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid shake type data in molecule file\n",
|
error->all(FLERR,"Invalid shake type data in molecule file: {}",e.what());
|
||||||
"{}", e.what());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < natoms; i++) {
|
for (int i = 0; i < natoms; i++) {
|
||||||
@ -1695,8 +1654,7 @@ void Molecule::body(int flag, int pflag, char *line)
|
|||||||
} else nword += ncount;
|
} else nword += ncount;
|
||||||
}
|
}
|
||||||
} catch (TokenizerException &e) {
|
} catch (TokenizerException &e) {
|
||||||
error->all(FLERR, "Invalid body params in molecule file\n",
|
error->all(FLERR,"Invalid body params in molecule file: {}", e.what());
|
||||||
"{}", e.what());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1735,8 +1693,7 @@ void Molecule::check_attributes(int flag)
|
|||||||
if (onemol->rmassflag && !atom->rmass_flag) mismatch = 1;
|
if (onemol->rmassflag && !atom->rmass_flag) mismatch = 1;
|
||||||
|
|
||||||
if (mismatch && me == 0)
|
if (mismatch && me == 0)
|
||||||
error->warning(FLERR,
|
error->warning(FLERR,"Molecule attributes do not match system attributes");
|
||||||
"Molecule attributes do not match system attributes");
|
|
||||||
|
|
||||||
// for all atom styles, check nbondtype,etc
|
// for all atom styles, check nbondtype,etc
|
||||||
|
|
||||||
@ -1770,8 +1727,7 @@ void Molecule::check_attributes(int flag)
|
|||||||
// warn if molecule topology defined but no special settings
|
// warn if molecule topology defined but no special settings
|
||||||
|
|
||||||
if (onemol->bondflag && !onemol->specialflag)
|
if (onemol->bondflag && !onemol->specialflag)
|
||||||
if (me == 0) error->warning(FLERR,"Molecule has bond topology "
|
if (me == 0) error->warning(FLERR,"Molecule has bond topology but no special bond settings");
|
||||||
"but no special bond settings");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1878,47 +1834,31 @@ void Molecule::allocate()
|
|||||||
memory->create(special,natoms,maxspecial,"molecule:special");
|
memory->create(special,natoms,maxspecial,"molecule:special");
|
||||||
|
|
||||||
if (bondflag) {
|
if (bondflag) {
|
||||||
memory->create(bond_type,natoms,bond_per_atom,
|
memory->create(bond_type,natoms,bond_per_atom,"molecule:bond_type");
|
||||||
"molecule:bond_type");
|
memory->create(bond_atom,natoms,bond_per_atom,"molecule:bond_atom");
|
||||||
memory->create(bond_atom,natoms,bond_per_atom,
|
|
||||||
"molecule:bond_atom");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angleflag) {
|
if (angleflag) {
|
||||||
memory->create(angle_type,natoms,angle_per_atom,
|
memory->create(angle_type,natoms,angle_per_atom,"molecule:angle_type");
|
||||||
"molecule:angle_type");
|
memory->create(angle_atom1,natoms,angle_per_atom,"molecule:angle_atom1");
|
||||||
memory->create(angle_atom1,natoms,angle_per_atom,
|
memory->create(angle_atom2,natoms,angle_per_atom,"molecule:angle_atom2");
|
||||||
"molecule:angle_atom1");
|
memory->create(angle_atom3,natoms,angle_per_atom,"molecule:angle_atom3");
|
||||||
memory->create(angle_atom2,natoms,angle_per_atom,
|
|
||||||
"molecule:angle_atom2");
|
|
||||||
memory->create(angle_atom3,natoms,angle_per_atom,
|
|
||||||
"molecule:angle_atom3");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dihedralflag) {
|
if (dihedralflag) {
|
||||||
memory->create(dihedral_type,natoms,dihedral_per_atom,
|
memory->create(dihedral_type,natoms,dihedral_per_atom,"molecule:dihedral_type");
|
||||||
"molecule:dihedral_type");
|
memory->create(dihedral_atom1,natoms,dihedral_per_atom,"molecule:dihedral_atom1");
|
||||||
memory->create(dihedral_atom1,natoms,dihedral_per_atom,
|
memory->create(dihedral_atom2,natoms,dihedral_per_atom,"molecule:dihedral_atom2");
|
||||||
"molecule:dihedral_atom1");
|
memory->create(dihedral_atom3,natoms,dihedral_per_atom,"molecule:dihedral_atom3");
|
||||||
memory->create(dihedral_atom2,natoms,dihedral_per_atom,
|
memory->create(dihedral_atom4,natoms,dihedral_per_atom,"molecule:dihedral_atom4");
|
||||||
"molecule:dihedral_atom2");
|
|
||||||
memory->create(dihedral_atom3,natoms,dihedral_per_atom,
|
|
||||||
"molecule:dihedral_atom3");
|
|
||||||
memory->create(dihedral_atom4,natoms,dihedral_per_atom,
|
|
||||||
"molecule:dihedral_atom4");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (improperflag) {
|
if (improperflag) {
|
||||||
memory->create(improper_type,natoms,improper_per_atom,
|
memory->create(improper_type,natoms,improper_per_atom,"molecule:improper_type");
|
||||||
"molecule:improper_type");
|
memory->create(improper_atom1,natoms,improper_per_atom,"molecule:improper_atom1");
|
||||||
memory->create(improper_atom1,natoms,improper_per_atom,
|
memory->create(improper_atom2,natoms,improper_per_atom,"molecule:improper_atom2");
|
||||||
"molecule:improper_atom1");
|
memory->create(improper_atom3,natoms,improper_per_atom,"molecule:improper_atom3");
|
||||||
memory->create(improper_atom2,natoms,improper_per_atom,
|
memory->create(improper_atom4,natoms,improper_per_atom,"molecule:improper_atom4");
|
||||||
"molecule:improper_atom2");
|
|
||||||
memory->create(improper_atom3,natoms,improper_per_atom,
|
|
||||||
"molecule:improper_atom3");
|
|
||||||
memory->create(improper_atom4,natoms,improper_per_atom,
|
|
||||||
"molecule:improper_atom4");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shakeflag) {
|
if (shakeflag) {
|
||||||
|
|||||||
Reference in New Issue
Block a user