1#ifndef _MOVECS_PARSER_HEADE
2#define _MOVECS_PARSER_HEADE
13#define _L(_l) LOG(_l, "MovecReader")
17 uint32_t fortran_section, copy;
18 std::vector<F> buffer;
20 file.read((
char *)&fortran_section,
sizeof(int32_t));
21 copy = fortran_section;
22 buffer.resize(fortran_section /
sizeof(F));
23 file.read((
char *)buffer.data(), fortran_section);
24 file.read((
char *)&fortran_section,
sizeof(int32_t));
25 assert(copy == fortran_section);
34 std::vector<int64_t>
nmo;
38 std::fstream file(fileName.c_str(), std::ios::binary | std::ios::in);
39 if (!file.good())
throw "File " + fileName +
" not found";
40 if (!file.is_open())
throw "File IO error: " + fileName;
41 readFortranChunk<char>(file);
42 readFortranChunk<char>(file);
43 readFortranChunk<char>(file);
45 const auto _rfile(readFortranChunk<char>(file).data());
46 _L(0) <<
"title: " << _rfile << std::endl;
48 readFortranChunk<char>(file).data();
50 const auto _rbasis(readFortranChunk<char>(file).data());
51 _L(0) <<
"basis: " << _rbasis << std::endl;
54 nsets = *readFortranChunk<int64_t>(file).data();
55 Np = *readFortranChunk<int64_t>(file).data();
57 _L(0) <<
"nsets: " <<
nsets << std::endl;
58 _L(0) <<
"Np: " <<
Np << std::endl;
66 nmo = readFortranChunk<int64_t>(file);
67 for (
size_t i = 0; i <
nsets; i++) {
68 _L(0) <<
"nmo[" << i <<
"]: " <<
nmo[i] << std::endl;
72 for (
size_t i = 0; i <
iset; i++) {
73 readFortranChunk<char>(file);
74 readFortranChunk<char>(file);
75 for (uint64_t j = 0; j <
nmo[i]; j++) {
77 readFortranChunk<char>(file);
81 for (
size_t s(0); s <
nsets; s++) {
85 _L(0) <<
"#occupations read: " <<
occupations[s].size() << std::endl;
89 _L(0) <<
"#eigenvalues read: " <<
eigenvalues[s].size() << std::endl;
92 for (
size_t i(0); i <
nmo[
iset]; i++) {
93 const std::vector<double> mos_buff(readFortranChunk<double>(file));
94 assert(mos_buff.size() ==
Np);
95 for (
size_t j(0); j < mos_buff.size(); j++)
96 mos[s][j +
Np * i] = mos_buff[j];
std::vector< F > readFortranChunk(std::fstream &file)
Definition MovecsParser.hpp:16
#define _L(_l)
Definition MovecsParser.hpp:13
Definition BasisParser.hpp:15
Definition MovecsParser.hpp:32
std::vector< std::vector< double > > occupations
Definition MovecsParser.hpp:35
std::vector< std::vector< double > > mos
Definition MovecsParser.hpp:35
size_t nsets
Definition MovecsParser.hpp:33
std::vector< int64_t > nmo
Definition MovecsParser.hpp:34
size_t Np
Definition MovecsParser.hpp:33
size_t iset
Definition MovecsParser.hpp:36
MovecReader(const std::string &fileName)
Definition MovecsParser.hpp:37
std::vector< std::vector< double > > eigenvalues
Definition MovecsParser.hpp:35