From fc539b46ea6f8356dce949ba42fc07a78fc38963 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Fri, 21 Jun 2024 09:23:04 -0600 Subject: [PATCH] change all function ptrs and 2 example dump files --- examples/triclinic/dump.8Apr24.general.g++.1 | 4 +- examples/triclinic/dump.8Apr24.general.g++.4 | 4 +- src/dump_custom.cpp | 95 ++++++++++++++++---- 3 files changed, 82 insertions(+), 21 deletions(-) diff --git a/examples/triclinic/dump.8Apr24.general.g++.1 b/examples/triclinic/dump.8Apr24.general.g++.1 index 4e7a7d08e0..2452b17086 100644 --- a/examples/triclinic/dump.8Apr24.general.g++.1 +++ b/examples/triclinic/dump.8Apr24.general.g++.1 @@ -7,5 +7,5 @@ ITEM: BOX BOUNDS abc origin pp pp pp 9.9999999999999989e-01 9.9999999999999989e-01 0.0000000000000000e+00 0.0000000000000000e+00 9.9999999999999989e-01 9.9999999999999989e-01 1.0000000000000000e+00 0.0000000000000000e+00 ITEM: ATOMS id type x y z -1 1 0.141421 0.141421 0.1 -2 1 0.565685 0.565685 0.3 +1 1 0.2 -1.38778e-17 0.1 +2 1 0.8 -1.11022e-16 0.3 diff --git a/examples/triclinic/dump.8Apr24.general.g++.4 b/examples/triclinic/dump.8Apr24.general.g++.4 index 4e7a7d08e0..2452b17086 100644 --- a/examples/triclinic/dump.8Apr24.general.g++.4 +++ b/examples/triclinic/dump.8Apr24.general.g++.4 @@ -7,5 +7,5 @@ ITEM: BOX BOUNDS abc origin pp pp pp 9.9999999999999989e-01 9.9999999999999989e-01 0.0000000000000000e+00 0.0000000000000000e+00 9.9999999999999989e-01 9.9999999999999989e-01 1.0000000000000000e+00 0.0000000000000000e+00 ITEM: ATOMS id type x y z -1 1 0.141421 0.141421 0.1 -2 1 0.565685 0.565685 0.3 +1 1 0.2 -1.38778e-17 0.1 +2 1 0.8 -1.11022e-16 0.3 diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 0ca88fdc7f..53366d46f4 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -240,7 +240,7 @@ DumpCustom::~DumpCustom() void DumpCustom::init_style() { - // assemble ITEMS: column string from defaults and user values + // assemble ITEMS column string from defaults and user values delete[] columns; std::string combined; @@ -312,7 +312,68 @@ void DumpCustom::init_style() else if (buffer_flag == 1) write_choice = &DumpCustom::write_string; else write_choice = &DumpCustom::write_lines; - // if triclinic_general = 1, change any affected pack_choice function ptrs + // triclinic_general can be toggled by dump_modify before or between run + // change any affected pack_choice function ptrs + + if (triclinic_general == 0) { + for (int n = 0; n < size_one; n++) { + if (pack_choice[n] == &DumpCustom::pack_x_triclinic_general) + pack_choice[n] = &DumpCustom::pack_x; + else if (pack_choice[n] == &DumpCustom::pack_y_triclinic_general) + pack_choice[n] = &DumpCustom::pack_y; + else if (pack_choice[n] == &DumpCustom::pack_z_triclinic_general) + pack_choice[n] = &DumpCustom::pack_z; + else if (pack_choice[n] == &DumpCustom::pack_xu_triclinic_general) { + if (domain->triclinic) pack_choice[n] = &DumpCustom::pack_xu_triclinic; + else pack_choice[n] == &DumpCustom::pack_xu; + } else if (pack_choice[n] == &DumpCustom::pack_yu_triclinic_general) { + if (domain->triclinic) pack_choice[n] = &DumpCustom::pack_yu_triclinic; + else pack_choice[n] == &DumpCustom::pack_yu; + } else if (pack_choice[n] == &DumpCustom::pack_zu_triclinic_general) { + if (domain->triclinic) pack_choice[n] = &DumpCustom::pack_zu_triclinic; + else pack_choice[n] == &DumpCustom::pack_zu; + } + + else if (pack_choice[n] == &DumpCustom::pack_vx_triclinic_general) + pack_choice[n] = &DumpCustom::pack_vx; + else if (pack_choice[n] == &DumpCustom::pack_vy_triclinic_general) + pack_choice[n] = &DumpCustom::pack_vy; + else if (pack_choice[n] == &DumpCustom::pack_vz_triclinic_general) + pack_choice[n] = &DumpCustom::pack_vz; + else if (pack_choice[n] == &DumpCustom::pack_fx_triclinic_general) + pack_choice[n] = &DumpCustom::pack_fx; + else if (pack_choice[n] == &DumpCustom::pack_fy_triclinic_general) + pack_choice[n] = &DumpCustom::pack_fy; + else if (pack_choice[n] == &DumpCustom::pack_fz_triclinic_general) + pack_choice[n] = &DumpCustom::pack_fz; + + else if (pack_choice[n] == &DumpCustom::pack_mux_triclinic_general) + pack_choice[n] = &DumpCustom::pack_mux; + else if (pack_choice[n] == &DumpCustom::pack_muy_triclinic_general) + pack_choice[n] = &DumpCustom::pack_muy; + else if (pack_choice[n] == &DumpCustom::pack_muz_triclinic_general) + pack_choice[n] = &DumpCustom::pack_muz; + + else if (pack_choice[n] == &DumpCustom::pack_omegax_triclinic_general) + pack_choice[n] = &DumpCustom::pack_omegax; + else if (pack_choice[n] == &DumpCustom::pack_omegay_triclinic_general) + pack_choice[n] = &DumpCustom::pack_omegay; + else if (pack_choice[n] == &DumpCustom::pack_omegaz_triclinic_general) + pack_choice[n] = &DumpCustom::pack_omegaz; + else if (pack_choice[n] == &DumpCustom::pack_angmomx_triclinic_general) + pack_choice[n] = &DumpCustom::pack_angmomx; + else if (pack_choice[n] == &DumpCustom::pack_angmomy_triclinic_general) + pack_choice[n] = &DumpCustom::pack_angmomy; + else if (pack_choice[n] == &DumpCustom::pack_angmomz_triclinic_general) + pack_choice[n] = &DumpCustom::pack_angmomz; + else if (pack_choice[n] == &DumpCustom::pack_tqx_triclinic_general) + pack_choice[n] = &DumpCustom::pack_tqx; + else if (pack_choice[n] == &DumpCustom::pack_tqy_triclinic_general) + pack_choice[n] = &DumpCustom::pack_tqy; + else if (pack_choice[n] == &DumpCustom::pack_tqz_triclinic_general) + pack_choice[n] = &DumpCustom::pack_tqz; + } + } if (triclinic_general == 1) { for (int n = 0; n < size_one; n++) { @@ -322,12 +383,6 @@ void DumpCustom::init_style() pack_choice[n] = &DumpCustom::pack_y_triclinic_general; else if (pack_choice[n] == &DumpCustom::pack_z) pack_choice[n] = &DumpCustom::pack_z_triclinic_general; - else if (pack_choice[n] == &DumpCustom::pack_xs) - pack_choice[n] = &DumpCustom::pack_xs_triclinic_general; - else if (pack_choice[n] == &DumpCustom::pack_ys) - pack_choice[n] = &DumpCustom::pack_ys_triclinic_general; - else if (pack_choice[n] == &DumpCustom::pack_zs) - pack_choice[n] = &DumpCustom::pack_zs_triclinic_general; else if (pack_choice[n] == &DumpCustom::pack_xu || pack_choice[n] == &DumpCustom::pack_xu_triclinic) pack_choice[n] = &DumpCustom::pack_xu_triclinic_general; @@ -357,7 +412,13 @@ void DumpCustom::init_style() pack_choice[n] = &DumpCustom::pack_muy_triclinic_general; else if (pack_choice[n] == &DumpCustom::pack_muz) pack_choice[n] = &DumpCustom::pack_muz_triclinic_general; - + + else if (pack_choice[n] == &DumpCustom::pack_omegax) + pack_choice[n] = &DumpCustom::pack_omegax_triclinic_general; + else if (pack_choice[n] == &DumpCustom::pack_omegay) + pack_choice[n] = &DumpCustom::pack_omegay_triclinic_general; + else if (pack_choice[n] == &DumpCustom::pack_omegaz) + pack_choice[n] = &DumpCustom::pack_omegaz_triclinic_general; else if (pack_choice[n] == &DumpCustom::pack_angmomx) pack_choice[n] = &DumpCustom::pack_angmomx_triclinic_general; else if (pack_choice[n] == &DumpCustom::pack_angmomy) @@ -1412,12 +1473,15 @@ int DumpCustom::parse_fields(int narg, char **arg) pack_choice[iarg] = &DumpCustom::pack_z; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"xs") == 0) { - pack_choice[iarg] = &DumpCustom::pack_xs; + if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_xs_triclinic; + else pack_choice[iarg] = &DumpCustom::pack_xs; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"ys") == 0) { - pack_choice[iarg] = &DumpCustom::pack_ys; + if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_ys_triclinic; + else pack_choice[iarg] = &DumpCustom::pack_ys; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"zs") == 0) { + if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_zs_triclinic; pack_choice[iarg] = &DumpCustom::pack_zs; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"xu") == 0) { @@ -1514,20 +1578,17 @@ int DumpCustom::parse_fields(int narg, char **arg) } else if (strcmp(arg[iarg],"omegax") == 0) { if (!atom->omega_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); - if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_omegax_triclinic_general; - else pack_choice[iarg] = &DumpCustom::pack_omegax; + pack_choice[iarg] = &DumpCustom::pack_omegax; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"omegay") == 0) { if (!atom->omega_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); - if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_omegay_triclinic_general; - else pack_choice[iarg] = &DumpCustom::pack_omegay; + pack_choice[iarg] = &DumpCustom::pack_omegay; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"omegaz") == 0) { if (!atom->omega_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); - if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_omegaz_triclinic_general; - else pack_choice[iarg] = &DumpCustom::pack_omegaz; + pack_choice[iarg] = &DumpCustom::pack_omegaz; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"angmomx") == 0) {