From 83a978d69b12bc53230d779617ec84c7b163225b Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Tue, 7 Dec 2021 23:32:14 -0500 Subject: [PATCH] error messages --- doc/src/Errors_messages.rst | 24 ++++++++++++++++++ doc/src/Howto_type_labels.rst | 34 ++++++++++++------------- src/input.h | 5 ++++ src/label_map.cpp | 2 +- src/label_map.h | 9 +++++++ src/read_data.cpp | 48 +++++++++++++++++------------------ src/read_data.h | 6 +++++ src/variable.h | 5 ++++ 8 files changed, 91 insertions(+), 42 deletions(-) diff --git a/doc/src/Errors_messages.rst b/doc/src/Errors_messages.rst index 6b3df7f0fe..12f9da2404 100644 --- a/doc/src/Errors_messages.rst +++ b/doc/src/Errors_messages.rst @@ -5446,6 +5446,10 @@ Doc page with :doc:`WARNING messages ` Mass command must set a type from 1-N where N is the number of atom types. +*Invalid type label in variable formula* + Argument of a labelmap function must be a valid type label that has + been assigned to a numeric type. + *Invalid use of library file() function* This function is called through the library interface. This error should not occur. Contact the developers if it does. @@ -5578,9 +5582,18 @@ Doc page with :doc:`WARNING messages ` *LJ6 off not supported in pair_style buck/long/coul/long* Self-explanatory. +*Label map is incomplete: all types must be assigned a unique type label* + For a given type-kind (atom types, bond types, etc.) to be written to + the data file, all associated types must be assigned a type label, and + each type label can be assigned to only one numeric type. + *Label wasn't found in input script* Self-explanatory. +*Labelmap command before simulation box is defined* + The labelmap command cannot be used before a read_data, + read_restart, or create_box command. + *Lattice orient vectors are not orthogonal* The three specified lattice orientation vectors must be mutually orthogonal. @@ -7860,6 +7873,10 @@ keyword to allow for additional bonds to be formed Number of local atoms times number of columns must fit in a 32-bit integer for dump. +*Topology type exceeds system topology type* + The number of bond, angle, etc types exceeds the system setting. See + the create_box or read_data command for how to specify these values. + *Tree structure in joint connections* Fix poems cannot (yet) work with coupled bodies whose joints connect the bodies in a tree structure. @@ -7884,6 +7901,13 @@ keyword to allow for additional bonds to be formed *Two groups cannot be the same in fix spring couple* Self-explanatory. +*Type label already exists: type labels must be unique* + For a given type-kind (atom types, bond types, etc.), a given type + label can be assigned to only one numeric type. + +*Type labels cannot start with a number* + Self-explanatory. + *Unable to initialize accelerator for use* There was a problem initializing an accelerator for the gpu package diff --git a/doc/src/Howto_type_labels.rst b/doc/src/Howto_type_labels.rst index b96f256b32..35fb0967e7 100644 --- a/doc/src/Howto_type_labels.rst +++ b/doc/src/Howto_type_labels.rst @@ -19,10 +19,10 @@ of other commands below which can use label types in interesting ways. A collection of type labels for all type-kinds (atom types, bond types, etc.) is stored as a "label map" which is simply a list of -numeric types and associated type labels. Within a map, each type -label must be unique. It can be assigned to only one numeric type. -To read and write the default type labels to data files for a given -type-kind, all associated numeric types need have a type label +numeric types and associated type labels. Within a type-kind, each +type label must be unique. It can be assigned to only one numeric +type. To read and write the default type labels to data files for a +given type-kind, all associated numeric types need have a type label assigned. There can be multiple label maps defined. There is a default label @@ -45,19 +45,19 @@ a C-H bond with a type label "[C][H]". There are two ways to define label maps. One is via the :doc:`labelmap ` command, which has an optional *mapID* -keyword to allow creation of type labels in either a default map or an -additional map with a mapID. The other is via the :doc:`read_data +keyword to allow creation of type labels in either the default map or +an additional map with a mapID. The other is via the :doc:`read_data ` command. A data file can have sections such as Atom Type Labels, Bond Type Labels, etc, which associate type labels with numeric types. Only the default label map can be defined in this manner. If defined, the default label map can be written out to data files by -the :doc:`write_data ` command. They are also written to -and read from restart files, by the :doc:`write_restart ` -and :doc:`read_restart ` commands. Label maps with -mapIDs cannot be written to either data or restart files by these -commands. +the :doc:`write_data ` command. This map is also written +to and read from restart files, by the :doc:`write_restart +` and :doc:`read_restart ` commands. +Label maps with mapIDs cannot be written to either data or restart +files by these commands. ---------- @@ -135,12 +135,12 @@ using wildcards to further increase the portability of reaction templates, as well as automatically inferring the types of newly created bond, angle, etc. interactions. -LAMMPS label types will be used in a planned extension of OpenKIM to +LAMMPS type labels will be used in a planned extension of OpenKIM to support bonded force fields (FFs) (such as CHARMM, AMBER, IFF, etc.). Users will be able to use a bonded FF, packaged as an OpenKIM -Simulator Model (SM), using the `kim init` command. The SM will +Simulator Model (SM), using the `kim init` command. The SM will include all required interaction parameters (pair, bond, angle, -dihedral, improper) defined in terms of the standard atom type labels -for that FF. Molecular configurations can then be defined within a -LAMMPS script or read in from a data file by defining the mapping from -standard LAMMPS integer atom type integers to the new label types. +dihedral, improper) defined in terms of the standard atom types for +that FF. Molecular configurations can then be specified within a +LAMMPS script or read in from a data file by using type labels that +match the atom types for that FF. diff --git a/src/input.h b/src/input.h index b25511932f..47b18523b1 100644 --- a/src/input.h +++ b/src/input.h @@ -329,6 +329,11 @@ E: KSpace style has not yet been set Cannot use kspace_modify command until a kspace style is set. +E: Labelmap command before simulation box is defined + +The labelmap command cannot be used before a read_data, read_restart, +or create_box command. + E: Mass command before simulation box is defined The mass command cannot be used before a read_data, read_restart, or diff --git a/src/label_map.cpp b/src/label_map.cpp index 0d2e93320c..51bde569f7 100644 --- a/src/label_map.cpp +++ b/src/label_map.cpp @@ -107,7 +107,7 @@ void LabelMap::modify_lmap(int narg, char **arg) if (isdigit(slabel[0])) error->all(FLERR,"Type labels cannot start with a number"); if (search(slabel,(*labels_map)) != -1) - error->all(FLERR,"Type label already exists: types labels must be unique"); + error->all(FLERR,"Type label already exists: type labels must be unique"); std::string &str = (*labels)[itype-1]; if (!str.empty()) (*labels_map).erase(str); str = slabel; diff --git a/src/label_map.h b/src/label_map.h index 596024418e..5a785d5bb9 100644 --- a/src/label_map.h +++ b/src/label_map.h @@ -79,4 +79,13 @@ E: Topology type exceeds system topology type The number of bond, angle, etc types exceeds the system setting. See the create_box or read_data command for how to specify these values. +E: Type label already exists: type labels must be unique + +For a given type-kind (atom types, bond types, etc.), a given type +label can be assigned to only one numeric type. + +E: Type labels cannot start with a number + +Self-explanatory. + */ diff --git a/src/read_data.cpp b/src/read_data.cpp index 2dfb42c023..622bf8ec51 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1305,8 +1305,8 @@ void ReadData::atoms() eof = utils::read_lines_from_file(fp,nchunk,MAXLINE,buffer,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); atom->data_atoms(nchunk,buffer,id_offset,mol_offset,toffset, shiftflag,shift,tlabelflag,lmap->lmap2lmap.atom); nread += nchunk; @@ -1423,8 +1423,8 @@ void ReadData::bonds(int firstpass) eof = utils::read_lines_from_file(fp,nchunk,MAXLINE,buffer,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); if (blabelflag && !lmap->is_complete(Atom::BOND)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); atom->data_bonds(nchunk,buffer,count,id_offset,boffset, blabelflag,lmap->lmap2lmap.bond); nread += nchunk; @@ -1501,8 +1501,8 @@ void ReadData::angles(int firstpass) eof = utils::read_lines_from_file(fp,nchunk,MAXLINE,buffer,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); if (alabelflag && !lmap->is_complete(Atom::ANGLE)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); atom->data_angles(nchunk,buffer,count,id_offset,aoffset, alabelflag,lmap->lmap2lmap.angle); nread += nchunk; @@ -1579,8 +1579,8 @@ void ReadData::dihedrals(int firstpass) eof = utils::read_lines_from_file(fp,nchunk,MAXLINE,buffer,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); if (dlabelflag && !lmap->is_complete(Atom::DIHEDRAL)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); atom->data_dihedrals(nchunk,buffer,count,id_offset,doffset, dlabelflag,lmap->lmap2lmap.dihedral); nread += nchunk; @@ -1657,8 +1657,8 @@ void ReadData::impropers(int firstpass) eof = utils::read_lines_from_file(fp,nchunk,MAXLINE,buffer,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); if (ilabelflag && !lmap->is_complete(Atom::IMPROPER)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); atom->data_impropers(nchunk,buffer,count,id_offset,ioffset, ilabelflag,lmap->lmap2lmap.improper); nread += nchunk; @@ -1854,8 +1854,8 @@ void ReadData::mass() int eof = utils::read_lines_from_file(fp,ntypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < ntypes; i++) { @@ -1878,8 +1878,8 @@ void ReadData::paircoeffs() if (eof) error->all(FLERR,"Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < ntypes; i++) { @@ -1908,8 +1908,8 @@ void ReadData::pairIJcoeffs() if (eof) error->all(FLERR,"Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (i = 0; i < ntypes; i++) @@ -1938,8 +1938,8 @@ void ReadData::bondcoeffs() if (eof) error->all(FLERR,"Unexpected end of data file"); if (blabelflag && !lmap->is_complete(Atom::BOND)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nbondtypes; i++) { @@ -1967,8 +1967,8 @@ void ReadData::anglecoeffs(int which) if (eof) error->all(FLERR,"Unexpected end of data file"); if (alabelflag && !lmap->is_complete(Atom::ANGLE)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nangletypes; i++) { @@ -2000,8 +2000,8 @@ void ReadData::dihedralcoeffs(int which) if (eof) error->all(FLERR,"Unexpected end of data file"); if (dlabelflag && !lmap->is_complete(Atom::DIHEDRAL)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < ndihedraltypes; i++) { @@ -2040,8 +2040,8 @@ void ReadData::impropercoeffs(int which) if (eof) error->all(FLERR,"Unexpected end of data file"); if (ilabelflag && !lmap->is_complete(Atom::IMPROPER)) - error->all(FLERR,"Label map is incomplete. " - "All types must be assigned a unique type label."); + error->all(FLERR,"Label map is incomplete: " + "all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nimpropertypes; i++) { diff --git a/src/read_data.h b/src/read_data.h index 018ee51693..156093b022 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -367,6 +367,12 @@ E: Invalid data file section: EndBondTorsion Coeffs Atom style does not allow dihedrals. +E: Label map is incomplete: all types must be assigned a unique type label + +For a given type-kind (atom types, bond types, etc.) to be written to +the data file, all associated types must be assigned a type label, and +each type label can be assigned to only one numeric type. + E: Must define dihedral_style before EndBondTorsion Coeffs Must use a dihedral_style command before reading a data file that diff --git a/src/variable.h b/src/variable.h index 44bf604ca1..bc77b14dfc 100644 --- a/src/variable.h +++ b/src/variable.h @@ -223,6 +223,11 @@ E: All variables in next command must have same style UNDOCUMENTED +E: Invalid type label in variable formula + +Argument of a labelmap function must be a valid type label that has +been assigned to a numeric type. + E: Invalid variable style with next command Variable styles {equal} and {world} cannot be used in a next