Skip to content

Commit

Permalink
[fix] wrong access to solver params
Browse files Browse the repository at this point in the history
  • Loading branch information
the-hampel committed Jun 13, 2024
1 parent 353858e commit 376cc5f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
8 changes: 4 additions & 4 deletions python/solid_dmft/dmft_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def _dmft_step(sum_k, solvers, it, general_params,
solvers[icrsh].G0_freq << make_hermitian(solvers[icrsh].G0_freq)
sum_k.symm_deg_gf(solvers[icrsh].G0_freq, ish=icrsh)

if ((solver_type_per_imp[icrsh] == 'cthyb' and solver_params[icrsh]['delta_interface'])
if ((solver_type_per_imp[icrsh] == 'cthyb' and solvers[icrsh].solver_params['delta_interface'])
or solver_type_per_imp[icrsh] == 'ctseg'):
mpi.report('\n Using the delta interface for passing Delta(tau) and Hloc0 directly to the solver.')
# prepare solver input
Expand All @@ -689,7 +689,7 @@ def _dmft_step(sum_k, solvers, it, general_params,
solvers[icrsh].Delta_time[name] << make_gf_from_fourier(solvers[icrsh].Delta_freq[name],
solvers[icrsh].Delta_time.mesh, tail)

if solver_params[icrsh]['diag_delta']:
if solvers[icrsh].solver_params['diag_delta']:
for o1 in range(g0.target_shape[0]):
for o2 in range(g0.target_shape[0]):
if o1 != o2:
Expand All @@ -701,7 +701,7 @@ def _dmft_step(sum_k, solvers, it, general_params,
for o1 in range(spin_block.shape[0]):
for o2 in range(spin_block.shape[1]):
# check if off-diag element is larger than threshold
if o1 != o2 and abs(spin_block[o1,o2]) < solver_params[icrsh]['off_diag_threshold']:
if o1 != o2 and abs(spin_block[o1,o2]) < solvers[icrsh].solver_params['off_diag_threshold']:
continue
else:
# TODO: adapt for SOC calculations, which should keep the imag part
Expand All @@ -718,7 +718,7 @@ def _dmft_step(sum_k, solvers, it, general_params,
# store DMFT input directly in last_iter
if mpi.is_master_node():
archive['DMFT_results/last_iter']['G0_freq_{}'.format(icrsh)] = solvers[icrsh].G0_freq
if solver_type_per_imp[icrsh] == 'cthyb' and solver_params[icrsh]['delta_interface']:
if solver_type_per_imp[icrsh] == 'cthyb' and solvers[icrsh].solver_params['delta_interface']:
archive['DMFT_results/last_iter']['Delta_time_{}'.format(icrsh)] = solvers[icrsh].Delta_time

# setup of measurement of chi(SzSz(tau) if requested
Expand Down
8 changes: 4 additions & 4 deletions python/solid_dmft/gw_embedding/gw_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def embedding_driver(general_params, solver_params, gw_params, advanced_params):
# dyson equation to extract G0_freq, using Hermitian symmetry (always needed in solver postprocessing)
solvers[ish].G0_freq << make_hermitian(make_gf_imfreq(G0_dlr, n_iw=general_params['n_iw']))

if ((solver_type_per_imp[ish] == 'cthyb' and solver_params[ish]['delta_interface'])
if ((solver_type_per_imp[ish] == 'cthyb' and solvers[ish].solver_params['delta_interface'])
or solver_type_per_imp[ish] == 'ctseg'):
mpi.report('\n Using the delta interface for passing Delta(tau) and Hloc0 directly to the solver.\n')

Expand Down Expand Up @@ -391,7 +391,7 @@ def embedding_driver(general_params, solver_params, gw_params, advanced_params):
else:
solvers[ish].Delta_time[name] << Delta_tau

if solver_params[ish]['diag_delta']:
if solvers[ish].solver_params['diag_delta']:
for o1 in range(imp_eal[name].shape[0]):
for o2 in range(imp_eal[name].shape[0]):
if o1 != o2:
Expand All @@ -403,7 +403,7 @@ def embedding_driver(general_params, solver_params, gw_params, advanced_params):
for o1 in range(spin_block.shape[0]):
for o2 in range(spin_block.shape[1]):
# check if off-diag element is larger than threshold
if o1 != o2 and abs(spin_block[o1, o2]) < solver_params[ish]['off_diag_threshold']:
if o1 != o2 and abs(spin_block[o1, o2]) < solvers[ish].solver_params['off_diag_threshold']:
continue
else:
# TODO: adapt for SOC calculations, which should keep the imag part
Expand Down Expand Up @@ -444,7 +444,7 @@ def embedding_driver(general_params, solver_params, gw_params, advanced_params):
tail, err = gf.fit_hermitian_tail()
solvers[ish].Sigma_Hartree[block] = tail[0]

if solver_params[ish]['type'] in ('cthyb', 'ctseg') and solver_params[ish]['crm_dyson_solver']:
if solvers[ish].solver_params['type'] in ('cthyb', 'ctseg') and solvers[ish].solver_params['crm_dyson_solver']:
Sigma_dlr[ish] = make_gf_dlr(solvers[ish].Sigma_dlr)
else:
Sigma_dlr_iw[ish] = sumk.block_structure.create_gf(ish=ish,
Expand Down
4 changes: 2 additions & 2 deletions python/solid_dmft/io_tools/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ n_l = "<none>"
n_tau_k = 10001
n_warmup_cycles = "<no default>"
off_diag_threshold = 0.0
perform_tail_fit = true
perform_tail_fit = false
random_seed = "<none>"

[[solver]]
type = "hubbardI"
idx_impurities = "<none>"
legendre_fit = false
measure_density_matrix = false
measure_density_matrix = true
measure_G_l = false
measure_G_tau = true
n_l = "<none>"
Expand Down
14 changes: 14 additions & 0 deletions python/solid_dmft/io_tools/verify_input_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ def _verify_input_params_solver(params: FullConfig) -> None:
raise ValueError(
'Solver "cthyb" when using "crm_dyson_solver" must also measure the density matrix: "measure_density_matrix" = True'
)
if entry['type'] == 'ctseg':
tail_op = [entry['crm_dyson_solver'],
entry['legendre_fit'],
entry['improved_estimator'],
entry['perform_tail_fit']]
if sum(tail_op) > 1:
raise ValueError('Only one of the options "crm_dyson_solver", "legendre_fit", "improved_estimator", and "perform_tail_fit" can be set to True.')
if entry['type'] == 'cthyb':
tail_op = [entry['crm_dyson_solver'],
entry['legendre_fit'],
entry['measure_G_l'],
entry['perform_tail_fit']]
if sum(tail_op) > 1:
raise ValueError('Only one of the options "crm_dyson_solver", "legendre_fit", "improved_estimator", and "perform_tail_fit" can be set to True.')


def _verify_input_params_gw(params: FullConfig) -> None:
Expand Down

0 comments on commit 376cc5f

Please sign in to comment.