From bd3475b048246f348e7982c6852bdf99577a1ea9 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Mon, 14 Nov 2022 19:07:08 +0900 Subject: [PATCH 01/12] Add only_chiloc option in dcore_bse --- src/dcore/dcore_bse.py | 31 ++++++++++++++++----------- src/dcore/impurity_solvers/pomerol.py | 31 ++++++++++++++++++++------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index a9467aa9..9c529354 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -92,18 +92,23 @@ def calc_g2_in_impurity_model(solver_name, solver_params, mpirun_command, basis_ # Check results for x_loc print("\n Checking x_loc...") - assert isinstance(xloc, dict) - for key, data in list(xloc.items()): - # print(" ", key) - if flag_box: - assert data.shape == (num_wb, 2*num_wf, 2*num_wf) - else: - assert data.shape == (freqs.shape[0],) - print(" OK") + if xloc is None: + print(" not computed") + else: + assert isinstance(xloc, dict) + for key, data in list(xloc.items()): + # print(" ", key) + if flag_box: + assert data.shape == (num_wb, 2*num_wf, 2*num_wf) + else: + assert data.shape == (freqs.shape[0],) + print(" OK") # Check results for chi_loc - if chiloc is not None: - print("\n Checking chi_loc...") + print("\n Checking chi_loc...") + if chiloc is None: + print(" not computed") + else: assert isinstance(chiloc, dict) for key, data in list(chiloc.items()): # print(" ", key) @@ -500,7 +505,8 @@ def calc_num_flavors(_ish): self._params['bse']['num_wb'], self._params['bse']['num_wf'], ish, freqs=freqs) - subtract_disconnected(x_loc, g_imp, self.spin_block_names, freqs=freqs) + if x_loc is not None: + subtract_disconnected(x_loc, g_imp, self.spin_block_names, freqs=freqs) # Open HDF5 file to improve performance. Close manually. bse.h5bse.open('a') @@ -509,7 +515,8 @@ def calc_num_flavors(_ish): for icrsh in range(self._n_corr_shells): if ish == self._sk.corr_to_inequiv[icrsh]: # X_loc - bse.save_xloc(x_loc, icrsh=icrsh) + if x_loc is not None: + bse.save_xloc(x_loc, icrsh=icrsh) # chi_loc if chi_loc is not None: bse.save_chiloc(chi_loc, icrsh=icrsh) diff --git a/src/dcore/impurity_solvers/pomerol.py b/src/dcore/impurity_solvers/pomerol.py index cceb6916..df0edbe3 100644 --- a/src/dcore/impurity_solvers/pomerol.py +++ b/src/dcore/impurity_solvers/pomerol.py @@ -317,20 +317,35 @@ def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): val = numpy.ndarray(n_w2b) """ - params_kw['flag_vx'] = 1 - params_kw['n_w2f'] = num_wf - params_kw['n_w2b'] = num_wb + # Set parameters + only_chiloc = True + if only_chiloc: + print("\n Calc only chi_loc (X_loc is not computed)\n") + params_kw['flag_vx'] = 0 + else: + params_kw['flag_vx'] = 1 + params_kw['n_w2f'] = num_wf + params_kw['n_w2b'] = num_wb + params_kw['flag_suscep'] = 1 params_kw['n_wb'] = num_wb + # Run the impurity solver self.solve(rot, mpirun_command, params_kw) - g2_loc = self._read_g2loc(params_kw) - # 1d array --> (wb, wf1, wf2) - for key, data in list(g2_loc.items()): - g2_loc[key] = data.reshape((num_wb, 2*num_wf, 2*num_wf)) + # Get results if computed + g2_loc = chi_loc = None + + # X_loc + if params_kw['flag_vx']: + g2_loc = self._read_g2loc(params_kw) + # 1d array --> (wb, wf1, wf2) + for key, data in list(g2_loc.items()): + g2_loc[key] = data.reshape((num_wb, 2*num_wf, 2*num_wf)) - chi_loc = self._read_chiloc(params_kw) + # chi_loc + if params_kw['flag_suscep']: + chi_loc = self._read_chiloc(params_kw) return g2_loc, chi_loc From 11375835dfe3b626aa97d4f29d9d30b5c31f855d Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Mon, 14 Nov 2022 19:59:39 +0900 Subject: [PATCH 02/12] Print input parameters in dcore_bse --- src/dcore/dcore_bse.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index 9c529354..dde77faf 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -27,7 +27,7 @@ from dcore._dispatcher import HDFArchive, dyson from dcore.dmft_core import DMFTCoreSolver -from dcore.program_options import create_parser, parse_parameters +from dcore.program_options import create_parser, parse_parameters, delete_parameters, print_parameters from dcore.tools import * from dcore import impurity_solvers from .sumkdft_workers.launcher import run_sumkdft @@ -625,7 +625,7 @@ def dcore_bse(filename, np=1): # # Construct a parser with default values # - pars = create_parser() + pars = create_parser(['model', 'system', 'impurity_solver', 'mpi', 'bse']) # # Parse keywords and store @@ -636,6 +636,13 @@ def dcore_bse(filename, np=1): seedname = p["model"]["seedname"] p["mpi"]["num_processes"] = np + # Delete unnecessary parameters + delete_parameters(p, block='model', delete=['bvec']) + delete_parameters(p, block='system', retain=['beta', 'n_iw', 'mu', 'fix_mu', 'prec_mu', 'with_dc', 'no_tail_fit']) + + # Summary of input parameters + print_parameters(p) + # # Load DMFT data # @@ -645,14 +652,11 @@ def dcore_bse(filename, np=1): print("Number of iterations :", solver.iteration_number) # - # Compute data for BSE + # Calculate quantities necessary for BSE # solver.calc_bse() - - # # Finish - # print("\n################# Done #####################\n") From 3fa82408571ad9b7ffc27e21c0da63f79d9030a0 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Mon, 14 Nov 2022 21:53:58 +0900 Subject: [PATCH 03/12] Add an option 'calc_only_chiloc' in bse block --- src/dcore/dcore_bse.py | 8 +++++--- src/dcore/impurity_solvers/alps_cthyb.py | 4 ++-- src/dcore/impurity_solvers/alps_cthyb_seg.py | 2 +- src/dcore/impurity_solvers/base.py | 12 ++++++++---- src/dcore/impurity_solvers/jo_cthyb_seg.py | 2 +- src/dcore/impurity_solvers/pomerol.py | 4 ++-- src/dcore/program_options.py | 4 ++++ 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index dde77faf..669a9f58 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -52,7 +52,7 @@ def compare_str_list(list1, list2): def calc_g2_in_impurity_model(solver_name, solver_params, mpirun_command, basis_rot, Umat, gf_struct, beta, n_iw, - Sigma_iw, Gloc_iw, num_wb, num_wf, ish, freqs=None): + Sigma_iw, Gloc_iw, num_wb, num_wf, only_chiloc, ish, freqs=None): """ Calculate G2 in an impurity model @@ -86,7 +86,7 @@ def calc_g2_in_impurity_model(solver_name, solver_params, mpirun_command, basis_ # Solve the model rot = impurity_solvers.compute_basis_rot(basis_rot, sol) if flag_box: - xloc, chiloc = sol.calc_Xloc_ph(rot, mpirun_command, num_wf, num_wb, s_params) + xloc, chiloc = sol.calc_Xloc_ph(rot, mpirun_command, num_wf, num_wb, s_params, only_chiloc) else: xloc, chiloc = sol.calc_Xloc_ph_sparse(rot, mpirun_command, freqs, num_wb, s_params) @@ -503,7 +503,9 @@ def calc_num_flavors(_ish): self._beta, self._n_iw, self._sh_quant[ish].Sigma_iw, Gloc_iw_sh[ish], self._params['bse']['num_wb'], - self._params['bse']['num_wf'], ish, freqs=freqs) + self._params['bse']['num_wf'], + self._params['bse']['calc_only_chiloc'], + ish, freqs=freqs) if x_loc is not None: subtract_disconnected(x_loc, g_imp, self.spin_block_names, freqs=freqs) diff --git a/src/dcore/impurity_solvers/alps_cthyb.py b/src/dcore/impurity_solvers/alps_cthyb.py index 83fb8472..9679a544 100644 --- a/src/dcore/impurity_solvers/alps_cthyb.py +++ b/src/dcore/impurity_solvers/alps_cthyb.py @@ -43,7 +43,7 @@ def to_numpy_array(g, block_names): Rearrange spins and orbitals so that up and down spins appear alternatingly. If there is a single block, we assume that spin and down spins appear alternatignly. If there are two blocks, we assume that they are spin1 and spin2 sectors. - + Note by HS: The comment above may be wrong. The correct one may be If there is a single block, we assume that a up-spin block is followed by a down-spin block. """ @@ -125,7 +125,7 @@ def solve(self, rot, mpirun_command, params_kw): self._solve_impl(rot, mpirun_command, None, params_kw) - def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): + def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): raise RuntimeError("calc_Xloc_ph is not implemented!") def calc_G2loc_ph_sparse(self, rot, mpirun_command, wsample_ph, params_kw): diff --git a/src/dcore/impurity_solvers/alps_cthyb_seg.py b/src/dcore/impurity_solvers/alps_cthyb_seg.py index 8464099c..d85fdfd2 100644 --- a/src/dcore/impurity_solvers/alps_cthyb_seg.py +++ b/src/dcore/impurity_solvers/alps_cthyb_seg.py @@ -413,7 +413,7 @@ def set_blockgf_from_h5(sigma, group): # [(s1,o1), (s2,o2), 0] self.quant_to_save['nn_equal_time'] = nn_equal_time[:, :, 0] # copy - def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): + def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ compute local G2 in p-h channel X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} > diff --git a/src/dcore/impurity_solvers/base.py b/src/dcore/impurity_solvers/base.py index de02af94..2c0cd9a4 100644 --- a/src/dcore/impurity_solvers/base.py +++ b/src/dcore/impurity_solvers/base.py @@ -147,7 +147,7 @@ def solve(self, rot, mpirun_command, params): # Set self.Gimp_iw, self.G_tau, self.Sigma_iw - def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): + def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ Compute Xloc(m, n, n') in p-h channel and chi_loc(m) (optional) @@ -155,10 +155,12 @@ def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): Parameters ---------- - num_wf: + num_wf: int Number of non-negative fermionic frequencies - num_wb: + num_wb: int Number of non-negative bosonic frequencies + only_chiloc: bool + If True, only chi_loc is computed (no Xloc). The other parameters are the same as for solve(). @@ -167,9 +169,11 @@ def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): Xloc(m, n, n') : 3d ndarray of complex type Data for -num_wf <= n, n' < num_wf and m = 0, 1, ..., num_wb-1. + None is returned when only_chiloc=True. chi_loc(m) : 1d ndarray of complex type - return None if not computed + Local susceptibility with one bosonic frequency. + Return None if not computed. """ return NotImplementedError() diff --git a/src/dcore/impurity_solvers/jo_cthyb_seg.py b/src/dcore/impurity_solvers/jo_cthyb_seg.py index 8e0c9a2a..3902b203 100644 --- a/src/dcore/impurity_solvers/jo_cthyb_seg.py +++ b/src/dcore/impurity_solvers/jo_cthyb_seg.py @@ -357,7 +357,7 @@ def _read(key): # [(s1,o1), (s2,o2), 0] # self.quant_to_save['nn_equal_time'] = nn_equal_time[:, :, 0] # copy - def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): + def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ compute local G2 in p-h channel X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} > diff --git a/src/dcore/impurity_solvers/pomerol.py b/src/dcore/impurity_solvers/pomerol.py index df0edbe3..cfb8e988 100644 --- a/src/dcore/impurity_solvers/pomerol.py +++ b/src/dcore/impurity_solvers/pomerol.py @@ -293,7 +293,7 @@ def _read_chiloc(self, params_kw): dir_suscep = params_kw.get('dir_suscep', './susceptibility') return self._read_common(dir_suscep) - def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): + def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ compute local G2 in p-h channel X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} > @@ -305,6 +305,7 @@ def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): num_wf num_wb params_kw + only_chiloc Returns ------- @@ -318,7 +319,6 @@ def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw): """ # Set parameters - only_chiloc = True if only_chiloc: print("\n Calc only chi_loc (X_loc is not computed)\n") params_kw['flag_vx'] = 0 diff --git a/src/dcore/program_options.py b/src/dcore/program_options.py index f6fba8b4..640448be 100644 --- a/src/dcore/program_options.py +++ b/src/dcore/program_options.py @@ -149,6 +149,7 @@ def create_parser(target_sections=None): parser.add_option("bse", "h5_output_file", str, 'dmft_bse.h5', "Output HDF5 file for bse data") parser.add_option("bse", "skip_X0q_if_exists", bool, False, "Skip X_0(q) calc if file already exists") parser.add_option("bse", "skip_Xloc", bool, False, "Skip X_loc calc (for RPA)") + parser.add_option("bse", "calc_only_chiloc", bool, False, "Calculate only chi_loc but no X_loc (for SCL, rRPA).") parser.add_option("bse", "use_temp_file", bool, False, "Whether or not temporary file is used in computing X0_q. This option will reduce the memory footprints.") parser.add_option("bse", "X0q_qpoints_saved", str, 'quadrant', "Specifies for which q points X0q are saved in a HDF file. quadrant or path to a q_path.dat file.") @@ -239,6 +240,9 @@ def parse_parameters(params): if params['tool']['n_pade_max'] < 0: params['tool']['n_pade_max'] = params['system']['n_iw'] + if 'bse' in params: + two_options_incompatible(params, ('bse', 'skip_Xloc'), ('bse', 'calc_only_chiloc')) + def parse_knode(knode_string): """ From e59c27ef303df53869f0521744e8cf8e00f912ca Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Mon, 14 Nov 2022 22:03:13 +0900 Subject: [PATCH 04/12] Improve docstring in calc_Xloc_ph() --- src/dcore/impurity_solvers/alps_cthyb_seg.py | 22 +++---------------- src/dcore/impurity_solvers/base.py | 19 ++++++++-------- src/dcore/impurity_solvers/jo_cthyb_seg.py | 23 +++----------------- src/dcore/impurity_solvers/pomerol.py | 22 ++----------------- 4 files changed, 17 insertions(+), 69 deletions(-) diff --git a/src/dcore/impurity_solvers/alps_cthyb_seg.py b/src/dcore/impurity_solvers/alps_cthyb_seg.py index d85fdfd2..26e2fdf9 100644 --- a/src/dcore/impurity_solvers/alps_cthyb_seg.py +++ b/src/dcore/impurity_solvers/alps_cthyb_seg.py @@ -415,27 +415,11 @@ def set_blockgf_from_h5(sigma, group): def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ - compute local G2 in p-h channel - X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} > + Compute local G2 in p-h channel - Parameters - ---------- - rot - mpirun_command - num_wf - num_wb - params_kw - - Returns - ------- - G2_loc : dict - key = (i1, i2, i3, i4) - val = numpy.ndarray(n_w2b, 2*n_w2f, 2*n_w2f) - - chi_loc : dict (None if not computed) - key = (i1, i2, i3, i4) - val = numpy.ndarray(n_w2b) + For details, see SolverBase.calc_Xloc_ph """ + if rot is not None: # TODO raise NotImplementedError diff --git a/src/dcore/impurity_solvers/base.py b/src/dcore/impurity_solvers/base.py index 2c0cd9a4..27f2b0ce 100644 --- a/src/dcore/impurity_solvers/base.py +++ b/src/dcore/impurity_solvers/base.py @@ -149,9 +149,9 @@ def solve(self, rot, mpirun_command, params): def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ - Compute Xloc(m, n, n') in p-h channel - and chi_loc(m) (optional) - + Compute local G2 in p-h channel + X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} >, and + chi_loc = < c_{i1}^+ c_{i2} ; c_{i4}^+ c_{i3} > (optional) Parameters ---------- @@ -166,14 +166,13 @@ def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chil Returns ------- + X_loc : dict + key : (i1, i2, i3, i4) + val : numpy.ndarray(n_w2b, 2*n_w2f, 2*n_w2f) - Xloc(m, n, n') : 3d ndarray of complex type - Data for -num_wf <= n, n' < num_wf and m = 0, 1, ..., num_wb-1. - None is returned when only_chiloc=True. - - chi_loc(m) : 1d ndarray of complex type - Local susceptibility with one bosonic frequency. - Return None if not computed. + chi_loc : dict (None if not computed) + key : (i1, i2, i3, i4) + val : numpy.ndarray(n_w2b) """ return NotImplementedError() diff --git a/src/dcore/impurity_solvers/jo_cthyb_seg.py b/src/dcore/impurity_solvers/jo_cthyb_seg.py index 3902b203..1cab4760 100644 --- a/src/dcore/impurity_solvers/jo_cthyb_seg.py +++ b/src/dcore/impurity_solvers/jo_cthyb_seg.py @@ -359,26 +359,9 @@ def _read(key): def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ - compute local G2 in p-h channel - X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} > - - Parameters - ---------- - rot - mpirun_command - num_wf - num_wb - params_kw - - Returns - ------- - G2_loc : dict - key = (i1, i2, i3, i4) - val = numpy.ndarray(n_w2b, 2*n_w2f, 2*n_w2f) - - chi_loc : dict (None if not computed) - key = (i1, i2, i3, i4) - val = numpy.ndarray(n_w2b) + Compute local G2 in p-h channel + + For details, see SolverBase.calc_Xloc_ph """ raise NotImplementedError diff --git a/src/dcore/impurity_solvers/pomerol.py b/src/dcore/impurity_solvers/pomerol.py index cfb8e988..508be2cd 100644 --- a/src/dcore/impurity_solvers/pomerol.py +++ b/src/dcore/impurity_solvers/pomerol.py @@ -295,27 +295,9 @@ def _read_chiloc(self, params_kw): def calc_Xloc_ph(self, rot, mpirun_command, num_wf, num_wb, params_kw, only_chiloc): """ - compute local G2 in p-h channel - X_loc = < c_{i1}^+ ; c_{i2} ; c_{i4}^+ ; c_{i3} > + Compute local G2 in p-h channel - Parameters - ---------- - rot - mpirun_command - num_wf - num_wb - params_kw - only_chiloc - - Returns - ------- - G2_loc : dict - key = (i1, i2, i3, i4) - val = numpy.ndarray(n_w2b, 2*n_w2f, 2*n_w2f) - - chi_loc : dict (None if not computed) - key = (i1, i2, i3, i4) - val = numpy.ndarray(n_w2b) + For details, see SolverBase.calc_Xloc_ph """ # Set parameters From 47c9889b766e29a977183167d5ab88372a72e576 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Mon, 13 Mar 2023 20:25:21 +0900 Subject: [PATCH 05/12] Fix a minor bug in SumkDFT_opt.calculate_min_max_band_energies --- src/dcore/sumkdft_opt.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dcore/sumkdft_opt.py b/src/dcore/sumkdft_opt.py index 7f9e2805..44644a71 100644 --- a/src/dcore/sumkdft_opt.py +++ b/src/dcore/sumkdft_opt.py @@ -854,6 +854,7 @@ def eff_atomic_levels(self): eff_atlevels = None return mpi.bcast(eff_atlevels) + # This replacement does not work when np_mpi > nk def calculate_min_max_band_energies(self): # hop = self.hopping # diag_hop = numpy.zeros(hop.shape[:-1]) @@ -871,6 +872,16 @@ def calculate_min_max_band_energies(self): self.max_band_energy = max_band_energy return min_band_energy, max_band_energy + # Simply set 0 + def calculate_min_max_band_energies(self): + if mpi.is_master_node(): + warn("Set min_band_energy=0 and max_band_energy=0 when hopping_part is used.") + min_band_energy = 0 + max_band_energy = 0 + self.min_band_energy = min_band_energy + self.max_band_energy = max_band_energy + return min_band_energy, max_band_energy + # This method is not used for the moment. # Actually, replacement is simple. def calc_density_correction(self, filename=None, dm_type='wien2k'): From 64b43b0382d7fd79c8a3de7bccd3c0d87b856c49 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Sun, 12 May 2024 19:23:29 +0900 Subject: [PATCH 06/12] Change hdf5 subgroup name 'chi_loc' -> 'chi_loc_in' in dcore_bse --- src/dcore/dcore_bse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index a9467aa9..a158c7fa 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -337,7 +337,7 @@ def save_xloc(self, xloc_ijkl, icrsh): self._save_common(xloc_ijkl, icrsh, 'X_loc') def save_chiloc(self, chiloc_ijkl, icrsh): - self._save_common(chiloc_ijkl, icrsh, 'chi_loc') + self._save_common(chiloc_ijkl, icrsh, 'chi_loc_in') def save_gamma0(self, u_mat, icrsh): From 0af3b8efc64fef87245f44718e5c8aff971ebc57 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Tue, 14 May 2024 20:01:04 +0900 Subject: [PATCH 07/12] New parameters [pre] flag_* and overwrite --- src/dcore/dcore_pre.py | 58 ++++++++++++++++++++++++++++-------- src/dcore/program_options.py | 6 ++++ src/dcore/sumkdft_compat.py | 2 +- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/src/dcore/dcore_pre.py b/src/dcore/dcore_pre.py index 57b80a11..ce2c92a5 100644 --- a/src/dcore/dcore_pre.py +++ b/src/dcore/dcore_pre.py @@ -44,7 +44,12 @@ def __generate_local_potential(p): spin_orbit = p["model"]["spin_orbit"] # read parameters from DFT data - skc = SumkDFTCompat(p["model"]["seedname"] + '.h5') + try: + skc = SumkDFTCompat(p["model"]["seedname"] + '.h5') + except RuntimeError as e: + print(f"\nERROR: {e}", file=sys.stderr) + print("Generate lattice model by running dcore_pre with flag_lattice=True before generating local potential.", file=sys.stderr) + sys.exit(1) assert skc.n_inequiv_shells == n_inequiv_shells @@ -122,7 +127,7 @@ def dcore_pre(input_filenames): # # Construct a parser with default values # - pars = create_parser(['model']) + pars = create_parser(['model', 'pre']) # # Parse keywords and store # @@ -140,44 +145,73 @@ def dcore_pre(input_filenames): # print_parameters(p) + print("\n@@@@@@@@@@@@@@@@@@@ Generate Model-HDF5 File @@@@@@@@@@@@@@@@@@@@") # # remove HDF5 file if exists # h5_file = p['model']['seedname'] + '.h5' - if p['model']['lattice'] != 'external': - if os.path.exists(h5_file): - print("\nRemoving the existing model HDF5 file...") + if os.path.exists(h5_file): + print(f"\nFile '{h5_file}' found") + if p['pre']['overwrite']: + print(" --> overwritten (overwrite=True)") + else: + print(" --> replaced (overwrite=False)") os.remove(h5_file) + else: + print(f"\nFile '{h5_file}' is created") + # # Lattice information # -> create h5_file/dft_input # - print("\n@@@@@@@@@@@@@@@@@@@ Generate Model-HDF5 File @@@@@@@@@@@@@@@@@@@@\n") - lattice_model = create_lattice_model(p) - lattice_model.generate_model_file() + print("\nGenerating lattice model including H(k)") + print(f" in {h5_file}/dft_input") + if p['pre']['flag_lattice']: + lattice_model = create_lattice_model(p) + lattice_model.generate_model_file() + else: + print("skip") # # Interaction # -> create h5_file/DCore/umat # print("\nGenerating U-matrix") - generate_umat(p) + print(f" in {h5_file}/DCore/Umat") + if p['pre']['flag_umat']: + generate_umat(p) + else: + print("skip") # # Local potential # -> create h5_file/DCore/local_potential # print("\nGenerating local potential") - __generate_local_potential(p) + print(f" in {h5_file}/DCore/LocalPotential") + if p['pre']['flag_local_potential']: + __generate_local_potential(p) + else: + print("skip") # # Check HDF5 file # print('') print('@@@@@@@@@@@@@@@@@@@ Check Model-HDF5 file @@@@@@@@@@@@@@@@@@@@') - __check_if_Hk_is_hermite(h5_file) - print_local_fields(h5_file) + + print("\nChecking H(k)") + if p['pre']['flag_lattice']: + __check_if_Hk_is_hermite(h5_file) + else: + print("skip") + + print("\nLocal Fields") + if p['pre']['flag_lattice']: + print_local_fields(h5_file) + else: + print("skip") # # Finish diff --git a/src/dcore/program_options.py b/src/dcore/program_options.py index c13e7ecd..763a4114 100644 --- a/src/dcore/program_options.py +++ b/src/dcore/program_options.py @@ -84,6 +84,12 @@ def create_parser(target_sections=None): parser.add_option("model", "local_potential_matrix", str, "None", "dict of {ish: 'filename'} to specify local potential matrix of ish-th shell") parser.add_option("model", "local_potential_factor", str, "1.0", "Prefactors to the local potential matrix (float or list with len=ncor)") + # [pre] + parser.add_option("pre", "flag_lattice", bool, True, "Whether lattice model including H(k) is generated in dcore_pre. If False, data in seedname.h5/dft_input are kept.") + parser.add_option("pre", "flag_umat", bool, True, "Whether U matrix is generated in dcore_pre. If False, data in seedname.h5/DCore/Umat are kept.") + parser.add_option("pre", "flag_local_potential", bool, True, "Whether local potential is generated in dcore_pre. If False, data in seedname.h5/DCore/LocalPotential are kept.") + parser.add_option("pre", "overwrite", bool, True, "Whether seedname.h5 is overwritten. If False, the existing seedname.h5 is repalced.") + # [system] parser.add_option("system", "beta", float, 1.0, "Inverse temperature. This parameter is overwritten, if T is given.") parser.add_option("system", "T", float, -1.0, "Temperature. If this parameter is given, beta is overwritten by 1/T.") diff --git a/src/dcore/sumkdft_compat.py b/src/dcore/sumkdft_compat.py index 936d078e..2cd4689d 100644 --- a/src/dcore/sumkdft_compat.py +++ b/src/dcore/sumkdft_compat.py @@ -29,7 +29,7 @@ def read_dft_input_data(file, subgrp, things_to_read): values = {} with HDFArchive(file, 'r') as ar: if not subgrp in ar: - raise RuntimeError("subrp " + subgrp + "does not exist in " + file + "!") + raise RuntimeError("subgrp " + subgrp + " does not exist in " + file + "!") # first read the necessary things: for it in things_to_read: values[it] = ar[subgrp][it] From 9b2103833c3e636f223ec9b31670aa37462efcca Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Tue, 14 May 2024 21:11:09 +0900 Subject: [PATCH 08/12] New parameters [bse] flag_Xloc, flag_X0q (skip_Xloc, skip_X0q_if_exists are deprecated) --- src/dcore/dcore_bse.py | 27 +++++++++++++++------------ src/dcore/program_options.py | 11 +++++++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index a158c7fa..58d41763 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -42,13 +42,10 @@ def to_str(x): return x -def compare_str_list(list1, list2): - if len(list1) != len(list2): - return False +def _compare_str_list(list1, list2): + assert len(list1) == len(list2), f"len({list1}) != len({list2})" for x, y in zip(list1, list2): - if to_str(x) != to_str(y): - return False - return True + assert to_str(x) == to_str(y), f"{to_str(x)} != {to_str(y)}" def calc_g2_in_impurity_model(solver_name, solver_params, mpirun_command, basis_rot, Umat, gf_struct, beta, n_iw, @@ -274,7 +271,7 @@ def __init__(self, h5_file, bse_info, n_corr_shells, n_flavors, use_spin_orbit, assert n_block == len(spin_names) # NOTE: change the order of spins in HDF5 to meet SumkDFTChi - self.block2 = IndexPair2(list(range(n_corr_shells)), sorted(spin_names), only_diagonal1=only_diagonal) + self.block2 = IndexPair2(list(range(n_corr_shells)), spin_names, only_diagonal1=only_diagonal) self.inner2 = IndexPair(list(range(n_inner)), convert_to_int=True) print(" block2 namelist =", self.block2.namelist) print(" inner2 namelist =", self.inner2.namelist) @@ -284,8 +281,8 @@ def __init__(self, h5_file, bse_info, n_corr_shells, n_flavors, use_spin_orbit, self.h5bse = h5BSE(h5_file, bse_grp) if bse_info == 'check': # check equivalence of info - #assert compare_str_list(h5bse.get(key=('block_name',)), self.block2.namelist) - #assert compare_str_list(h5bse.get(key=('inner_name',)), self.inner2.namelist) + _compare_str_list(self.h5bse.get(key=('block_name',)), self.block2.namelist) + _compare_str_list(self.h5bse.get(key=('inner_name',)), self.inner2.namelist) assert self.h5bse.get(key=('beta',)) == beta elif bse_info == 'save': # save info @@ -406,7 +403,7 @@ def _calc_bse_x0q(self): Calc X_0(q) """ print("\n--- dcore_bse - X_0(q)") - if self._params['bse']['skip_X0q_if_exists'] and os.path.exists(self._params['bse']['h5_output_file']): + if self._params['bse']['flag_X0q'] == False: print(" skip") return @@ -452,10 +449,16 @@ def calc_num_flavors(_ish): # init for saving data into HDF5 # print("\n--- dcore_bse - invoking h5BSE...") + + if os.path.isfile(self._params['bse']['h5_output_file']): + bse_info = 'check' + else: + bse_info = 'save' + bse = SaveBSE( n_corr_shells=self._n_corr_shells, h5_file=os.path.abspath(self._params['bse']['h5_output_file']), - bse_info='check', + bse_info=bse_info, nonlocal_order_parameter=False, use_spin_orbit=self._use_spin_orbit, beta=self._beta, @@ -478,7 +481,7 @@ def calc_num_flavors(_ish): # X_loc # print("\n--- dcore_bse - X_loc") - if self._params['bse']['skip_Xloc']: + if self._params['bse']['flag_Xloc'] == False: print(" skip") return diff --git a/src/dcore/program_options.py b/src/dcore/program_options.py index 763a4114..e3371130 100644 --- a/src/dcore/program_options.py +++ b/src/dcore/program_options.py @@ -154,8 +154,10 @@ def create_parser(target_sections=None): parser.add_option("bse", "num_wb", int, 1, "Number of bosonic frequencies (>0)") parser.add_option("bse", "num_wf", int, 10, "Number of fermionic frequencies (>0)") parser.add_option("bse", "h5_output_file", str, 'dmft_bse.h5', "Output HDF5 file for bse data") - parser.add_option("bse", "skip_X0q_if_exists", bool, False, "Skip X_0(q) calc if file already exists") - parser.add_option("bse", "skip_Xloc", bool, False, "Skip X_loc calc (for RPA)") + parser.add_option("bse", "skip_X0q_if_exists", bool, False, "[NOT USED] Skip X_0(q) calc if file already exists", OptionStatus.RETIRED) + parser.add_option("bse", "skip_Xloc", bool, False, "[DEPRECATED] Skip X_loc calc (for RPA)", OptionStatus.DEPRECATED) + parser.add_option("bse", "flag_X0q", bool, True, "Whether X_0(q) is calculated.") + parser.add_option("bse", "flag_Xloc", bool, True, "Whether X_loc is calculated. Set False for RPA") parser.add_option("bse", "use_temp_file", bool, False, "Whether or not temporary file is used in computing X0_q. This option will reduce the memory footprints.") parser.add_option("bse", "X0q_qpoints_saved", str, 'quadrant', "Specifies for which q points X0q are saved in a HDF file. quadrant or path to a q_path.dat file.") @@ -246,6 +248,11 @@ def parse_parameters(params): if params['tool']['n_pade_max'] < 0: params['tool']['n_pade_max'] = params['system']['n_iw'] + if 'bse' in params: + # skip_Xloc is dreprecated. + if params['bse']['skip_Xloc'] == True: + params['bse']['flag_Xloc'] = False + def parse_knode(knode_string): """ From 4b1ec3775122221dcb3682afa349741c7a9406d3 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Wed, 15 May 2024 16:02:07 +0900 Subject: [PATCH 09/12] Print parameters in dcore_bse --- src/dcore/dcore_bse.py | 23 +++++++++++++++-------- src/dcore/dcore_post.py | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index 58d41763..cfcac4a4 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -27,7 +27,7 @@ from dcore._dispatcher import HDFArchive, dyson from dcore.dmft_core import DMFTCoreSolver -from dcore.program_options import create_parser, parse_parameters +from dcore.program_options import create_parser, parse_parameters, print_parameters, delete_parameters from dcore.tools import * from dcore import impurity_solvers from .sumkdft_workers.launcher import run_sumkdft @@ -621,21 +621,28 @@ def dcore_bse(filename, np=1): # # Construct a parser with default values # - pars = create_parser() - + pars = create_parser(["model", "system", "impurity_solver", "mpi", "bse"]) # # Parse keywords and store # pars.read(filename) - p = pars.as_dict() - parse_parameters(p) - seedname = p["model"]["seedname"] - p["mpi"]["num_processes"] = np + params = pars.as_dict() + parse_parameters(params) + + params["mpi"]["num_processes"] = np + + # Delete unnecessary parameters + delete_parameters(params, block='model', delete=['interaction', 'density_density', 'kanamori', 'slater_f', 'slater_uj', 'slater_basis', 'interaction_file', 'local_potential_matrix', 'local_potential_factor']) + delete_parameters(params, block='model', delete=['bvec']) + + # Summary of input parameters + print_parameters(params) # # Load DMFT data # - solver = DMFTBSESolver(seedname, p, output_file=seedname + '.out.h5') + seedname = params["model"]["seedname"] + solver = DMFTBSESolver(seedname, params, output_file=seedname + '.out.h5') if solver.iteration_number == 0: raise RuntimeError("Number of iterations is zero!") print("Number of iterations :", solver.iteration_number) diff --git a/src/dcore/dcore_post.py b/src/dcore/dcore_post.py index 23ef2fb9..db035d89 100644 --- a/src/dcore/dcore_post.py +++ b/src/dcore/dcore_post.py @@ -477,7 +477,7 @@ def dcore_post(filename, np=1, prefix=None): # # Delete unnecessary parameters # - delete_parameters(p, block='model', delete=['interaction', 'density_density', 'kanamori', 'slater_f', 'slater_uj', 'slater_basis', 'local_potential_matrix', 'local_potential_factor']) + delete_parameters(p, block='model', delete=['interaction', 'density_density', 'kanamori', 'slater_f', 'slater_uj', 'slater_basis', 'interaction_file', 'local_potential_matrix', 'local_potential_factor']) # Summary of input parameters print_parameters(p) From 1e53df196bf5f2065fa908ae0a21c9b5ebb69b78 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Wed, 26 Jun 2024 17:18:01 +0900 Subject: [PATCH 10/12] Change flag_* parameters to skip_* --- src/dcore/dcore_bse.py | 12 +++--------- src/dcore/dcore_pre.py | 32 ++++++++++++++++---------------- src/dcore/program_options.py | 18 +++++++----------- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/dcore/dcore_bse.py b/src/dcore/dcore_bse.py index c13ede72..531a8959 100644 --- a/src/dcore/dcore_bse.py +++ b/src/dcore/dcore_bse.py @@ -408,7 +408,7 @@ def _calc_bse_x0q(self): Calc X_0(q) """ print("\n--- dcore_bse - X_0(q)") - if self._params['bse']['flag_X0q'] == False: + if self._params['bse']['skip_X0q']: print(" skip") return @@ -486,7 +486,7 @@ def calc_num_flavors(_ish): # X_loc # print("\n--- dcore_bse - X_loc") - if self._params['bse']['flag_Xloc'] == False: + if self._params['bse']['skip_Xloc']: print(" skip") return @@ -643,17 +643,11 @@ def dcore_bse(filename, np=1): # Delete unnecessary parameters delete_parameters(params, block='model', delete=['interaction', 'density_density', 'kanamori', 'slater_f', 'slater_uj', 'slater_basis', 'interaction_file', 'local_potential_matrix', 'local_potential_factor']) delete_parameters(params, block='model', delete=['bvec']) + delete_parameters(params, block='system', retain=['beta', 'n_iw', 'mu', 'fix_mu', 'prec_mu', 'with_dc', 'no_tail_fit']) # Summary of input parameters print_parameters(params) - # Delete unnecessary parameters - delete_parameters(p, block='model', delete=['bvec']) - delete_parameters(p, block='system', retain=['beta', 'n_iw', 'mu', 'fix_mu', 'prec_mu', 'with_dc', 'no_tail_fit']) - - # Summary of input parameters - print_parameters(p) - # # Load DMFT data # diff --git a/src/dcore/dcore_pre.py b/src/dcore/dcore_pre.py index ce2c92a5..b9db75b3 100644 --- a/src/dcore/dcore_pre.py +++ b/src/dcore/dcore_pre.py @@ -48,7 +48,7 @@ def __generate_local_potential(p): skc = SumkDFTCompat(p["model"]["seedname"] + '.h5') except RuntimeError as e: print(f"\nERROR: {e}", file=sys.stderr) - print("Generate lattice model by running dcore_pre with flag_lattice=True before generating local potential.", file=sys.stderr) + print("Generate lattice model by running dcore_pre with skip_lattice=False (default) before generating local potential.", file=sys.stderr) sys.exit(1) assert skc.n_inequiv_shells == n_inequiv_shells @@ -167,11 +167,11 @@ def dcore_pre(input_filenames): # print("\nGenerating lattice model including H(k)") print(f" in {h5_file}/dft_input") - if p['pre']['flag_lattice']: + if p['pre']['skip_lattice']: + print("skip") + else: lattice_model = create_lattice_model(p) lattice_model.generate_model_file() - else: - print("skip") # # Interaction @@ -179,10 +179,10 @@ def dcore_pre(input_filenames): # print("\nGenerating U-matrix") print(f" in {h5_file}/DCore/Umat") - if p['pre']['flag_umat']: - generate_umat(p) - else: + if p['pre']['skip_umat']: print("skip") + else: + generate_umat(p) # # Local potential @@ -190,10 +190,10 @@ def dcore_pre(input_filenames): # print("\nGenerating local potential") print(f" in {h5_file}/DCore/LocalPotential") - if p['pre']['flag_local_potential']: - __generate_local_potential(p) - else: + if p['pre']['skip_local_potential']: print("skip") + else: + __generate_local_potential(p) # # Check HDF5 file @@ -202,16 +202,16 @@ def dcore_pre(input_filenames): print('@@@@@@@@@@@@@@@@@@@ Check Model-HDF5 file @@@@@@@@@@@@@@@@@@@@') print("\nChecking H(k)") - if p['pre']['flag_lattice']: - __check_if_Hk_is_hermite(h5_file) - else: + if p['pre']['skip_lattice']: print("skip") + else: + __check_if_Hk_is_hermite(h5_file) print("\nLocal Fields") - if p['pre']['flag_lattice']: - print_local_fields(h5_file) - else: + if p['pre']['skip_lattice']: print("skip") + else: + print_local_fields(h5_file) # # Finish diff --git a/src/dcore/program_options.py b/src/dcore/program_options.py index e238fe23..a9a4f8ce 100644 --- a/src/dcore/program_options.py +++ b/src/dcore/program_options.py @@ -85,9 +85,9 @@ def create_parser(target_sections=None): parser.add_option("model", "local_potential_factor", str, "1.0", "Prefactors to the local potential matrix (float or list with len=ncor)") # [pre] - parser.add_option("pre", "flag_lattice", bool, True, "Whether lattice model including H(k) is generated in dcore_pre. If False, data in seedname.h5/dft_input are kept.") - parser.add_option("pre", "flag_umat", bool, True, "Whether U matrix is generated in dcore_pre. If False, data in seedname.h5/DCore/Umat are kept.") - parser.add_option("pre", "flag_local_potential", bool, True, "Whether local potential is generated in dcore_pre. If False, data in seedname.h5/DCore/LocalPotential are kept.") + parser.add_option("pre", "skip_lattice", bool, False, "Skip generation of lattice model including H(k) in dcore_pre. If True, data in seedname.h5/dft_input are kept.") + parser.add_option("pre", "skip_umat", bool, False, "Skip generation of U matrix in dcore_pre. If True, data in seedname.h5/DCore/Umat are kept.") + parser.add_option("pre", "skip_local_potential", bool, False, "Skip generation of local potential in dcore_pre. If True, data in seedname.h5/DCore/LocalPotential are kept.") parser.add_option("pre", "overwrite", bool, True, "Whether seedname.h5 is overwritten. If False, the existing seedname.h5 is repalced.") # [system] @@ -155,10 +155,9 @@ def create_parser(target_sections=None): parser.add_option("bse", "num_wf", int, 10, "Number of fermionic frequencies (>0)") parser.add_option("bse", "h5_output_file", str, 'dmft_bse.h5', "Output HDF5 file for bse data") parser.add_option("bse", "skip_X0q_if_exists", bool, False, "[NOT USED] Skip X_0(q) calc if file already exists", OptionStatus.RETIRED) - parser.add_option("bse", "skip_Xloc", bool, False, "[DEPRECATED] Skip X_loc calc (for RPA)", OptionStatus.DEPRECATED) - parser.add_option("bse", "flag_X0q", bool, True, "Whether X_0(q) is calculated.") - parser.add_option("bse", "flag_Xloc", bool, True, "Whether X_loc is calculated. Set False for RPA") - parser.add_option("bse", "calc_only_chiloc", bool, False, "Calculate only chi_loc but no X_loc (for SCL, rRPA).") + parser.add_option("bse", "skip_X0q", bool, False, "Skip X_0(q) calc") + parser.add_option("bse", "skip_Xloc", bool, False, "Skip X_loc calc (for RPA)") + parser.add_option("bse", "calc_only_chiloc", bool, False, "Calculate only chi_loc but no X_loc (for SCL, rRPA). Do not activate skip_Xloc when using this option.") parser.add_option("bse", "use_temp_file", bool, False, "Whether or not temporary file is used in computing X0_q. This option will reduce the memory footprints.") parser.add_option("bse", "X0q_qpoints_saved", str, 'quadrant', "Specifies for which q points X0q are saved in a HDF file. quadrant or path to a q_path.dat file.") @@ -250,10 +249,7 @@ def parse_parameters(params): params['tool']['n_pade_max'] = params['system']['n_iw'] if 'bse' in params: - # skip_Xloc is dreprecated. - if params['bse']['skip_Xloc'] == True: - params['bse']['flag_Xloc'] = False - # two_options_incompatible(params, ('bse', 'skip_Xloc'), ('bse', 'calc_only_chiloc')) + two_options_incompatible(params, ('bse', 'skip_Xloc'), ('bse', 'calc_only_chiloc')) def parse_knode(knode_string): From 3b99354aad24f62732a4aa9276c20b9705ca3fef Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Thu, 27 Jun 2024 09:43:54 +0900 Subject: [PATCH 11/12] [doc] Add descriptions of parameters in pre block --- doc/reference/input.rst | 10 +++++++++- src/dcore/program_options.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/reference/input.rst b/doc/reference/input.rst index 6c8c2ced..d64c5a92 100644 --- a/doc/reference/input.rst +++ b/doc/reference/input.rst @@ -16,13 +16,14 @@ The following table shows which blocks are used by each program. :widths: 5, 5, 5, 5, 5 [model] , Yes, Yes, Yes, Yes + [pre] , Yes, , , [system] , , Yes, Yes, Yes [impurity_solver], , Yes, , Yes [control] , , Yes [tool] , , , Yes, Yes [mpi] , , Yes, , Yes -For example, we can see that ``dcore_pre`` reads only [model] block. Therefore, ``dcore_pre`` needs to be re-executed only when the parameters in [model] block are changed. +For example, we can see that ``dcore_pre`` reads only [model] and [pre] blocks. Therefore, ``dcore_pre`` needs to be re-executed only when the parameters in [model] and [pre] blocks are changed. The parameters included in each block are explained below. @@ -54,6 +55,13 @@ See separate pages from the link below for detailed descriptions of some paramet ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +[pre] block +-------------- + +This block includes parameters that controls the behavior of ``dcore_pre``. + +.. include:: pre_desc.txt + [system] block -------------- diff --git a/src/dcore/program_options.py b/src/dcore/program_options.py index a9a4f8ce..9a5e866f 100644 --- a/src/dcore/program_options.py +++ b/src/dcore/program_options.py @@ -46,7 +46,7 @@ def create_parser(target_sections=None): Create a parser for all program options of DCore """ if target_sections is None: - parser = TypedParser(['mpi', 'model', 'system', 'impurity_solver', 'control', 'tool', 'bse', 'vertex', 'sparse_bse']) + parser = TypedParser(['mpi', 'model', 'pre', 'system', 'impurity_solver', 'control', 'tool', 'bse', 'vertex', 'sparse_bse']) else: parser = TypedParser(target_sections) From 208a03f7de2a7cc679b601beab4f47ba0436b290 Mon Sep 17 00:00:00 2001 From: Junya Otsuki Date: Thu, 27 Jun 2024 16:10:45 +0900 Subject: [PATCH 12/12] Replace plt.clf with plt.close --- src/dcore/dcore_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dcore/dcore_check.py b/src/dcore/dcore_check.py index af02fcc8..b532c55e 100644 --- a/src/dcore/dcore_check.py +++ b/src/dcore/dcore_check.py @@ -95,7 +95,7 @@ def print_chemical_potential(self): def __plot_init(self): if self.plot_called: - self.plt.clf() + self.plt.close() self.plt.figure(figsize=(8, 6)) # default return self.plot_called = True