diff --git a/src/atom.cpp b/src/atom.cpp index b0ee766c8d..02bd5605a3 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -227,6 +227,7 @@ Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp) // type labels lmap = nullptr; + types_style = NUMERIC; // custom atom arrays diff --git a/src/write_data.cpp b/src/write_data.cpp index 75182c869f..2bc3a21627 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -73,7 +73,8 @@ void WriteData::command(int narg, char **arg) coeffflag = 1; fixflag = 1; lmapflag = 1; - atom->types_style = Atom::NUMERIC; + // store current (default) setting since we may change it. + int types_style = atom->types_style; int noinit = 0; int iarg = 1; @@ -134,6 +135,8 @@ void WriteData::command(int narg, char **arg) } write(file); + // restore saved setting + atom->types_style = types_style; } /* ---------------------------------------------------------------------- diff --git a/unittest/commands/test_labelmap.cpp b/unittest/commands/test_labelmap.cpp index f847beba13..8688575767 100644 --- a/unittest/commands/test_labelmap.cpp +++ b/unittest/commands/test_labelmap.cpp @@ -57,6 +57,7 @@ TEST_F(LabelMapTest, Atoms) EXPECT_EQ(atom->natoms, 0); EXPECT_EQ(domain->box_exist, 0); EXPECT_EQ(atom->labelmapflag, 0); + EXPECT_EQ(atom->types_style, Atom::NUMERIC); ASSERT_EQ(atom->lmap, nullptr); TEST_FAILURE(".*ERROR: Labelmap command before simulation box is.*", command("labelmap atom 3 C1"););