Skip to content

Commit

Permalink
[fix] fix small bugs and improve NiO test
Browse files Browse the repository at this point in the history
  • Loading branch information
the-hampel committed Feb 27, 2024
1 parent 896e7a2 commit be338c9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 19 deletions.
18 changes: 17 additions & 1 deletion python/solid_dmft/dmft_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,24 @@ def _extract_quantity_per_inequiv(param_name, n_inequiv_shells, general_params):
For quantities that can be different for each inequivalent shell, this
function checks if the quantity is a single value or a list of the correct
length. If just a single value is given, this value is applied to each shell.
Parameters
----------
param_name : str
name of the parameter to be checked
n_inequiv_shells : int
number of inequivalent shells
general_params : dict
general parameters as a dict
Returns
-------
general_params : dict
updated general parameters as a dict
"""


def formatter(value):
if isinstance(value, float):
return '{:.2f}'.format(value)
Expand Down Expand Up @@ -338,7 +354,7 @@ def dmft_cycle(general_params, solver_params, advanced_params, dft_params,
map_imp_solver.append(isolver)
break
solver_type_per_imp = [solver_params[map_imp_solver[iineq]]['type'] for iineq in range(sum_k.n_inequiv_shells)]
mpi.report(f'Solver type per impurity: {solver_type_per_imp}')
mpi.report(f'\nSolver type per impurity: {solver_type_per_imp}')

# Checks all parameters that need to be checked against info in SumkDFT object
verify_input_params.verify_h5_dependent(sum_k, solver_type_per_imp, general_params)
Expand Down
4 changes: 2 additions & 2 deletions python/solid_dmft/dmft_tools/results_to_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _compile_information(sum_k, general_params, solver_params, solvers, map_imp_

# if legendre was set, that we have both now!
if (solver_params[isolvsec]['measure_G_l']
or not solver_params[isolvsec]['perform_tail_fit'] and general_params['legendre_fit']):
or not solver_params[isolvsec]['perform_tail_fit'] and solver_params[isolvsec]['legendre_fit']):
write_to_h5['G_time_orig_{}'.format(icrsh)] = solvers[icrsh].G_time_orig
write_to_h5['Gimp_l_{}'.format(icrsh)] = solvers[icrsh].G_l

Expand All @@ -91,7 +91,7 @@ def _compile_information(sum_k, general_params, solver_params, solvers, map_imp_

if solver_type_per_imp[icrsh] == 'ctseg':
# if legendre was set, that we have both now!
if (solver_params[isolvsec]['measure_gl'] or general_params['legendre_fit']):
if (solver_params[isolvsec]['measure_gl'] or solver_params[isolvsec]['legendre_fit']):
write_to_h5['G_time_orig_{}'.format(icrsh)] = solvers[icrsh].G_time_orig
write_to_h5['Gimp_l_{}'.format(icrsh)] = solvers[icrsh].G_l
if solver_params[isolvsec]['measure_ft']:
Expand Down
14 changes: 8 additions & 6 deletions python/solid_dmft/dmft_tools/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,12 +623,14 @@ def _create_cthyb_solver(self):
self.triqs_solver_params = {}
keys_to_pass = ('imag_threshold', 'length_cycle', 'max_time', 'measure_density_matrix',
'measure_G_l', 'measure_pert_order', 'move_double', 'move_shift',
'n_warmup_cycles', 'loc_n_max', 'loc_n_min', 'off_diag_threshold', 'perform_tail_fit')
'off_diag_threshold', 'perform_tail_fit')
for key in keys_to_pass:
self.triqs_solver_params[key] = self.solver_params[key]

# Calculates number of sweeps per rank
self.triqs_solver_params['n_cycles'] = int(self.solver_params['n_cycles_tot'] / mpi.size)
# cast warmup cycles to int in case given in scientific notation
self.triqs_solver_params['n_warmup_cycles'] = int(self.solver_params['n_warmup_cycles'])

# Renames measure chi param
self.triqs_solver_params['measure_O_tau_min_ins'] = self.solver_params['measure_chi_insertions']
Expand All @@ -640,11 +642,11 @@ def _create_cthyb_solver(self):
for key in ('fit_max_moment', 'fit_max_n', 'fit_max_w', 'fit_min_n', 'fit_min_w'):
self.triqs_solver_params[key] = self.solver_params[key]

# Resolve defaults for n_loc_min and n_loc_max
if self.triqs_solver_params['loc_n_min'] is None:
self.triqs_solver_params['loc_n_min'] = 0
if self.triqs_solver_params['loc_n_max'] is None:
self.triqs_solver_params['loc_n_max'] = 100000 # large number
# set loc_n_min and loc_n_max
if self.solver_params['loc_n_min'] is not None:
self.triqs_solver_params['loc_n_min'] = self.solver_params['loc_n_min']
if self.solver_params['loc_n_max'] is not None:
self.triqs_solver_params['loc_n_max'] = self.solver_params['loc_n_max']

gf_struct = self.sum_k.gf_struct_solver_list[self.icrsh]
# Construct the triqs_solver instances
Expand Down
2 changes: 1 addition & 1 deletion python/solid_dmft/io_tools/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ noise_level_initial_sigma = 0.0
occ_conv_crit = -1.0
path_to_sigma = "<none>"
plo_cf = "plo.cfg"
prec_mu = "<no default>"
prec_mu = 1e-4
ratio_F4_F2 = "<none>"
sampling_h5_save_freq = 5
sampling_iterations = 0
Expand Down
19 changes: 10 additions & 9 deletions test/python/nio_cthyb_hartree/dmft_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
seedname = "inp"
jobname = "out"

mu_initial_guess = 13.724188
mu_initial_guess = 13.751
enforce_off_diag = [false, true]

n_iw = 501
beta = 40
beta = 20
w_range = [-10, 10]
eta = 0.05
n_w = 501

prec_mu = 0.001
calc_mu_method = "brent"

h_int_type = ["density_density", "kanamori"]
U = [10, 15]
U = [8.32, 6.8]
U_prime = ["<none>", 0]
J = [1, 0]
J = [1.19, 0.8]
ratio_F4_F2 = [0.68, "<none>"]

calc_energies = true

Expand All @@ -29,12 +30,12 @@ dc_dmft = false
[[solver]]
type = "cthyb"
idx_impurities = [0]
n_l = 35
length_cycle = 120
n_warmup_cycles = 8000
n_l = 25
length_cycle = 1000
n_warmup_cycles = 1e+3
n_cycles_tot = 1e+4
imag_threshold = 1e-5
measure_G_l = true
legendre_fit = true
measure_density_matrix = true

[[solver]]
Expand Down
Binary file modified test/python/nio_cthyb_hartree/ref.h5
Binary file not shown.

0 comments on commit be338c9

Please sign in to comment.