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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ license = {file = "LICENSE"}
[project.scripts]
phelel = "phelel.scripts.phelel:run"
phelel-load = "phelel.scripts.phelel_load:run"
velph = "phelel.velph.cli:cmd_root"
velph = "phelel.velph.cli.cmd_root:cmd_root"

[tool.setuptools.dynamic]
version = { attr = "phelel.version.__version__" }
Expand Down
5 changes: 0 additions & 5 deletions src/phelel/velph/__init__.py

This file was deleted.

41 changes: 0 additions & 41 deletions src/phelel/velph/cli/__init__.py

This file was deleted.

28 changes: 28 additions & 0 deletions src/phelel/velph/cli/cmd_root.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""velph command line tool module."""

import click


@click.group()
@click.help_option("-h", "--help")
def cmd_root():
"""Command-line utility to help VASP el-ph calculation."""
pass


from phelel.velph.cli.el_bands.cmd_el_bands import cmd_el_bands # noqa: E402, F401
from phelel.velph.cli.generate.cmd_generate import cmd_generate # noqa: E402, F401
from phelel.velph.cli.init.cmd_init import cmd_init # noqa: E402, F401
from phelel.velph.cli.nac.cmd_nac import cmd_nac # noqa: E402, F401
from phelel.velph.cli.ph_bands.cmd_ph_bands import cmd_ph_bands # noqa: E402, F401
from phelel.velph.cli.ph_selfenergy.cmd_ph_selfenergy import ( # noqa: E402, F401
cmd_ph_selfenergy,
)
from phelel.velph.cli.phelel.cmd_phelel import cmd_phelel # noqa: E402, F401
from phelel.velph.cli.phono3py.cmd_phono3py import cmd_phono3py # noqa: E402, F401
from phelel.velph.cli.phonopy.cmd_phonopy import cmd_phonopy # noqa: E402, F401
from phelel.velph.cli.relax.cmd_relax import cmd_relax # noqa: E402, F401
from phelel.velph.cli.selfenergy.cmd_selfenergy import ( # noqa: E402, F401
cmd_selfenergy,
)
from phelel.velph.cli.transport.cmd_transport import cmd_transport # noqa: E402, F401
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import click

from phelel.velph.cli import cmd_root
from phelel.velph.cli.cmd_root import cmd_root
from phelel.velph.cli.el_bands.generate import write_input_files
from phelel.velph.cli.el_bands.plot import plot_el_bandstructures
from phelel.velph.utils.plot_eigenvalues import (
Expand Down Expand Up @@ -95,12 +95,6 @@ def cmd_plot_transport_eigenvalues(
cutoff_occupancy,
mu,
None,
None,
calc_type="el_bands",
)


def plot(window: tuple[float, float], save_plot: bool = False):
"""Plot electronic band structure."""
with click.Context(cmd_plot) as ctx:
ctx.params = {"window": window, "save_plot": save_plot}
cmd_plot.invoke(ctx)
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
"""velph command line tool / velph-generate."""

from __future__ import annotations

import pathlib

import click
import tomli
from phonopy.interface.calculator import write_crystal_structure
from phonopy.structure.atoms import parse_cell_dict

from phelel.velph.cli import cmd_root
from phelel.velph.cli.cmd_root import cmd_root


#
Expand Down Expand Up @@ -53,9 +55,16 @@ def _run_generate(toml_filename: str, prefix: str) -> None:
_write_cell(filename, toml_dict["primitive_cell"])


def _write_cell(filename, toml_cell_dict):
def _write_cell(filename: str, toml_cell_dict: dict):
if pathlib.Path(filename).exists():
click.echo(f'"{filename}" was not overwritten because it exists.', err=True)
else:
write_crystal_structure(filename, parse_cell_dict(toml_cell_dict))
click.echo(f'"{filename}" was generated.', err=True)
cell = parse_cell_dict(toml_cell_dict)
if cell is None:
click.echo(
f'"{filename}" was not generated because of invalid cell data.',
err=True,
)
return
write_crystal_structure(filename, cell)
click.echo(f'"{filename}" was generated.')
100 changes: 0 additions & 100 deletions src/phelel/velph/cli/hints/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import click

from phelel.velph.cli import cmd_root
from phelel.velph.cli.cmd_root import cmd_root
from phelel.velph.cli.init.init import run_init
from phelel.velph.cli.utils import (
DefaultCellChoices,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""velph command line tool / velph-nac."""

from __future__ import annotations

import pathlib

import click

from phelel.velph.cli import cmd_root
from phelel.velph.cli.cmd_root import cmd_root
from phelel.velph.cli.nac.generate import write_input_files


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""velph command line tool / velph-ph_bands."""

from __future__ import annotations

import pathlib

import click

from phelel.velph.cli import cmd_root
from phelel.velph.cli.cmd_root import cmd_root
from phelel.velph.cli.ph_bands.generate import (
write_input_files as write_input_files_ph_bandstructures,
)
Expand Down Expand Up @@ -64,10 +66,3 @@ def cmd_plot(use_ordinary_frequency: bool, save_plot: bool):
plot_ph_bandstructures(
vaspout_filename, use_ordinary_frequency, save_plot=save_plot
)


def plot(save_plot: bool = False):
"""Plot phonon band structure."""
with click.Context(cmd_plot) as ctx:
ctx.params = {"save_plot": save_plot}
cmd_plot.invoke(ctx)
10 changes: 0 additions & 10 deletions src/phelel/velph/cli/ph_selfenergy/__init__.py

This file was deleted.

26 changes: 25 additions & 1 deletion src/phelel/velph/cli/ph_selfenergy/cmd_ph_selfenergy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import pathlib

import click
import h5py

from phelel.velph.cli import cmd_root
from phelel.velph.cli.cmd_root import cmd_root
from phelel.velph.cli.selfenergy.generate import write_selfenergy_input_files
from phelel.velph.cli.utils import check_fft

Expand Down Expand Up @@ -51,3 +52,26 @@ def cmd_generate(toml_filename: str, dry_run: bool):
def cmd_check_fft(toml_filename: str):
"""Show [NGX, NGY, NGZ] in vasprun.xml."""
check_fft(toml_filename, "ph_selfenergy")


@cmd_ph_selfenergy.command("dump")
@click.argument(
"vaspout_filename",
nargs=1,
type=click.Path(),
default="ph_selfenergy/vaspout.h5",
)
@click.argument(
"output_filename",
nargs=1,
type=click.Path(),
default="ph_selfenergy/ph_selfenergy.hdf5",
)
@click.help_option("-h", "--help")
def cmd_dump(vaspout_filename: str, output_filename: str):
"""Dump ph_selfenergy data to HDF5 file."""
with h5py.File(vaspout_filename, "r") as f:
list(f)


from phelel.velph.cli.ph_selfenergy.plot.cmd_plot import cmd_plot # noqa: E402, F401
7 changes: 0 additions & 7 deletions src/phelel/velph/cli/ph_selfenergy/plot/__init__.py

This file was deleted.

Loading
Loading