6 #include "Permutation.h"
11 #define HDF5_STATUS_CHECK(status) if(status < 0) std::cerr << __FILE__ << ":" << __LINE__ << ": Problem with writing to file. Status code=" << status << std::endl;
52 hid_t file_id, group_id, dataset_id, attribute_id;
55 file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
58 group_id = H5Gopen(file_id,
"/integrals", H5P_DEFAULT);
61 attribute_id = H5Aopen(group_id,
"nelectrons", H5P_DEFAULT);
64 status = H5Aread(attribute_id, H5T_NATIVE_UINT, &
n_electrons);
67 status = H5Aclose(attribute_id);
70 attribute_id = H5Aopen(group_id,
"sp_dim", H5P_DEFAULT);
73 status = H5Aread(attribute_id, H5T_NATIVE_UINT, &
n_sp);
76 status = H5Aclose(attribute_id);
80 throw std::overflow_error(
"The used type is not big enough to store all single particle states!");
82 attribute_id = H5Aopen(group_id,
"nuclear_repulsion_energy", H5P_DEFAULT);
85 status = H5Aread(attribute_id, H5T_NATIVE_DOUBLE, &
nucl_rep);
88 status = H5Aclose(attribute_id);
96 dataset_id = H5Dopen(group_id,
"OEI", H5P_DEFAULT);
99 status = H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, OEI->getpointer());
102 status = H5Dclose(dataset_id);
105 dataset_id = H5Dopen(group_id,
"TEI", H5P_DEFAULT);
108 status = H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, TEI->getpointer());
111 status = H5Dclose(dataset_id);
114 status = H5Gclose(group_id);
117 status = H5Fclose(file_id);
139 OEI = std::move(orig.OEI);
140 TEI = std::move(orig.TEI);
161 OEI = std::move(orig.OEI);
162 TEI = std::move(orig.TEI);
214 return (*TEI)(a*
n_sp + b, c*
n_sp + d);
225 printf(
"%20.15f\t%d\t%d\t0\t0\n", 0.0, 0, 0);
228 printf(
"%20.15f\t%d\t%d\t0\t0\n", (*OEI)(a,b), a+1,b+1);
234 printf(
"%20.15f\t%d\t%d\t%d\t%d\n", (*TEI)(a*L+b,c*L+d), a+1,c+1,b+1,d+1);
250 energy += 2 *
getT(a,a);
255 energy += 2 *
getV(a,b,a,b) -
getV(a,b,b,a);
virtual double get_nucl_rep() const
#define HDF5_STATUS_CHECK(status)
unsigned int n_electrons
number of electrons
double getV(int, int, int, int) const
PSI_C1_Molecule(std::string)
double nucl_rep
nuclear repulsion (const part to add to the energy)
double getT(int, int) const
virtual unsigned int get_n_electrons() const
unsigned int n_sp
the size of the single particles space (without spin)
static unsigned int getMax()
PSI_C1_Molecule * clone() const
PSI_C1_Molecule & operator=(const PSI_C1_Molecule &)
virtual unsigned int get_n_sp() const