diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 9ba779924f..f8e29ba46e 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -234,14 +234,25 @@ void DumpAtomMPIIO::init_style() // setup column string + std::string default_columns; + if (scale_flag == 0 && image_flag == 0) - columns = (char *) "id type x y z"; + default_columns = "id type x y z"; else if (scale_flag == 0 && image_flag == 1) - columns = (char *) "id type x y z ix iy iz"; + default_columns = "id type x y z ix iy iz"; else if (scale_flag == 1 && image_flag == 0) - columns = (char *) "id type xs ys zs"; + default_columns = "id type xs ys zs"; else if (scale_flag == 1 && image_flag == 1) - columns = (char *) "id type xs ys zs ix iy iz"; + default_columns = "id type xs ys zs ix iy iz"; + + int icol = 0; + columns.clear(); + for (auto item : utils::split_words(default_columns)) { + if (columns.size()) columns += " "; + if (keyword_user[icol].size()) columns += keyword_user[icol]; + else columns += item; + ++icol; + } // setup function ptrs diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 372b8705b9..196a2d0bb9 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -216,6 +216,19 @@ void DumpCustomMPIIO::write() void DumpCustomMPIIO::init_style() { + // assemble ITEMS: column string from defaults and user values + + delete[] columns; + std::string combined; + int icol = 0; + for (auto item : utils::split_words(columns_default)) { + if (combined.size()) combined += " "; + if (keyword_user[icol].size()) combined += keyword_user[icol]; + else combined += item; + ++icol; + } + columns = utils::strdup(combined); + // format = copy of default or user-specified line format delete[] format; diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index faad91f3c5..3662c01313 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -66,6 +66,7 @@ void DumpAtom::init_style() domain->boundary_string(boundstr); // setup column string + std::string default_columns; if (scale_flag == 0 && image_flag == 0) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index b22e9d6eec..8232360d42 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -275,7 +275,7 @@ void DumpCustom::init_style() ++icol; } columns = utils::strdup(combined); - + // format = copy of default or user-specified line format delete[] format;