Skip to content

Commit

Permalink
Merge branch 'rc'
Browse files Browse the repository at this point in the history
  • Loading branch information
atztogo committed Feb 2, 2024
2 parents 87bc1d8 + 309fc79 commit c0ac4fd
Show file tree
Hide file tree
Showing 77 changed files with 224 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ repos:
- id: check-added-large-files

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
args:
- "--max-line-length=88"
- "--ignore=E203,W503"

- repo: https://github.com/psf/black
rev: 23.12.0
rev: 24.1.1
hooks:
- id: black
args:
Expand Down
4 changes: 4 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Change Log

## Feb-2-2024: Version 2.9.2

- `boundary_mfp` value is stored in `kappa-*.hdf5` file when it is specified.

## Dec-26-2023: Version 2.9.1

- Release to build conda-forge package.
Expand Down
2 changes: 2 additions & 0 deletions doc/command-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ Then running with isotope calculation:
In the result hdf5 file, currently isotope scattering strength is not written
out, i.e., `gamma` is still imaginary part of self energy of ph-ph scattering.

(boundary_mfp_option)=

### `--boundary-mfp`, `--bmfp` (`BOUNDARY_MFP`)

A most simple phonon boundary scattering treatment is included. $v_g/L$ is just
Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sphinx phono3py configuration file."""

#
# phono3py documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 26 13:13:14 2013.
Expand Down Expand Up @@ -59,7 +60,7 @@
# The short X.Y version.
version = "2.9"
# The full version, including alpha/beta/rc tags.
release = "2.9.1"
release = "2.9.2"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
14 changes: 11 additions & 3 deletions doc/hdf5_howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ The array shape is (irreducible q-point, phonon band).
(kappa_hdf5_file_gamma)=
### gamma

Imaginary part of self energy. The physical unit is THz, where THz
is in the ordinal frequency not the angular frequency.
Imaginary part of self energy of phonon bubble diagram (phonon-phonon
scattering). The physical unit is THz, where THz is in the ordinal frequency not
the angular frequency.

The array shape for all grid-points (irreducible q-points) is
(temperature, irreducible q-point, phonon band).
Expand Down Expand Up @@ -262,9 +263,16 @@ P_{\mathbf{q}j} = \frac{1}{(3n_\mathrm{a})^2} \sum_{\lambda'\lambda''}
$$

This is not going to be calculated in the RTA thermal coductivity
calculation mode by default. To calculate this, `--full_pp` option
calculation mode by default. To calculate this, `--full-pp` option
has to be specified (see {ref}`full_pp_option`).

### boundary_mfp

A value specified by {ref}`boundary_mfp_option`. The physical unit is
micrometre.

When `--boundary-mfp` option is explicitly specified, its value is stored here.

### kappa_unit_conversion

This is used to convert the physical unit of lattice thermal
Expand Down
1 change: 1 addition & 0 deletions example/Si-PBEsol/Si.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example to run thermal conductivity of Si."""

import numpy as np
from phonopy.interface.vasp import read_vasp

Expand Down
1 change: 1 addition & 0 deletions example/zb-ZnTe-PBEsol/launch_phono3py_ZnTe_PBEsol_222.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Launch script of ZnTe AiiDA calculation using aiida-phononpy."""

from aiida.engine import submit
from aiida.manage.configuration import load_profile
from aiida.orm import Bool, Float, Str
Expand Down
1 change: 1 addition & 0 deletions phono3py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Shortcuts to important classes, methods, and variables."""

# Copyright (C) 2019 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/api_isotope.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for isotope scattering."""

# Copyright (C) 2019 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/api_jointdos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for joint-density-of-states calculation."""

# Copyright (C) 2019 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/api_phono3py.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Phono3py main class."""

# Copyright (C) 2016 Atsushi Togo
# All rights reserved.
#
Expand Down
8 changes: 8 additions & 0 deletions phono3py/conductivity/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Thermal conductivity base class."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down Expand Up @@ -375,6 +376,8 @@ def __init__(
volume = self._pp.primitive.volume
self._conversion_factor = unit_to_WmK / volume

self._averaged_pp_interaction = None

# `self._velocity_obj` is the instance of an inherited class of
# `GroupVelocity`. `self._init_velocity()` is the method setup the instance,
# which must be implmented in the inherited class of `ConductivityBase`.
Expand Down Expand Up @@ -632,6 +635,11 @@ def get_averaged_pp_interaction(self):
)
return self.averaged_pp_interaction

@property
def boundary_mfp(self) -> float:
"""Return boundary MFP."""
return self._boundary_mfp

def get_number_of_sampling_grid_points(self):
"""Return number of grid points.
Expand Down
8 changes: 4 additions & 4 deletions phono3py/conductivity/direct_solution.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Calculate lattice thermal conductivity by direct solution."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down Expand Up @@ -108,7 +109,6 @@ def __init__(
self._init_velocity(gv_delta_q)

self._lang = lang
self._averaged_pp_interaction = None
self._collision_eigenvalues = None
self._is_reducible_collision_matrix = is_reducible_collision_matrix
self._solve_collective_phonon = solve_collective_phonon
Expand Down Expand Up @@ -517,9 +517,9 @@ def _set_collision_matrix_at_sigmas(self, i_gp):
else:
i_data = 0
self._gamma[j, k, i_data] = self._collision.imag_self_energy
self._collision_matrix[
j, k, i_data
] = self._collision.get_collision_matrix()
self._collision_matrix[j, k, i_data] = (
self._collision.get_collision_matrix()
)

def _prepare_collision_matrix(self):
"""Collect pieces and construct collision matrix."""
Expand Down
1 change: 1 addition & 0 deletions phono3py/conductivity/kubo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Kubo thermal conductivity base class."""

# Copyright (C) 2022 Atsushi Togo
# All rights reserved.
#
Expand Down
8 changes: 4 additions & 4 deletions phono3py/conductivity/rta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Lattice thermal conductivity calculation with RTA."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down Expand Up @@ -97,7 +98,6 @@ def __init__(
self._gamma_detail_at_q = None
self._use_ave_pp = use_ave_pp
self._use_const_ave_pp = None
self._averaged_pp_interaction = None
self._num_ignored_phonon_modes = None

super().__init__(
Expand Down Expand Up @@ -298,9 +298,9 @@ def _set_gamma_at_sigmas(self, i):
self._gamma_N[j, k, i] = g_N
self._gamma_U[j, k, i] = g_U
if self._is_gamma_detail:
self._gamma_detail_at_q[
k
] = self._collision.get_detailed_imag_self_energy()
self._gamma_detail_at_q[k] = (
self._collision.get_detailed_imag_self_energy()
)

def _set_gamma_at_sigmas_lowmem(self, i):
"""Calculate gamma without storing ph-ph interaction strength.
Expand Down
19 changes: 12 additions & 7 deletions phono3py/conductivity/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for lattice thermal conductivity calculation."""

# Copyright (C) 2022 Atsushi Togo
# All rights reserved.
#
Expand Down Expand Up @@ -268,6 +269,7 @@ def write_kappa(
qpoints = br.qpoints
grid_points = br.grid_points
weights = br.grid_weights
boundary_mfp = br.boundary_mfp

for i, sigma in enumerate(sigmas):
if kappa is None:
Expand Down Expand Up @@ -314,6 +316,7 @@ def write_kappa(
write_kappa_to_hdf5(
temperatures,
mesh,
boundary_mfp=boundary_mfp,
bz_grid=bz_grid,
frequency=frequencies,
group_velocity=gv,
Expand Down Expand Up @@ -487,13 +490,13 @@ def write_collision(
@staticmethod
def write_kappa(
lbte: "cond_LBTE_type",
volume,
is_reducible_collision_matrix=False,
write_LBTE_solution=False,
pinv_solver=None,
compression="gzip",
filename=None,
log_level=0,
volume: float,
is_reducible_collision_matrix: bool = False,
write_LBTE_solution: bool = False,
pinv_solver: Optional[int] = None,
compression: str = "gzip",
filename: Optional[str] = None,
log_level: int = 0,
):
"""Write kappa related properties into a hdf5 file."""
from phono3py.conductivity.direct_solution import (
Expand Down Expand Up @@ -546,6 +549,7 @@ def write_kappa(
f_vector = lbte.get_f_vectors()
mode_cv = lbte.mode_heat_capacities
mfp = lbte.get_mean_free_path()
boundary_mfp = lbte.boundary_mfp

coleigs = lbte.get_collision_eigenvalues()
# After kappa calculation, the variable is overwritten by unitary matrix
Expand Down Expand Up @@ -612,6 +616,7 @@ def write_kappa(
write_kappa_to_hdf5(
temperatures,
mesh,
boundary_mfp=boundary_mfp,
bz_grid=bz_grid,
frequency=frequencies,
group_velocity=gv,
Expand Down
1 change: 1 addition & 0 deletions phono3py/conductivity/wigner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wigner thermal conductivity base class."""

# Copyright (C) 2022 Michele Simoncelli
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/create_force_constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Force constants calculation utilities for command line user interface."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/create_supercells.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities of main CUI script."""

# Copyright (C) 2015 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/kaccum_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Phono3py kaccum command line script."""

import argparse
import sys

Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/load.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Phono3py loader."""

# Copyright (C) 2019 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/phono3py_argparse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Phono3py command option argument parser."""

# Copyright (C) 2015 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/phono3py_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Phono3py main command line script."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Phono3py command option and conf file parser."""

# Copyright (C) 2015 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/show_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities to show various logs for main CUI script."""

# Copyright (C) 2015 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/cui/triplets_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Show and write triplets information."""

# Copyright (C) 2015 Atsushi Togo
# All rights reserved.
#
Expand Down
19 changes: 13 additions & 6 deletions phono3py/file_IO.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File I/O methods."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down Expand Up @@ -32,9 +33,12 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from __future__ import annotations

import os
import warnings
from collections.abc import Sequence
from typing import Optional, Union

import h5py
import numpy as np
Expand Down Expand Up @@ -918,6 +922,7 @@ def write_collision_eigenvalues_to_hdf5(
def write_kappa_to_hdf5(
temperature,
mesh,
boundary_mfp: float = None,
bz_grid=None,
frequency=None,
group_velocity=None,
Expand Down Expand Up @@ -1058,6 +1063,8 @@ def write_kappa_to_hdf5(
w.create_dataset("sigma_cutoff_width", data=sigma_cutoff)
if kappa_unit_conversion is not None:
w.create_dataset("kappa_unit_conversion", data=kappa_unit_conversion)
if boundary_mfp is not None:
w.create_dataset("boundary_mfp", data=boundary_mfp)

if verbose:
text = "Thermal conductivity related properties "
Expand Down Expand Up @@ -1720,12 +1727,12 @@ def get_length_of_first_line(f):

def _get_filename_suffix(
mesh,
grid_point=None,
band_indices=None,
sigma=None,
sigma_cutoff=None,
temperature=None,
filename=None,
grid_point: Optional[int] = None,
band_indices: Optional[Union[np.ndarray, Sequence]] = None,
sigma: Optional[float] = None,
sigma_cutoff: Optional[float] = None,
temperature: Optional[float] = None,
filename: Optional[str] = None,
):
"""Return filename suffix corresponding to parameters."""
suffix = "-m%d%d%d" % tuple(mesh)
Expand Down
1 change: 1 addition & 0 deletions phono3py/interface/alm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ALM interface for force constants calculation."""

# Copyright (C) 2016 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/interface/calculator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities of calculator interfaces."""

# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
Expand Down
1 change: 1 addition & 0 deletions phono3py/interface/fc_calculator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Interfaces for force constants calculators."""

# Copyright (C) 2019 Atsushi Togo
# All rights reserved.
#
Expand Down
Loading

0 comments on commit c0ac4fd

Please sign in to comment.