I/O for nrgcore#

template<typename nrgcore_type>
class NrgData

This class provides a way to save the nrgcore internal data from the NRG calculation into a HDF5 file. The data is saved in a file and can be read back into the NRG calculation. This is useful for back-ward iteration of the of the nrg-iterations. Everything needed for NRG iteration can accessed from this this file. This class also provides functionality to read and write qOperator.

Template Parameters:

nrgcore_type – Type of the nrgcore object.

Param tfilename:

File name of the HDF5 file to save the data. If this is empty, a random file name is generated starting with the name tempfile.

Public Functions

inline explicit NrgData(const std::string &tfilename = "")

This sets the nrg_object to nullptr and you need to specify the nrg_object by calling the setNRGObject function.

Parameters:

tfilename – File name of the HDF5 file to save the data.

inline void readFromFile(const std::string &tfile)

Read the data from the file tfile into the nrg_object. This function is used to read the data back into the nrg_object for back-ward iteration of the NRG calculation.

inline void setFileName(const std::string &tfile)

Set the file name of the HDF5 file to save the data.

inline void setNRGObject(nrgcore_type *t_nrg_object)

Set the nrg_object to t_nrg_object.

inline void saveFinalState()

We should call this function after the last iteration of the Wilson Chain.

inline void close()

We should always call this function after the last iteration of the Wilson Chain to close file.

inline void clear()

This \f \textbf{deletes} \f the temp file and closes the file.

inline void saveCurrentData()

This saves data for the the current iteration state of the Wilson Chain.

inline void saveqOperator(std::vector<qOperator> *opr, const std::string &hgroup)

Saves the qOperator in the file. This function is called after the qOperator is constructed and rotated in the eigenbasis after each iteration.

Parameters:
  • oprqOperator to be saved.

  • hgroup – The group name in which the qOperator is to be saved. Remember pass same string when reading the qOperator from the file.

inline void loadqOperator(std::vector<qOperator> *opr, const std::string &hgroup)

Reads the qOperator from the file. This function is called in the back-ward iteration of the Wilson Chain.

Parameters:
  • oprqOperator to be read from the file.

  • hgroup – The group name in which the qOperator was saved.

inline void loadCurrentData(int in)

Loads the data from the file. This function is called in the back-ward iteration of the Wilson Chain.

Parameters:

in – The current iteration number or the Wilson number. We normally pass the nrg_object->nrg_iterations_cnt to this function. We set the impurity to the iteration number to be -1.

Public Members

bool debugIO = false

Print Debugg Info.

std::vector<size_t> savedNRGIndex

Nrg iteration Numbers for which higher energy states are discarded.