37namespace pseudopotential {
42 struct element_values {
48 typedef std::map<std::string, element_values> element_map;
59 while ((ent =
readdir(dir)) != NULL) {
61 const std::string fullname = dirname +
"/" + filename;
63 if (filename ==
"." || filename ==
"..")
66 pseudopotential::format format = detect_format(fullname);
68 if (format == pseudopotential::format::FILE_NOT_FOUND ||
69 format == pseudopotential::format::UNKNOWN)
74 pseudopotential::base *pseudo = NULL;
79 case pseudopotential::format::QSO:
80 pseudo =
new pseudopotential::qso(fullname);
82 case pseudopotential::format::UPF1:
83 pseudo =
new pseudopotential::upf1(fullname,
true);
85 case pseudopotential::format::UPF2:
86 pseudo =
new pseudopotential::upf2(fullname,
true);
88 case pseudopotential::format::PSML:
89 pseudo =
new pseudopotential::psml(fullname,
true);
91 case pseudopotential::format::PSP8:
92 pseudo =
new pseudopotential::psp8(fullname);
96 for (
int ii = 0; ii < 3; ii++) {
97 char cc = filename[ii];
98 bool is_letter = (cc >=
'a' && cc <=
'z') || (cc >=
'A' && cc <=
'Z');
101 symbol.push_back(cc);
106 symbol = pseudo->symbol();
112 vals.file_path_ = fullname;
113 vals.lmax_ = INVALID_L;
114 vals.llocal_ = INVALID_L;
119 std::ifstream defaults_file((dirname +
"/set_defaults").c_str());
125 getline(defaults_file, line);
129 defaults_file >> symbol;
130 if (defaults_file.eof())
137 defaults_file >> fname;
139 defaults_file >> map_[symbol].lmax_;
140 defaults_file >> map_[symbol].llocal_;
143 getline(defaults_file, line);
146 defaults_file.close();
151 bool has(
const element &el)
const {
152 return map_.find(el.symbol()) != map_.end();
155 const std::string &file_path(
const element &el)
const {
156 return map_.at(el.symbol()).file_path_;
159 int lmax(
const element &el)
const {
return map_.at(el.symbol()).lmax_; }
161 int llocal(
const element &el)
const {
return map_.at(el.symbol()).llocal_; }
179 return a.map_it_ != b.map_it_;
182 element operator*() {
return element(map_it_->first); }
if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran it is better to use that and build all the preprocessor definitions in one line In !this the debuggers will provide the right line numbers !If the compiler accepts line number then CARDINAL and ACARDINAL !will put them just a new line or a ampersand plus a new line !These macros should be used in macros that span several lines They should by !put immedialty before a line where a compilation error might occur and at the !end of the macro !Note that the cardinal and newline words are substituted by the program !preprocess pl by the ampersand and by a real new line just before compilation !The assertions are ignored if the code is compiled in not debug when !prints out the assertion string
type(oct_iterator_t), save iterator
DIR DIR struct dirent * readdir(DIR *__dirp) __attribute__((__nonnull__(1)))
DIR * opendir(const char *__name) __attribute__((__nonnull__(1))) __attribute__((__malloc__)) __attribute__((__malloc__(closedir
int closedir(DIR *__dirp) __attribute__((__nonnull__(1)))