Skip to content
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
8 changes: 4 additions & 4 deletions src/phelel/velph/cli/el_bands/cmd_el_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def cmd_el_bands():
# velph el_bands generate
#
@cmd_el_bands.command("generate")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand Down Expand Up @@ -75,9 +75,9 @@ def cmd_plot(window: tuple[float, float], save_plot: bool):


@cmd_el_bands.command("plot_eigenvalues")
@click.argument(
@click.option(
"--vaspout-filename",
"vaspout_filename",
nargs=1,
type=click.Path(),
default="el_bands/dos/vaspout.h5",
)
Expand Down
3 changes: 1 addition & 2 deletions src/phelel/velph/cli/generate/cmd_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
@click.option(
"-f",
"toml_filename",
nargs=1,
type=click.Path(exists=True),
default="velph.toml",
show_default=True,
help="Specify velph.toml",
)
@click.option(
"--prefix",
nargs=1,
"prefix",
type=click.Path(),
default="POSCAR",
show_default=True,
Expand Down
20 changes: 11 additions & 9 deletions src/phelel/velph/cli/init/cmd_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@
# velph init
#
@cmd_root.command("init")
@click.argument("cell_filename", nargs=1, type=click.Path())
@click.argument("project_folder", nargs=1, type=click.Path())
@click.argument(
"cell_filename",
nargs=1,
type=click.Path(),
)
@click.argument(
"project_folder",
nargs=1,
type=click.Path(),
)
@click.option(
"--amplitude",
nargs=1,
"amplitude",
type=float,
default=None,
help=(
Expand Down Expand Up @@ -92,7 +100,6 @@
@click.option(
"--kspacing",
"kspacing",
nargs=1,
type=float,
default=None,
help=(
Expand All @@ -103,7 +110,6 @@
@click.option(
"--kspacing-dense",
"kspacing_dense",
nargs=1,
type=float,
default=None,
help=(
Expand All @@ -124,7 +130,6 @@
@click.option(
"--max-num-atoms",
"max_num_atoms",
nargs=1,
default=None,
type=int,
help=(
Expand Down Expand Up @@ -200,7 +205,6 @@
@click.option(
"--template-toml",
"template_toml_filename",
nargs=1,
type=click.Path(),
default=None,
help=(
Expand All @@ -211,7 +215,6 @@
@click.option(
"--tolerance",
"tolerance",
nargs=1,
type=float,
default=None,
help=(
Expand All @@ -222,7 +225,6 @@
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default=None,
help="File name of velph.toml type file to be created.",
Expand Down
4 changes: 2 additions & 2 deletions src/phelel/velph/cli/nac/cmd_nac.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def cmd_nac():


@cmd_nac.command("generate")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand Down
4 changes: 2 additions & 2 deletions src/phelel/velph/cli/ph_bands/cmd_ph_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def cmd_ph_bands():
# velph ph_bands generate
#
@cmd_ph_bands.command("generate")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand Down
22 changes: 13 additions & 9 deletions src/phelel/velph/cli/ph_selfenergy/cmd_ph_selfenergy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def cmd_ph_selfenergy():


@cmd_ph_selfenergy.command("generate")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand All @@ -42,9 +42,9 @@ def cmd_generate(toml_filename: str, dry_run: bool):


@cmd_ph_selfenergy.command("check-fft")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand All @@ -55,17 +55,21 @@ def cmd_check_fft(toml_filename: str):


@cmd_ph_selfenergy.command("dump_phono3py")
@click.argument(
@click.option(
"--vaspout-filename",
"vaspout_filename",
nargs=1,
type=click.Path(),
default="ph_selfenergy/vaspout.h5",
)
@click.argument(
@click.option(
"--output-filename",
"output_filename",
nargs=1,
type=click.Path(),
default="ph_selfenergy/phono3py_elph.hdf5",
default="ph_selfenergy/gamma-elph{mesh}.hdf5",
help=(
'Output filename. Default is "ph_selfenergy/gamma_elph{mesh}.hdf5". '
'{mesh} will be replaced by the mesh size, e.g. "-m202020".'
),
)
@click.help_option("-h", "--help")
def cmd_dump_phono3py(vaspout_filename: str, output_filename: str):
Expand Down
8 changes: 6 additions & 2 deletions src/phelel/velph/cli/ph_selfenergy/dump_phono3py.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def dump_phono3py(vaspout_filename: str, output_filename: str):
freqs_calcs, gammas_calcs, temps_calcs, indices = (
read_freqs_and_ph_gammas_from_vaspout_h5(f)
)
with h5py.File(output_filename, "w") as f_out:
_output_filename = output_filename.format(
mesh="-m" + "".join(map(str, bz_grid.D_diag))
)
with h5py.File(_output_filename, "w") as f_out:
f_out.create_dataset("qpoint", data=ir_kpoints)
f_out.create_dataset("weight", data=weights)
f_out.create_dataset("mesh", data=bz_grid.D_diag)
Expand All @@ -38,8 +41,9 @@ def dump_phono3py(vaspout_filename: str, output_filename: str):
f_out.create_dataset(f"frequency_{i}", data=_freqs)
f_out.create_dataset(f"gamma_{i}", data=_gammas)
f_out.create_dataset(f"temperature_{i}", data=temps)
click.echo(f"calc-{i} temperatures: {temps}")

click.echo(f'Dumped ph_selfenergy data to "{output_filename}".')
click.echo(f'Dumped ph_selfenergy data to "{_output_filename}".')


def _collect_data_from_vaspout(
Expand Down
12 changes: 5 additions & 7 deletions src/phelel/velph/cli/ph_selfenergy/plot/cmd_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def cmd_plot():


@cmd_plot.command("selfenergy")
@click.argument(
@click.option(
"--vaspout-filename",
"vaspout_filename",
nargs=1,
type=click.Path(),
default="ph_selfenergy/vaspout.h5",
)
Expand All @@ -35,7 +35,7 @@ def cmd_plot():
"save_plot",
is_flag=bool,
default=False,
help=("Save plot to file."),
help="Save plot to file.",
)
@click.help_option("-h", "--help")
def cmd_plot_selfenergy(vaspout_filename: str, save_plot: bool):
Expand All @@ -49,15 +49,14 @@ def cmd_plot_selfenergy(vaspout_filename: str, save_plot: bool):


@cmd_plot.command("eigenvalues")
@click.argument(
@click.option(
"--vaspout-filename",
"vaspout_filename",
nargs=1,
type=click.Path(),
default="ph_selfenergy/vaspout.h5",
)
@click.option(
"--tid",
nargs=1,
type=int,
default=None,
help=(
Expand All @@ -67,7 +66,6 @@ def cmd_plot_selfenergy(vaspout_filename: str, save_plot: bool):
)
@click.option(
"--calcid",
nargs=1,
type=int,
default=None,
help=(
Expand Down
53 changes: 16 additions & 37 deletions src/phelel/velph/cli/phelel/cmd_phelel.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@ def cmd_phelel():
# velph phelel init
#
@cmd_phelel.command("init")
@click.argument("toml_filename", nargs=1, type=click.Path(), default="velph.toml")
@click.option(
"--dir-name",
"dir_name",
type=str,
default="phelel",
help=(
'Used for backward compatibility, for which set "supercell". '
'(dir_name: str, default="phelel")'
),
"--toml-filename",
"toml_filename",
type=click.Path(),
default="velph.toml",
)
@click.help_option("-h", "--help")
def cmd_init(toml_filename: str, dir_name: str):
Expand All @@ -64,16 +59,11 @@ def cmd_init(toml_filename: str, dir_name: str):
# velph phelel generate
#
@cmd_phelel.command("generate")
@click.argument("toml_filename", nargs=1, type=click.Path(), default="velph.toml")
@click.option(
"--dir-name",
"dir_name",
type=str,
default="phelel",
help=(
'Used for backward compatibility, for which set "supercell". '
'(phelel_dirname: str, default="phelel")'
),
"--toml-filename",
"toml_filename",
type=click.Path(),
default="velph.toml",
)
@click.help_option("-h", "--help")
def cmd_generate(toml_filename: str, dir_name: str):
Expand All @@ -91,20 +81,14 @@ def cmd_generate(toml_filename: str, dir_name: str):
# velph supercell differentiate
#
@cmd_phelel.command("differentiate")
@click.argument("toml_filename", nargs=1, type=click.Path(), default="velph.toml")
@click.option(
"--dir-name",
"dir_name",
type=str,
default="phelel",
help=(
'Used for backward compatibility, for which set "supercell". '
'(phelel_dirname: str, default="phelel")'
),
"--toml-filename",
"toml_filename",
type=click.Path(),
default="velph.toml",
)
@click.option(
"--encut",
nargs=1,
type=float,
default=None,
help=(
Expand Down Expand Up @@ -182,16 +166,11 @@ def cmd_differentiate(
# velph phelel phonopy
#
@cmd_phelel.command("phonopy")
@click.argument("toml_filename", nargs=1, type=click.Path(), default="velph.toml")
@click.option(
"--dir-name",
"dir_name",
type=str,
default="phelel",
help=(
'Used for backward compatibility, for which set "supercell". '
'(phelel_dirname: str, default="phelel")'
),
"--toml-filename",
"toml_filename",
type=click.Path(),
default="velph.toml",
)
@click.help_option("-h", "--help")
def cmd_phonopy(toml_filename: str, dir_name: str):
Expand Down
9 changes: 4 additions & 5 deletions src/phelel/velph/cli/phono3py/cmd_phono3py.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ def cmd_phono3py():
# velph phono3py init
#
@cmd_phono3py.command("init")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
@click.option(
"--rd",
"random_displacements",
nargs=1,
default=None,
type=int,
help="Number of snapshots of supercells with random directional displacement.",
Expand Down Expand Up @@ -68,9 +67,9 @@ def cmd_init(
# velph phono3py generate
#
@cmd_phono3py.command("generate")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand Down
8 changes: 4 additions & 4 deletions src/phelel/velph/cli/phonopy/cmd_phonopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def cmd_phonopy():
# velph phonopy init
#
@cmd_phonopy.command("init")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand Down Expand Up @@ -53,9 +53,9 @@ def cmd_init(toml_filename: str):
# velph phonopy generate
#
@cmd_phonopy.command("generate")
@click.argument(
@click.option(
"--toml-filename",
"toml_filename",
nargs=1,
type=click.Path(),
default="velph.toml",
)
Expand Down
Loading
Loading