Skip to content

Commit 5f67096

Browse files
committed
[fix] make n_orb init for self-energy safer
1 parent 089aa55 commit 5f67096

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

python/solid_dmft/dmft_tools/initial_self_energies.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ def determine_dc_and_initial_sigma(general_params, gw_params, advanced_params, s
520520
mesh=sum_k.mesh)
521521
for iineq in range(sum_k.n_inequiv_shells)]
522522
for icrsh in range(sum_k.n_inequiv_shells):
523-
n_orb = sum_k.corr_shells[icrsh]['dim']
524523
dc_pot = sum_k.block_structure.convert_matrix(sum_k.dc_imp[sum_k.inequiv_to_corr[icrsh]],
525524
ish_from=icrsh,
526525
space_from='sumk', space_to='solver')
@@ -535,9 +534,9 @@ def determine_dc_and_initial_sigma(general_params, gw_params, advanced_params, s
535534
# if magmom positive the up channel will be favored
536535
for spin_channel in sum_k.gf_struct_solver[icrsh].keys():
537536
if 'up' in spin_channel:
538-
start_sigma[icrsh][spin_channel] << dc_pot[spin_channel] - fac*np.eye(n_orb)
537+
start_sigma[icrsh][spin_channel] << dc_pot[spin_channel] - fac*np.eye(dc_pot[spin_channel].shape[0])
539538
else:
540-
start_sigma[icrsh][spin_channel] << dc_pot[spin_channel] + fac*np.eye(n_orb)
539+
start_sigma[icrsh][spin_channel] << dc_pot[spin_channel] + fac*np.eye(dc_pot[spin_channel].shape[0])
541540

542541
else:
543542
for spin_channel in sum_k.gf_struct_solver[icrsh].keys():
@@ -548,7 +547,6 @@ def determine_dc_and_initial_sigma(general_params, gw_params, advanced_params, s
548547
start_sigma = [sum_k.block_structure.create_gf(ish=iineq, gf_function=Gf, space='solver', mesh=sum_k.mesh)
549548
for iineq in range(sum_k.n_inequiv_shells)]
550549
for icrsh in range(sum_k.n_inequiv_shells):
551-
n_orb = sum_k.corr_shells[icrsh]['dim']
552550
if (general_params['magnetic'] and general_params['magmom'] and sum_k.SO == 0):
553551
mpi.report(f'\n*** Adding magnetic bias to initial sigma for impurity {icrsh} ***')
554552
# if we are doing a magnetic calculation and initial magnetic moments
@@ -558,9 +556,9 @@ def determine_dc_and_initial_sigma(general_params, gw_params, advanced_params, s
558556
# if magmom positive the up channel will be favored
559557
for spin_channel in sum_k.gf_struct_solver[icrsh].keys():
560558
if 'up' in spin_channel:
561-
start_sigma[icrsh][spin_channel] << -fac*np.eye(n_orb)
559+
start_sigma[icrsh][spin_channel] << -fac*np.eye(start_sigma[icrsh][spin_channel].target_shape[0])
562560
else:
563-
start_sigma[icrsh][spin_channel] << fac*np.eye(n_orb)
561+
start_sigma[icrsh][spin_channel] << fac*np.eye(start_sigma[icrsh][spin_channel].target_shape[0])
564562
else:
565563
start_sigma = [sum_k.block_structure.create_gf(ish=iineq, gf_function=Gf, space='solver', mesh=sum_k.mesh)
566564
for iineq in range(sum_k.n_inequiv_shells)]

0 commit comments

Comments
 (0)