mirror of
https://github.com/triqs/dft_tools
synced 2025-01-03 10:05:49 +01:00
[fix] orb_names is deprecated in h_int_ methods
This commit is contained in:
parent
e324b5728c
commit
f8153c2134
@ -27,8 +27,6 @@ SK.analyse_block_structure_from_gf(G, threshold = 1e-3)
|
||||
# Setup CTQMC Solver
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
spin_names = ['up','down']
|
||||
orb_names = [i for i in range(0,n_orb)]
|
||||
|
||||
|
||||
# Print some information on the master node
|
||||
iteration_offset = 0
|
||||
|
@ -30,7 +30,7 @@ dc_type = 1 # DC type: 0 FLL, 1 Held, 2 AMF
|
||||
#U_cubic = transform_U_matrix(U_sph, spherical_to_cubic(l=2, convention='wien2k'))
|
||||
#Umat = t2g_submatrix(U_cubic, convention='wien2k')
|
||||
## Construct Slater Hamiltonian
|
||||
#h_int = h_int_slater(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U_matrix=Umat)
|
||||
#h_int = h_int_slater(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U_matrix=Umat)
|
||||
|
||||
# Solver parameters
|
||||
p = {}
|
||||
@ -69,11 +69,11 @@ SK=SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=use_blocks,h_field=h_field
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
l = SK.corr_shells[0]['l']
|
||||
spin_names = ["up","down"]
|
||||
orb_names = [i for i in range(n_orb)]
|
||||
n_orb = 3
|
||||
# Construct U matrix for density-density calculations
|
||||
Umat, Upmat = U_matrix_kanamori(n_orb=n_orb, U_int=U, J_hund=J)
|
||||
# Construct density-density Hamiltonian
|
||||
h_int = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
h_int = h_int_density(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
|
||||
# Use GF structure determined by DFT blocks
|
||||
gf_struct = [(block, indices) for block, indices in SK.gf_struct_solver[0].items()]
|
||||
|
@ -37,9 +37,7 @@ for i_sh in range(len(SK.deg_shells)):
|
||||
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
spin_names = ['up','down']
|
||||
orb_names = [i for i in range(0,n_orb)]
|
||||
|
||||
#gf_struct = set_operator_structure(spin_names, orb_names, orb_hyb)
|
||||
gf_struct = SK.gf_struct_solver_list[0]
|
||||
mpi.report('Sumk to Solver: %s'%SK.sumk_to_solver)
|
||||
mpi.report('GF struct sumk: %s'%SK.gf_struct_sumk)
|
||||
@ -57,7 +55,7 @@ U_sph = U_matrix(l=2, U_int=U, J_hund=J)
|
||||
U_cubic = transform_U_matrix(U_sph, spherical_to_cubic(l=2, convention=''))
|
||||
Umat, Upmat = reduce_4index_to_2index(U_cubic)
|
||||
|
||||
H = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
H = h_int_density(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
|
||||
# Print some information on the master node
|
||||
mpi.report('Greens function structure is: %s '%gf_struct)
|
||||
|
@ -44,9 +44,7 @@ def dmft_cycle():
|
||||
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
spin_names = ['up','down']
|
||||
orb_names = [i for i in range(0,n_orb)]
|
||||
|
||||
#gf_struct = set_operator_structure(spin_names, orb_names, orb_hyb)
|
||||
gf_struct = SK.gf_struct_solver_list[0]
|
||||
mpi.report('Sumk to Solver: %s'%SK.sumk_to_solver)
|
||||
mpi.report('GF struct sumk: %s'%SK.gf_struct_sumk)
|
||||
@ -64,7 +62,7 @@ def dmft_cycle():
|
||||
U_cubic = transform_U_matrix(U_sph, spherical_to_cubic(l=2, convention=''))
|
||||
Umat, Upmat = reduce_4index_to_2index(U_cubic)
|
||||
|
||||
H = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
H = h_int_density(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
|
||||
# Print some information on the master node
|
||||
mpi.report('Greens function structure is: %s '%gf_struct)
|
||||
|
@ -145,7 +145,6 @@ The first step is done using methods of the :ref:`TRIQS <triqslibs:welcome>` lib
|
||||
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
spin_names = ["up","down"]
|
||||
orb_names = [i for i in range(n_orb)]
|
||||
# Use GF structure determined by DFT blocks:
|
||||
gf_struct = SK.gf_struct_solver_list[0]
|
||||
# Construct U matrix for density-density calculations:
|
||||
@ -156,7 +155,7 @@ Kanamori definitions of :math:`U` and :math:`J`.
|
||||
|
||||
Next, we construct the Hamiltonian and the solver::
|
||||
|
||||
h_int = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
h_int = h_int_density(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
S = Solver(beta=beta, gf_struct=gf_struct)
|
||||
|
||||
As you see, we take only density-density interactions into
|
||||
|
@ -50,7 +50,6 @@ SK=SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=use_blocks,h_field=h_field
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
l = SK.corr_shells[0]['l']
|
||||
spin_names = ["up","down"]
|
||||
orb_names = [i for i in range(n_orb)]
|
||||
|
||||
## KANAMORI DENSITY-DENSITY (for full Kanamori use h_int_kanamori)
|
||||
# Define interaction paramters, DC and Hamiltonian
|
||||
@ -60,7 +59,7 @@ dc_type = 1 # DC type: 0 FLL, 1 Held, 2 AMF
|
||||
# Construct U matrix for density-density calculations
|
||||
Umat, Upmat = U_matrix_kanamori(n_orb=n_orb, U_int=U, J_hund=J)
|
||||
# Construct density-density Hamiltonian
|
||||
h_int = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
h_int = h_int_density(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
|
||||
## SLATER HAMILTONIAN
|
||||
## Define interaction paramters, DC and Hamiltonian
|
||||
@ -72,7 +71,7 @@ h_int = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_s
|
||||
#U_cubic = transform_U_matrix(U_sph, spherical_to_cubic(l=2, convention='wien2k'))
|
||||
#Umat = t2g_submatrix(U_cubic, convention='wien2k')
|
||||
## Construct Slater Hamiltonian
|
||||
#h_int = h_int_slater(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U_matrix=Umat)
|
||||
#h_int = h_int_slater(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U_matrix=Umat)
|
||||
|
||||
# Use GF structure determined by DFT blocks
|
||||
gf_struct = [(block, indices) for block, indices in SK.gf_struct_solver[0].items()]
|
||||
|
@ -99,7 +99,6 @@ The first step is done using methods of the :ref:`TRIQS <triqslibs:welcome>` lib
|
||||
n_orb = SK.corr_shells[0]['dim']
|
||||
l = SK.corr_shells[0]['l']
|
||||
spin_names = ["up","down"]
|
||||
orb_names = [i for i in range(n_orb)]
|
||||
# Use GF structure determined by DFT blocks:
|
||||
gf_struct = [(block, indices) for block, indices in SK.gf_struct_solver[0].iteritems()]
|
||||
# Construct U matrix for density-density calculations:
|
||||
@ -109,7 +108,7 @@ We assumed here that we want to use an interaction matrix with Kanamori definiti
|
||||
|
||||
Next, we construct the Hamiltonian and the solver::
|
||||
|
||||
h_int = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
h_int = h_int_density(spin_names, n_orb, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
|
||||
S = Solver(beta=beta, gf_struct=gf_struct)
|
||||
|
||||
For simplicity, we take only density-density interactions into account here. Other Hamiltonians with, e.g. with full rotational invariant interactions are:
|
||||
|
@ -79,21 +79,27 @@ from triqs.operators.util import h_int_slater, U_matrix, t2g_submatrix, transfor
|
||||
U3x3 = t2g_submatrix(U_matrix(2, U_int=2, J_hund=0.2, basis='spheric'))
|
||||
|
||||
BS.transformation = [{'up':np.eye(3), 'down': np.eye(3)}]
|
||||
H0 = h_int_slater(spin_names=['up','down'], orb_names=range(3), U_matrix=U3x3, off_diag=False)
|
||||
H1 = h_int_slater(spin_names=['up','down'], orb_names=range(3), U_matrix=U3x3, off_diag=True)
|
||||
H0 = h_int_slater(spin_names=['up','down'], n_orb=3, U_matrix=U3x3, off_diag=False)
|
||||
H1 = h_int_slater(spin_names=['up','down'], n_orb=3, U_matrix=U3x3, off_diag=True)
|
||||
assert( H0 == BS.convert_operator(H1) )
|
||||
|
||||
# Trafo Matrix switching index 1 & 2
|
||||
BS.transformation = [{'up':np.array([[1,0,0],[0,0,1],[0,1,0]]), 'down': np.array([[1,0,0],[0,0,1],[0,1,0]])}]
|
||||
H2 = BS.convert_operator(h_int_slater(spin_names=['up','down'], orb_names=[0,2,1], U_matrix=U3x3, off_diag=True))
|
||||
map_op = {('up', 0): ('up', 0),
|
||||
('up', 1): ('up', 2),
|
||||
('up', 2): ('up', 1),
|
||||
('down', 0): ('down', 0),
|
||||
('down', 1): ('down', 2),
|
||||
('down', 2): ('down', 1)}
|
||||
H2 = BS.convert_operator(h_int_slater(spin_names=['up','down'], n_orb=3, U_matrix=U3x3, off_diag=True, map_operator_structure=map_op))
|
||||
assert( H0 == H2 )
|
||||
|
||||
BS.transformation = [{'up':np.array([[1,0,0],[0,1/np.sqrt(2),1/np.sqrt(2)],[0,1/np.sqrt(2),-1/np.sqrt(2)]]), 'down': np.array([[1,0,0],[0,1/np.sqrt(2),1/np.sqrt(2)],[0,1/np.sqrt(2),-1/np.sqrt(2)]])}]
|
||||
H3 = BS.convert_operator(h_int_slater(spin_names=['up','down'], orb_names=[0,1,2], U_matrix=U3x3, off_diag=True))
|
||||
H3 = BS.convert_operator(h_int_slater(spin_names=['up','down'], n_orb=3, U_matrix=U3x3, off_diag=True))
|
||||
for op in H3:
|
||||
for c_op in op[0]:
|
||||
assert(BS.solver_to_sumk[0][(c_op[1][0], c_op[1][1])] is not None) # This crashes with a key error if the operator structure is not the solver structure
|
||||
|
||||
U_trafod = transform_U_matrix(U3x3, BS.transformation[0]['up'].conjugate()) # The notorious .conjugate()
|
||||
H4 = h_int_slater(spin_names=['up','down'], orb_names=range(3), U_matrix=U_trafod, map_operator_structure=BS.sumk_to_solver[0])
|
||||
H4 = h_int_slater(spin_names=['up','down'], n_orb=3, U_matrix=U_trafod, map_operator_structure=BS.sumk_to_solver[0])
|
||||
assert( H4 == H3 ) # check that convert_operator does the same as transform_U_matrix
|
||||
|
Loading…
Reference in New Issue
Block a user