1#ifndef _TURBOMOLE_MOVECESP_PARSER
2#define _TURBOMOLE_MOVECESP_PARSER
40 std::fstream file(fileName.c_str(), std::ios::binary | std::ios::in);
41 std::vector<double> mos_buf;
43 const auto fortranDoubleToDouble = [](std::string &s) {
44 std::replace(s.begin(), s.end(),
'D',
'e');
45 return std::atof(s.c_str());
48 if (!file.good())
throw "File " + fileName +
" not found";
49 if (!file.is_open())
throw "File IO error: " + fileName;
51 while (std::getline(file, line)) {
60 e = std::string(
match[3]);
62 buf_size = atoi(std::string(
match[4]).c_str());
63 Nsaos.push_back(buf_size);
70 for (
size_t i(1); i <
match.size(); i++) {
71 s = std::string(
match[i]);
72 mos_buf.push_back(fortranDoubleToDouble(s));
75 if (mos_buf.size() > 0 && mos_buf.size() == buf_size) {
77 for (
size_t i(0); i < mos_buf.size(); i++) {
78 mos.push_back(mos_buf[i]);
const Str alnum("[[:alnum:]]")
const Str blank("[[:blank:]]")
const std::function< Str(Str)> capture([](const Str &i) { return "("+i+")";})
const Str digit("[[:digit:]]")
const Str print("[[:print:]]")
Definition MosParser.hpp:14
Definition Parsing.hpp:45
const std::regex r
Definition Parsing.hpp:47
const std::string s
Definition Parsing.hpp:46
Definition MosParser.hpp:16
std::vector< double > eigenvalues
Definition MosParser.hpp:19
const pars::Regex comment
Definition MosParser.hpp:26
const pars::Regex mosline2
Definition MosParser.hpp:33
const pars::Regex mosline3
Definition MosParser.hpp:34
const pars::Regex twodigits
Definition MosParser.hpp:22
const pars::Regex symm
Definition MosParser.hpp:25
std::vector< double > mos
Definition MosParser.hpp:19
MosParser(const std::string &fileName)
Definition MosParser.hpp:39
std::vector< size_t > Nsaos
Definition MosParser.hpp:18
const pars::Regex mosline1
Definition MosParser.hpp:32
const pars::Regex expnumber
Definition MosParser.hpp:23
std::vector< double > occupations
Definition MosParser.hpp:19
std::smatch match
Definition MosParser.hpp:20
size_t Np
Definition MosParser.hpp:17
const pars::Regex unper
Definition MosParser.hpp:27
const pars::Regex eigenval
Definition MosParser.hpp:28
const pars::Regex number
Definition MosParser.hpp:21
const pars::Regex sep
Definition MosParser.hpp:21
const pars::Regex mosline4
Definition MosParser.hpp:36