From b6ce6755d907d2916ff8c1626ffad401f4f0f6ec Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Aug 2022 16:13:00 -0400 Subject: [PATCH] add Atom::get_style() method --- src/atom.cpp | 15 +++++++++++++++ src/atom.h | 1 + src/info.cpp | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/atom.cpp b/src/atom.cpp index 085b76def5..66552c5508 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -760,6 +760,21 @@ void Atom::setup() if (sortfreq > 0) setup_sort_bins(); } +/* ---------------------------------------------------------------------- */ + +std::string Atom::get_style() +{ + std::string retval = atom_style; + if (retval == "hybrid") { + auto avec_hybrid = dynamic_cast(avec); + for (int i = 0; i < avec_hybrid->nstyles; i++) { + retval += ' '; + retval += avec_hybrid->keywords[i]; + } + } + return retval; +} + /* ---------------------------------------------------------------------- return ptr to AtomVec class if matches style or to matching hybrid sub-class return nullptr if no match diff --git a/src/atom.h b/src/atom.h index 399ad5023c..837711d439 100644 --- a/src/atom.h +++ b/src/atom.h @@ -311,6 +311,7 @@ class Atom : protected Pointers { void init(); void setup(); + std::string get_style(); AtomVec *style_match(const char *); void modify_params(int, char **); void tag_check(); diff --git a/src/info.cpp b/src/info.cpp index dc59bdadee..a93c57780e 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -402,7 +402,7 @@ void Info::command(int narg, char **arg) if (flags & SYSTEM) { fputs("\nSystem information:\n",out); fmt::print(out,"Units = {}\n", update->unit_style); - fmt::print(out,"Atom style = {}\n", atom->atom_style); + fmt::print(out,"Atom style = {}\n", atom->get_style()); fmt::print(out,"Atom map = {}\n", mapstyles[atom->map_style]); if (atom->molecular != Atom::ATOMIC) { const char *msg;