# generate the solver.ctqmc.in file p.write() # destroy the instance del p # mpi barrier comm.Barrier() # init ctqmc impurity solver ctqmc.cat_init_ctqmc(comm.rank, comm.size) # setup hybridization function # for the first iteration, we just use the default value if i > 0: ctqmc.cat_set_hybf(size_t, hybf) # exec ctqmc impurity solver ctqmc.cat_exec_ctqmc(i + 1) # get green's function grnf = ctqmc.cat_get_grnf(size_t) # get new hybridization function hybf = do_dmft_loop(mfreq, norbs, grnf) # get occupation number nmat = ctqmc.cat_get_nmat(norbs) # calculate new chemical potential mune = mune + 0.3 * float(occup - sum(nmat))
mfreq = 8193 # number of matsubara frequency points norbs = 4 # number of orbitals niter = 20 # number of iterations size_t = mfreq * norbs * norbs # allocate memory hybf = numpy.zeros(size_t, dtype=numpy.complex) grnf = numpy.zeros(size_t, dtype=numpy.complex) grnf_s = numpy.zeros(size_t, dtype=numpy.complex) # init ctqmc impurity solver ctqmc.cat_init_ctqmc(comm.rank, comm.size) # try to implement the DMFT self-consistent loop for i in range(niter): ctqmc.cat_exec_ctqmc(i + 1) grnf = ctqmc.cat_get_grnf(size_t) hybf = do_dmft_loop(mfreq, norbs, grnf) ctqmc.cat_set_hybf(size_t, hybf) print 'MAX_ERROR:', (numpy.absolute(grnf - grnf_s)).max() grnf_s = (grnf + grnf_s) / 2.0 # stop ctqmc impurity solver ctqmc.cat_stop_ctqmc() # mpi barrier comm.Barrier() # deallocate memory del hybf, grnf, grnf_s
# generate the solver.ctqmc.in file p.write() # destroy the instance del p # mpi barrier comm.Barrier() # init ctqmc impurity solver ctqmc.cat_init_ctqmc(comm.rank, comm.size) # setup hybridization function # for the first iteration, we just use the default value if i > 0: ctqmc.cat_set_hybf(size_t, hybf) # exec ctqmc impurity solver ctqmc.cat_exec_ctqmc(i+1) # get green's function grnf = ctqmc.cat_get_grnf(size_t) # get new hybridization function hybf = do_dmft_loop(mfreq, norbs, grnf) # get occupation number nmat = ctqmc.cat_get_nmat(norbs) # calculate new chemical potential mune = mune + 0.3 * float( occup - sum(nmat) )
mfreq = 8193 # number of matsubara frequency points norbs = 4 # number of orbitals niter = 20 # number of iterations size_t = mfreq * norbs * norbs # allocate memory hybf = numpy.zeros(size_t, dtype = numpy.complex) grnf = numpy.zeros(size_t, dtype = numpy.complex) grnf_s = numpy.zeros(size_t, dtype = numpy.complex) # init ctqmc impurity solver ctqmc.cat_init_ctqmc(comm.rank, comm.size) # try to implement the DMFT self-consistent loop for i in range(niter): ctqmc.cat_exec_ctqmc(i+1) grnf = ctqmc.cat_get_grnf(size_t) hybf = do_dmft_loop(mfreq, norbs, grnf) ctqmc.cat_set_hybf(size_t, hybf) print 'MAX_ERROR:', (numpy.absolute(grnf - grnf_s)).max() grnf_s = (grnf + grnf_s)/2.0 # stop ctqmc impurity solver ctqmc.cat_stop_ctqmc() # mpi barrier comm.Barrier() # deallocate memory del hybf, grnf, grnf_s