add code to allow reporting which styles are part of what package

This commit is contained in:
Axel Kohlmeyer
2019-04-07 20:55:00 -04:00
parent 2fbf86a58d
commit 9166001041
5 changed files with 205 additions and 2 deletions

View File

@ -11,8 +11,10 @@
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include <mpi.h>
#include <cstring>
#include "utils.h"
#include "lammps.h"
#include "error.h"
/*! \file utils.cpp */
@ -123,6 +125,24 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size,
/* ------------------------------------------------------------------ */
std::string utils::check_packages_for_style(std::string style,
std::string name, LAMMPS *lmp)
{
std::string errmsg = "Unrecognized " + style + " style " + name;
const char *pkg = lmp->match_style(style.c_str(),name.c_str());
if (pkg) {
errmsg += " is part of the " + std::string(pkg) + " package";
if (lmp->is_installed_pkg(pkg))
errmsg += ", but seems to be missing because of a dependency";
else
errmsg += " which is not enabled in this LAMMPS binary.";
}
return errmsg;
}
/* ------------------------------------------------------------------ */
extern "C" {
/* Typedef'd pointer to get abstract datatype. */
typedef struct regex_t *re_t;