add Atom::get_style() method

This commit is contained in:
Axel Kohlmeyer 2022-08-27 16:13:00 -04:00
parent 3b1a6f5e8e
commit b6ce6755d9
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
3 changed files with 17 additions and 1 deletions

View File

@ -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<AtomVecHybrid *>(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

View File

@ -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();

View File

@ -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;