diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 15c08c2821..033e89861a 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -36,6 +36,8 @@ #include "memory.h" #include "modify.h" #include "molecule.h" +#include "output.h" +#include "thermo.h" #include "tokenizer.h" #include "update.h" #include "variable.h" @@ -498,6 +500,10 @@ void DumpImage::init_style() DumpCustom::init_style(); + // cache dump image filename pattern for access through library interface. + + if (multifile) output->thermo->set_image_fname(filename); + // for grid output, find current ptr for compute or fix // check that fix frequency is acceptable diff --git a/src/thermo.cpp b/src/thermo.cpp index 801fd6ec6e..009c9cdf27 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -113,6 +113,7 @@ Thermo::Thermo(LAMMPS *_lmp, int narg, char **arg) : flushflag = 0; ntimestep = -1; nline = -1; + image_fname.clear(); // set style and corresponding lineflag // custom style builds its own line of keywords, including wildcard expansion diff --git a/src/thermo.h b/src/thermo.h index 9dca0f9f28..ad1e1c440d 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -42,14 +42,17 @@ class Thermo : protected Pointers { void compute(int); int evaluate_keyword(const std::string &, double *); - // for accessing cached thermo data - const int *get_nfield() const { return &nfield; } + // for accessing cached thermo and related data const int *get_line() const { return &nline; } + const char *get_image_fname() const { return image_fname.c_str(); } + + const int *get_nfield() const { return &nfield; } const bigint *get_timestep() const { return &ntimestep; } const std::vector &get_fields() const { return field_data; } const std::vector &get_keywords() const { return keyword; } void set_line(int _nline) { nline = _nline; } + void set_image_fname(const std::string &fname) { image_fname = fname; } private: int nfield, nfield_initial; @@ -75,6 +78,7 @@ class Thermo : protected Pointers { bigint natoms; bigint ntimestep; int nline; + std::string image_fname; // data used by routines that compute single values int ivalue; // integer value to print