diff --git a/src/atom.cpp b/src/atom.cpp index 8e8c1a2bb8..5d3b960731 100755 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1990,7 +1990,7 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, allocate space for type label map ------------------------------------------------------------------------- */ -void Atom::add_label_map(char *mapID) +void Atom::add_label_map(std::string mapID) { labelmapflag = 1; lmaps = (LabelMap **) diff --git a/src/atom.h b/src/atom.h index 94741261b0..4eb62bdfe4 100755 --- a/src/atom.h +++ b/src/atom.h @@ -329,7 +329,7 @@ class Atom : protected Pointers { int find_molecule(char *); void add_molecule_atom(class Molecule *, int, int, tagint); - void add_label_map(char *); + void add_label_map(std::string mapID = ""); int find_label(std::string, int); void first_reorder(); diff --git a/src/input.cpp b/src/input.cpp index 31cd037e8e..e51643fbfa 100755 --- a/src/input.cpp +++ b/src/input.cpp @@ -668,7 +668,8 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) void Input::readtype(char *&str, int mode) { int numflag = 1; - for (int i = 0; i < strlen(str); i++) + int n = strlen(str); + for (int i = 0; i < n; i++) if (!isdigit(str[i]) && str[i] != '*') numflag = 0; if (numflag) return; if (!atom->labelmapflag) error->all(FLERR,fmt::format("Invalid type {}",str)); @@ -1593,7 +1594,7 @@ void Input::labelmap() { if (domain->box_exist == 0) error->all(FLERR,"Labelmap command before simulation box is defined"); - if (!atom->labelmapflag) atom->add_label_map(""); + if (!atom->labelmapflag) atom->add_label_map(); atom->lmaps[0]->modify_lmap(narg,arg); } diff --git a/src/read_data.cpp b/src/read_data.cpp index fd60a2b9b2..35c4ebb49b 100755 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1974,7 +1974,7 @@ void ReadData::typelabels(std::vector &mytypelabel, int myntypes, i char *buf = new char[myntypes*MAXLINE]; labelflag = 1; - if (!atom->labelmapflag) atom->add_label_map(""); + if (!atom->labelmapflag) atom->add_label_map(); int eof = comm->read_lines_from_file(fp,myntypes,MAXLINE,buf); if (eof) error->all(FLERR,"Unexpected end of data file"); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index d3b3f70b4a..fcfadb6d22 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -932,7 +932,7 @@ void ReadRestart::type_arrays() } else if (flag == LABELMAP) { read_int(); - atom->add_label_map(""); + atom->add_label_map(); atom->lmaps[0]->read_restart(fp); } else error->all(FLERR,