Skip to content

Commit

Permalink
Change flag_* parameters to skip_*
Browse files Browse the repository at this point in the history
  • Loading branch information
j-otsuki committed Jun 26, 2024
1 parent a2ceb42 commit 1e53df1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 36 deletions.
12 changes: 3 additions & 9 deletions src/dcore/dcore_bse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
#
Expand Down
32 changes: 16 additions & 16 deletions src/dcore/dcore_pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -167,33 +167,33 @@ 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
# -> create h5_file/DCore/umat
#
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
# -> create h5_file/DCore/local_potential
#
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
Expand All @@ -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
Expand Down
18 changes: 7 additions & 11 deletions src/dcore/program_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.")

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 1e53df1

Please sign in to comment.