1#ifndef PSEUDO_ELEMENT_HPP
2#define PSEUDO_ELEMENT_HPP
32namespace pseudopotential {
38 typedef std::map<std::string, properties> map_type;
41 element(
const std::string &symbol =
"none") : symbol_(trim(symbol)) {
42 symbol_[0] = std::toupper(symbol_[0]);
43 for (
unsigned ii = 1; ii < symbol_.size(); ii++)
44 symbol_[ii] = std::tolower(symbol_[ii]);
49 element(
int atomic_number) {
52 if (atomic_number == 1) {
58 if (it->second.z_ == atomic_number) {
59 symbol_ = trim(it->first);
65 bool valid()
const {
return map().find(symbol_) != map().end(); }
67 double charge()
const {
return -1.0 * atomic_number(); }
69 const std::string &symbol()
const {
return symbol_; }
71 int atomic_number()
const {
return map().at(symbol_).z_; }
73 double mass()
const {
return map().at(symbol_).mass_; }
75 double vdw_radius()
const {
return map().at(symbol_).vdw_radius_; }
84 static map_type &map() {
89 std::string filename = pseudopotential::share_directory::get() +
90 "/pseudopotentials/elements.dat";
92 std::ifstream
file(filename.c_str());
95 std::cerr <<
"Internal error: cannot open file '" << filename <<
"'."
108 if (symbol[0] ==
'#') {
109 getline(
file, symbol);
115 file >> prop.z_ >> prop.mass_ >> prop.vdw_radius_;
129 str.erase(0, str.find_first_not_of(chars));
135 str.erase(str.find_last_not_of(chars) + 1);
142 return ltrim(rtrim(str, chars), chars);
if write to the Free Software Franklin Fifth USA !The assertions are ignored if the code is compiled in not debug when !prints out the assertion string
if write to the Free Software Franklin Fifth USA !The assertions are ignored if the code is compiled in not debug when !prints out the assertion the file
type(oct_iterator_t), save iterator