Skip to content

Commit

Permalink
updated scripts to be consistent with 3.3.x api (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisonlabollita authored Oct 15, 2024
1 parent 0fbd551 commit f071a5e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
18 changes: 10 additions & 8 deletions doc/ce_input/ce.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@

filename = 'ce'

SK = SumkDFT(hdf_file = filename+'.h5', use_dft_blocks = False)

beta = 100.0

mesh = MeshImFreq(beta = beta, n_iw = 1025, S = 'Fermion'

SK = SumkDFT(hdf_file = filename+'.h5', use_dft_blocks = False, mesh = mesh)

Sigma = SK.block_structure.create_gf(beta=beta)
SK.put_Sigma([Sigma])
G = SK.extract_G_loc()
G = SK.extract_G_loc(transform_to_solver_blocks=False)
SK.analyse_block_structure_from_gf(G, threshold = 1e-2)
for i_sh in range(len(SK.deg_shells)):
num_block_deg_orbs = len(SK.deg_shells[i_sh])
Expand All @@ -59,7 +61,7 @@
spin_names = ['up','down']
orb_names = [i for i in range(0,n_orb)]

gf_struct = SK.gf_struct_solver[0]
gf_struct = [(key, val) for key, val in SK.gf_struct_solver[0].items()]
mpi.report('Sumk to Solver: %s'%SK.sumk_to_solver)
mpi.report('GF struct sumk: %s'%SK.gf_struct_sumk)
mpi.report('GF struct solver: %s'%SK.gf_struct_solver)
Expand All @@ -72,7 +74,7 @@
J = 0.7

U_sph = U_matrix_slater(l=3, U_int=U, J_hund=J)
U_cubic = transform_U_matrix(U_sph, spherical_to_cubic(l=3, convention=''))
U_cubic = transform_U_matrix(U_sph, spherical_to_cubic(l=3, convention='vasp'))

H = h_int_slater(spin_names, orb_names, U_cubic, map_operator_structure=SK.sumk_to_solver[0])

Expand Down Expand Up @@ -107,11 +109,11 @@
SK.chemical_potential = mpi.bcast(SK.chemical_potential)

# Calc the first G0
SK.symm_deg_gf(S.Sigma_iw,orb=0)
SK.symm_deg_gf(S.Sigma_iw,ish=0)
SK.put_Sigma(Sigma_imp = [S.Sigma_iw])
SK.calc_mu(precision=0.01)
S.G_iw << SK.extract_G_loc()[0]
SK.symm_deg_gf(S.G_iw, orb=0)
SK.symm_deg_gf(S.G_iw, ish=0)

#Init the DC term and the self-energy if no previous iteration was found
if iteration_offset == 0:
Expand All @@ -137,7 +139,7 @@
SK.calc_dc(dm, U_interact=U, J_hund=J, orb=0, use_dc_formula=DC_type)

# Get new G
SK.symm_deg_gf(S.Sigma_iw,orb=0)
SK.symm_deg_gf(S.Sigma_iw,ish=0)
SK.put_Sigma(Sigma_imp=[S.Sigma_iw])
SK.calc_mu(precision=0.01)
S.G_iw << SK.extract_G_loc()[0]
Expand Down
31 changes: 19 additions & 12 deletions doc/ce_input/ce_local_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,54 @@
warnings.filterwarnings("ignore", category=FutureWarning)

filename = 'ce'
SK_tools = SumkDFTTools(hdf_file = filename+'.h5', use_dft_blocks = False)
beta = 100.0
mesh = MeshImFreq(beta=beta, n_iw=1025, S='Fermion')
SK_tools = SumkDFTTools(hdf_file = filename+'.h5', use_dft_blocks = False, mesh = mesh)

# We analyze the block structure of the Hamiltonian
Sigma = SK_tools.block_structure.create_gf(beta=beta)

SK_tools.put_Sigma([Sigma])
G = SK_tools.extract_G_loc()
G = SK_tools.extract_G_loc(transform_to_solver_blocks=False)
SK_tools.analyse_block_structure_from_gf(G, threshold = 1e-2)
gf_struct = SK_tools.gf_struct_solver[0]
gf_struct = [(key,val) for key, val in SK_tools.gf_struct_solver[0].items()]

S = Solver(beta=beta, gf_struct=gf_struct)

# non-interacting chemical potential
# non-interacting chemical potential, interacting chemical potential, and double counting
chemical_potential0 = 0.0

chemical_potential = 0.0
dc_imp = None
if mpi.is_master_node():
ar = HDFArchive(filename+'.h5','a')
if 'iteration_count' in ar['DMFT_results']:
previous_present = True
iteration_offset = ar['DMFT_results']['iteration_count']+1
print('reading iteration'+str(iteration_offset))
SK_tools.dc_imp = ar['DMFT_results']['Iterations']['dc_imp'+str(iteration_offset-1)]
dc_imp = ar['DMFT_results']['Iterations']['dc_imp'+str(iteration_offset-1)]
S.Sigma_w = ar['DMFT_results']['Iterations']['Sigma_w_it'+str(iteration_offset-1)]
dc_energ = ar['DMFT_results']['Iterations']['dc_energ'+str(iteration_offset-1)]
SK_tools.chemical_potential = ar['DMFT_results']['Iterations']['chemical_potential'+str(iteration_offset-1)].real
chemical_potential = ar['DMFT_results']['Iterations']['chemical_potential'+str(iteration_offset-1)].real
chemical_potential0 = ar['DMFT_results']['Iterations']['chemical_potential0'].real

mpi.barrier()
S.Sigma_w << mpi.bcast(S.Sigma_w)
SK_tools.chemical_potential = mpi.bcast(SK_tools.chemical_potential)

# create new SumkTools with ReFreqMesh
SK_tools = SumkDFTTools(hdf_file = filename+'.h5', use_dft_blocks = False, mesh = S.Sigma_w.mesh)
SK_tools.analyse_block_structure_from_gf(G, threshold = 1e-2)

SK_tools.chemical_potential = mpi.bcast(chemical_potential)
chemical_potential0 = mpi.bcast(chemical_potential0)
SK_tools.dc_imp = mpi.bcast(SK_tools.dc_imp)
SK_tools.dc_imp = mpi.bcast(dc_imp)
SK_tools.put_Sigma(Sigma_imp = [S.Sigma_w])

idelta = 0.1
DOS, DOSproj, DOSproj_orb = SK_tools.dos_wannier_basis(broadening=idelta, with_dc=True, with_Sigma=True)
DOS, DOSproj, DOSproj_orb = SK_tools.density_of_states(broadening=idelta, proj_type='wann', with_dc=True, with_Sigma=True, save_to_file=False)

SK_tools.chemical_potential = chemical_potential0
SK_tools.put_Sigma(Sigma_imp = [0.0*S.Sigma_w])
idelta = 0.1
DOS0, DOSproj0, DOSproj0_orb = SK_tools.dos_wannier_basis(broadening=idelta, with_dc=False, with_Sigma=True)
DOS0, DOSproj0, DOSproj0_orb = SK_tools.density_of_states(broadening=idelta, proj_type='wann', with_dc=False, with_Sigma=True, save_to_file=False)

if mpi.is_master_node():
ar['DMFT_results']['Iterations']['DOS_it'+str(iteration_offset-1)] = DOS
Expand Down

0 comments on commit f071a5e

Please sign in to comment.