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

Include velph in phelel #1

Merged
merged 5 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Made seekpath optional
atztogo committed Jul 13, 2024
commit d81cb6e55073a7cf212ded3c4302095bed13c92b
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
run: |
conda activate test
conda install --yes -c conda-forge python=${{ matrix.python-version }}
conda install --yes -c conda-forge phonopy phono3py finufft pytest click codecov pytest-cov
conda install --yes -c conda-forge phonopy phono3py finufft seekpath pytest click codecov pytest-cov
- name: Setup phelel
run: |
conda activate test
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ requires-python = ">=3.9"
dependencies = [
"phono3py",
"finufft",
"click"
"click",
]
license = {file = "LICENSE"}

5 changes: 5 additions & 0 deletions src/phelel/velph/cli/el_bands/generate.py
Original file line number Diff line number Diff line change
@@ -61,6 +61,11 @@ def write_input_files(toml_filename: pathlib.Path) -> None:

# KPOINTS_OPT
if calc_type == "bands":
if "path" in toml_dict["vasp"]["el_bands"]["kpoints_opt"]:
click.echo(
"Seek-path (https://github.com/giovannipizzi/seekpath) is used."
)

write_kpoints_line_mode(
primitive,
directory,
3 changes: 3 additions & 0 deletions src/phelel/velph/cli/ph_bands/generate.py
Original file line number Diff line number Diff line change
@@ -46,6 +46,9 @@ def write_input_files(toml_filename: pathlib.Path) -> None:
)

# QPOINTS
if "path" in toml_dict["vasp"]["ph_bands"]["qpoints"]:
click.echo("Seek-path (https://github.com/giovannipizzi/seekpath) is used.")

write_kpoints_line_mode(
primitive,
directory,
6 changes: 5 additions & 1 deletion src/phelel/velph/utils/vasp.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
from typing import Optional, Union

import numpy as np
import seekpath
from phonopy.structure.cells import PhonopyAtoms


@@ -96,6 +95,11 @@ def _get_line_mode(toml_dict: dict, cell: PhonopyAtoms) -> list:
lines.append(f"{coord} {p[i]}")
lines.append("")
else:
try:
import seekpath
except ImportError as exc:
raise ModuleNotFoundError("You need to install seekpath.") from exc

band_path = seekpath.get_path(cell.totuple())
for p in list(band_path["path"]):
for i in range(2):
2 changes: 2 additions & 0 deletions test/velph/utils/test_vasp.py
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import tempfile

import numpy as np
import pytest
import tomli
from phelel.velph.utils.vasp import CutoffToFFTMesh, VaspIncar, VaspKpoints, VaspPotcar
from phonopy.structure.atoms import PhonopyAtoms
@@ -43,6 +44,7 @@ def test_write_kpoints_line_mode(nacl_cell: PhonopyAtoms):

def test_write_kpoints_line_mode_seekpath(nacl_cell: PhonopyAtoms):
"""Test of KPOINTS writer in line mode with seekpath."""
pytest.importorskip("seekpath")
toml_str = """line = 51"""
ref_str = """k points along high symmetry lines by velph
51