mirror of https://github.com/phonopy/phono3py.git
Update document to read pp-*.hdf5 and handling triplets
This commit is contained in:
parent
16957da192
commit
9fc5186267
|
@ -357,8 +357,7 @@ loader.
|
|||
`FORCES_FC3` is assumed.
|
||||
- TURBOMOLE interface is provided by Antti Karttunen (`--turbomole`).
|
||||
- Compatibility of `fc2.hdf5` and `force_constants.hdf5` was improved for all
|
||||
calculators to store physical unit information in the hdf5 file. See
|
||||
{ref}`file_format_compatibility`.
|
||||
calculators to store physical unit information in the hdf5 file.
|
||||
|
||||
## Mar-24-2019: Version 1.16.0
|
||||
|
||||
|
|
|
@ -197,7 +197,6 @@ created from `FORCES_FC2` and `phono3py_disp.yaml` instead of `FORCES_FC3` and
|
|||
```
|
||||
|
||||
(sp_option)=
|
||||
|
||||
### `--sp` or `--save-params`
|
||||
|
||||
Instead of `FORCES_FC3`, `phono3py_params.yaml` is generated. This option must
|
||||
|
@ -329,7 +328,6 @@ information about primitive cell (`primitive_matrix` key) in
|
|||
```
|
||||
|
||||
(random_displacements_option)=
|
||||
|
||||
### `--rd` (`RANDOM_DISPLACEMENTS`), `--rd-fc2` (`RANDOM_DISPLACEMENTS_FC2`) and `--random-seed` (`RANDOM_SEED`)
|
||||
|
||||
**`phono3py-load` doesn't have this option.**
|
||||
|
@ -596,7 +594,7 @@ expected.
|
|||
### `--sigma` (`SIGMA`)
|
||||
|
||||
$\sigma$ value of Gaussian function for smearing when calculating imaginary part
|
||||
of self energy. See the detail at {ref}`brillouinzone_sum`.
|
||||
of self energy.
|
||||
|
||||
Multiple $\sigma$ values are also specified by space separated numerical values.
|
||||
This is used when we want to test several $\sigma$ values simultaneously.
|
||||
|
@ -806,48 +804,8 @@ $\Gamma_\lambda(\omega_\lambda) =
|
|||
\Gamma^\text{U}_\lambda(\omega_\lambda)$
|
||||
and this is used to calculate thermal conductivity in single-mode RTA. The
|
||||
separation, i.e., the choice of G-vector, is made based on the first Brillouin
|
||||
zone.
|
||||
zone. See {ref}`iofile_kappa_hdf5_gamma_NU`.
|
||||
|
||||
The data are stored in `kappa-mxxx(-gx-sx-sdx).hdf5` file and accessed by
|
||||
`gamma_N` and `gamma_U` keys. The shape of the arrays is the same as that of
|
||||
`gamma` (see {ref}`kappa_hdf5_file_gamma`). An example (Si-PBEsol) is shown
|
||||
below:
|
||||
|
||||
```bash
|
||||
% phono3py-load --mesh 11 11 11 --fc3 --fc2 --br --nu
|
||||
...
|
||||
% ipython
|
||||
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("kappa-m111111.hdf5", 'r')
|
||||
|
||||
In [3]: list(f)
|
||||
Out[3]:
|
||||
['frequency',
|
||||
'gamma',
|
||||
'gamma_N',
|
||||
'gamma_U',
|
||||
'group_velocity',
|
||||
'gv_by_gv',
|
||||
'heat_capacity',
|
||||
'kappa',
|
||||
'kappa_unit_conversion',
|
||||
'mesh',
|
||||
'mode_kappa',
|
||||
'qpoint',
|
||||
'temperature',
|
||||
'weight']
|
||||
|
||||
In [4]: f['gamma'].shape
|
||||
Out[4]: (101, 56, 6)
|
||||
|
||||
In [5]: f['gamma_N'].shape
|
||||
Out[5]: (101, 56, 6)
|
||||
|
||||
In [6]: f['gamma_U'].shape
|
||||
Out[6]: (101, 56, 6)
|
||||
```
|
||||
|
||||
### `--scattering-event-class` (`SCATTERING_EVENT_CLASS`)
|
||||
|
||||
|
@ -1202,68 +1160,9 @@ not found, `kappa-mxxx-gx-bx(-sx-sdx).hdf5` files for band indices are searched.
|
|||
### `--write-gamma-detail` (`WRITE_GAMMA_DETAIL = .TRUE.`)
|
||||
|
||||
Each q-point triplet contribution to imaginary part of self energy is written
|
||||
into `gamma_detail-mxxx-gx(-sx-sdx).hdf5` file. Be careful that this is large
|
||||
data.
|
||||
into `gamma_detail-mxxx-gx(-sx-sdx).hdf5` file. Be careful that this can be a
|
||||
large file. See {ref}`iofile_gamma_detail_hdf5`.
|
||||
|
||||
In the output file in hdf5, following keys are used to extract the detailed
|
||||
information.
|
||||
|
||||
```{table}
|
||||
| dataset | Array shape |
|
||||
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| gamma_detail for `--ise` | (temperature, sampling frequency point, symmetry reduced set of triplets at a grid point, band1, band2, band3) in THz (without $2\pi$) |
|
||||
| gamma_detail for `--br` | (temperature, symmetry reduced set of triplets at a grid point, band1, band2, band3) in THz (without $2\pi$) |
|
||||
| mesh | Numbers of sampling mesh along reciprocal axes. |
|
||||
| frequency_point for `--ise` | Sampling frequency points in THz (without $2\pi$), i.e., $\omega$ in $\Gamma_\lambda(\omega)$ |
|
||||
| temperature | (temperature,), Temperatures in K |
|
||||
| triplet | (symmetry reduced set of triplets at a grid point, 3), Triplets are given by the grid point indices (see below). |
|
||||
| weight | (symmetry reduced set of triplets at a grid point,), Weight of each triplet to imaginary part of self energy |
|
||||
```
|
||||
|
||||
Imaginary part of self energy (linewidth/2) is recovered by the following
|
||||
script:
|
||||
|
||||
```python
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
||||
gd = h5py.File("gamma_detail-mxxx-gx.hdf5")
|
||||
temp_index = 30 # index of temperature
|
||||
temperature = gd['temperature'][temp_index]
|
||||
gamma_tp = gd['gamma_detail'][:].sum(axis=-1).sum(axis=-1)
|
||||
weight = gd['weight'][:]
|
||||
gamma = np.dot(weight, gamma_tp[temp_index])
|
||||
```
|
||||
|
||||
For example, for `--br`, this `gamma` gives $\Gamma_\lambda(\omega_\lambda)$ of
|
||||
the band indices at the grid point indicated by $\lambda$ at the temperature of
|
||||
index 30. If any bands are degenerated, those `gamma` in
|
||||
`kappa-mxxx-gx(-sx-sdx).hdf5` or `gamma-mxxx-gx(-sx-sdx).hdf5` type file are
|
||||
averaged, but the `gamma` obtained here in this way are not symmetrized. Apart
|
||||
from this symmetrization, the values must be equivalent between them.
|
||||
|
||||
To understand each contribution of triptle to imaginary part of self energy,
|
||||
reading `phonon-mxxx.hdf5` is useful (see {ref}`write_phonon_option`). For
|
||||
example, phonon triplets of three phonon scatterings are obtained by
|
||||
|
||||
```python
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
||||
gd = h5py.File("gamma_detail-mxxx-gx.hdf5", 'r')
|
||||
ph = h5py.File("phonon-mxxx.hdf5", 'r')
|
||||
gp1 = gd['grid_point'][()]
|
||||
triplets = gd['triplet'][:] # Sets of (gp1, gp2, gp3) where gp1 is fixed
|
||||
mesh = gd['mesh'][:]
|
||||
grid_address = ph['grid_address'][:]
|
||||
q_triplets = grid_address[triplets] / mesh.astype('double')
|
||||
# Phonons of triplets[2]
|
||||
phonon_tp = [(ph['frequency'][i], ph['eigenvector'][i]) for i in triplets[2]]
|
||||
# Fractions of contributions of triplets at this grid point and temperature index 30
|
||||
gamma_sum_over_bands = np.dot(weight, gd['gamma_detail'][30].sum(axis=-1).sum(axis=-1).sum(axis=-1))
|
||||
contrib_tp = [gd['gamma_detail'][30, i].sum() / gamma_sum_over_bands for i in range(len(weight))]
|
||||
np.dot(weight, contrib_tp) # is one
|
||||
```
|
||||
|
||||
(write_phonon_option)=
|
||||
|
||||
|
@ -1271,45 +1170,12 @@ np.dot(weight, contrib_tp) # is one
|
|||
|
||||
Phonon frequencies, eigenvectors, and grid point addresses are stored in
|
||||
`phonon-mxxx.hdf5` file. {ref}`--pa <pa_option>` and {ref}`--nac <nac_option>`
|
||||
may be required depending on calculation setting.
|
||||
may be required depending on calculation setting. See {ref}`iofile_phonon_hdf5`.
|
||||
|
||||
```bash
|
||||
% phono3py-load --mesh 11 11 11 --nac --write-phoonon
|
||||
```
|
||||
|
||||
Contents of `phonon-mxxx.hdf5` are watched by:
|
||||
|
||||
```bash
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: ph = h5py.File("phonon-m111111.hdf5", 'r')
|
||||
|
||||
In [3]: list(ph)
|
||||
Out[3]: ['eigenvector', 'frequency', 'grid_address', 'mesh']
|
||||
|
||||
In [4]: ph['mesh'][:]
|
||||
Out[4]: array([11, 11, 11], dtype=int32)
|
||||
|
||||
In [5]: ph['grid_address'].shape
|
||||
Out[5]: (1367, 3)
|
||||
|
||||
In [6]: ph['frequency'].shape
|
||||
Out[6]: (1367, 6)
|
||||
|
||||
In [7]: ph['eigenvector'].shape
|
||||
Out[7]: (1367, 6, 6)
|
||||
```
|
||||
|
||||
The first axis of `ph['grid_address']`, `ph['frequency']`, and
|
||||
`ph['eigenvector']` corresponds to the number of q-points where phonons are
|
||||
calculated. Here the number of phonons may not be equal to product of mesh
|
||||
numbers ($1367 \neq 11^3$). This is because all q-points on Brillouin zone
|
||||
boundary are included, i.e., even if multiple q-points are translationally
|
||||
equivalent, those phonons are stored separately though these phonons are
|
||||
physically equivalent within the equations employed in phono3py. Here Brillouin
|
||||
zone is defined by Wigner–Seitz cell of reciprocal primitive basis vectors. This
|
||||
is convenient to categorize phonon triplets into Umklapp and Normal scatterings
|
||||
based on the Brillouin zone.
|
||||
|
||||
(read_phonon_option)=
|
||||
|
||||
|
|
|
@ -0,0 +1,280 @@
|
|||
(grid)=
|
||||
# Grids in reciprocal space
|
||||
|
||||
The regular grid can be a conventional regular grid or a generalized regular
|
||||
grid. Here the conventional regular grid means that the grids are cut parallel
|
||||
to the reciprocal basis vectors. In most cases, the conventional regular grid is
|
||||
used. In special case, e.g., for crystals with body center tetragonal symmetry,
|
||||
the generalized regular grid can be useful. In phono3py, the generalized regular
|
||||
grid is defined to be cut parallel to the reciprocal basis vectors of the
|
||||
conventional unit cell.
|
||||
|
||||
Two types of grid data structure are used in phono3py. Normal regular grid
|
||||
contains translationally unique grid points (regular grid). The other grid
|
||||
includes the points on Brillouin zone (BZ) boundary (BZ grid).
|
||||
|
||||
## `BZGrid` class instance
|
||||
|
||||
Grid point information in reciprocal space is stored in the `BZGrid` class. This
|
||||
class instance can be easily accessed in the following way.
|
||||
|
||||
```python
|
||||
In [1]: import phono3py
|
||||
|
||||
In [2]: ph3 = phono3py.load("phono3py.yaml", produce_fc=False)
|
||||
|
||||
In [3]: ph3.mesh_numbers = [11, 11, 11]
|
||||
|
||||
In [4]: ph3.grid
|
||||
Out[4]: <phono3py.phonon.grid.BZGrid at 0x1070f3b60>
|
||||
```
|
||||
|
||||
It is recommended to read docstring in `BZGrid` by
|
||||
|
||||
```python
|
||||
In [5]: help(ph3.grid)
|
||||
```
|
||||
|
||||
Some attributes of this class are presented below.
|
||||
|
||||
```python
|
||||
In [6]: ph3.grid.addresses.shape
|
||||
Out[6]: (1367, 3)
|
||||
|
||||
In [7]: ph3.grid.D_diag
|
||||
Out[7]: array([11, 11, 11])
|
||||
|
||||
In [8]: ph3.grid.P
|
||||
Out[8]:
|
||||
array([[1, 0, 0],
|
||||
[0, 1, 0],
|
||||
[0, 0, 1]])
|
||||
|
||||
In [9]: ph3.grid.Q
|
||||
Out[9]:
|
||||
array([[1, 0, 0],
|
||||
[0, 1, 0],
|
||||
[0, 0, 1]])
|
||||
|
||||
In [10]: ph3.grid.QDinv
|
||||
Out[10]:
|
||||
array([[0.09090909, 0. , 0. ],
|
||||
[0. , 0.09090909, 0. ],
|
||||
[0. , 0. , 0.09090909]])
|
||||
|
||||
In [11]: ph3.grid.PS
|
||||
Out[11]: array([0, 0, 0])
|
||||
```
|
||||
|
||||
The integer array `addresses` contains grid point addresses. Every grid point
|
||||
address is represented by the unique series of three integers. These addresses
|
||||
are converted to the q-points in fractional coordinates as explained in the
|
||||
{ref}`section below<grid_address_to_q>`.
|
||||
|
||||
Unless generalized regular grid is employed, the other attributes are not
|
||||
important. `D_diag` is equivalent to the three integer numbers of the specified
|
||||
conventional regular grid. `P` and `Q` are are the left and right unimodular
|
||||
matrix after Smith normal form: $\mathrm{D}=\mathrm{PAQ}$, respectively, where
|
||||
$\mathrm{A}$ is the grid matrix. `D_diag` is the three diagonal elements of the
|
||||
matrix $\mathrm{D}$. The grid matrix is usually a diagonal matrix, then
|
||||
$\mathrm{P}$ and $\mathrm{Q}$ are chosen as identity matrix. `QDinv` is given
|
||||
by $\mathrm{Q}\mathrm{D}^{-1}$. `PS` represents half-grid-shifts (usually always
|
||||
`[0, 0, 0]` in phono3py).
|
||||
|
||||
## Find grid point index corresponding to grid point address
|
||||
|
||||
Grid point index corresponding to a grid point address is obtained using the
|
||||
instance method `BZGrid.get_indices_from_addresses` as follows:
|
||||
|
||||
```python
|
||||
In [1]: import phono3py
|
||||
|
||||
In [2]: ph3 = phono3py.load("phono3py_disp.yaml")
|
||||
|
||||
In [3]: ph3.mesh_numbers = [20, 20, 20]
|
||||
|
||||
In [4]: ph3.grid.get_indices_from_addresses([0, 10, 10])
|
||||
Out[4]: 4448
|
||||
```
|
||||
|
||||
This index number is different between phono3py version 1.x and 2.x.
|
||||
To get the number corresponding to the phono3py version 1.x,
|
||||
`store_dense_gp_map=False` should be specified in `phono3py.load`,
|
||||
|
||||
```python
|
||||
In [5]: ph3 = phono3py.load("phono3py_disp.yaml", store_dense_gp_map=False)
|
||||
|
||||
In [6]: ph3.mesh_numbers = [20, 20, 20]
|
||||
|
||||
In [7]: ph3.grid.get_indices_from_addresses([0, 10, 10])
|
||||
Out[7]: 4200
|
||||
```
|
||||
|
||||
(grid_address_to_q)=
|
||||
## q-points in fractional coordinates corresponding to grid addresses
|
||||
|
||||
For Gamma centered regular grid, q-points in fractional coordinates
|
||||
are obtained by
|
||||
|
||||
```python
|
||||
qpoints = addresses @ QDinv.T
|
||||
```
|
||||
|
||||
For shifted regular grid (usually unused in phono3py),
|
||||
|
||||
```python
|
||||
qpoints = (addresses * 2 + PS) @ (QDinv.T / 2.0)
|
||||
```
|
||||
|
||||
(grid_triplets)=
|
||||
## Grid point triplets
|
||||
|
||||
Three grid point indices are used to represent a q-point triplet. For example
|
||||
the following command generates `gamma_detail-m111111-g5.hdf5`,
|
||||
|
||||
```bash
|
||||
% phono3py-load phono3py.yaml --gp 5 --br --mesh 11 11 11 --write-gamma-detail
|
||||
```
|
||||
|
||||
This file contains various information:
|
||||
|
||||
```python
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("gamma_detail-m111111-g5.hdf5")
|
||||
|
||||
In [3]: list(f)
|
||||
Out[3]:
|
||||
['gamma_detail',
|
||||
'grid_point',
|
||||
'mesh',
|
||||
'temperature',
|
||||
'triplet',
|
||||
'triplet_all',
|
||||
'version',
|
||||
'weight']
|
||||
|
||||
In [4]: f['gamma_detail'].shape
|
||||
Out[4]: (101, 146, 6, 6, 6)
|
||||
```
|
||||
|
||||
For the detailed analysis of contributions of triplets to imaginary part of
|
||||
self energy a phonon mode of the grid point, it is necessary to understand the
|
||||
data structure of `triplet` and `weight`.
|
||||
|
||||
```python
|
||||
In [5]: f['triplet'].shape
|
||||
Out[5]: (146, 3)
|
||||
|
||||
In [6]: f['weight'].shape
|
||||
Out[6]: (146,)
|
||||
|
||||
In [7]: f['triplet'][:10]
|
||||
Out[7]:
|
||||
array([[ 5, 0, 6],
|
||||
[ 5, 1, 5],
|
||||
[ 5, 2, 4],
|
||||
[ 5, 3, 3],
|
||||
[ 5, 7, 10],
|
||||
[ 5, 8, 9],
|
||||
[ 5, 11, 118],
|
||||
[ 5, 12, 117],
|
||||
[ 5, 13, 116],
|
||||
[ 5, 14, 115]])
|
||||
```
|
||||
|
||||
The second index of `gamma_detail` corresponds to the first index of `triplet`.
|
||||
Three integers of each triplet are the grid point indices, which means, the grid
|
||||
addresses and their q-points are recovered by
|
||||
|
||||
```python
|
||||
In [8]: import phono3py
|
||||
|
||||
In [9]: ph3 = phono3py.load("phono3py.yaml", produce_fc=False)
|
||||
|
||||
In [10]: ph3.mesh_numbers = [11, 11, 11]
|
||||
|
||||
In [11]: ph3.grid.addresses[f['triplet'][:10]]
|
||||
Out[11]:
|
||||
array([[[ 5, 0, 0],
|
||||
[ 0, 0, 0],
|
||||
[-5, 0, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 1, 0, 0],
|
||||
[ 5, 0, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 2, 0, 0],
|
||||
[ 4, 0, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 3, 0, 0],
|
||||
[ 3, 0, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[-4, 0, 0],
|
||||
[-1, 0, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[-3, 0, 0],
|
||||
[-2, 0, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 0, 1, 0],
|
||||
[-5, -1, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 1, 1, 0],
|
||||
[ 5, -1, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 2, 1, 0],
|
||||
[ 4, -1, 0]],
|
||||
|
||||
[[ 5, 0, 0],
|
||||
[ 3, 1, 0],
|
||||
[ 3, -1, 0]]])
|
||||
|
||||
n [14]: ph3.grid.addresses[f['triplet'][:10]] @ ph3.grid.QDinv
|
||||
Out[14]:
|
||||
array([[[ 0.45454545, 0. , 0. ],
|
||||
[ 0. , 0. , 0. ],
|
||||
[-0.45454545, 0. , 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0.09090909, 0. , 0. ],
|
||||
[ 0.45454545, 0. , 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0.18181818, 0. , 0. ],
|
||||
[ 0.36363636, 0. , 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0.27272727, 0. , 0. ],
|
||||
[ 0.27272727, 0. , 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[-0.36363636, 0. , 0. ],
|
||||
[-0.09090909, 0. , 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[-0.27272727, 0. , 0. ],
|
||||
[-0.18181818, 0. , 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0. , 0.09090909, 0. ],
|
||||
[-0.45454545, -0.09090909, 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0.09090909, 0.09090909, 0. ],
|
||||
[ 0.45454545, -0.09090909, 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0.18181818, 0.09090909, 0. ],
|
||||
[ 0.36363636, -0.09090909, 0. ]],
|
||||
|
||||
[[ 0.45454545, 0. , 0. ],
|
||||
[ 0.27272727, 0.09090909, 0. ],
|
||||
[ 0.27272727, -0.09090909, 0. ]]])
|
||||
```
|
|
@ -1,23 +1,18 @@
|
|||
(hdf5_howto)=
|
||||
# How to read the results stored in hdf5 files
|
||||
# Using phono3py hdf5 files
|
||||
|
||||
```{contents}
|
||||
:depth: 3
|
||||
:local:
|
||||
```
|
||||
## Using `h5py` in ipython
|
||||
|
||||
## How to use HDF5 python library
|
||||
It is assumed that `python-h5py` is installed on the computer you interactively
|
||||
use. In the following, how to see the contents of `.hdf5` files in the
|
||||
interactive mode of Python. The basic usage of reading `.hdf5` files using
|
||||
`h5py` is found at
|
||||
[here](http://docs.h5py.org/en/latest/high/dataset.html#reading-writing-data>).
|
||||
In the following example, an MgO result of thermal conductivity calculation
|
||||
stored in `kappa-m111111.hdf5` (see {ref}`iofile_kappa_hdf5`) is loaded and
|
||||
thermal conductivity tensor at 300 K is watched.
|
||||
|
||||
It is assumed that `python-h5py` is installed on the computer you
|
||||
interactively use. In the following, how to see the contents of
|
||||
`.hdf5` files in the interactive mode of Python. The basic usage of
|
||||
reading `.hdf5` files using `h5py` is found at [here](http://docs.h5py.org/en/latest/high/dataset.html#reading-writing-data>).
|
||||
Usually for running interactive python, `ipython` is recommended to
|
||||
use but not the plain python. In the following example, an MgO result
|
||||
of thermal conductivity calculation is loaded and thermal conductivity
|
||||
tensor at 300 K is watched.
|
||||
|
||||
```bash
|
||||
```python
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("kappa-m111111.hdf5")
|
||||
|
@ -90,256 +85,3 @@ In [11]: g = np.where(g > 0, g, -1)
|
|||
|
||||
In [12]: lifetime = np.where(g > 0, 1.0 / (2 * 2 * np.pi * g), 0)
|
||||
```
|
||||
|
||||
(kappa_hdf5_file)=
|
||||
## Details of `kappa-*.hdf5` file
|
||||
|
||||
Files name, e.g. `kappa-m323220.hdf5`, is determined by some
|
||||
specific options. `mxxx`, show the numbers of sampling
|
||||
mesh. `sxxx` and `gxxx` appear optionally. `sxxx` gives the
|
||||
smearing width in the smearing method for Brillouin zone integration
|
||||
for phonon lifetime, and `gxxx` denotes the grid number. Using the
|
||||
command option of `-o`, the file name can be modified slightly. For
|
||||
example `-o nac` gives `kappa-m323220.nac.hdf5` to
|
||||
memorize the option `--nac` was used.
|
||||
|
||||
Currently `kappa-*.hdf5` file (not for the specific grid points)
|
||||
contains the properties shown below.
|
||||
|
||||
### mesh
|
||||
|
||||
(Versions 1.10.11 or later)
|
||||
|
||||
The numbers of mesh points for reciprocal space sampling along
|
||||
reciprocal axes, $a^*, b^*, c^*$.
|
||||
|
||||
### frequency
|
||||
|
||||
Phonon frequencies. The physical unit is THz, where THz
|
||||
is in the ordinal frequency not the angular frequency.
|
||||
|
||||
The array shape is (irreducible q-point, phonon band).
|
||||
|
||||
(kappa_hdf5_file_gamma)=
|
||||
### gamma
|
||||
|
||||
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).
|
||||
|
||||
The array shape for a specific grid-point is
|
||||
(temperature, phonon band).
|
||||
|
||||
Phonon lifetime ($\tau_\lambda=1/2\Gamma_\lambda(\omega_\lambda)$) may
|
||||
be estimated from `gamma`. $2\pi$ has to be multiplied with
|
||||
`gamma` values in the hdf5 file to convert the unit of ordinal
|
||||
frequency to angular frequency. Zeros in `gamma` values mean that
|
||||
those elements were not calculated such as for three acoustic modes at
|
||||
$\Gamma$ point. The below is the copy-and-paste from the
|
||||
previous section to show how to obtain phonon lifetime in pico
|
||||
second:
|
||||
|
||||
```bash
|
||||
In [8]: g = f['gamma'][30]
|
||||
|
||||
In [9]: import numpy as np
|
||||
|
||||
In [10]: g = np.where(g > 0, g, -1)
|
||||
|
||||
In [11]: lifetime = np.where(g > 0, 1.0 / (2 * 2 * np.pi * g), 0)
|
||||
```
|
||||
|
||||
### gamma_isotope
|
||||
|
||||
Isotope scattering of $1/2\tau^\mathrm{iso}_\lambda$.
|
||||
The physical unit is same as that of gamma.
|
||||
|
||||
The array shape is same as that of frequency.
|
||||
|
||||
### group_velocity
|
||||
|
||||
Phonon group velocity, $\nabla_\mathbf{q}\omega_\lambda$. The
|
||||
physical unit is $\text{THz}\cdot\text{Angstrom}$, where THz
|
||||
is in the ordinal frequency not the angular frequency.
|
||||
|
||||
The array shape is (irreducible q-point, phonon band, 3 = Cartesian coordinates).
|
||||
|
||||
### heat_capacity
|
||||
|
||||
Mode-heat-capacity defined by
|
||||
|
||||
$$
|
||||
C_\lambda = k_\mathrm{B}
|
||||
\left(\frac{\hbar\omega_\lambda}{k_\mathrm{B} T} \right)^2
|
||||
\frac{\exp(\hbar\omega_\lambda/k_\mathrm{B}
|
||||
T)}{[\exp(\hbar\omega_\lambda/k_\mathrm{B} T)-1]^2}.
|
||||
$$
|
||||
|
||||
The physical unit is eV/K.
|
||||
|
||||
The array shape is (temperature, irreducible q-point, phonon band).
|
||||
|
||||
(output_kappa)=
|
||||
### kappa
|
||||
|
||||
Thermal conductivity tensor. The physical unit is W/m-K.
|
||||
|
||||
The array shape is (temperature, 6 = (xx, yy, zz, yz, xz, xy)).
|
||||
|
||||
(output_mode_kappa)=
|
||||
### mode-kappa
|
||||
|
||||
Thermal conductivity tensors at k-stars (${}^*\mathbf{k}$):
|
||||
|
||||
$$
|
||||
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \kappa_{\mathbf{q}j}.
|
||||
$$
|
||||
|
||||
The sum of this over ${}^*\mathbf{k}$ corresponding to
|
||||
irreducible q-points divided by number of grid points gives
|
||||
$\kappa$ ({ref}`output_kappa`), e.g.,:
|
||||
|
||||
```python
|
||||
kappa_xx_at_index_30 = mode_kappa[30, :, :, 0].sum()/ weight.sum()
|
||||
```
|
||||
|
||||
Be careful that until version 1.12.7, mode-kappa values were divided
|
||||
by number of grid points.
|
||||
|
||||
The physical unit is W/m-K. Each tensor element is the sum of tensor
|
||||
elements on the members of ${}^*\mathbf{k}$, i.e., symmetrically
|
||||
equivalent q-points by crystallographic point group and time reversal
|
||||
symmetry.
|
||||
|
||||
The array shape is (temperature, irreducible q-point, phonon band, 6 =
|
||||
(xx, yy, zz, yz, xz, xy)).
|
||||
|
||||
### gv_by_gv
|
||||
|
||||
Outer products of group velocities for k-stars
|
||||
(${}^*\mathbf{k}$) for each irreducible q-point and phonon band
|
||||
($j$):
|
||||
|
||||
$$
|
||||
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \mathbf{v}_{\mathbf{q}j} \otimes
|
||||
\mathbf{v}_{\mathbf{q}j}.
|
||||
$$
|
||||
|
||||
The physical unit is
|
||||
$\text{THz}^2\cdot\text{Angstrom}^2$, where THz is in the
|
||||
ordinal frequency not the angular frequency.
|
||||
|
||||
The array shape is (irreducible q-point, phonon band, 6 = (xx, yy, zz,
|
||||
yz, xz, xy)).
|
||||
|
||||
### q-point
|
||||
|
||||
Irreducible q-points in reduced coordinates.
|
||||
|
||||
The array shape is (irreducible q-point, 3 = reduced
|
||||
coordinates in reciprocal space).
|
||||
|
||||
### temperature
|
||||
|
||||
Temperatures where thermal conductivities are calculated. The physical
|
||||
unit is K.
|
||||
|
||||
### weight
|
||||
|
||||
Weights corresponding to irreducible q-points. Sum of weights equals to
|
||||
the number of mesh grid points.
|
||||
|
||||
### ave_pp
|
||||
|
||||
Averaged phonon-phonon interaction in $\text{eV}^2,
|
||||
$P_{\mathbf{q}j}$:
|
||||
|
||||
$$
|
||||
P_{\mathbf{q}j} = \frac{1}{(3n_\mathrm{a})^2} \sum_{\lambda'\lambda''}
|
||||
|\Phi_{\lambda\lambda'\lambda''}|^2.
|
||||
$$
|
||||
|
||||
This is not going to be calculated in the RTA thermal coductivity
|
||||
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
|
||||
micrometer.
|
||||
|
||||
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
|
||||
conductivity made of `heat_capacity`, `group_velocity`, and
|
||||
`gamma`, to W/m-K. In the single mode relaxation time (SMRT) method,
|
||||
a mode contribution to the lattice thermal conductivity is given by
|
||||
|
||||
$$
|
||||
\kappa_\lambda = \frac{1}{V_0} C_\lambda \mathbf{v}_\lambda \otimes
|
||||
\mathbf{v}_\lambda \tau_\lambda^{\mathrm{SMRT}}.
|
||||
$$
|
||||
|
||||
For example, $\kappa_{\lambda,{xx}}$ is calculated by:
|
||||
|
||||
```bash
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("kappa-m111111.hdf5")
|
||||
|
||||
In [3]: kappa_unit_conversion = f['kappa_unit_conversion'][()]
|
||||
|
||||
In [4]: weight = f['weight'][:]
|
||||
|
||||
In [5]: heat_capacity = f['heat_capacity'][:]
|
||||
|
||||
In [6]: gv_by_gv = f['gv_by_gv'][:]
|
||||
|
||||
In [7]: gamma = f['gamma'][:]
|
||||
|
||||
In [8]: kappa_unit_conversion * heat_capacity[30, 2, 0] * gv_by_gv[2, 0] / (2 * gamma[30, 2, 0])
|
||||
|
||||
Out[8]:
|
||||
array([ 1.02050241e+03, 1.02050241e+03, 1.02050241e+03,
|
||||
4.40486382e-15, 0.00000000e+00, -4.40486382e-15])
|
||||
|
||||
In [9]: f['mode_kappa'][30, 2, 0]
|
||||
Out[9]:
|
||||
array([ 1.02050201e+03, 1.02050201e+03, 1.02050201e+03,
|
||||
4.40486209e-15, 0.00000000e+00, -4.40486209e-15])
|
||||
```
|
||||
|
||||
## How to know grid point index number corresponding to grid address
|
||||
|
||||
Running with `--write-gamma`, hdf5 files are written out with file names
|
||||
such as `kappa-m202020-g4448.hdf5`. You may want to know the grid point
|
||||
index number with given grid address. This is done as follows:
|
||||
|
||||
```bash
|
||||
In [1]: import phono3py
|
||||
|
||||
In [2]: ph3 = phono3py.load("phono3py_disp.yaml")
|
||||
|
||||
In [3]: ph3.mesh_numbers = [20, 20, 20]
|
||||
|
||||
In [4]: ph3.grid.get_indices_from_addresses([0, 10, 10])
|
||||
Out[4]: 4448
|
||||
```
|
||||
|
||||
This index number is different between phono3py version 1.x and 2.x.
|
||||
To get the number corresponding to the phono3py version 1.x,
|
||||
`store_dense_gp_map=False` should be specified in `phono3py.load`,
|
||||
|
||||
```bash
|
||||
In [5]: ph3 = phono3py.load("phono3py_disp.yaml", store_dense_gp_map=False)
|
||||
|
||||
In [6]: ph3.mesh_numbers = [20, 20, 20]
|
||||
|
||||
In [7]: ph3.grid.get_indices_from_addresses([0, 10, 10])
|
||||
Out[7]: 4200
|
||||
```
|
||||
|
|
|
@ -38,7 +38,6 @@ examples
|
|||
Interfaces to calculators (VASP, QE, CRYSTAL, Abinit, TURBOMOLE) <interfaces>
|
||||
command-options
|
||||
input-output-files
|
||||
hdf5_howto
|
||||
auxiliary-tools
|
||||
direct-solution
|
||||
wigner-solution
|
||||
|
@ -49,7 +48,8 @@ cutoff-pair
|
|||
external-tools
|
||||
phono3py-api
|
||||
phono3py-load
|
||||
tips
|
||||
hdf5_howto
|
||||
grid
|
||||
citation
|
||||
reference
|
||||
changelog
|
||||
|
|
|
@ -2,34 +2,30 @@
|
|||
|
||||
# Input / Output files
|
||||
|
||||
```{contents}
|
||||
:depth: 3
|
||||
:local:
|
||||
```
|
||||
|
||||
The calculation results are written into files. Mostly the data are stored in
|
||||
HDF5 format, therefore how to read the data from HDF5 files is also shown.
|
||||
|
||||
## Intermediate text files
|
||||
|
||||
The following files are not compatible with phonopy. But phonopy's `FORCE_SETS`
|
||||
file can be created using phono3py command options from the following files. See
|
||||
the detail at {ref}`file_format_compatibility`.
|
||||
|
||||
### `phono3py_disp.yaml`
|
||||
|
||||
This is created with `-d` option. See {ref}`create_displacements_option`.
|
||||
## `phono3py_disp.yaml`
|
||||
|
||||
This is created with {ref}`-d <create_displacements_option>` or
|
||||
{ref}`--rd <random_displacements_option>` option.
|
||||
This file contains displacement dataset and crystal structure information.
|
||||
Parameters for non-analytical term correction can be also included.
|
||||
|
||||
(input-output_files_FORCES_FC3)=
|
||||
## `phono3py_params.yaml`
|
||||
|
||||
### `FORCES_FC3`
|
||||
|
||||
This is created with `--cf3` option. See {ref}`cf3_option`.
|
||||
This is created with the combination of {ref}`--cf3 <cf3_option>` and {ref}`--sp
|
||||
<sp_option>` options. This file contains displacement-force dataset and crystal
|
||||
structure information. In addition, energies of supercells may be included in
|
||||
the dataset. Parameters for non-analytical term correction can be also included.
|
||||
|
||||
There are two formats of `FORCES_FC3`. The type-I format is like that shown
|
||||
below
|
||||
(iofile_FORCES_FC3)=
|
||||
|
||||
## `FORCES_FC3`
|
||||
|
||||
This is created with {ref}`--cf3 <cf3_option>` option . There are two formats of
|
||||
`FORCES_FC3`. The type-I format is like that shown below
|
||||
|
||||
```
|
||||
# File: 1
|
||||
|
@ -79,22 +75,13 @@ The type-II format is the same as
|
|||
[phonopy's type-II format](https://phonopy.github.io/phonopy/input-files.html#type-2)
|
||||
of `FORCE_SETS`.
|
||||
|
||||
### `FORCES_FC2`
|
||||
## `FORCES_FC2`
|
||||
|
||||
This is created with `--cf2` option. See {ref}`cf2_option` and
|
||||
{ref}`dim_fc2_option`.
|
||||
This is created with {ref}`--cf2 <dim_fc2_option>` option. The file formats
|
||||
(type-I and type-II) are same as those of `FORCES_FC3`.
|
||||
|
||||
The file formats (type-I and type-II) are same as those of `FORCES_FC3`.
|
||||
|
||||
## HDF5 files
|
||||
|
||||
### `kappa-*.hdf5`
|
||||
|
||||
See the detail at {ref}`kappa_hdf5_file`.
|
||||
|
||||
(fc3_hdf5_file)=
|
||||
|
||||
### `fc3.hdf5`
|
||||
(iofile_fc3_hdf5)=
|
||||
## `fc3.hdf5`
|
||||
|
||||
Third order force constants (in real space) are stored in
|
||||
$\mathrm{eV}/\text{Angstrom}^3$.
|
||||
|
@ -145,9 +132,8 @@ $$
|
|||
|
||||
So what you have to set is `--pa="0 1/4 1/4 1/4 0 1/4 1/4 1/4 0"`.
|
||||
|
||||
(fc2_hdf5_file)=
|
||||
|
||||
### `fc2.hdf5`
|
||||
(iofile_fc2_hdf5)=
|
||||
## `fc2.hdf5`
|
||||
|
||||
Second order force constants are stored in $\mathrm{eV}/\text{Angstrom}^2$.
|
||||
|
||||
|
@ -159,29 +145,434 @@ in the shape of:
|
|||
```
|
||||
|
||||
against $\Phi_{\alpha\beta}(l\kappa, l'\kappa')$. More detail is similar to the
|
||||
case for {ref}`fc3_hdf5_file`.
|
||||
case for {ref}`iofile_fc3_hdf5`.
|
||||
|
||||
### `gamma-*.hdf5`
|
||||
(iofile_kappa_hdf5)=
|
||||
## `kappa-*.hdf5`
|
||||
|
||||
Files name, e.g. `kappa-m323220.hdf5`, is determined by some
|
||||
specific options. `mxxx`, show the numbers of sampling
|
||||
mesh. `sxxx` and `gxxx` appear optionally. `sxxx` gives the
|
||||
smearing width in the smearing method for Brillouin zone integration
|
||||
for phonon lifetime, and `gxxx` denotes the grid number. Using the
|
||||
command option of `-o`, the file name can be modified slightly. For
|
||||
example `-o nac` gives `kappa-m323220.nac.hdf5` to
|
||||
memorize the option `--nac` was used.
|
||||
|
||||
### `mesh`
|
||||
|
||||
(Versions 1.10.11 or later)
|
||||
|
||||
The numbers of mesh points for reciprocal space sampling along
|
||||
reciprocal axes, $a^*, b^*, c^*$.
|
||||
|
||||
### `frequency`
|
||||
|
||||
Phonon frequencies. The physical unit is THz, where THz
|
||||
is in the ordinal frequency not the angular frequency.
|
||||
|
||||
The array shape is (irreducible q-point, phonon band).
|
||||
|
||||
(iofile_kappa_hdf5_gamma)=
|
||||
### `gamma`
|
||||
|
||||
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).
|
||||
|
||||
The array shape for a specific grid-point is
|
||||
(temperature, phonon band).
|
||||
|
||||
Phonon lifetime ($\tau_\lambda=1/2\Gamma_\lambda(\omega_\lambda)$) may
|
||||
be estimated from `gamma`. $2\pi$ has to be multiplied with
|
||||
`gamma` values in the hdf5 file to convert the unit of ordinal
|
||||
frequency to angular frequency. Zeros in `gamma` values mean that
|
||||
those elements were not calculated such as for three acoustic modes at
|
||||
$\Gamma$ point. The below is the copy-and-paste from the
|
||||
previous section to show how to obtain phonon lifetime in pico
|
||||
second:
|
||||
|
||||
```python
|
||||
In [8]: g = f['gamma'][30]
|
||||
|
||||
In [9]: import numpy as np
|
||||
|
||||
In [10]: g = np.where(g > 0, g, -1)
|
||||
|
||||
In [11]: lifetime = np.where(g > 0, 1.0 / (2 * 2 * np.pi * g), 0)
|
||||
```
|
||||
|
||||
### `gamma_isotope`
|
||||
|
||||
Isotope scattering of $1/2\tau^\mathrm{iso}_\lambda$.
|
||||
The physical unit is same as that of gamma.
|
||||
|
||||
The array shape is same as that of frequency.
|
||||
|
||||
### `group_velocity`
|
||||
|
||||
Phonon group velocity, $\nabla_\mathbf{q}\omega_\lambda$. The
|
||||
physical unit is $\text{THz}\cdot\text{Angstrom}$, where THz
|
||||
is in the ordinal frequency not the angular frequency.
|
||||
|
||||
The array shape is (irreducible q-point, phonon band, 3 = Cartesian coordinates).
|
||||
|
||||
### `heat_capacity`
|
||||
|
||||
Mode-heat-capacity defined by
|
||||
|
||||
$$
|
||||
C_\lambda = k_\mathrm{B}
|
||||
\left(\frac{\hbar\omega_\lambda}{k_\mathrm{B} T} \right)^2
|
||||
\frac{\exp(\hbar\omega_\lambda/k_\mathrm{B}
|
||||
T)}{[\exp(\hbar\omega_\lambda/k_\mathrm{B} T)-1]^2}.
|
||||
$$
|
||||
|
||||
The physical unit is eV/K.
|
||||
|
||||
The array shape is (temperature, irreducible q-point, phonon band).
|
||||
|
||||
(iofile_kappa_hdf5_kappa)=
|
||||
### `kappa`
|
||||
|
||||
Thermal conductivity tensor. The physical unit is W/m-K.
|
||||
|
||||
The array shape is (temperature, 6 = (xx, yy, zz, yz, xz, xy)).
|
||||
|
||||
### `mode-kappa`
|
||||
|
||||
Thermal conductivity tensors at k-stars (${}^*\mathbf{k}$):
|
||||
|
||||
$$
|
||||
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \kappa_{\mathbf{q}j}.
|
||||
$$
|
||||
|
||||
The sum of this over ${}^*\mathbf{k}$ corresponding to
|
||||
irreducible q-points divided by number of grid points gives
|
||||
$\kappa$ ({ref}`iofile_kappa_hdf5_kappa`), e.g.,:
|
||||
|
||||
```python
|
||||
kappa_xx_at_index_30 = mode_kappa[30, :, :, 0].sum()/ weight.sum()
|
||||
```
|
||||
|
||||
Be careful that until version 1.12.7, mode-kappa values were divided
|
||||
by number of grid points.
|
||||
|
||||
The physical unit is W/m-K. Each tensor element is the sum of tensor
|
||||
elements on the members of ${}^*\mathbf{k}$, i.e., symmetrically
|
||||
equivalent q-points by crystallographic point group and time reversal
|
||||
symmetry.
|
||||
|
||||
The array shape is (temperature, irreducible q-point, phonon band, 6 =
|
||||
(xx, yy, zz, yz, xz, xy)).
|
||||
|
||||
### `gv_by_gv`
|
||||
|
||||
Outer products of group velocities for k-stars
|
||||
(${}^*\mathbf{k}$) for each irreducible q-point and phonon band
|
||||
($j$):
|
||||
|
||||
$$
|
||||
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \mathbf{v}_{\mathbf{q}j} \otimes
|
||||
\mathbf{v}_{\mathbf{q}j}.
|
||||
$$
|
||||
|
||||
The physical unit is
|
||||
$\text{THz}^2\cdot\text{Angstrom}^2$, where THz is in the
|
||||
ordinal frequency not the angular frequency.
|
||||
|
||||
The array shape is (irreducible q-point, phonon band, 6 = (xx, yy, zz,
|
||||
yz, xz, xy)).
|
||||
|
||||
### `q-point`
|
||||
|
||||
Irreducible q-points in reduced coordinates.
|
||||
|
||||
The array shape is (irreducible q-point, 3 = reduced
|
||||
coordinates in reciprocal space).
|
||||
|
||||
### `temperature`
|
||||
|
||||
Temperatures where thermal conductivities are calculated. The physical
|
||||
unit is K.
|
||||
|
||||
### `weight`
|
||||
|
||||
Weights corresponding to irreducible q-points. Sum of weights equals to
|
||||
the number of mesh grid points.
|
||||
|
||||
### `ave_pp`
|
||||
|
||||
Averaged phonon-phonon interaction $P_{\mathbf{q}j}$ in $\text{eV}^2$:
|
||||
|
||||
$$
|
||||
P_{\mathbf{q}j} = \frac{1}{(3n_\mathrm{a})^2} \sum_{\lambda'\lambda''}
|
||||
|\Phi_{\lambda\lambda'\lambda''}|^2.
|
||||
$$
|
||||
|
||||
This is not going to be calculated in the RTA thermal coductivity
|
||||
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
|
||||
micrometer.
|
||||
|
||||
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
|
||||
conductivity made of `heat_capacity`, `group_velocity`, and
|
||||
`gamma`, to W/m-K. In the single mode relaxation time (SMRT) method,
|
||||
a mode contribution to the lattice thermal conductivity is given by
|
||||
|
||||
$$
|
||||
\kappa_\lambda = \frac{1}{V_0} C_\lambda \mathbf{v}_\lambda \otimes
|
||||
\mathbf{v}_\lambda \tau_\lambda^{\mathrm{SMRT}}.
|
||||
$$
|
||||
|
||||
For example, $\kappa_{\lambda,{xx}}$ is calculated by:
|
||||
|
||||
```python
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("kappa-m111111.hdf5")
|
||||
|
||||
In [3]: kappa_unit_conversion = f['kappa_unit_conversion'][()]
|
||||
|
||||
In [4]: weight = f['weight'][:]
|
||||
|
||||
In [5]: heat_capacity = f['heat_capacity'][:]
|
||||
|
||||
In [6]: gv_by_gv = f['gv_by_gv'][:]
|
||||
|
||||
In [7]: gamma = f['gamma'][:]
|
||||
|
||||
In [8]: kappa_unit_conversion * heat_capacity[30, 2, 0] * gv_by_gv[2, 0] / (2 * gamma[30, 2, 0])
|
||||
|
||||
Out[8]:
|
||||
array([ 1.02050241e+03, 1.02050241e+03, 1.02050241e+03,
|
||||
4.40486382e-15, 0.00000000e+00, -4.40486382e-15])
|
||||
|
||||
In [9]: f['mode_kappa'][30, 2, 0]
|
||||
Out[9]:
|
||||
array([ 1.02050201e+03, 1.02050201e+03, 1.02050201e+03,
|
||||
4.40486209e-15, 0.00000000e+00, -4.40486209e-15])
|
||||
```
|
||||
|
||||
(iofile_kappa_hdf5_gamma_NU)=
|
||||
### `gamma_N` and `gamma_U`
|
||||
|
||||
The data are stored in `kappa-mxxx(-gx-sx-sdx).hdf5` file and accessed by
|
||||
`gamma_N` and `gamma_U` keys. The shape of the arrays is the same as that of
|
||||
`gamma` (see {ref}`iofile_kappa_hdf5_gamma`). An example (Si-PBEsol) is shown
|
||||
below:
|
||||
|
||||
```bash
|
||||
% phono3py-load --mesh 11 11 11 --fc3 --fc2 --br --nu
|
||||
...
|
||||
% ipython
|
||||
```
|
||||
|
||||
```python
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("kappa-m111111.hdf5", 'r')
|
||||
|
||||
In [3]: list(f)
|
||||
Out[3]:
|
||||
['frequency',
|
||||
'gamma',
|
||||
'gamma_N',
|
||||
'gamma_U',
|
||||
'group_velocity',
|
||||
'gv_by_gv',
|
||||
'heat_capacity',
|
||||
'kappa',
|
||||
'kappa_unit_conversion',
|
||||
'mesh',
|
||||
'mode_kappa',
|
||||
'qpoint',
|
||||
'temperature',
|
||||
'weight']
|
||||
|
||||
In [4]: f['gamma'].shape
|
||||
Out[4]: (101, 56, 6)
|
||||
|
||||
In [5]: f['gamma_N'].shape
|
||||
Out[5]: (101, 56, 6)
|
||||
|
||||
In [6]: f['gamma_U'].shape
|
||||
Out[6]: (101, 56, 6)
|
||||
```
|
||||
|
||||
## `gamma-*.hdf5`
|
||||
|
||||
Imaginary parts of self energies at harmonic phonon frequencies
|
||||
($\Gamma_\lambda(\omega_\lambda)$ = half linewidths) are stored in THz. See
|
||||
{ref}`write_gamma_option`.
|
||||
|
||||
### `gamma_detail-*.hdf5`
|
||||
(iofile_gamma_detail_hdf5)=
|
||||
## `gamma_detail-*.hdf5`
|
||||
|
||||
Q-point triplet contributions to imaginary parts of self energies at phonon
|
||||
frequencies (half linewidths) are stored in THz. See
|
||||
{ref}`write_detailed_gamma_option`.
|
||||
{ref}`--write-gamma-detail <write_detailed_gamma_option>` option.
|
||||
|
||||
## Simple text file
|
||||
In the output file in hdf5, following keys are used to extract the detailed
|
||||
information.
|
||||
|
||||
### `gammas-*.dat`
|
||||
```{table}
|
||||
| dataset | Array shape |
|
||||
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| gamma_detail for `--ise` | (temperature, sampling frequency point, symmetry reduced set of triplets at given grid point, band1, band2, band3) in THz (without $2\pi$) |
|
||||
| gamma_detail for `--br` | (temperature, symmetry reduced set of triplets at gvien grid point, band1, band2, band3) in THz (without $2\pi$) |
|
||||
| mesh | Numbers of sampling mesh along reciprocal axes. |
|
||||
| frequency_point for `--ise` | Sampling frequency points in THz (without $2\pi$), i.e., $\omega$ in $\Gamma_\lambda(\omega)$ |
|
||||
| temperature | (temperature,), Temperatures in K |
|
||||
| triplet | (symmetry reduced set of triplets at given grid point, 3), Triplets are given by the grid point indices (see below). |
|
||||
| weight | (symmetry reduced set of triplets at given grid point,), Weight of each triplet to imaginary part of self energy |
|
||||
| triplet_all | (triplets at given grid point, 3), symmetry non-reduced version of the triplet information. |
|
||||
```
|
||||
|
||||
See {ref}`grid_triplets` to recover the q-points of each triplet.
|
||||
|
||||
Imaginary part of self energy (linewidth/2) is recovered by the following
|
||||
script:
|
||||
|
||||
```python
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
||||
gd = h5py.File("gamma_detail-mxxx-gx.hdf5")
|
||||
temp_index = 30 # index of temperature
|
||||
temperature = gd['temperature'][temp_index]
|
||||
gamma_tp = gd['gamma_detail'][:].sum(axis=-1).sum(axis=-1)
|
||||
weight = gd['weight'][:]
|
||||
gamma = np.dot(weight, gamma_tp[temp_index])
|
||||
```
|
||||
|
||||
For example, for `--br`, this `gamma` gives $\Gamma_\lambda(\omega_\lambda)$ of
|
||||
the band indices at the grid point indicated by $\lambda$ at the temperature of
|
||||
index 30. If any bands are degenerated, those `gamma` in
|
||||
`kappa-mxxx-gx(-sx-sdx).hdf5` or `gamma-mxxx-gx(-sx-sdx).hdf5` type file are
|
||||
averaged, but the `gamma` obtained here in this way are not symmetrized. Apart
|
||||
from this symmetrization, the values must be equivalent between them.
|
||||
|
||||
To understand each contribution of triptle to imaginary part of self energy,
|
||||
reading `phonon-mxxx.hdf5` is useful (see {ref}`write_phonon_option`). For
|
||||
example, phonon triplets of three phonon scatterings are obtained by
|
||||
|
||||
```python
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
||||
gd = h5py.File("gamma_detail-mxxx-gx.hdf5", 'r')
|
||||
ph = h5py.File("phonon-mxxx.hdf5", 'r')
|
||||
gp1 = gd['grid_point'][()]
|
||||
triplets = gd['triplet'][:] # Sets of (gp1, gp2, gp3) where gp1 is fixed
|
||||
mesh = gd['mesh'][:]
|
||||
grid_address = ph['grid_address'][:]
|
||||
q_triplets = grid_address[triplets] / mesh.astype('double') # For conventional regular grid
|
||||
# Phonons of triplets[2]
|
||||
phonon_tp = [(ph['frequency'][i], ph['eigenvector'][i]) for i in triplets[2]]
|
||||
# Fractions of contributions of triplets at this grid point and temperature index 30
|
||||
gamma_sum_over_bands = np.dot(weight, gd['gamma_detail'][30].sum(axis=-1).sum(axis=-1).sum(axis=-1))
|
||||
contrib_tp = [gd['gamma_detail'][30, i].sum() / gamma_sum_over_bands for i in range(len(weight))]
|
||||
np.dot(weight, contrib_tp) # is one
|
||||
```
|
||||
|
||||
(iofile_phonon_hdf5)=
|
||||
## `phonon-*.hdf5`
|
||||
|
||||
Contents of `phonon-mxxx.hdf5` are watched by:
|
||||
|
||||
```python
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("phonon-m111111.hdf5")
|
||||
|
||||
In [3]: list(f)
|
||||
Out[3]:
|
||||
['eigenvector',
|
||||
'frequency',
|
||||
'grid_address',
|
||||
'ir_grid_points',
|
||||
'ir_grid_weights',
|
||||
'mesh',
|
||||
'version']
|
||||
|
||||
In [4]: f['mesh'][:]
|
||||
Out[4]: array([11, 11, 11])
|
||||
|
||||
In [5]: f['grid_address'].shape
|
||||
Out[5]: (1367, 3)
|
||||
|
||||
In [6]: f['frequency'].shape
|
||||
Out[6]: (1367, 6)
|
||||
|
||||
In [7]: f['eigenvector'].shape
|
||||
Out[7]: (1367, 6, 6)
|
||||
|
||||
In [8]: f['ir_grid_points'].shape
|
||||
Out[8]: (56,)
|
||||
```
|
||||
|
||||
The first axis of `ph['grid_address']`, `ph['frequency']`, and
|
||||
`ph['eigenvector']` corresponds to the number of q-points where phonons are
|
||||
calculated. Here the number of phonons may not be equal to product of mesh
|
||||
numbers ($1367 \neq 11^3$). This is because all q-points on Brillouin zone
|
||||
boundary are included, i.e., even if multiple q-points are translationally
|
||||
equivalent, those phonons are stored separately though these phonons are
|
||||
physically equivalent within the equations employed in phono3py. Here Brillouin
|
||||
zone is defined by Wigner–Seitz cell of reciprocal primitive basis vectors. This
|
||||
is convenient to categorize phonon triplets into Umklapp and Normal scatterings
|
||||
based on the Brillouin zone.
|
||||
|
||||
|
||||
## `pp-*.hdf5`
|
||||
|
||||
This file contains phonon-phonon interaction strength
|
||||
$\bigl|\Phi_{\lambda\lambda'\lambda''}\bigl|^2$. To use the data in this
|
||||
file, it is recommended to generate with `--full-pp` option because the data
|
||||
structure to access becomes simpler.
|
||||
|
||||
```bash
|
||||
% phono3py-load phono3py.yaml --gp 5 --br --mesh 11 11 11 --write-pp --full-pp
|
||||
```
|
||||
|
||||
```python
|
||||
In [1]: import h5py
|
||||
|
||||
In [2]: f = h5py.File("pp-m111111-g5.hdf5")
|
||||
|
||||
In [3]: list(f)
|
||||
Out[3]: ['pp', 'triplet', 'triplet_all', 'version', 'weight']
|
||||
|
||||
In [4]: f['pp'].shape
|
||||
Out[4]: (146, 6, 6, 6)
|
||||
```
|
||||
|
||||
Indices of the `pp` array are (symmetry reduced set of triplets at given grid
|
||||
point, band1, band2, band3), and the values are given in $\text{eV}^2$. See
|
||||
{ref}`grid_triplets` to recover the q-points of each triplet.
|
||||
|
||||
Except for `pp`, all the other information are equivalent to those found in
|
||||
{ref}`iofile_gamma_detail_hdf5`.
|
||||
|
||||
|
||||
## `gammas-*.dat`
|
||||
|
||||
Imaginary parts of self energies with respect to frequency
|
||||
$\Gamma_\lambda(\omega)$ are stored in THz. See {ref}`ise_option`.
|
||||
|
||||
### `jdos-*.dat`
|
||||
## `jdos-*.dat`
|
||||
|
||||
Joint densities of states are stored in Thz. See {ref}`jdos_option`.
|
||||
|
||||
### `linewidth-*.dat`
|
||||
## `linewidth-*.dat`
|
||||
|
|
|
@ -148,7 +148,7 @@ shape of `(num_supercells, num_atoms_in_supercell, 3)`. In the above example,
|
|||
the array shape is `(1254, 72, 3)`.
|
||||
|
||||
If the calculated force sets are stored in the
|
||||
{ref}`input-output_files_FORCES_FC3` file, the numpy array of `forces` is
|
||||
{ref}`iofile_FORCES_FC3` file, the numpy array of `forces` is
|
||||
obtained by
|
||||
|
||||
```python
|
||||
|
|
113
doc/tips.md
113
doc/tips.md
|
@ -1,113 +0,0 @@
|
|||
(tips)=
|
||||
|
||||
# Tips
|
||||
|
||||
```{contents}
|
||||
:depth: 2
|
||||
:local:
|
||||
```
|
||||
(brillouinzone_sum)=
|
||||
|
||||
## Brillouin zone summation
|
||||
|
||||
Brillouin zone (BZ) summations appear at different two points in
|
||||
phonon lifetime calculation. First it is used for the Fourier
|
||||
transform of force constants, and second to obtain imaginary part of
|
||||
phonon-self-energy. For the summation, usually uniform sampling meshes
|
||||
are employed. To obtain more accurate result, it is always better to
|
||||
use denser meshes. But the denser mesh requires more computational
|
||||
demand.
|
||||
|
||||
The second BZ summation contains delta functions. In
|
||||
phono3py calculation, a linear tetrahedron method ({ref}`thm option <thm_option>`, default option) and a smearing method ({ref}`sigma option <sigma_option>`) can be used for this BZ
|
||||
integration. In most cases, the tetrahedron method is better. Especially in high
|
||||
thermal conductivity materials, the smearing method results in
|
||||
underestimation of lattice thermal conductivity.
|
||||
|
||||
The figure below shows Si thermal conductivity convergence with
|
||||
respect to number of mesh points along an axis from n=19 to 65. This
|
||||
is calculated with RTA and the linear tetrahedron method. Within the
|
||||
methods and phono3py implementation, it is converging at around n=55,
|
||||
however this computational demand is not trivial. As far as observing
|
||||
this result, an extrapolation to $1/n \rightarrow 0$ seems not a
|
||||
good idea, since it gives overestimation in the case of this Si
|
||||
example. This plot tells that we have to decide how much value is
|
||||
acceptable as lattice thermal conductivity value. Therefore it
|
||||
important to describe the number of sampling mesh and method of BZ
|
||||
integration to let other people reproduce the computational results.
|
||||
|
||||
```{image} Si-convergence.png
|
||||
:width: 25%
|
||||
```
|
||||
|
||||
In case the smearing method is necessary to use, the convergence of
|
||||
q-point mesh together with smearing width has to be checked
|
||||
carefully. Since smearing parameter is used to approximate delta
|
||||
functions, small `sigma` value is better to describe the detailed
|
||||
structure of three-phonon-space, however it requires a denser sampling
|
||||
mesh to converge the result. To check the convergence with respect to
|
||||
the `sigma` value, multiple sigma values can be set. This can be
|
||||
computationally efficient, since it is avoided to re-calculate
|
||||
phonon-phonon interaction strength for different `sigma` values in
|
||||
this case. Convergence with respect to the sampling mesh and smearing
|
||||
parameter strongly depends on materials. For Si example, a
|
||||
$20\times 20\times 20$ sampling mesh (or 8000 reducible sampling
|
||||
points) and 0.1 THz smearing value for reciprocal of the volume of an
|
||||
atom may be a good starting choice. The tetrahedron method requires no
|
||||
such parameter as the smearing width.
|
||||
|
||||
## Importance of numerical quality of force constants
|
||||
|
||||
Third-order force constants (fc3) are much weaker to numerical noise
|
||||
of a force calculator than second-order force constants
|
||||
(fc2). Therefore supercell force calculations have to be done very
|
||||
carefully.
|
||||
|
||||
Numerical quality of forces given by force calculators is the most
|
||||
important factor for the numerical quality of lattice thermal
|
||||
conductivity calculation. We may be able to apply symmetry constraints
|
||||
to force constants, however even if force constants fulfill those
|
||||
symmetries, the numerical quality of force constants is not guaranteed
|
||||
since elements of force constants just suffice the symmetries but most
|
||||
of those intensities are not constrained.
|
||||
|
||||
It is important to use the best possible force calculator in the
|
||||
possibly best way. The knowledge of the force calculator from the
|
||||
theory and method to the practical usage is required to obtain
|
||||
good results of lattice thermal conductivity calculation.
|
||||
|
||||
In the following, a few things that may be good to know are
|
||||
presented.
|
||||
|
||||
### A practical way to check lattice thermal conductivity result
|
||||
|
||||
Some feeling whether our calculation result is OK or not may be
|
||||
obtained by comparing lattice thermal conductivities calculated with
|
||||
and without {ref}`symmetrizations of force constants <symmetrization_option>`. If they are enough different, e.g., more
|
||||
than twice different, it is better to re-consider about the force
|
||||
calculation. In the case of DFT calculations, the choice of input
|
||||
settings such as k-point sampling mesh, plane-wave energy cutoff, and
|
||||
exchange-correlational potential, etc, should be reconsidered.
|
||||
|
||||
### Displacement distance of atoms
|
||||
|
||||
The phono3py default displacement distance is 0.03
|
||||
$\text{Angstrom}$. In some cases, accurate result may not be obtained
|
||||
due to the numerical noise of the force calculator. Usually increasing
|
||||
the displacement distance by the {ref}`amplitude option <amplitude_option>` reduces the numerical noise, but as its drawback
|
||||
higher order anharmonicity is involved (renormalized) into fc3 and fc2.
|
||||
|
||||
(file_format_compatibility)=
|
||||
|
||||
## File format compatibility with phonopy
|
||||
|
||||
- `FORCES_FC3` and `FORCES_FC2` are not
|
||||
compatible with phonopy's `FORCE_SETS`.
|
||||
- `FORCE_SETS` can be created using {ref}`--cfs <cfs_option>` from
|
||||
`FORCES_FC3` and `phono3py_disp.yaml` or `FORCES_FC2` and
|
||||
`phono3py_disp.yaml` (needs to specify `--dim-fc2`).
|
||||
- `FORCES_FC2` can be created using {ref}`--fs2f2 <fs2f2_option>` from `FORCE_SETS`.
|
||||
- `fc2.hdf5` can be used in phonopy in the `hdf5` mode when it is
|
||||
renamed to `force_constants.hdf5`. In the previous combinations of
|
||||
phonopy and phono3py, depending on the physical unit of force
|
||||
constants of calculators, the direct compatibility is not guaranteed.
|
|
@ -132,6 +132,7 @@ class BZGrid:
|
|||
D_diag : ndarray
|
||||
P : ndarray
|
||||
Q : ndarray
|
||||
PS : ndarray
|
||||
QDinv : ndarray
|
||||
grid_matrix : ndarray
|
||||
microzone_lattice : ndarray
|
||||
|
|
Loading…
Reference in New Issue