first stab at implementing dump_modify colname
This commit is contained in:
66
src/dump.cpp
66
src/dump.cpp
@ -150,19 +150,19 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
|
|||||||
|
|
||||||
Dump::~Dump()
|
Dump::~Dump()
|
||||||
{
|
{
|
||||||
delete [] id;
|
delete[] id;
|
||||||
delete [] style;
|
delete[] style;
|
||||||
delete [] filename;
|
delete[] filename;
|
||||||
delete [] multiname;
|
delete[] multiname;
|
||||||
|
|
||||||
delete [] format;
|
delete[] format;
|
||||||
delete [] format_default;
|
delete[] format_default;
|
||||||
delete [] format_line_user;
|
delete[] format_line_user;
|
||||||
delete [] format_float_user;
|
delete[] format_float_user;
|
||||||
delete [] format_int_user;
|
delete[] format_int_user;
|
||||||
delete [] format_bigint_user;
|
delete[] format_bigint_user;
|
||||||
|
|
||||||
delete [] refresh;
|
delete[] refresh;
|
||||||
|
|
||||||
// format_column_user is deallocated by child classes that use it
|
// format_column_user is deallocated by child classes that use it
|
||||||
|
|
||||||
@ -1019,7 +1019,7 @@ void Dump::balance()
|
|||||||
memory->destroy(tmp);
|
memory->destroy(tmp);
|
||||||
memory->destroy(proc_offsets);
|
memory->destroy(proc_offsets);
|
||||||
memory->destroy(proc_new_offsets);
|
memory->destroy(proc_new_offsets);
|
||||||
delete [] request;
|
delete[] request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -1059,7 +1059,7 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
||||||
int n;
|
int n;
|
||||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||||
delete [] output->var_dump[idump];
|
delete[] output->var_dump[idump];
|
||||||
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
||||||
n = 0;
|
n = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1077,7 +1077,7 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
||||||
double delta;
|
double delta;
|
||||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||||
delete [] output->var_dump[idump];
|
delete[] output->var_dump[idump];
|
||||||
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
||||||
delta = 0.0;
|
delta = 0.0;
|
||||||
} else {
|
} else {
|
||||||
@ -1107,7 +1107,7 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
MPI_Comm_free(&clustercomm);
|
MPI_Comm_free(&clustercomm);
|
||||||
MPI_Comm_split(world,icluster,0,&clustercomm);
|
MPI_Comm_split(world,icluster,0,&clustercomm);
|
||||||
|
|
||||||
delete [] multiname;
|
delete[] multiname;
|
||||||
char *ptr = strchr(filename,'%');
|
char *ptr = strchr(filename,'%');
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
multiname = utils::strdup(fmt::format("{}{}{}", filename, icluster, ptr+1));
|
multiname = utils::strdup(fmt::format("{}{}{}", filename, icluster, ptr+1));
|
||||||
@ -1124,14 +1124,38 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
flush_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
flush_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
|
} else if (strcmp(arg[iarg],"colname") == 0) {
|
||||||
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
if (strcmp(arg[iarg+1],"default") == 0) {
|
||||||
|
for (auto item : keyword_user) item.clear();
|
||||||
|
iarg += 2;
|
||||||
|
} else {
|
||||||
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
int icol = -1;
|
||||||
|
if (utils::is_integer(arg[iarg + 1])) {
|
||||||
|
icol = utils::inumeric(FLERR,arg[iarg + 1],false,lmp);
|
||||||
|
if (icol < 0) icol = keyword_user.size() + icol + 1;
|
||||||
|
icol--;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
icol = key2col.at(arg[iarg + 1]);
|
||||||
|
} catch (std::out_of_range &) {
|
||||||
|
icol = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((icol < 0) || (icol >= (int)keyword_user.size()))
|
||||||
|
error->all(FLERR, "Illegal thermo_modify command");
|
||||||
|
keyword_user[icol] = arg[iarg+2];
|
||||||
|
iarg += 3;
|
||||||
|
}
|
||||||
} else if (strcmp(arg[iarg],"format") == 0) {
|
} else if (strcmp(arg[iarg],"format") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
|
||||||
if (strcmp(arg[iarg+1],"none") == 0) {
|
if (strcmp(arg[iarg+1],"none") == 0) {
|
||||||
delete [] format_line_user;
|
delete[] format_line_user;
|
||||||
delete [] format_int_user;
|
delete[] format_int_user;
|
||||||
delete [] format_bigint_user;
|
delete[] format_bigint_user;
|
||||||
delete [] format_float_user;
|
delete[] format_float_user;
|
||||||
format_line_user = nullptr;
|
format_line_user = nullptr;
|
||||||
format_int_user = nullptr;
|
format_int_user = nullptr;
|
||||||
format_bigint_user = nullptr;
|
format_bigint_user = nullptr;
|
||||||
@ -1146,7 +1170,7 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump_modify command");
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
|
||||||
if (strcmp(arg[iarg+1],"line") == 0) {
|
if (strcmp(arg[iarg+1],"line") == 0) {
|
||||||
delete [] format_line_user;
|
delete[] format_line_user;
|
||||||
format_line_user = utils::strdup(arg[iarg+2]);
|
format_line_user = utils::strdup(arg[iarg+2]);
|
||||||
iarg += 3;
|
iarg += 3;
|
||||||
} else { // pass other format options to child classes
|
} else { // pass other format options to child classes
|
||||||
@ -1204,7 +1228,7 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
MPI_Comm_free(&clustercomm);
|
MPI_Comm_free(&clustercomm);
|
||||||
MPI_Comm_split(world,icluster,0,&clustercomm);
|
MPI_Comm_split(world,icluster,0,&clustercomm);
|
||||||
|
|
||||||
delete [] multiname;
|
delete[] multiname;
|
||||||
char *ptr = strchr(filename,'%');
|
char *ptr = strchr(filename,'%');
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
multiname = utils::strdup(fmt::format("{}{}{}", filename, icluster, ptr+1));
|
multiname = utils::strdup(fmt::format("{}{}{}", filename, icluster, ptr+1));
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "pointers.h" // IWYU pragma: export
|
#include "pointers.h" // IWYU pragma: export
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class Dump : protected Pointers {
|
class Dump : protected Pointers {
|
||||||
@ -100,6 +102,8 @@ class Dump : protected Pointers {
|
|||||||
char *format_bigint_user;
|
char *format_bigint_user;
|
||||||
char **format_column_user;
|
char **format_column_user;
|
||||||
enum { INT, DOUBLE, STRING, BIGINT };
|
enum { INT, DOUBLE, STRING, BIGINT };
|
||||||
|
std::map<std::string, int> key2col;
|
||||||
|
std::vector<std::string> keyword_user;
|
||||||
|
|
||||||
FILE *fp; // file to write dump to
|
FILE *fp; // file to write dump to
|
||||||
int size_one; // # of quantities for one atom
|
int size_one; // # of quantities for one atom
|
||||||
|
|||||||
@ -38,6 +38,9 @@ DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
|
|||||||
buffer_allow = 1;
|
buffer_allow = 1;
|
||||||
buffer_flag = 1;
|
buffer_flag = 1;
|
||||||
format_default = nullptr;
|
format_default = nullptr;
|
||||||
|
key2col = { { "id", 0 }, { "type", 1 }, { "x", 2 }, { "y", 3 },
|
||||||
|
{ "z", 4 }, { "ix", 5 }, { "iy", 6 }, { "iz", 7 } };
|
||||||
|
keyword_user = { "", "", "", "", "", "", "", "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -63,15 +66,25 @@ void DumpAtom::init_style()
|
|||||||
domain->boundary_string(boundstr);
|
domain->boundary_string(boundstr);
|
||||||
|
|
||||||
// setup column string
|
// setup column string
|
||||||
|
std::string default_columns;
|
||||||
|
|
||||||
if (scale_flag == 0 && image_flag == 0)
|
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)
|
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)
|
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)
|
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
|
// setup function ptrs
|
||||||
|
|
||||||
@ -201,9 +214,9 @@ void DumpAtom::header_unit_style_binary()
|
|||||||
|
|
||||||
void DumpAtom::header_columns_binary()
|
void DumpAtom::header_columns_binary()
|
||||||
{
|
{
|
||||||
int len = strlen(columns);
|
int len = columns.size();
|
||||||
fwrite(&len, sizeof(int), 1, fp);
|
fwrite(&len, sizeof(int), 1, fp);
|
||||||
fwrite(columns, sizeof(char), len, fp);
|
fwrite(columns.c_str(), sizeof(char), len, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -301,7 +314,7 @@ void DumpAtom::header_item(bigint ndump)
|
|||||||
fprintf(fp,"%-1.16e %-1.16e\n",boxxlo,boxxhi);
|
fprintf(fp,"%-1.16e %-1.16e\n",boxxlo,boxxhi);
|
||||||
fprintf(fp,"%-1.16e %-1.16e\n",boxylo,boxyhi);
|
fprintf(fp,"%-1.16e %-1.16e\n",boxylo,boxyhi);
|
||||||
fprintf(fp,"%-1.16e %-1.16e\n",boxzlo,boxzhi);
|
fprintf(fp,"%-1.16e %-1.16e\n",boxzlo,boxzhi);
|
||||||
fprintf(fp,"ITEM: ATOMS %s\n",columns);
|
fprintf(fp,"ITEM: ATOMS %s\n",columns.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -322,7 +335,7 @@ void DumpAtom::header_item_triclinic(bigint ndump)
|
|||||||
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy);
|
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy);
|
||||||
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz);
|
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz);
|
||||||
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz);
|
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz);
|
||||||
fprintf(fp,"ITEM: ATOMS %s\n",columns);
|
fprintf(fp,"ITEM: ATOMS %s\n",columns.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class DumpAtom : public Dump {
|
|||||||
int scale_flag; // 1 if atom coords are scaled, 0 if no
|
int scale_flag; // 1 if atom coords are scaled, 0 if no
|
||||||
int image_flag; // 1 if append box count to atom coords, 0 if no
|
int image_flag; // 1 if append box count to atom coords, 0 if no
|
||||||
|
|
||||||
char *columns; // column labels
|
std::string columns; // column labels
|
||||||
|
|
||||||
void init_style() override;
|
void init_style() override;
|
||||||
int modify_param(int, char **) override;
|
int modify_param(int, char **) override;
|
||||||
|
|||||||
@ -53,26 +53,26 @@ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
if (strcmp(earg[2],"xs") == 0) {
|
if (strcmp(earg[2],"xs") == 0) {
|
||||||
if (strcmp(earg[3],"ysu") == 0 || strcmp(earg[4],"zsu") == 0)
|
if (strcmp(earg[3],"ysu") == 0 || strcmp(earg[4],"zsu") == 0)
|
||||||
error->all(FLERR,
|
error->all(FLERR,"Dump cfg arguments can not mix xs|ys|zs with xsu|ysu|zsu");
|
||||||
"Dump cfg arguments can not mix xs|ys|zs with xsu|ysu|zsu");
|
|
||||||
unwrapflag = 0;
|
unwrapflag = 0;
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(earg[3],"ys") == 0 || strcmp(earg[4],"zs") == 0)
|
if (strcmp(earg[3],"ys") == 0 || strcmp(earg[4],"zs") == 0)
|
||||||
error->all(FLERR,
|
error->all(FLERR,"Dump cfg arguments can not mix xs|ys|zs with xsu|ysu|zsu");
|
||||||
"Dump cfg arguments can not mix xs|ys|zs with xsu|ysu|zsu");
|
|
||||||
unwrapflag = 1;
|
unwrapflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup auxiliary property name strings
|
// setup auxiliary property name strings
|
||||||
// convert 'X_ID[m]' (X=c,f,v) to 'X_ID_m'
|
// convert 'X_ID[m]' (X=c,f,v) to 'X_ID_m'
|
||||||
|
|
||||||
if (nfield > 5) auxname = new char*[nfield];
|
if (nfield > 5) auxname = new char*[nfield-5];
|
||||||
else auxname = nullptr;
|
else auxname = nullptr;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
key2col.clear();
|
||||||
|
keyword_user.resize(nfield-5);
|
||||||
for (int iarg = 5; iarg < nfield; iarg++, i++) {
|
for (int iarg = 5; iarg < nfield; iarg++, i++) {
|
||||||
ArgInfo argi(earg[iarg],ArgInfo::COMPUTE|ArgInfo::FIX|ArgInfo::VARIABLE
|
ArgInfo argi(earg[iarg],ArgInfo::COMPUTE|ArgInfo::FIX|ArgInfo::VARIABLE|
|
||||||
|ArgInfo::DNAME|ArgInfo::INAME);
|
ArgInfo::DNAME|ArgInfo::INAME);
|
||||||
|
|
||||||
if (argi.get_dim() == 1) {
|
if (argi.get_dim() == 1) {
|
||||||
std::string newarg = fmt::format("{}_{}_{}", earg[iarg][0], argi.get_name(), argi.get_index1());
|
std::string newarg = fmt::format("{}_{}_{}", earg[iarg][0], argi.get_name(), argi.get_index1());
|
||||||
@ -80,6 +80,8 @@ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
} else {
|
} else {
|
||||||
auxname[i] = utils::strdup(earg[iarg]);
|
auxname[i] = utils::strdup(earg[iarg]);
|
||||||
}
|
}
|
||||||
|
key2col[earg[iarg]] = i;
|
||||||
|
keyword_user[i].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,8 +90,8 @@ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
DumpCFG::~DumpCFG()
|
DumpCFG::~DumpCFG()
|
||||||
{
|
{
|
||||||
if (auxname) {
|
if (auxname) {
|
||||||
for (int i = 0; i < nfield-5; i++) delete [] auxname[i];
|
for (int i = 0; i < nfield-5; i++) delete[] auxname[i];
|
||||||
delete [] auxname;
|
delete[] auxname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,8 +138,12 @@ void DumpCFG::write_header(bigint n)
|
|||||||
fprintf(fp,"H0(3,3) = %g A\n",domain->zprd);
|
fprintf(fp,"H0(3,3) = %g A\n",domain->zprd);
|
||||||
fprintf(fp,".NO_VELOCITY.\n");
|
fprintf(fp,".NO_VELOCITY.\n");
|
||||||
fprintf(fp,"entry_count = %d\n",nfield-2);
|
fprintf(fp,"entry_count = %d\n",nfield-2);
|
||||||
for (int i = 0; i < nfield-5; i++)
|
for (int i = 0; i < nfield-5; i++) {
|
||||||
fprintf(fp,"auxiliary[%d] = %s\n",i,auxname[i]);
|
if (keyword_user[i].size())
|
||||||
|
fprintf(fp,"auxiliary[%d] = %s\n",i,keyword_user[i].c_str());
|
||||||
|
else
|
||||||
|
fprintf(fp,"auxiliary[%d] = %s\n",i,auxname[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -55,14 +55,11 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR};
|
|||||||
DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Dump(lmp, narg, arg),
|
Dump(lmp, narg, arg),
|
||||||
idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr),
|
idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr),
|
||||||
thresh_last(nullptr), thresh_fix(nullptr),
|
thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), thresh_first(nullptr),
|
||||||
thresh_fixID(nullptr), thresh_first(nullptr),
|
earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), columns_default(nullptr),
|
||||||
earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), choose(nullptr),
|
choose(nullptr), dchoose(nullptr), clist(nullptr), field2index(nullptr), argindex(nullptr),
|
||||||
dchoose(nullptr), clist(nullptr), field2index(nullptr),
|
id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), id_variable(nullptr),
|
||||||
argindex(nullptr), id_compute(nullptr),
|
variable(nullptr), vbuf(nullptr), id_custom(nullptr), custom(nullptr), custom_flag(nullptr),
|
||||||
compute(nullptr), id_fix(nullptr), fix(nullptr),
|
|
||||||
id_variable(nullptr), variable(nullptr),
|
|
||||||
vbuf(nullptr), id_custom(nullptr), custom(nullptr), custom_flag(nullptr),
|
|
||||||
typenames(nullptr), pack_choice(nullptr)
|
typenames(nullptr), pack_choice(nullptr)
|
||||||
{
|
{
|
||||||
if (narg == 5) error->all(FLERR,"No dump custom arguments specified");
|
if (narg == 5) error->all(FLERR,"No dump custom arguments specified");
|
||||||
@ -180,13 +177,14 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// setup column string
|
// setup column string
|
||||||
|
|
||||||
cols.clear();
|
cols.clear();
|
||||||
|
keyword_user.resize(nfield);
|
||||||
for (int iarg = 0; iarg < nfield; iarg++) {
|
for (int iarg = 0; iarg < nfield; iarg++) {
|
||||||
|
key2col[earg[iarg]] = iarg;
|
||||||
|
keyword_user[iarg].clear();
|
||||||
|
if (cols.size()) cols += " ";
|
||||||
cols += earg[iarg];
|
cols += earg[iarg];
|
||||||
cols += " ";
|
|
||||||
}
|
}
|
||||||
// remove trailing blank and copy
|
columns_default = utils::strdup(cols);
|
||||||
cols.resize(cols.size()-1);
|
|
||||||
columns = utils::strdup(cols);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -257,6 +255,7 @@ DumpCustom::~DumpCustom()
|
|||||||
delete[] format_column_user;
|
delete[] format_column_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] columns_default;
|
||||||
delete[] columns;
|
delete[] columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +263,19 @@ DumpCustom::~DumpCustom()
|
|||||||
|
|
||||||
void DumpCustom::init_style()
|
void DumpCustom::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
|
// format = copy of default or user-specified line format
|
||||||
|
|
||||||
delete[] format;
|
delete[] format;
|
||||||
|
|||||||
@ -60,6 +60,7 @@ class DumpCustom : public Dump {
|
|||||||
char **vformat; // format string for each vector element
|
char **vformat; // format string for each vector element
|
||||||
//
|
//
|
||||||
char *columns; // column labels
|
char *columns; // column labels
|
||||||
|
char *columns_default;
|
||||||
//
|
//
|
||||||
int nchoose; // # of selected atoms
|
int nchoose; // # of selected atoms
|
||||||
int maxlocal; // size of atom selection and variable arrays
|
int maxlocal; // size of atom selection and variable arrays
|
||||||
|
|||||||
@ -631,8 +631,7 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
} else if (strcmp(arg[iarg], "colname") == 0) {
|
} else if (strcmp(arg[iarg], "colname") == 0) {
|
||||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command");
|
if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command");
|
||||||
if (strcmp(arg[iarg + 1], "default") == 0) {
|
if (strcmp(arg[iarg + 1], "default") == 0) {
|
||||||
for (int i=0; i < nfield_initial + 1; ++i)
|
for (auto item : keyword_user) item.clear();
|
||||||
keyword_user[i].clear();
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else {
|
} else {
|
||||||
if (iarg + 3 > narg) error->all(FLERR, "Illegal thermo_modify command");
|
if (iarg + 3 > narg) error->all(FLERR, "Illegal thermo_modify command");
|
||||||
@ -660,7 +659,7 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
format_int_user.clear();
|
format_int_user.clear();
|
||||||
format_bigint_user.clear();
|
format_bigint_user.clear();
|
||||||
format_float_user.clear();
|
format_float_user.clear();
|
||||||
for (int i = 0; i < nfield_initial + 1; ++i) format_column_user[i].clear();
|
for (auto item : format_column_user) item.clear();
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user