Dear all,
right now I'm working on a LDA+DMFT code and want to use the Hybridization Impurity Solver from the ALPS package. I have two questions regarding the implementation of the Impurity solver and would be very glad if you could provide me with some guidiance:
My first question is, what is the best way to implement the impurity solver in a C++ code? What I've done so far is the following: I'm using the newest ALPS code version 2.1.1-r6176. By modifying the CMakeLists.txt files I compiled the code from the hybridization2 folder into a static library libhybridization_impl2.a which I planned to use. I included the impurity.h header file in my code and added the following Include- and Library-paths into my makefile:
-L$(ALPS_DIR)/alps/src/boost -lboost \ -L$(ALPS_DIR)/alps/src/alps -lalps \ -L$(ALPS_DIR)/alps/applications/dmft/qmc -lhybridization_impl2 \ -L$(HOME)/local/lib/hdf5 -lsz \ -L$(HOME)/GotoBLAS2/current -lgoto2 \ -L/usr/lib/openmpi/lib -lmpi -lmpi_cxx \ -L/opt/intel/Compiler/11.1/046/lib/intel64 -limf -lirc -lifcore -lsvml
-I$(ALPS_DIR)/alps/src \ -I$(ALPS_DIR)/alps/src/alps/ngs/lib \ -I$(ALPS_DIR)/alps/applications/dmft/qmc \ -I$(ALPS_DIR)/alps/applications/dmft/qmc/hybridization2 \ -I/usr/lib/openmpi/include
As a reference I used the main.C file in the hybridization2 folder. Therefore, calling the impurity solver looks like this:
int main(int argc, char *argv[]) { ... #ifdef USE_MPI boost::mpi::environment env(argc, argv); boost::mpi::communicator world; #endif
... //Do all initalization, generate intial Weiss-Field/Bath-GF //Enter DMFT loop while(!converged) { //Save Weiss-Field/Bath-GF into HDF5 file for the solver ...
alps::mcoptions options(argc, argv); if (options.valid) { alps::parameters_type<hybridization>::type parms(alps::hdf5::archive(options.input_file, "r")); alps::parallel<hybridization> s(parms, world);
if(options.time_limit!=0) throw std::invalid_argument("time limit is passed in the parameter file!"); if(!parms.defined("MAX_TIME")) throw std::runtime_error("parameter MAX_TIME is not defined. How long do you want to run the code for? (in seconds)");
s.run(boost::bind(&stop_callback, boost::posix_time::second_clock::local_time() + boost::posix_time::seconds((int)parms["MAX_TIME"])));
if (world.rank()==0) { alps::results_type<hybridization>::type results = collect_results(s); save_results(results, parms, options.output_file, "/simulation/results"); }
... //Read the results from the output file and convert //the Impurity GF from Legendre representation to //Matsubara representation. }
//Do remaining DMFT steps: //Get Selfenergy //Hilbert-Transformation //Get new bath GF //check convergence
} //end of DMFT loop
}
Everything seems to work quite well but I would also like to use the functions that print information about the percentage of work done and I want to feed and read my data directly in/to the impurity solver without writing them into a file. So the way I currently do it is far away from optimal. Can you give me a general advice on how you intended the impurity solver to be used in a C++ code?
Another problem that I have, but want to adress after I resolved my first question, is that the GF from the Impurity Solver is not decaying like 1/w_n but with some factor ~ 1/1.5w_n. I'm using the Legendre representation of the GF and transform it back for further use in the DMFT cycle. Do you know a possible reason for this? Is this simply caused by too few Sweeps or Legendre coefficients?
I'd greatly appreciate your help.
Sincerely, Steffen Backes