nolabel for write_data

also bug fixes
This commit is contained in:
jrgissing
2021-01-31 16:37:09 -05:00
parent b92adfaf6f
commit 4f219a94aa
8 changed files with 20 additions and 8 deletions

View File

@ -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 <variable>` syntax.
can be processed using :doc:`variable <variable>` syntax using
labelmap functions.
.. note::

View File

@ -911,8 +911,9 @@ Labelmap functions convert type labels into numeric types, using label
maps created by the :doc:`labelmap <labelmap>` or :doc:`read_data <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.
----------

View File

@ -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 <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 <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

View File

@ -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++;

View File

@ -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;
}
}

View File

@ -1984,7 +1984,7 @@ void ReadData::typelabels(std::vector<std::string> &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;
}

View File

@ -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();
}

View File

@ -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;