diff --git a/doc/src/labelmap.rst b/doc/src/labelmap.rst index 7d9ec89166..4fd67798b2 100755 --- a/doc/src/labelmap.rst +++ b/doc/src/labelmap.rst @@ -46,7 +46,8 @@ Type Label sections. If substituting numeric types with type labels is currently supported by a given command, this feature will be mentioned on that command's doc page. Or, for input script commands, type labels - can be processed using :doc:`variable ` syntax. + can be processed using :doc:`variable ` syntax using + labelmap functions. .. note:: diff --git a/doc/src/variable.rst b/doc/src/variable.rst index fe07f3672f..19438aa0e5 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -911,8 +911,9 @@ Labelmap functions convert type labels into numeric types, using label maps created by the :doc:`labelmap ` or :doc:`read_data ` commands. Their argument must be a valid type label, and they return the corresponding integer numeric type. The argument for the *label()*\ , -*blabel()*\ , *alabel()*\ , *dlabel()*\ , and *ilabel()*\ , must be -an atom, bond, angle, dihedral, or improper type label, respectively. +*blabel()*\ , *alabel()*\ , *dlabel()*\ , and *ilabel()* functions, +must be an atom, bond, angle, dihedral, or improper type label, +respectively. ---------- diff --git a/doc/src/write_data.rst b/doc/src/write_data.rst index 0aa26f8bbf..3e52322111 100755 --- a/doc/src/write_data.rst +++ b/doc/src/write_data.rst @@ -12,12 +12,13 @@ Syntax * file = name of data file to write out * zero or more keyword/value pairs may be appended -* keyword = *pair* or *nocoeff* +* keyword = *pair* or *nocoeff* or *nofix* or *nolabelmap* .. parsed-literal:: *nocoeff* = do not write out force field info *nofix* = do not write out extra sections read by fixes + *nolabelmap* = do not write out the default label map *pair* value = *ii* or *ij* *ii* = write one line of pair coefficient info per atom type *ij* = write one line of pair coefficient info per IJ atom type pair @@ -105,6 +106,10 @@ should be written to the data file (see the *fix* option of the option excludes sections for user-created per-atom properties from :doc:`fix property/atom `. +The *nolabelmap* keyword requests that the default label map should +not be written to the data file (see the Type Label sections of +:doc:`read_data ` command for details). + The *pair* keyword lets you specify in what format the pair coefficient information is written into the data file. If the value is specified as *ii*\ , then one line per atom type is written, to diff --git a/src/input.cpp b/src/input.cpp index 5965cc907a..bf8faa8856 100755 --- a/src/input.cpp +++ b/src/input.cpp @@ -1616,7 +1616,7 @@ void Input::labelmap() ilmap = atom->find_labelmap(mapid); if (ilmap == -1) ilmap = atom->add_label_map(mapid); if (narg > i+2) error->all(FLERR,"Illegal labelmap command"); - narg = i - 2; + narg = narg - 2; break; } i++; diff --git a/src/label_map.cpp b/src/label_map.cpp index 438c0172e4..0096105e7b 100755 --- a/src/label_map.cpp +++ b/src/label_map.cpp @@ -106,7 +106,7 @@ void LabelMap::modify_lmap(int narg, char **arg) itype = utils::inumeric(FLERR,arg[iarg++],false,lmp); charlabel = arg[iarg++]; if (itype > ntypes) error->all(FLERR,"Topology type exceeds system topology type"); - if (isdigit(charlabel[0])) error->all(FLERR,"Type labels must begin with a letter"); + if (isdigit(charlabel[0])) error->all(FLERR,"Type labels cannot start with a number"); (*labels)[itype-1] = charlabel; } } diff --git a/src/read_data.cpp b/src/read_data.cpp index 276379972d..06f7dfa1fd 100755 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1984,7 +1984,7 @@ void ReadData::typelabels(std::vector &mytypelabel, int myntypes, i next = strchr(buf,'\n'); *next = '\0'; sscanf(buf,"%*d %s",typelabel); - if (!isalpha(typelabel[0])) error->all(FLERR,"Type labels must begin with a letter"); + if (isdigit(typelabel[0])) error->all(FLERR,"Type labels cannot start with a number"); mytypelabel[i] = typelabel; buf = next + 1; } diff --git a/src/write_data.cpp b/src/write_data.cpp index 4a94f12500..737320dc7f 100755 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -72,6 +72,7 @@ void WriteData::command(int narg, char **arg) pairflag = II; coeffflag = 1; fixflag = 1; + lmapflag = 1; int noinit = 0; int iarg = 1; @@ -91,6 +92,9 @@ void WriteData::command(int narg, char **arg) } else if (strcmp(arg[iarg],"nofix") == 0) { fixflag = 0; iarg++; + } else if (strcmp(arg[iarg],"nolabelmap") == 0) { + lmapflag = 0; + iarg++; } else error->all(FLERR,"Illegal write_data command"); } @@ -186,7 +190,7 @@ void WriteData::write(const std::string &file) if (me == 0) { header(); - if (atom->labelmapflag) atom->lmaps[0]->write_data(fp); + if (lmapflag && atom->labelmapflag) atom->lmaps[0]->write_data(fp); type_arrays(); if (coeffflag) force_fields(); } diff --git a/src/write_data.h b/src/write_data.h index a4e71c9cda..19b544c84d 100755 --- a/src/write_data.h +++ b/src/write_data.h @@ -35,6 +35,7 @@ class WriteData : protected Pointers { int pairflag; int coeffflag; int fixflag; + int lmapflag; FILE *fp; bigint nbonds_local,nbonds; bigint nangles_local,nangles;