36 hid_t file_id, group_id, attribute_id;
40 file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
43 group_id = H5Gopen(file_id,
"/integrals", H5P_DEFAULT);
46 attribute_id = H5Aopen(group_id,
"sp_dim", H5P_DEFAULT);
49 status = H5Aread(attribute_id, H5T_NATIVE_INT, &spdim);
52 status = H5Aclose(attribute_id);
60 hid_t file_id, group_id, attribute_id;
64 file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
67 group_id = H5Gopen(file_id,
"/Data", H5P_DEFAULT);
70 attribute_id = H5Dopen(group_id,
"nelectrons", H5P_DEFAULT);
73 status = H5Dread(attribute_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nelectrons);
76 status = H5Dclose(attribute_id);
84 hid_t file_id, group_id, attribute_id;
88 file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
91 group_id = H5Gopen(file_id,
"/integrals", H5P_DEFAULT);
94 attribute_id = H5Aopen(group_id,
"nuclear_repulsion_energy", H5P_DEFAULT);
97 status = H5Aread(attribute_id, H5T_NATIVE_DOUBLE, &nuclrep);
100 status = H5Aclose(attribute_id);
109 const int L = rdm.
gL();
111 std::function<double(int,int)> getT = [&ham] (
int a,
int b) ->
double {
return ham.
getTmat(a,b); };
112 std::function<double(int,int,int,int)> getV = [&ham] (
int a,
int b,
int c,
int d) ->
double {
return ham.
getVmat(a,b,c,d); };
116 auto orig_ham = mymethod.
getHam();
118 for(
int k_in=0;k_in<L;k_in++)
119 for(
int l_in=k_in+1;l_in<L;l_in++)
123 std::string filename = getenv(
"SAVE_H5_PATH");
124 filename +=
"/orbs-scan-" + std::to_string(k_in) +
"-" + std::to_string(l_in) +
".txt";
125 fs.open(filename, std::fstream::out | std::fstream::trunc);
129 fs <<
"# theta\trot\trot+v2dm" << std::endl;
133 std::cout <<
"Min:\t" << k_in <<
"\t" << l_in <<
"\t" << found.first <<
"\t" << found.second << std::endl;
135 std::cout <<
"######################" << std::endl;
140 for(
int a=0;a<=Na;a++)
142 double theta = 1.0*M_PI/(1.0*Na) * a - M_PI/2.0;
144 mymethod.
getHam() = orig_ham;
146 mymethod.
getHam().
rotate(k_in, l_in, theta, getT, getV);
153 fs << theta <<
"\t" << new_en <<
"\t" << mymethod.
evalEnergy() << std::endl;
162 const int L = rdm.
gL();
164 std::function<double(int,int)> getT = [&ham] (
int a,
int b) ->
double {
return ham.
getTmat(a,b); };
165 std::function<double(int,int,int,int)> getV = [&ham] (
int a,
int b,
int c,
int d) ->
double {
return ham.
getVmat(a,b,c,d); };
169 const auto orig_ham = method.
getHam();
171 for(
int k_in=0;k_in<L;k_in++)
172 for(
int l_in=k_in+1;l_in<L;l_in++)
176 std::string filename = getenv(
"SAVE_H5_PATH");
177 filename +=
"/orbs-scan-" + std::to_string(k_in) +
"-" + std::to_string(l_in) +
".txt";
178 fs.open(filename, std::fstream::out | std::fstream::trunc);
182 fs <<
"# theta\trot\trot+v2dm" << std::endl;
186 std::cout <<
"Min:\t" << k_in <<
"\t" << l_in <<
"\t" << found.first <<
"\t" << found.second << std::endl;
188 std::cout <<
"######################" << std::endl;
192 #pragma omp parallel for
193 for(
int a=0;a<=Na;a++)
195 double theta = 1.0*M_PI/(1.0*Na) * a - M_PI/2.0;
202 mymethod.
getHam() = orig_ham;
204 mymethod.
getHam().
rotate(k_in, l_in, theta, getT, getV);
211 fs << theta <<
"\t" << new_en <<
"\t" << mymethod.
evalEnergy() << std::endl;
int getOrbitalIrrep(const int nOrb) const
Get an orbital irrep number.
double getVmat(const int index1, const int index2, const int index3, const int index4) const
Get a Vmat element.
void rotate(int, int, double, std::function< double(int, int)> &, std::function< double(int, int, int, int)> &)
double getTmat(const int index1, const int index2) const
Get a Tmat element.
std::pair< double, bool > find_min_angle(int k, int l, double start_angle, std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) const
#define HDF5_STATUS_CHECK(status)
double evalEnergy() const
double evalEnergy() const