utils/include/io

Defines

MAX_PRECISION

Used to output maximum precision to screen [e.g., INFO(MAX_PRECISION << “energy: ” << energy)].

namespace feasst

Functions

std::string install_dir()

Return the feasst install directory as a string. Warning: This does not work with pip or conda Python. Instead, use pyfeasst.forcefield_dir().

std::string version()

Return the feasst version as a string.

template<class T>
std::string feasst_str(const std::vector<T> &vec, const bool max_precision = false)

Return string representation of vector.

Parameters
  • max_precision: use maximum precision

template<class T>
std::string feasst_str(const std::vector<std::vector<T>> &vec, const bool max_precision = false)

Parameters
  • max_precision: use maximum precision

template<class T>
std::string feasst_str(const std::deque<T> &deq, const bool max_precision = false)

Parameters
  • max_precision: use maximum precision

std::string feasst_str(std::map<std::string, std::string> mp)

Print a std::map of a pair of strings in human readable format.

std::vector<std::string> split(const std::string str)

Split a string into a vector of strings via space delimitors.

std::string trim(const char *specialchr, const char *phrase, int from_left = 1)

Return phrase with all characters up to the last specialchr removed.

Parameters
  • from_left: If 1, remove characters from the left. Otherwise, remove characters from the right.

std::string trim(const char *specialchr, std::string phrase, int from_left = 1)

Same as above except for string phrase.

template<typename T>
std::string str(const T a_value)

Convert to string with maximum precision.

int num_spaces(const std::string str)

Return the number of spaces in string.

bool is_found_in(const std::string &str, const std::string &substr)

Return true if substring is found inside of string.

int str_to_int(const std::string &str)

Convert a string to an integer.

double str_to_double(const std::string &str)

Convert a string to an double.

bool str_to_bool(const std::string &str)

Convert a string to a boolean.