Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Estimation of elph_nabnds was replaced by that of elph_selfen_band_stop #50

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/phelel/velph/cli/selfenergy/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def write_selfenergy_input_files(
current_directory : Path
Used for test.
energy_threshold : float
Energy threshold (gap) to estimate elph_nbands used for
Energy threshold (gap) to estimate elph_selfen_band_stop used for
calc_type="transport".

"""
Expand Down Expand Up @@ -83,13 +83,13 @@ def write_selfenergy_input_files(
toml_incar_dict["nelm"] = 0
toml_incar_dict["elph_run"] = False

# Automatic elph_nbands setting for transport.
# Automatic elph_selfen_band_stop setting for transport.
if calc_type == "transport":
# Here toml_incar_dict is updated for setting elph_nbands
band_index = _find_elph_nbands(current_directory, energy_threshold)
# Here toml_incar_dict is updated for setting elph_selfen_band_stop
band_index = _find_elph_selfen_band_stop(current_directory, energy_threshold)
if band_index is not None:
click.echo(f' "elph_nbands={band_index + 1}" in INCAR is set.')
toml_incar_dict["elph_nbands"] = band_index + 1
click.echo(f' "elph_selfen_band_stop={band_index + 1}" in INCAR is set.')
toml_incar_dict["elph_selfen_band_stop"] = band_index + 1

# POSCAR
primitive = parse_cell_dict(toml_dict["primitive_cell"])
Expand Down Expand Up @@ -137,37 +137,40 @@ def write_selfenergy_input_files(
click.echo(f'VASP input files were generated in "{directory_path}".')


def _find_elph_nbands(current_directory: pathlib.Path, energy_threshold: float) -> int:
def _find_elph_selfen_band_stop(
current_directory: pathlib.Path, energy_threshold: float
) -> int:
dos_directory = current_directory / "el_bands" / "dos"
if dos_directory.exists():
click.echo('Found "el_bands/dos" directory. Estimate elph_nbands.')
click.echo('Found "el_bands/dos" directory. Estimate elph_selfen_band_stop.')
vaspout_path = dos_directory / "vaspout.h5"
if vaspout_path.exists():
possiblly_occupied_band_index = _estimate_elph_nbands(
possiblly_occupied_band_index = _estimate_elph_selfen_band_stop(
vaspout_path, energy_threshold=energy_threshold
)
if possiblly_occupied_band_index is None:
click.echo("Estimation of elph_nbands failed.")
click.echo("Estimation of elph_selfen_band_stop failed.")
return None
return possiblly_occupied_band_index
else:
click.echo('Not found "el_bands/dos/vasprun.xml".')
return None


def _estimate_elph_nbands(
def _estimate_elph_selfen_band_stop(
vaspout_path: pathlib.Path,
energy_threshold: float = 0.5,
occupation_condition: float = 1e-10,
) -> Optional[int]:
"""Estimate elph_nbands from eigenvalues in electronic DOS calculation.
"""Estimate elph_selfen_band_stop from eigenvalues in el-DOS result.

Parameters
----------
vaspout_path : pathlib.Path
"vaspout.h5" path.
energy_threshold : float
Energy threshold (gap) in eV to estimate elph_nbands. Default is 0.5 eV.
Energy threshold (gap) in eV to estimate elph_selfen_band_stop. Default
is 0.5 eV.
occupation_condition : float
Condition to determine either if bands are occupied or not. This value
is used as occupation_number > occupation_condition. Default is 1e-5.
Expand Down
8 changes: 1 addition & 7 deletions src/phelel/velph/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
"elph_selfen_dw": True,
"elph_selfen_delta": 0.01,
"elph_selfen_temps": [300],
"elph_wf_cache_mb": 1000,
"elph_wf_cache_prefill": True,
"elph_wf_redistribute": True,
"elph_nbands": 100,
"elph_nbands_sum": [50, 100],
"elph_selfen_gaps": True,
Expand All @@ -85,7 +82,7 @@
},
"transport": {
"incar": {
"elph_fermi_nedos": 5001,
"elph_fermi_nedos": 501,
"elph_ismear": -24,
"elph_mode": "transport",
"elph_selfen_carrier_den": 0.0,
Expand Down Expand Up @@ -144,9 +141,6 @@
1400,
],
"elph_transport_nedos": 501,
"elph_wf_redistribute": True,
"elph_wf_redistribute_opt": 0,
"elph_wf_comm_opt": 0,
},
},
"el_bands": {
Expand Down
Loading