mirror of https://github.com/phonopy/phono3py.git
Preparationg for v3 release
This commit is contained in:
parent
427e00463c
commit
ac874d115f
|
@ -39,21 +39,18 @@ Let's computer lattice thermal conductivity of Si using the `Si-PBEsol` example
|
|||
found in the example directory.
|
||||
|
||||
```bash
|
||||
% phono3py --dim="2 2 2" --pa="F" -c POSCAR-unitcell --mesh="11 11 11" --sym-fc --br
|
||||
% phono3py --mesh="11 11 11" --sym-fc --br
|
||||
```
|
||||
|
||||
Then using the output file, `kappa-m111111.hdf5`, run `phono3py-kaccum` as
|
||||
follows:
|
||||
|
||||
```bash
|
||||
% phono3py-kaccum --pa="F" -c POSCAR-unitcell kappa-m111111.hdf5 |tee kaccum.dat
|
||||
% phono3py-kaccum kappa-m111111.hdf5 |tee kaccum.dat
|
||||
```
|
||||
|
||||
Here `--pa` is optional. The definition of `--pa` option is same as
|
||||
{ref}`pa_option`. `POSCAR-unitcell` is the unit cell filename that is specified
|
||||
with `-c` option. `kappa-m111111.hdf5` is the output file of thermal
|
||||
conductivity calculation, which is passed to `phono3py-kaccum` as the first
|
||||
argument.
|
||||
`kappa-m111111.hdf5` is the output file of thermal conductivity calculation,
|
||||
which is passed to `phono3py-kaccum` as the first argument.
|
||||
|
||||
The format of the output is as follows: The first column gives frequency in THz,
|
||||
and the second to seventh columns give the cumulative lattice thermal
|
||||
|
@ -99,7 +96,7 @@ Let `phono3py-kaccum` read a QE (pw) unit cell file with `-c` option, for
|
|||
example:
|
||||
|
||||
```bash
|
||||
% phono3py-kaccum --qe --pa="F" -c Si.in kappa-m191919.hdf5
|
||||
% phono3py-kaccum --qe kappa-m191919.hdf5
|
||||
```
|
||||
|
||||
```{image} Si-kaccum-pwscf.png
|
||||
|
|
|
@ -2,6 +2,24 @@
|
|||
|
||||
# Change Log
|
||||
|
||||
## Apr-19-2024: Version 3.0.0
|
||||
|
||||
This is a major version release. There are backward-incompatible changes.
|
||||
|
||||
- Method to transform supercell third-order force constants fc3 in real to
|
||||
reciprocal space was changed as described at Version 2.9.0 changelog below.
|
||||
This results in the change of results with respect to those obtained by
|
||||
phono3py version 2. To emulate v2 behaviour, use `--v2` option in phono3py
|
||||
command line script. For `Phono3py` class , `make_r0_average=True` (default)
|
||||
when instantiating it, and similarly for `phono3py.load` function.
|
||||
- Completely dropped support of `disp_fc3.yaml` and `disp_fc2.yaml`.
|
||||
- Dropped support of old style usage of `phono3py-kaccum` script.
|
||||
- Removed functions `write_fc3_dat`, `write_triplets`, `write_grid_address` in
|
||||
`file_IO.py`.
|
||||
- Removed methods marked by `DeprecationWarning`.
|
||||
- Removed `masses`, `band_indices`, `sigmas`, `sigma_cutoff` parameters from
|
||||
`Phono3py.__init__()`.
|
||||
|
||||
## Mar-20-2024: Version 2.10.0
|
||||
|
||||
- Maintenance release
|
||||
|
@ -100,7 +118,7 @@
|
|||
|
||||
## Jul-22-2021: Version 2.0.0
|
||||
|
||||
This is a major version release. There are some backword-incompatible changes.
|
||||
This is a major version release. There are some backward-incompatible changes.
|
||||
|
||||
1. Grid point indexing system to address grid points of q-points is changed.
|
||||
2. Array data types of most of the integer arrays are changed to `dtype='int_'`
|
||||
|
|
|
@ -58,9 +58,9 @@ copyright = "2015, Atsushi Togo"
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = "2.10"
|
||||
version = "3.0"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "2.10.0"
|
||||
release = "3.0.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import warnings
|
||||
from collections.abc import Sequence
|
||||
from typing import Optional, Union
|
||||
|
||||
|
@ -144,17 +143,13 @@ class Phono3py:
|
|||
supercell_matrix=None,
|
||||
primitive_matrix=None,
|
||||
phonon_supercell_matrix=None,
|
||||
masses=None,
|
||||
band_indices=None,
|
||||
sigmas=None,
|
||||
sigma_cutoff=None,
|
||||
cutoff_frequency=1e-4,
|
||||
frequency_factor_to_THz=VaspToTHz,
|
||||
is_symmetry=True,
|
||||
is_mesh_symmetry=True,
|
||||
use_grg=False,
|
||||
SNF_coordinates="reciprocal",
|
||||
make_r0_average: bool = False,
|
||||
make_r0_average: bool = True,
|
||||
symprec=1e-5,
|
||||
calculator: Optional[str] = None,
|
||||
log_level=0,
|
||||
|
@ -185,14 +180,6 @@ class Phono3py:
|
|||
than that of fc3. Unless setting this, supercell_matrix is used.
|
||||
This is only valide when unitcell or unitcell_filename is given.
|
||||
Default is None.
|
||||
masses : Deprecated.
|
||||
Use Phono3py.masses attribute after instanciation.
|
||||
band_indices : Deprecated.
|
||||
Use Phono3py.band_indices attribute after instanciation.
|
||||
sigmas : Deprecated.
|
||||
Use Phono3py.sigmas attribute after instanciation.
|
||||
sigma_cutoff : Deprecated.
|
||||
Use Phono3py.sigma_cutoff attribute after instanciation.
|
||||
cutoff_frequency : float, optional
|
||||
Phonon frequency below this value is ignored when the cutoff is
|
||||
needed for the computation. Default is 1e-4.
|
||||
|
@ -308,38 +295,6 @@ class Phono3py:
|
|||
self._band_indices_flatten = None
|
||||
self._set_band_indices()
|
||||
|
||||
if masses is not None:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of masses is deprecated. "
|
||||
"Use Phono3py.masses attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.masses = masses
|
||||
|
||||
if band_indices is not None:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of band_indices is deprecated. "
|
||||
"Use Phono3py.band_indices attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.band_indices = band_indices
|
||||
|
||||
if sigmas is not None:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of sigmas is deprecated. "
|
||||
"Use Phono3py.sigmas attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.sigmas = sigmas
|
||||
|
||||
if sigma_cutoff is not None:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of sigma_cutoff is deprecated. "
|
||||
"Use Phono3py.sigma_cutoff attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.sigma_cutoff = sigma_cutoff
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
"""Return phono3py release version number.
|
||||
|
@ -350,15 +305,6 @@ class Phono3py:
|
|||
"""
|
||||
return __version__
|
||||
|
||||
def get_version(self):
|
||||
"""Return phono3py release version number."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_version() is deprecated."
|
||||
"Use Phono3py.version attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.version
|
||||
|
||||
@property
|
||||
def calculator(self) -> Optional[str]:
|
||||
"""Return calculator interface name.
|
||||
|
@ -386,22 +332,6 @@ class Phono3py:
|
|||
def fc3(self, fc3):
|
||||
self._fc3 = fc3
|
||||
|
||||
def get_fc3(self):
|
||||
"""Return third order force constants (fc3)."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_fc3() is deprecated." "Use Phono3py.fc3 attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.fc3
|
||||
|
||||
def set_fc3(self, fc3):
|
||||
"""Set fc3."""
|
||||
warnings.warn(
|
||||
"Phono3py.set_fc3() is deprecated." "Use Phono3py.fc3 attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.fc3 = fc3
|
||||
|
||||
@property
|
||||
def fc2(self):
|
||||
"""Setter and getter of second order force constants (fc2).
|
||||
|
@ -419,22 +349,6 @@ class Phono3py:
|
|||
def fc2(self, fc2):
|
||||
self._fc2 = fc2
|
||||
|
||||
def get_fc2(self):
|
||||
"""Return second order force constants (fc2)."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_fc2() is deprecated." "Use Phono3py.fc2 attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.fc2
|
||||
|
||||
def set_fc2(self, fc2):
|
||||
"""Set fc2."""
|
||||
warnings.warn(
|
||||
"Phono3py.set_fc2() is deprecated." "Use Phono3py.fc2 attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.fc2 = fc2
|
||||
|
||||
@property
|
||||
def force_constants(self):
|
||||
"""Return fc2. This is same as the getter attribute `fc2`."""
|
||||
|
@ -511,24 +425,6 @@ class Phono3py:
|
|||
if self._interaction is not None:
|
||||
self._init_dynamical_matrix()
|
||||
|
||||
def get_nac_params(self):
|
||||
"""Return NAC parameters."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_nac_params() is deprecated."
|
||||
"Use Phono3py.nac_params attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.nac_params
|
||||
|
||||
def set_nac_params(self, nac_params):
|
||||
"""Set NAC parameters."""
|
||||
warnings.warn(
|
||||
"Phono3py.set_nac_params() is deprecated."
|
||||
"Use Phono3py.nac_params attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.nac_params = nac_params
|
||||
|
||||
@property
|
||||
def dynamical_matrix(self):
|
||||
"""Return DynamicalMatrix instance.
|
||||
|
@ -552,15 +448,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._primitive
|
||||
|
||||
def get_primitive(self):
|
||||
"""Return primitive cell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_primitive() is deprecated."
|
||||
"Use Phono3py.primitive attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.primitive
|
||||
|
||||
@property
|
||||
def unitcell(self) -> PhonopyAtoms:
|
||||
"""Return Unit cell.
|
||||
|
@ -571,15 +458,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._unitcell
|
||||
|
||||
def get_unitcell(self):
|
||||
"""Return Unit cell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_unitcell() is deprecated."
|
||||
"Use Phono3py.unitcell attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.unitcell
|
||||
|
||||
@property
|
||||
def supercell(self) -> Supercell:
|
||||
"""Return supercell.
|
||||
|
@ -590,15 +468,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._supercell
|
||||
|
||||
def get_supercell(self):
|
||||
"""Return supercell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_supercell() is deprecated."
|
||||
"Use Phono3py.supercell attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.supercell
|
||||
|
||||
@property
|
||||
def phonon_supercell(self) -> Supercell:
|
||||
"""Return supercell for fc2.
|
||||
|
@ -609,15 +478,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._phonon_supercell
|
||||
|
||||
def get_phonon_supercell(self):
|
||||
"""Return supercell for fc2."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phonon_supercell() is deprecated."
|
||||
"Use Phono3py.phonon_supercell attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phonon_supercell
|
||||
|
||||
@property
|
||||
def phonon_primitive(self) -> Primitive:
|
||||
"""Return primitive cell for fc2.
|
||||
|
@ -630,15 +490,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._phonon_primitive
|
||||
|
||||
def get_phonon_primitive(self):
|
||||
"""Return primitive cell for fc2."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phonon_primitive() is deprecated."
|
||||
"Use Phono3py.phonon_primitive attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phonon_primitive
|
||||
|
||||
@property
|
||||
def symmetry(self) -> Symmetry:
|
||||
"""Return symmetry of supercell.
|
||||
|
@ -649,15 +500,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._symmetry
|
||||
|
||||
def get_symmetry(self):
|
||||
"""Return symmetry of supercell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_symmetry() is deprecated."
|
||||
"Use Phono3py.symmetry attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.symmetry
|
||||
|
||||
@property
|
||||
def primitive_symmetry(self) -> Symmetry:
|
||||
"""Return symmetry of primitive cell.
|
||||
|
@ -668,15 +510,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._primitive_symmetry
|
||||
|
||||
def get_primitive_symmetry(self):
|
||||
"""Return symmetry of primitive cell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_primitive_symmetry() is deprecated."
|
||||
"Use Phono3py.primitive_symmetry attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.primitive_symmetry
|
||||
|
||||
@property
|
||||
def phonon_supercell_symmetry(self) -> Symmetry:
|
||||
"""Return symmetry of supercell for fc2.
|
||||
|
@ -687,15 +520,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._phonon_supercell_symmetry
|
||||
|
||||
def get_phonon_supercell_symmetry(self):
|
||||
"""Return symmetry of supercell for fc2."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phonon_supercell_symmetry() is deprecated."
|
||||
"Use Phono3py.phonon_supercell_symmetry attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phonon_supercell_symmetry
|
||||
|
||||
@property
|
||||
def supercell_matrix(self):
|
||||
"""Return transformation matrix to supercell cell from unit cell.
|
||||
|
@ -707,15 +531,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._supercell_matrix
|
||||
|
||||
def get_supercell_matrix(self):
|
||||
"""Return transformation matrix to supercell cell from unit cell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_supercell_matrix() is deprecated."
|
||||
"Use Phono3py.supercell_matrix attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.supercell_matrix
|
||||
|
||||
@property
|
||||
def phonon_supercell_matrix(self):
|
||||
"""Return transformation matrix to phonon supercell from unit cell.
|
||||
|
@ -727,15 +542,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._phonon_supercell_matrix
|
||||
|
||||
def get_phonon_supercell_matrix(self):
|
||||
"""Return transformation matrix to phonon supercell from unit cell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phonon_supercell_matrix() is deprecated."
|
||||
"Use Phono3py.phonon_supercell_matrix attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phonon_supercell_matrix
|
||||
|
||||
@property
|
||||
def primitive_matrix(self):
|
||||
"""Return transformation matrix to primitive cell from unit cell.
|
||||
|
@ -747,15 +553,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._primitive_matrix
|
||||
|
||||
def get_primitive_matrix(self):
|
||||
"""Return transformation matrix to primitive cell from unit cell."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_primitive_matrix() is deprecated."
|
||||
"Use Phono3py.primitive_matrix attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.primitive_matrix
|
||||
|
||||
@property
|
||||
def unit_conversion_factor(self):
|
||||
"""Return phonon frequency unit conversion factor.
|
||||
|
@ -768,15 +565,6 @@ class Phono3py:
|
|||
"""
|
||||
return self._frequency_factor_to_THz
|
||||
|
||||
def set_displacement_dataset(self, dataset):
|
||||
"""Set displacement-force dataset."""
|
||||
warnings.warn(
|
||||
"Phono3py.set_displacement_dataset() is deprecated."
|
||||
"Use Phono3py.dataset attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._dataset = dataset
|
||||
|
||||
@property
|
||||
def dataset(self):
|
||||
"""Setter and getter of displacement-force dataset.
|
||||
|
@ -823,24 +611,6 @@ class Phono3py:
|
|||
self._supercells_with_displacements = None
|
||||
self._phonon_supercells_with_displacements = None
|
||||
|
||||
@property
|
||||
def displacement_dataset(self):
|
||||
"""Return displacement-force dataset."""
|
||||
warnings.warn(
|
||||
"Phono3py.displacement_dataset is deprecated." "Use Phono3py.dataset.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.dataset
|
||||
|
||||
def get_displacement_dataset(self):
|
||||
"""Return displacement-force dataset."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_displacement_dataset() is deprecated."
|
||||
"Use Phono3py.dataset.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.displacement_dataset
|
||||
|
||||
@property
|
||||
def phonon_dataset(self):
|
||||
"""Setter and getter of displacement-force dataset for fc2.
|
||||
|
@ -869,25 +639,6 @@ class Phono3py:
|
|||
def phonon_dataset(self, dataset):
|
||||
self._phonon_dataset = dataset
|
||||
|
||||
@property
|
||||
def phonon_displacement_dataset(self):
|
||||
"""Return phonon dispalcement-force dataset."""
|
||||
warnings.warn(
|
||||
"Phono3py.phonon_displacement_dataset is deprecated."
|
||||
"Use Phono3py.phonon_dataset.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self._phonon_dataset
|
||||
|
||||
def get_phonon_displacement_dataset(self):
|
||||
"""Return phonon dispalcement-force dataset."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phonon_displacement_dataset() is deprecated."
|
||||
"Use Phono3py.phonon_dataset.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phonon_displacement_dataset
|
||||
|
||||
@property
|
||||
def band_indices(self):
|
||||
"""Setter and getter of band indices.
|
||||
|
@ -903,15 +654,6 @@ class Phono3py:
|
|||
def band_indices(self, band_indices):
|
||||
self._set_band_indices(band_indices=band_indices)
|
||||
|
||||
def set_band_indices(self, band_indices):
|
||||
"""Set band indices."""
|
||||
warnings.warn(
|
||||
"Phono3py.set_band_indices() is deprecated."
|
||||
"Use Phono3py.band_indices attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.band_indices = band_indices
|
||||
|
||||
def _set_band_indices(self, band_indices=None):
|
||||
if band_indices is None:
|
||||
num_band = len(self._primitive) * 3
|
||||
|
@ -955,15 +697,6 @@ class Phono3py:
|
|||
self._build_supercells_with_displacements()
|
||||
return self._supercells_with_displacements
|
||||
|
||||
def get_supercells_with_displacements(self):
|
||||
"""Return supercells with displacements."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_supercells_with_displacements() is deprecated."
|
||||
"Use Phono3py.supercells_with_displacements attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.supercells_with_displacements
|
||||
|
||||
@property
|
||||
def phonon_supercells_with_displacements(self):
|
||||
"""Return supercells with displacements for fc2.
|
||||
|
@ -982,16 +715,6 @@ class Phono3py:
|
|||
)
|
||||
return self._phonon_supercells_with_displacements
|
||||
|
||||
def get_phonon_supercells_with_displacements(self):
|
||||
"""Return supercells with displacements for fc2."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phonon_supercells_with_displacements() "
|
||||
"is deprecated. Use Phono3py.phonon_supercells_with_displacements "
|
||||
"attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phonon_supercells_with_displacements
|
||||
|
||||
@property
|
||||
def mesh_numbers(self):
|
||||
"""Setter and getter of sampling mesh numbers in reciprocal space."""
|
||||
|
@ -1009,15 +732,6 @@ class Phono3py:
|
|||
"""Return thermal conductivity class instance."""
|
||||
return self._thermal_conductivity
|
||||
|
||||
def get_thermal_conductivity(self):
|
||||
"""Return thermal conductivity class instance."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_thermal_conductivity() is deprecated."
|
||||
"Use Phono3py.thermal_conductivity attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.thermal_conductivity
|
||||
|
||||
@property
|
||||
def displacements(self):
|
||||
"""Setter and getter displacements in supercells.
|
||||
|
@ -1261,15 +975,6 @@ class Phono3py:
|
|||
"""Return Interaction instance."""
|
||||
return self._interaction
|
||||
|
||||
def get_phph_interaction(self):
|
||||
"""Return Interaction instance."""
|
||||
warnings.warn(
|
||||
"Phono3py.get_phph_interaction() is deprecated."
|
||||
"Use Phono3py.phph_interaction attribute instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.phph_interaction
|
||||
|
||||
@property
|
||||
def detailed_gammas(self):
|
||||
"""Return detailed gamma."""
|
||||
|
@ -1880,15 +1585,6 @@ class Phono3py:
|
|||
|
||||
return vals
|
||||
|
||||
def write_imag_self_energy(self, filename=None):
|
||||
"""Write imaginary part of self energy to a file."""
|
||||
warnings.warn(
|
||||
"Phono3py.write_imag_self_energy is deprecated."
|
||||
"Use Phono3py.run_imag_self_energy with write_txt=True.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._write_imag_self_energy(output_filename=filename)
|
||||
|
||||
def _write_imag_self_energy(self, output_filename=None):
|
||||
write_imag_self_energy(
|
||||
self._gammas,
|
||||
|
|
|
@ -54,8 +54,6 @@ from phono3py import Phono3py
|
|||
from phono3py.cui.show_log import show_phono3py_force_constants_settings
|
||||
from phono3py.file_IO import (
|
||||
get_length_of_first_line,
|
||||
parse_disp_fc2_yaml,
|
||||
parse_disp_fc3_yaml,
|
||||
parse_FORCES_FC2,
|
||||
parse_FORCES_FC3,
|
||||
read_fc2_from_hdf5,
|
||||
|
@ -117,7 +115,6 @@ def create_phono3py_force_constants(
|
|||
ph3py_yaml,
|
||||
phono3py_yaml_filename,
|
||||
symmetrize_fc3r,
|
||||
input_filename,
|
||||
settings.is_compact_fc,
|
||||
settings.cutoff_pair_distance,
|
||||
fc_calculator,
|
||||
|
@ -167,7 +164,6 @@ def create_phono3py_force_constants(
|
|||
phono3py,
|
||||
ph3py_yaml,
|
||||
symmetrize_fc2,
|
||||
input_filename,
|
||||
settings.is_compact_fc,
|
||||
fc_calculator,
|
||||
fc_calculator_options,
|
||||
|
@ -178,7 +174,6 @@ def create_phono3py_force_constants(
|
|||
phono3py,
|
||||
ph3py_yaml,
|
||||
symmetrize_fc2,
|
||||
input_filename,
|
||||
settings.is_compact_fc,
|
||||
fc_calculator,
|
||||
fc_calculator_options,
|
||||
|
@ -207,7 +202,6 @@ def parse_forces(
|
|||
ph3py_yaml: Optional[Phono3pyYaml] = None,
|
||||
cutoff_pair_distance=None,
|
||||
force_filename: str = "FORCES_FC3",
|
||||
disp_filename: Optional[str] = None,
|
||||
phono3py_yaml_filename: Optional[str] = None,
|
||||
fc_type=None,
|
||||
log_level=0,
|
||||
|
@ -269,32 +263,7 @@ def parse_forces(
|
|||
force_to_eVperA=physical_units["force_to_eVperA"],
|
||||
)
|
||||
|
||||
# No dataset is found. "disp_fc*.yaml" is read. But this is deprecated.
|
||||
if dataset is None:
|
||||
if disp_filename is None:
|
||||
msg = (
|
||||
"Displacement dataset corresponding to "
|
||||
f'"{force_filename}" not found.'
|
||||
)
|
||||
raise RuntimeError(msg)
|
||||
# Displacement dataset is obtained from disp_filename.
|
||||
# can emit FileNotFoundError.
|
||||
dataset = _read_disp_fc_yaml(disp_filename, fc_type)
|
||||
filename_read_from = disp_filename
|
||||
|
||||
# No forces should exist. Therefore only unit of displacements is
|
||||
# converted.
|
||||
if calculator is None:
|
||||
if log_level:
|
||||
print(
|
||||
f'Displacements are read from "{disp_filename}", but '
|
||||
" the unit has not converted."
|
||||
)
|
||||
else:
|
||||
_convert_unit_in_dataset(
|
||||
dataset,
|
||||
distance_to_A=physical_units["distance_to_A"],
|
||||
)
|
||||
assert dataset is not None
|
||||
|
||||
if "natom" in dataset and dataset["natom"] != natom:
|
||||
msg = (
|
||||
|
@ -369,15 +338,6 @@ def get_fc_calculator_params(settings):
|
|||
return fc_calculator, fc_calculator_options
|
||||
|
||||
|
||||
def _read_disp_fc_yaml(disp_filename, fc_type):
|
||||
if fc_type == "phonon_fc2":
|
||||
dataset = parse_disp_fc2_yaml(filename=disp_filename)
|
||||
else:
|
||||
dataset = parse_disp_fc3_yaml(filename=disp_filename)
|
||||
|
||||
return dataset
|
||||
|
||||
|
||||
def _read_phono3py_fc3(phono3py, symmetrize_fc3r, input_filename, log_level):
|
||||
if input_filename is None:
|
||||
filename = "fc3.hdf5"
|
||||
|
@ -469,13 +429,12 @@ def _create_phono3py_fc3(
|
|||
phono3py: Phono3py,
|
||||
ph3py_yaml: Optional[Phono3pyYaml],
|
||||
phono3py_yaml_filename: Optional[str],
|
||||
symmetrize_fc3r,
|
||||
input_filename,
|
||||
is_compact_fc,
|
||||
cutoff_pair_distance,
|
||||
fc_calculator,
|
||||
fc_calculator_options,
|
||||
log_level,
|
||||
symmetrize_fc3r: bool,
|
||||
is_compact_fc: bool,
|
||||
cutoff_pair_distance: Optional[float],
|
||||
fc_calculator: Optional[str],
|
||||
fc_calculator_options: Optional[str],
|
||||
log_level: int,
|
||||
):
|
||||
"""Read or calculate fc3.
|
||||
|
||||
|
@ -491,14 +450,7 @@ def _create_phono3py_fc3(
|
|||
when the former value is smaller than the later.
|
||||
|
||||
"""
|
||||
# disp_fc3.yaml is obsolete.
|
||||
if input_filename is None:
|
||||
disp_filename = "disp_fc3.yaml"
|
||||
else:
|
||||
disp_filename = "disp_fc3." + input_filename + ".yaml"
|
||||
|
||||
# If disp_fc3.yaml is not found, default phono3py.yaml file is
|
||||
_ph3py_yaml = _get_ph3py_yaml(disp_filename, ph3py_yaml)
|
||||
_ph3py_yaml = _get_default_ph3py_yaml(ph3py_yaml)
|
||||
|
||||
try:
|
||||
dataset = parse_forces(
|
||||
|
@ -506,7 +458,6 @@ def _create_phono3py_fc3(
|
|||
ph3py_yaml=_ph3py_yaml,
|
||||
cutoff_pair_distance=cutoff_pair_distance,
|
||||
force_filename="FORCES_FC3",
|
||||
disp_filename=disp_filename,
|
||||
phono3py_yaml_filename=phono3py_yaml_filename,
|
||||
fc_type="fc3",
|
||||
log_level=log_level,
|
||||
|
@ -534,25 +485,18 @@ def _create_phono3py_fc2(
|
|||
phono3py: Phono3py,
|
||||
ph3py_yaml: Optional[Phono3pyYaml],
|
||||
symmetrize_fc2,
|
||||
input_filename,
|
||||
is_compact_fc,
|
||||
fc_calculator,
|
||||
fc_calculator_options,
|
||||
log_level,
|
||||
):
|
||||
if input_filename is None:
|
||||
disp_filename = "disp_fc3.yaml"
|
||||
else:
|
||||
disp_filename = "disp_fc3." + input_filename + ".yaml"
|
||||
|
||||
_ph3py_yaml = _get_ph3py_yaml(disp_filename, ph3py_yaml)
|
||||
_ph3py_yaml = _get_default_ph3py_yaml(ph3py_yaml)
|
||||
|
||||
try:
|
||||
dataset = parse_forces(
|
||||
phono3py,
|
||||
ph3py_yaml=_ph3py_yaml,
|
||||
force_filename="FORCES_FC3",
|
||||
disp_filename=disp_filename,
|
||||
fc_type="fc2",
|
||||
log_level=log_level,
|
||||
)
|
||||
|
@ -573,40 +517,30 @@ def _create_phono3py_fc2(
|
|||
)
|
||||
|
||||
|
||||
def _get_ph3py_yaml(disp_filename, ph3py_yaml: Optional[Phono3pyYaml]):
|
||||
def _get_default_ph3py_yaml(ph3py_yaml: Optional[Phono3pyYaml]):
|
||||
_ph3py_yaml = ph3py_yaml
|
||||
# Try to use phono3py.phonon_dataset when the disp file not found
|
||||
if not os.path.isfile(disp_filename):
|
||||
disp_filename = None
|
||||
if _ph3py_yaml is None and os.path.isfile("phono3py_disp.yaml"):
|
||||
_ph3py_yaml = Phono3pyYaml()
|
||||
_ph3py_yaml.read("phono3py_disp.yaml")
|
||||
if _ph3py_yaml is None and os.path.isfile("phono3py_disp.yaml"):
|
||||
_ph3py_yaml = Phono3pyYaml()
|
||||
_ph3py_yaml.read("phono3py_disp.yaml")
|
||||
return _ph3py_yaml
|
||||
|
||||
|
||||
def _create_phono3py_phonon_fc2(
|
||||
phono3py: Phono3py,
|
||||
ph3py_yaml: Optional[Phono3pyYaml],
|
||||
symmetrize_fc2,
|
||||
input_filename,
|
||||
is_compact_fc,
|
||||
fc_calculator,
|
||||
fc_calculator_options,
|
||||
log_level,
|
||||
symmetrize_fc2: bool,
|
||||
is_compact_fc: bool,
|
||||
fc_calculator: Optional[str],
|
||||
fc_calculator_options: Optional[str],
|
||||
log_level: int,
|
||||
):
|
||||
if input_filename is None:
|
||||
disp_filename = "disp_fc2.yaml"
|
||||
else:
|
||||
disp_filename = "disp_fc2." + input_filename + ".yaml"
|
||||
|
||||
_ph3py_yaml = _get_ph3py_yaml(disp_filename, ph3py_yaml)
|
||||
_ph3py_yaml = _get_default_ph3py_yaml(ph3py_yaml)
|
||||
|
||||
try:
|
||||
dataset = parse_forces(
|
||||
phono3py,
|
||||
ph3py_yaml=_ph3py_yaml,
|
||||
force_filename="FORCES_FC2",
|
||||
disp_filename=disp_filename,
|
||||
fc_type="phonon_fc2",
|
||||
log_level=log_level,
|
||||
)
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
from phonopy.interface.calculator import write_supercells_with_displacements
|
||||
|
||||
from phono3py import Phono3py
|
||||
from phono3py.file_IO import write_disp_fc2_yaml, write_disp_fc3_yaml
|
||||
from phono3py.interface.calculator import (
|
||||
get_additional_info_to_write_fc2_supercells,
|
||||
get_additional_info_to_write_supercells,
|
||||
|
@ -52,18 +51,12 @@ def create_phono3py_supercells(
|
|||
output_filename=None,
|
||||
interface_mode="vasp",
|
||||
log_level=1,
|
||||
write_disp_yaml=False,
|
||||
):
|
||||
"""Create displacements and supercells.
|
||||
|
||||
Distance unit used is that for the calculator interface.
|
||||
The default unit is Angstron.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
write_disp_yaml : bool
|
||||
Write old-style files of disp_fc3.yaml and disp_fc2.yaml. Default is False.
|
||||
|
||||
"""
|
||||
optional_structure_info = cell_info["optional_structure_info"]
|
||||
|
||||
|
@ -92,15 +85,6 @@ def create_phono3py_supercells(
|
|||
print('Unit cell was read from "%s".' % optional_structure_info[0])
|
||||
print("Displacement distance: %s" % distance)
|
||||
|
||||
if write_disp_yaml:
|
||||
if output_filename is None:
|
||||
filename = "disp_fc3.yaml"
|
||||
else:
|
||||
filename = "disp_fc3." + output_filename + ".yaml"
|
||||
num_disps, num_disp_files = write_disp_fc3_yaml(
|
||||
phono3py.dataset, phono3py.supercell, filename=filename
|
||||
)
|
||||
|
||||
ids = []
|
||||
disp_cells = []
|
||||
for i, cell in enumerate(phono3py.supercells_with_displacements):
|
||||
|
@ -132,15 +116,6 @@ def create_phono3py_supercells(
|
|||
print("Number of displacement supercell files created: %d" % num_disp_files)
|
||||
|
||||
if phono3py.phonon_supercell_matrix is not None:
|
||||
if write_disp_yaml:
|
||||
if output_filename is None:
|
||||
filename = "disp_fc2.yaml"
|
||||
else:
|
||||
filename = "disp_fc2." + output_filename + ".yaml"
|
||||
num_disps = write_disp_fc2_yaml(
|
||||
phono3py.phonon_dataset, phono3py.phonon_supercell, filename=filename
|
||||
)
|
||||
|
||||
additional_info = get_additional_info_to_write_fc2_supercells(
|
||||
interface_mode, phono3py.phonon_supercell_matrix
|
||||
)
|
||||
|
|
|
@ -358,9 +358,10 @@ def main():
|
|||
"""
|
||||
args = _get_parser()
|
||||
primitive = None
|
||||
if len(args.filenames) > 1: # deprecated
|
||||
cell, f_kappa = _read_files(args)
|
||||
primitive_matrix = _analyze_primitive_matrix_option(args, unitcell=cell)
|
||||
if len(args.filenames) > 1:
|
||||
raise RuntimeError(
|
||||
'Use of "phono3py-kaccum CRYSTAL_STRUCTURE_FILE" is not supported.'
|
||||
)
|
||||
else:
|
||||
interface_mode = _get_calculator(args)
|
||||
cell_info = _read_files_by_collect_cell_info(args.cell_filename, interface_mode)
|
||||
|
|
|
@ -94,17 +94,17 @@ def load(
|
|||
can be overwritten.
|
||||
|
||||
'fc3.hdf5' is read if found in current directory. Unless 'fc3.hdf5' is found
|
||||
and if 'FORCES_FC3' and 'disp_fc3.yaml" are found, these are read and fc3
|
||||
and fc2 are produced.
|
||||
and if 'FORCES_FC3' and 'phono3py_disp.yaml" are found, these are read and
|
||||
fc3 and fc2 are produced.
|
||||
|
||||
if 'fc2.hdf5' is found, this is read. Unless 'fc2.hdf5' is found and if
|
||||
'FORCES_FC2' and 'disp_fc2.yaml" are found, these are read and fc2 is
|
||||
'FORCES_FC2' and 'phono3py_disp.yaml" are found, these are read and fc2 is
|
||||
produced.
|
||||
|
||||
When force_sets_filename and force_constants_filename are not given,
|
||||
'FORCES_FC3' and 'FORCES_FC2' are looked for in the current directory as the
|
||||
default behaviour. When 'FORCES_FC3' ('FORCES_FC2') is given in the type-1
|
||||
format, 'disp_fc3.yaml' ('disp_fc2.yaml') is also necessary and read.
|
||||
format, 'phono3py_disp.yaml' is also necessary and read.
|
||||
|
||||
Crystal structure
|
||||
-----------------
|
||||
|
@ -121,12 +121,12 @@ def load(
|
|||
priority:
|
||||
1. fc3_filename (fc2_filename)
|
||||
2. forces_fc3_filename (forces_fc2_filename). Do not forget that for
|
||||
type-1 format, disp_fc3.yaml (disp_fc2.yaml) has to be given, too.
|
||||
type-1 format, phono3py_disp.yaml has to be given, too.
|
||||
3. 'fc3.hdf5' and 'fc2.hdf5' are searched in current directory.
|
||||
4. 'FORCES_FC3' and 'FORCES_FC2' are searched in current directory.
|
||||
'FORCES_FC2' is optional. For type-1 format, 'disp_fc3.yaml' and
|
||||
optionally 'disp_fc2.yaml' are also searched in current directory.
|
||||
When 'FORCES_FC2' is not found, 'FORCES_FC3' is used to create fc2.
|
||||
'FORCES_FC2' is optional. For type-1 format, 'phono3py_disp.yaml' is
|
||||
also searched in current directory. When 'FORCES_FC2' is not found,
|
||||
'FORCES_FC3' is used to create fc2.
|
||||
|
||||
Parameters for non-analytical term correctiion (NAC)
|
||||
----------------------------------------------------
|
||||
|
@ -188,11 +188,11 @@ def load(
|
|||
correction parameters.
|
||||
forces_fc3_filename : sequence or os.PathLike, optional
|
||||
A two-elemental sequence of filenames corresponding to ('FORCES_FC3',
|
||||
'disp_fc3.yaml') in the type-1 format or a filename (os.PathLike)
|
||||
'phono3py_disp.yaml') in the type-1 format or a filename (os.PathLike)
|
||||
corresponding to 'FORCES_FC3' in the type-2 format. Default is None.
|
||||
forces_fc2_filename : os.PathLike or sequence, optional
|
||||
A two-elemental sequence of filenames corresponding to ('FORCES_FC2',
|
||||
'disp_fc2.yaml') in the type-1 format or a filename (os.PathLike)
|
||||
'phono3py_disp.yaml') in the type-1 format or a filename (os.PathLike)
|
||||
corresponding to 'FORCES_FC2' in the type-2 format. Default is None.
|
||||
fc3_filename : os.PathLike, optional
|
||||
Filename of a file corresponding to 'fc3.hdf5', a file contains
|
||||
|
@ -233,10 +233,10 @@ def load(
|
|||
use_grg : bool, optional
|
||||
Use generalized regular grid when True. Default is False.
|
||||
make_r0_average : bool, optional
|
||||
fc3 transformation from real to reciprocal space is done
|
||||
around three atoms and averaged when True. Default is False, i.e.,
|
||||
only around the first atom. Setting False is for rough compatibility
|
||||
with v2.x. Default is True.
|
||||
fc3 transformation from real to reciprocal space is done around three
|
||||
atoms and averaged when True. Default is False, i.e., only around the
|
||||
first atom. Setting False is for rough compatibility with v2.x. Default
|
||||
is True.
|
||||
symprec : float, optional
|
||||
Tolerance used to find crystal symmetry. Default is 1e-5.
|
||||
log_level : int, optional
|
||||
|
@ -477,16 +477,11 @@ def _set_dataset_or_fc3(
|
|||
if log_level:
|
||||
print('fc3 was read from "%s".' % fc3_filename)
|
||||
elif forces_fc3_filename is not None:
|
||||
if isinstance(forces_fc3_filename, os.PathLike):
|
||||
force_filename = forces_fc3_filename
|
||||
disp_filename = None
|
||||
else:
|
||||
force_filename, disp_filename = forces_fc3_filename
|
||||
force_filename = forces_fc3_filename
|
||||
_set_dataset_for_fc3(
|
||||
ph3py,
|
||||
ph3py_yaml,
|
||||
force_filename,
|
||||
disp_filename,
|
||||
phono3py_yaml_filename,
|
||||
cutoff_pair_distance,
|
||||
log_level,
|
||||
|
@ -499,17 +494,10 @@ def _set_dataset_or_fc3(
|
|||
if log_level:
|
||||
print('fc3 was read from "fc3.hdf5".')
|
||||
elif os.path.isfile("FORCES_FC3"):
|
||||
disp_filename = None
|
||||
if os.path.isfile("disp_fc3.yaml"):
|
||||
if ph3py_yaml is None:
|
||||
disp_filename = "disp_fc3.yaml"
|
||||
elif ph3py_yaml.dataset is None:
|
||||
disp_filename = "disp_fc3.yaml"
|
||||
_set_dataset_for_fc3(
|
||||
ph3py,
|
||||
ph3py_yaml,
|
||||
"FORCES_FC3",
|
||||
disp_filename,
|
||||
phono3py_yaml_filename,
|
||||
cutoff_pair_distance,
|
||||
log_level,
|
||||
|
@ -523,7 +511,6 @@ def _set_dataset_or_fc3(
|
|||
ph3py,
|
||||
ph3py_yaml,
|
||||
None,
|
||||
None,
|
||||
phono3py_yaml_filename,
|
||||
cutoff_pair_distance,
|
||||
log_level,
|
||||
|
@ -548,16 +535,11 @@ def _set_dataset_phonon_dataset_or_fc2(
|
|||
if log_level:
|
||||
print('fc2 was read from "%s".' % fc2_filename)
|
||||
elif forces_fc2_filename is not None:
|
||||
if isinstance(forces_fc2_filename, os.PathLike):
|
||||
force_filename = forces_fc2_filename
|
||||
disp_filename = None
|
||||
else:
|
||||
force_filename, disp_filename = forces_fc2_filename
|
||||
force_filename = forces_fc2_filename
|
||||
_set_dataset_for_fc2(
|
||||
ph3py,
|
||||
ph3py_yaml,
|
||||
force_filename,
|
||||
disp_filename,
|
||||
"phonon_fc2",
|
||||
log_level,
|
||||
)
|
||||
|
@ -569,17 +551,10 @@ def _set_dataset_phonon_dataset_or_fc2(
|
|||
if log_level:
|
||||
print('fc2 was read from "fc2.hdf5".')
|
||||
elif os.path.isfile("FORCES_FC2"):
|
||||
disp_filename = None
|
||||
if os.path.isfile("disp_fc2.yaml"):
|
||||
if ph3py_yaml is None:
|
||||
disp_filename = "disp_fc2.yaml"
|
||||
elif ph3py_yaml.phonon_dataset is None:
|
||||
disp_filename = "disp_fc2.yaml"
|
||||
_set_dataset_for_fc2(
|
||||
ph3py,
|
||||
ph3py_yaml,
|
||||
"FORCES_FC2",
|
||||
disp_filename,
|
||||
"phonon_fc2",
|
||||
log_level,
|
||||
)
|
||||
|
@ -592,7 +567,6 @@ def _set_dataset_phonon_dataset_or_fc2(
|
|||
ph3py,
|
||||
ph3py_yaml,
|
||||
None,
|
||||
None,
|
||||
"phonon_fc2",
|
||||
log_level,
|
||||
)
|
||||
|
@ -605,23 +579,15 @@ def _set_dataset_phonon_dataset_or_fc2(
|
|||
ph3py,
|
||||
ph3py_yaml,
|
||||
None,
|
||||
None,
|
||||
"fc2",
|
||||
log_level,
|
||||
)
|
||||
elif os.path.isfile("FORCES_FC3"):
|
||||
# suppose fc3.hdf5 is read but fc2.hdf5 doesn't exist.
|
||||
disp_filename = None
|
||||
if os.path.isfile("disp_fc3.yaml"):
|
||||
if ph3py_yaml is None:
|
||||
disp_filename = "disp_fc3.yaml"
|
||||
elif ph3py_yaml.dataset is None:
|
||||
disp_filename = "disp_fc3.yaml"
|
||||
_set_dataset_for_fc2(
|
||||
ph3py,
|
||||
ph3py_yaml,
|
||||
"FORCES_FC3",
|
||||
disp_filename,
|
||||
"fc2",
|
||||
log_level,
|
||||
)
|
||||
|
@ -632,7 +598,6 @@ def _set_dataset_for_fc3(
|
|||
ph3py: Phono3py,
|
||||
ph3py_yaml: Optional[Phono3pyYaml],
|
||||
force_filename,
|
||||
disp_filename,
|
||||
phono3py_yaml_filename,
|
||||
cutoff_pair_distance,
|
||||
log_level,
|
||||
|
@ -642,7 +607,6 @@ def _set_dataset_for_fc3(
|
|||
ph3py_yaml=ph3py_yaml,
|
||||
cutoff_pair_distance=cutoff_pair_distance,
|
||||
force_filename=force_filename,
|
||||
disp_filename=disp_filename,
|
||||
phono3py_yaml_filename=phono3py_yaml_filename,
|
||||
fc_type="fc3",
|
||||
log_level=log_level,
|
||||
|
@ -653,7 +617,6 @@ def _set_dataset_for_fc2(
|
|||
ph3py: Phono3py,
|
||||
ph3py_yaml: Optional[Phono3pyYaml],
|
||||
force_filename,
|
||||
disp_filename,
|
||||
fc_type,
|
||||
log_level,
|
||||
):
|
||||
|
@ -661,7 +624,6 @@ def _set_dataset_for_fc2(
|
|||
ph3py,
|
||||
ph3py_yaml=ph3py_yaml,
|
||||
force_filename=force_filename,
|
||||
disp_filename=disp_filename,
|
||||
fc_type=fc_type,
|
||||
log_level=log_level,
|
||||
)
|
||||
|
|
|
@ -83,8 +83,6 @@ from phono3py.cui.show_log import (
|
|||
from phono3py.cui.triplets_info import show_num_triplets, write_grid_points
|
||||
from phono3py.file_IO import (
|
||||
get_length_of_first_line,
|
||||
parse_disp_fc2_yaml,
|
||||
parse_disp_fc3_yaml,
|
||||
parse_FORCES_FC2,
|
||||
read_phonon_from_hdf5,
|
||||
write_fc2_to_hdf5,
|
||||
|
@ -385,7 +383,6 @@ def create_FORCE_SETS_from_FORCES_FCx_then_exit(
|
|||
|
||||
def create_FORCES_FC3_and_FORCES_FC2_then_exit(
|
||||
settings,
|
||||
input_filename: Optional[str],
|
||||
cell_filename: Optional[str],
|
||||
log_level: Union[bool, int],
|
||||
):
|
||||
|
@ -397,24 +394,18 @@ def create_FORCES_FC3_and_FORCES_FC2_then_exit(
|
|||
# Create FORCES_FC3 #
|
||||
#####################
|
||||
if settings.create_forces_fc3 or settings.create_forces_fc3_file:
|
||||
if input_filename is None:
|
||||
disp_fc3_filename = "disp_fc3.yaml"
|
||||
else:
|
||||
disp_fc3_filename = "disp_fc3." + input_filename + ".yaml"
|
||||
disp_filename_candidates = ["phono3py_disp.yaml", disp_fc3_filename]
|
||||
disp_filename_candidates = [
|
||||
"phono3py_disp.yaml",
|
||||
]
|
||||
if cell_filename is not None:
|
||||
disp_filename_candidates.insert(0, cell_filename)
|
||||
disp_filenames = files_exist(disp_filename_candidates, log_level, is_any=True)
|
||||
disp_filename = disp_filenames[0]
|
||||
if disp_filename == disp_fc3_filename:
|
||||
file_exists(disp_filename, log_level)
|
||||
disp_dataset = parse_disp_fc3_yaml(filename=disp_filename)
|
||||
else:
|
||||
ph3py_yaml = Phono3pyYaml()
|
||||
ph3py_yaml.read(disp_filename)
|
||||
if ph3py_yaml.calculator is not None:
|
||||
interface_mode = ph3py_yaml.calculator # overwrite
|
||||
disp_dataset = ph3py_yaml.dataset
|
||||
ph3py_yaml = Phono3pyYaml()
|
||||
ph3py_yaml.read(disp_filename)
|
||||
if ph3py_yaml.calculator is not None:
|
||||
interface_mode = ph3py_yaml.calculator # overwrite
|
||||
disp_dataset = ph3py_yaml.dataset
|
||||
|
||||
if log_level:
|
||||
print("")
|
||||
|
@ -488,27 +479,21 @@ def create_FORCES_FC3_and_FORCES_FC2_then_exit(
|
|||
# Create FORCES_FC2 #
|
||||
#####################
|
||||
if settings.create_forces_fc2:
|
||||
if input_filename is None:
|
||||
disp_fc2_filename = "disp_fc2.yaml"
|
||||
else:
|
||||
disp_fc2_filename = "disp_fc2." + input_filename + ".yaml"
|
||||
disp_filename_candidates = ["phono3py_disp.yaml", disp_fc2_filename]
|
||||
disp_filename_candidates = [
|
||||
"phono3py_disp.yaml",
|
||||
]
|
||||
if cell_filename is not None:
|
||||
disp_filename_candidates.insert(0, cell_filename)
|
||||
disp_filenames = files_exist(disp_filename_candidates, log_level, is_any=True)
|
||||
disp_filename = disp_filenames[0]
|
||||
|
||||
if disp_filename == disp_fc2_filename:
|
||||
file_exists(disp_filename, log_level)
|
||||
disp_dataset = parse_disp_fc2_yaml(filename=disp_filename)
|
||||
else:
|
||||
# ph3py_yaml is not None, phono3py_disp.yaml is already read.
|
||||
if ph3py_yaml is None:
|
||||
ph3py_yaml = Phono3pyYaml()
|
||||
ph3py_yaml.read(disp_filename)
|
||||
if ph3py_yaml.calculator is not None:
|
||||
interface_mode = ph3py_yaml.calculator # overwrite
|
||||
disp_dataset = ph3py_yaml.phonon_dataset
|
||||
# ph3py_yaml is not None, phono3py_disp.yaml is already read.
|
||||
if ph3py_yaml is None:
|
||||
ph3py_yaml = Phono3pyYaml()
|
||||
ph3py_yaml.read(disp_filename)
|
||||
if ph3py_yaml.calculator is not None:
|
||||
interface_mode = ph3py_yaml.calculator # overwrite
|
||||
disp_dataset = ph3py_yaml.phonon_dataset
|
||||
|
||||
if log_level:
|
||||
print('Displacement dataset was read from "%s".' % disp_filename)
|
||||
|
@ -1138,9 +1123,7 @@ def main(**argparse_control):
|
|||
####################################
|
||||
# Create FORCES_FC3 and FORCES_FC2 #
|
||||
####################################
|
||||
create_FORCES_FC3_and_FORCES_FC2_then_exit(
|
||||
settings, input_filename, cell_filename, log_level
|
||||
)
|
||||
create_FORCES_FC3_and_FORCES_FC2_then_exit(settings, cell_filename, log_level)
|
||||
|
||||
###########################################################
|
||||
# Symmetry tolerance. Distance unit depends on interface. #
|
||||
|
|
|
@ -51,28 +51,12 @@ from phonopy.file_IO import check_force_constants_indices, get_cell_from_disp_ya
|
|||
from phono3py.version import __version__
|
||||
|
||||
|
||||
def write_cell_yaml(w, supercell):
|
||||
"""Write cell info.
|
||||
def write_disp_fc3_yaml(dataset, supercell, filename="disp_fc3.yaml"):
|
||||
"""Write disp_fc3.yaml.
|
||||
|
||||
This is only used from write_disp_fc3_yaml and write_disp_fc2_yaml.
|
||||
These methods are also deprecated.
|
||||
This function should not be called from phono3py script from version 3.
|
||||
|
||||
"""
|
||||
warnings.warn("write_cell_yaml() is deprecated.", DeprecationWarning)
|
||||
|
||||
w.write("lattice:\n")
|
||||
for axis in supercell.get_cell():
|
||||
w.write("- [ %20.15f,%20.15f,%20.15f ]\n" % tuple(axis))
|
||||
symbols = supercell.get_chemical_symbols()
|
||||
positions = supercell.get_scaled_positions()
|
||||
w.write("atoms:\n")
|
||||
for i, (s, v) in enumerate(zip(symbols, positions)):
|
||||
w.write("- symbol: %-2s # %d\n" % (s, i + 1))
|
||||
w.write(" position: [ %18.14f,%18.14f,%18.14f ]\n" % tuple(v))
|
||||
|
||||
|
||||
def write_disp_fc3_yaml(dataset, supercell, filename="disp_fc3.yaml"):
|
||||
"""Write disp_fc3.yaml."""
|
||||
warnings.warn("write_disp_fc3_yaml() is deprecated.", DeprecationWarning)
|
||||
|
||||
w = open(filename, "w")
|
||||
|
@ -158,7 +142,7 @@ def write_disp_fc3_yaml(dataset, supercell, filename="disp_fc3.yaml"):
|
|||
ids = ["%d" % disp2["id"] for disp2 in disp2_list]
|
||||
w.write(" displacement_ids: [ %s ]\n" % ", ".join(ids))
|
||||
|
||||
write_cell_yaml(w, supercell)
|
||||
_write_cell_yaml(w, supercell)
|
||||
|
||||
w.close()
|
||||
|
||||
|
@ -166,7 +150,11 @@ def write_disp_fc3_yaml(dataset, supercell, filename="disp_fc3.yaml"):
|
|||
|
||||
|
||||
def write_disp_fc2_yaml(dataset, supercell, filename="disp_fc2.yaml"):
|
||||
"""Write disp_fc2.yaml."""
|
||||
"""Write disp_fc2.yaml.
|
||||
|
||||
This function should not be called from phono3py script from version 3.
|
||||
|
||||
"""
|
||||
warnings.warn("write_disp_fc2_yaml() is deprecated.", DeprecationWarning)
|
||||
|
||||
w = open(filename, "w")
|
||||
|
@ -185,7 +173,7 @@ def write_disp_fc2_yaml(dataset, supercell, filename="disp_fc2.yaml"):
|
|||
)
|
||||
|
||||
if supercell is not None:
|
||||
write_cell_yaml(w, supercell)
|
||||
_write_cell_yaml(w, supercell)
|
||||
|
||||
w.close()
|
||||
|
||||
|
@ -271,25 +259,6 @@ def write_FORCES_FC3(disp_dataset, forces_fc3=None, fp=None, filename="FORCES_FC
|
|||
w.close()
|
||||
|
||||
|
||||
def write_fc3_dat(force_constants_third, filename="fc3.dat"):
|
||||
"""Write fc3.dat."""
|
||||
warnings.warn("write_fc3_dat() is deprecated.", DeprecationWarning)
|
||||
|
||||
w = open(filename, "w")
|
||||
for i in range(force_constants_third.shape[0]):
|
||||
for j in range(force_constants_third.shape[1]):
|
||||
for k in range(force_constants_third.shape[2]):
|
||||
tensor3 = force_constants_third[i, j, k]
|
||||
w.write(
|
||||
" %d - %d - %d (%f)\n"
|
||||
% (i + 1, j + 1, k + 1, np.abs(tensor3).sum())
|
||||
)
|
||||
for tensor2 in tensor3:
|
||||
for vec in tensor2:
|
||||
w.write("%20.14f %20.14f %20.14f\n" % tuple(vec))
|
||||
w.write("\n")
|
||||
|
||||
|
||||
def write_fc3_to_hdf5(fc3, filename="fc3.hdf5", p2s_map=None, compression="gzip"):
|
||||
"""Write fc3 in fc3.hdf5.
|
||||
|
||||
|
@ -404,64 +373,6 @@ def read_fc2_from_hdf5(filename="fc2.hdf5", p2s_map=None):
|
|||
)
|
||||
|
||||
|
||||
def write_triplets(
|
||||
triplets, weights, mesh, grid_address, grid_point=None, filename=None
|
||||
):
|
||||
"""Write triplets in triplets.dat."""
|
||||
warnings.warn("write_triplets() is deprecated.", DeprecationWarning)
|
||||
|
||||
triplets_filename = "triplets"
|
||||
suffix = "-m%d%d%d" % tuple(mesh)
|
||||
if grid_point is not None:
|
||||
suffix += "-g%d" % grid_point
|
||||
if filename is not None:
|
||||
suffix += "." + filename
|
||||
suffix += ".dat"
|
||||
triplets_filename += suffix
|
||||
w = open(triplets_filename, "w")
|
||||
for weight, g3 in zip(weights, triplets):
|
||||
w.write("%4d " % weight)
|
||||
for q3 in grid_address[g3]:
|
||||
w.write("%4d %4d %4d " % tuple(q3))
|
||||
w.write("\n")
|
||||
w.close()
|
||||
|
||||
|
||||
def write_grid_address(grid_address, mesh, filename=None):
|
||||
"""Write grid addresses in grid_address.dat."""
|
||||
warnings.warn("write_grid_address() is deprecated.", DeprecationWarning)
|
||||
|
||||
grid_address_filename = "grid_address"
|
||||
suffix = "-m%d%d%d" % tuple(mesh)
|
||||
if filename is not None:
|
||||
suffix += "." + filename
|
||||
suffix += ".dat"
|
||||
grid_address_filename += suffix
|
||||
|
||||
w = open(grid_address_filename, "w")
|
||||
w.write("# Grid addresses for %dx%dx%d mesh\n" % tuple(mesh))
|
||||
w.write(
|
||||
"#%9s %8s %8s %8s %8s %8s %8s\n"
|
||||
% (
|
||||
"index",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
("a%%%d" % mesh[0]),
|
||||
("b%%%d" % mesh[1]),
|
||||
("c%%%d" % mesh[2]),
|
||||
)
|
||||
)
|
||||
for i, bz_q in enumerate(grid_address):
|
||||
if i == np.prod(mesh):
|
||||
w.write("#" + "-" * 78 + "\n")
|
||||
q = bz_q % mesh
|
||||
w.write("%10d %8d %8d %8d " % (i, bz_q[0], bz_q[1], bz_q[2]))
|
||||
w.write("%8d %8d %8d\n" % tuple(q))
|
||||
|
||||
return grid_address_filename
|
||||
|
||||
|
||||
def write_grid_address_to_hdf5(
|
||||
grid_address,
|
||||
mesh,
|
||||
|
@ -1566,7 +1477,7 @@ def write_ir_grid_points(bz_grid, grid_points, grid_weights, primitive_lattice):
|
|||
def parse_disp_fc2_yaml(filename="disp_fc2.yaml", return_cell=False):
|
||||
"""Parse disp_fc2.yaml file.
|
||||
|
||||
This is obsolete at v2 and later versions.
|
||||
This function should not be called from phono3py script from version 3.
|
||||
|
||||
"""
|
||||
warnings.warn("parse_disp_fc2_yaml() is deprecated.", DeprecationWarning)
|
||||
|
@ -1593,7 +1504,7 @@ def parse_disp_fc2_yaml(filename="disp_fc2.yaml", return_cell=False):
|
|||
def parse_disp_fc3_yaml(filename="disp_fc3.yaml", return_cell=False):
|
||||
"""Parse disp_fc3.yaml file.
|
||||
|
||||
This is obsolete at v2 and later versions.
|
||||
This function should not be called from phono3py script from version 3.
|
||||
|
||||
"""
|
||||
warnings.warn("parse_disp_fc3_yaml() is deprecated.", DeprecationWarning)
|
||||
|
@ -1800,3 +1711,23 @@ def _parse_force_lines(forcefile, num_atom):
|
|||
return None
|
||||
else:
|
||||
return np.array(forces)
|
||||
|
||||
|
||||
def _write_cell_yaml(w, supercell):
|
||||
"""Write cell info.
|
||||
|
||||
This is only used from write_disp_fc3_yaml and write_disp_fc2_yaml.
|
||||
These methods are also deprecated.
|
||||
|
||||
"""
|
||||
warnings.warn("write_cell_yaml() is deprecated.", DeprecationWarning)
|
||||
|
||||
w.write("lattice:\n")
|
||||
for axis in supercell.get_cell():
|
||||
w.write("- [ %20.15f,%20.15f,%20.15f ]\n" % tuple(axis))
|
||||
symbols = supercell.get_chemical_symbols()
|
||||
positions = supercell.get_scaled_positions()
|
||||
w.write("atoms:\n")
|
||||
for i, (s, v) in enumerate(zip(symbols, positions)):
|
||||
w.write("- symbol: %-2s # %d\n" % (s, i + 1))
|
||||
w.write(" position: [ %18.14f,%18.14f,%18.14f ]\n" % tuple(v))
|
||||
|
|
|
@ -34,8 +34,9 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import warnings
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional, Union
|
||||
|
||||
import numpy as np
|
||||
from phonopy.harmonic.dynamical_matrix import get_dynamical_matrix
|
||||
|
@ -58,8 +59,8 @@ from phono3py.phonon.solver import run_phonon_solver_c, run_phonon_solver_py
|
|||
|
||||
def get_mass_variances(
|
||||
primitive: Optional[PhonopyAtoms] = None,
|
||||
symbols: Optional[Union[List[str], Tuple[str]]] = None,
|
||||
isotope_data: Optional[Dict] = None,
|
||||
symbols: Optional[Union[list[str], tuple[str]]] = None,
|
||||
isotope_data: Optional[dict] = None,
|
||||
):
|
||||
"""Calculate mass variances."""
|
||||
if primitive is not None:
|
||||
|
@ -176,14 +177,6 @@ class Isotope:
|
|||
else:
|
||||
self._sigma = float(sigma)
|
||||
|
||||
def set_sigma(self, sigma):
|
||||
"""Set smearing width."""
|
||||
warnings.warn(
|
||||
"Isotope.set_sigma() is deprecated." "Use Isotope.sigma attribute.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.sigma = sigma
|
||||
|
||||
@property
|
||||
def dynamical_matrix(self):
|
||||
"""Return DynamicalMatrix* class instance."""
|
||||
|
@ -199,14 +192,6 @@ class Isotope:
|
|||
"""Return scattering strength."""
|
||||
return self._gamma
|
||||
|
||||
def get_gamma(self):
|
||||
"""Return scattering strength."""
|
||||
warnings.warn(
|
||||
"Isotope.get_gamma() is deprecated." "Use Isotope.gamma attribute.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.gamma
|
||||
|
||||
@property
|
||||
def bz_grid(self):
|
||||
"""Return BZgrid class instance."""
|
||||
|
@ -217,15 +202,6 @@ class Isotope:
|
|||
"""Return mass variances."""
|
||||
return self._mass_variances
|
||||
|
||||
def get_mass_variances(self):
|
||||
"""Return mass variances."""
|
||||
warnings.warn(
|
||||
"Isotope.get_mass_variances() is deprecated."
|
||||
"Use Isotope.mass_variances attribute.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.mass_variances
|
||||
|
||||
def get_phonons(self):
|
||||
"""Return phonons on grid."""
|
||||
return self._frequencies, self._eigenvectors, self._phonon_done
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import warnings
|
||||
from collections.abc import Sequence
|
||||
from typing import Optional, Union
|
||||
|
||||
|
@ -134,37 +133,6 @@ class KappaDOSTHM:
|
|||
return bzgp2irgp_map
|
||||
|
||||
|
||||
class KappaDOS(KappaDOSTHM):
|
||||
"""Deprecated class to calculate DOS like spectram with tetrahedron method."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
mode_kappa: np.ndarray,
|
||||
frequencies: np.ndarray,
|
||||
bz_grid: BZGrid,
|
||||
ir_grid_points: np.ndarray,
|
||||
ir_grid_map: Optional[np.ndarray] = None,
|
||||
frequency_points: Optional[np.ndarray] = None,
|
||||
num_sampling_points: int = 100,
|
||||
):
|
||||
"""Init method."""
|
||||
warnings.warn(
|
||||
"KappaDOS is deprecated."
|
||||
"Use KappaDOSTHM instead with replacing ir_grid_points in BZ-grid "
|
||||
"by ir_grid_points in GR-grid.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
super().__init__(
|
||||
mode_kappa,
|
||||
frequencies,
|
||||
bz_grid,
|
||||
bz_grid.bzg2grg[ir_grid_points],
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=frequency_points,
|
||||
num_sampling_points=num_sampling_points,
|
||||
)
|
||||
|
||||
|
||||
class GammaDOSsmearing:
|
||||
"""Class to calculate Gamma spectram by smearing method."""
|
||||
|
||||
|
@ -245,7 +213,7 @@ def run_prop_dos(
|
|||
bz_grid: BZGrid,
|
||||
):
|
||||
"""Run DOS-like calculation."""
|
||||
kappa_dos = KappaDOS(
|
||||
kappa_dos = KappaDOSTHM(
|
||||
mode_prop,
|
||||
frequencies,
|
||||
bz_grid,
|
||||
|
@ -270,7 +238,7 @@ def run_mfp_dos(
|
|||
kdos = []
|
||||
sampling_points = []
|
||||
for i, _ in enumerate(mean_freepath):
|
||||
kappa_dos = KappaDOS(
|
||||
kappa_dos = KappaDOSTHM(
|
||||
mode_prop[i : i + 1, :, :],
|
||||
mean_freepath[i],
|
||||
bz_grid,
|
||||
|
|
|
@ -47,8 +47,7 @@ def get_displacements_and_forces_fc3(disp_dataset):
|
|||
Parameters
|
||||
----------
|
||||
disp_dataset : dict
|
||||
Displacement dataset that may be obtained by
|
||||
file_IO.parse_disp_fc3_yaml.
|
||||
Displacement dataset.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
|
@ -692,7 +692,7 @@ def _get_fc3_least_atoms(
|
|||
first_atom_nums = []
|
||||
for i in unique_first_atom_nums:
|
||||
if i != s2p_map[i]:
|
||||
print("Something wrong in disp_fc3.yaml")
|
||||
print("Something wrong in displacement dataset.")
|
||||
raise RuntimeError
|
||||
else:
|
||||
first_atom_nums.append(i)
|
||||
|
|
|
@ -34,4 +34,4 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
__version__ = "2.10.0"
|
||||
__version__ = "3.0.0"
|
||||
|
|
|
@ -5,15 +5,13 @@ from __future__ import annotations
|
|||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from phono3py import Phono3py
|
||||
from phono3py.other.kaccum import GammaDOSsmearing, KappaDOS, KappaDOSTHM, get_mfp
|
||||
from phono3py.other.kaccum import GammaDOSsmearing, KappaDOSTHM, get_mfp
|
||||
from phono3py.phonon.grid import get_ir_grid_points
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_legacy_class", [False, True])
|
||||
def test_kappados_si(si_pbesol: Phono3py, use_legacy_class: bool):
|
||||
def test_kappados_si(si_pbesol: Phono3py):
|
||||
"""Test KappaDOS class with Si.
|
||||
|
||||
* 3x3 tensor vs frequency
|
||||
|
@ -110,7 +108,6 @@ def test_kappados_si(si_pbesol: Phono3py, use_legacy_class: bool):
|
|||
ph3,
|
||||
tc.mode_kappa[0],
|
||||
freq_points=freq_points_in,
|
||||
use_legacy_class=use_legacy_class,
|
||||
)
|
||||
# for f, (jval, ival) in zip(freq_points, kdos):
|
||||
# print("[%.7f, %.7f, %.7f]," % (f, jval, ival))
|
||||
|
@ -122,7 +119,6 @@ def test_kappados_si(si_pbesol: Phono3py, use_legacy_class: bool):
|
|||
ph3,
|
||||
tc.gamma[0, :, :, :, None],
|
||||
freq_points=freq_points_in,
|
||||
use_legacy_class=use_legacy_class,
|
||||
)
|
||||
# for f, (jval, ival) in zip(freq_points, kdos):
|
||||
# print("[%.7f, %.7f, %.7f]," % (f, jval, ival))
|
||||
|
@ -131,9 +127,7 @@ def test_kappados_si(si_pbesol: Phono3py, use_legacy_class: bool):
|
|||
)
|
||||
|
||||
mfp_points_in = np.array(mfpdos_si).reshape(-1, 3)[:, 0]
|
||||
mfp_points, mfpdos = _calculate_mfpdos(
|
||||
ph3, mfp_points_in, use_legacy_class=use_legacy_class
|
||||
)
|
||||
mfp_points, mfpdos = _calculate_mfpdos(ph3, mfp_points_in)
|
||||
# for f, (jval, ival) in zip(mfp_points, mfpdos):
|
||||
# print("[%.7f, %.7f, %.7f]," % (f, jval, ival))
|
||||
np.testing.assert_allclose(
|
||||
|
@ -141,8 +135,7 @@ def test_kappados_si(si_pbesol: Phono3py, use_legacy_class: bool):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_legacy_class", [False, True])
|
||||
def test_kappados_nacl(nacl_pbe: Phono3py, use_legacy_class: bool):
|
||||
def test_kappados_nacl(nacl_pbe: Phono3py):
|
||||
"""Test KappaDOS class with NaCl.
|
||||
|
||||
* 3x3 tensor vs frequency
|
||||
|
@ -248,7 +241,6 @@ def test_kappados_nacl(nacl_pbe: Phono3py, use_legacy_class: bool):
|
|||
ph3,
|
||||
tc.gamma[0, :, :, :, None],
|
||||
freq_points=freq_points_in,
|
||||
use_legacy_class=use_legacy_class,
|
||||
)
|
||||
for f, (jval, ival) in zip(freq_points, kdos):
|
||||
print("[%.7f, %.7f, %.7f]," % (f, jval, ival))
|
||||
|
@ -257,9 +249,7 @@ def test_kappados_nacl(nacl_pbe: Phono3py, use_legacy_class: bool):
|
|||
)
|
||||
|
||||
mfp_points_in = np.array(mfpdos_nacl).reshape(-1, 3)[:, 0]
|
||||
mfp_points, mfpdos = _calculate_mfpdos(
|
||||
ph3, mfp_points_in, use_legacy_class=use_legacy_class
|
||||
)
|
||||
mfp_points, mfpdos = _calculate_mfpdos(ph3, mfp_points_in)
|
||||
# for f, (jval, ival) in zip(mfp_points, mfpdos):
|
||||
# print("[%.7f, %.7f, %.7f]," % (f, jval, ival))
|
||||
np.testing.assert_allclose(
|
||||
|
@ -305,79 +295,42 @@ def _calculate_kappados(
|
|||
ph3: Phono3py,
|
||||
mode_prop: np.ndarray,
|
||||
freq_points: Optional[np.ndarray] = None,
|
||||
use_legacy_class: bool = False,
|
||||
):
|
||||
tc = ph3.thermal_conductivity
|
||||
bz_grid = ph3.grid
|
||||
frequencies, _, _ = ph3.get_phonon_data()
|
||||
with pytest.deprecated_call():
|
||||
kappados = KappaDOS(
|
||||
mode_prop,
|
||||
frequencies,
|
||||
bz_grid,
|
||||
tc.grid_points,
|
||||
frequency_points=freq_points,
|
||||
)
|
||||
freq_points, kdos = kappados.get_kdos()
|
||||
|
||||
ir_grid_points, _, ir_grid_map = get_ir_grid_points(bz_grid)
|
||||
if use_legacy_class:
|
||||
with pytest.deprecated_call():
|
||||
kappados = KappaDOS(
|
||||
mode_prop,
|
||||
tc.frequencies,
|
||||
bz_grid,
|
||||
tc.grid_points,
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=freq_points,
|
||||
)
|
||||
else:
|
||||
kappados = KappaDOSTHM(
|
||||
mode_prop,
|
||||
tc.frequencies,
|
||||
bz_grid,
|
||||
bz_grid.bzg2grg[tc.grid_points],
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=freq_points,
|
||||
)
|
||||
kappados = KappaDOSTHM(
|
||||
mode_prop,
|
||||
tc.frequencies,
|
||||
bz_grid,
|
||||
bz_grid.bzg2grg[tc.grid_points],
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=freq_points,
|
||||
)
|
||||
ir_freq_points, ir_kdos = kappados.get_kdos()
|
||||
np.testing.assert_equal(bz_grid.bzg2grg[tc.grid_points], ir_grid_points)
|
||||
np.testing.assert_allclose(ir_freq_points, freq_points, rtol=0, atol=1e-5)
|
||||
np.testing.assert_allclose(ir_kdos, kdos, rtol=0, atol=1e-5)
|
||||
|
||||
return freq_points, kdos[0, :, :, 0]
|
||||
return freq_points, ir_kdos[0, :, :, 0]
|
||||
|
||||
|
||||
def _calculate_mfpdos(
|
||||
ph3: Phono3py,
|
||||
mfp_points=None,
|
||||
use_legacy_class: bool = False,
|
||||
):
|
||||
tc = ph3.thermal_conductivity
|
||||
bz_grid = ph3.grid
|
||||
mean_freepath = get_mfp(tc.gamma[0], tc.group_velocities)
|
||||
_, _, ir_grid_map = get_ir_grid_points(bz_grid)
|
||||
if use_legacy_class:
|
||||
with pytest.deprecated_call():
|
||||
mfpdos = KappaDOS(
|
||||
tc.mode_kappa[0],
|
||||
mean_freepath[0],
|
||||
bz_grid,
|
||||
tc.grid_points,
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=mfp_points,
|
||||
num_sampling_points=10,
|
||||
)
|
||||
else:
|
||||
mfpdos = KappaDOSTHM(
|
||||
tc.mode_kappa[0],
|
||||
mean_freepath[0],
|
||||
bz_grid,
|
||||
bz_grid.bzg2grg[tc.grid_points],
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=mfp_points,
|
||||
num_sampling_points=10,
|
||||
)
|
||||
mfpdos = KappaDOSTHM(
|
||||
tc.mode_kappa[0],
|
||||
mean_freepath[0],
|
||||
bz_grid,
|
||||
bz_grid.bzg2grg[tc.grid_points],
|
||||
ir_grid_map=ir_grid_map,
|
||||
frequency_points=mfp_points,
|
||||
num_sampling_points=10,
|
||||
)
|
||||
freq_points, kdos = mfpdos.get_kdos()
|
||||
|
||||
return freq_points, kdos[0, :, :, 0]
|
||||
|
|
Loading…
Reference in New Issue