mirror of https://github.com/phonopy/phono3py.git
Wrote thermal conductivity tests
This commit is contained in:
parent
3904e13306
commit
5d6609dfd5
|
@ -857,9 +857,13 @@ class Phono3py(object):
|
|||
elif 'displacements' in dataset or 'forces' in dataset:
|
||||
dataset['forces'] = forces
|
||||
|
||||
def get_phph_interaction(self):
|
||||
@property
|
||||
def phph_interaction(self):
|
||||
return self._interaction
|
||||
|
||||
def get_phph_interaction(self):
|
||||
return self.phph_interaction
|
||||
|
||||
def init_phph_interaction(self,
|
||||
nac_q_direction=None,
|
||||
constant_averaged_interaction=None,
|
||||
|
|
|
@ -54,8 +54,8 @@ class CollisionMatrix(ImagSelfEnergy):
|
|||
self._ir_grid_points = ir_grid_points
|
||||
self._rot_grid_points = rot_grid_points
|
||||
self._point_operations = point_operations
|
||||
self._primitive = self._pp.get_primitive()
|
||||
rec_lat = np.linalg.inv(self._primitive.get_cell())
|
||||
self._primitive = self._pp.primitive
|
||||
rec_lat = np.linalg.inv(self._primitive.cell)
|
||||
self._rotations_cartesian = np.array(
|
||||
[similarity_transformation(rec_lat, r)
|
||||
for r in self._point_operations], dtype='double', order='C')
|
||||
|
@ -92,9 +92,9 @@ class CollisionMatrix(ImagSelfEnergy):
|
|||
self._weights_at_q,
|
||||
self._triplets_map_at_q,
|
||||
self._ir_map_at_q) = self._pp.get_triplets_at_q()
|
||||
self._grid_address = self._pp.get_grid_address()
|
||||
self._grid_address = self._pp.grid_address
|
||||
self._grid_point = grid_point
|
||||
self._bz_map = self._pp.get_bz_map()
|
||||
self._bz_map = self._pp.bz_map
|
||||
self._frequencies, self._eigenvectors, _ = self._pp.get_phonons()
|
||||
|
||||
def _run_collision_matrix(self):
|
||||
|
|
|
@ -904,8 +904,8 @@ class Conductivity_LBTE(Conductivity):
|
|||
self._show_log(i)
|
||||
|
||||
def _allocate_values(self):
|
||||
num_band0 = len(self._pp.get_band_indices())
|
||||
num_band = self._primitive.get_number_of_atoms() * 3
|
||||
num_band0 = len(self._pp.band_indices)
|
||||
num_band = len(self._primitive) * 3
|
||||
num_ir_grid_points = len(self._ir_grid_points)
|
||||
num_temp = len(self._temperatures)
|
||||
num_mesh_points = np.prod(self._mesh)
|
||||
|
|
|
@ -298,11 +298,11 @@ class ImagSelfEnergy(object):
|
|||
self._pp.run(lang=self._lang)
|
||||
else:
|
||||
self._pp.run(lang=self._lang, g_zero=self._g_zero)
|
||||
self._pp_strength = self._pp.get_interaction_strength()
|
||||
self._pp_strength = self._pp.interaction_strength
|
||||
|
||||
def set_integration_weights(self, scattering_event_class=None):
|
||||
if self._frequency_points is None:
|
||||
bi = self._pp.get_band_indices()
|
||||
bi = self._pp.band_indices
|
||||
f_points = self._frequencies[self._grid_point][bi]
|
||||
else:
|
||||
f_points = self._frequency_points
|
||||
|
@ -618,5 +618,5 @@ class ImagSelfEnergy(object):
|
|||
|
||||
def _average_by_degeneracy(self, imag_self_energy):
|
||||
return average_by_degeneracy(imag_self_energy,
|
||||
self._pp.get_band_indices(),
|
||||
self._pp.band_indices,
|
||||
self._frequencies[self._grid_point])
|
||||
|
|
|
@ -537,11 +537,11 @@ def _set_triplets_integration_weights_c(g,
|
|||
neighboring_phonons=False):
|
||||
import phono3py._phono3py as phono3c
|
||||
|
||||
reciprocal_lattice = np.linalg.inv(interaction.get_primitive().get_cell())
|
||||
mesh = interaction.get_mesh_numbers()
|
||||
reciprocal_lattice = np.linalg.inv(interaction.primitive.cell)
|
||||
mesh = interaction.mesh_numbers
|
||||
thm = TetrahedronMethod(reciprocal_lattice, mesh=mesh)
|
||||
grid_address = interaction.get_grid_address()
|
||||
bz_map = interaction.get_bz_map()
|
||||
grid_address = interaction.grid_address
|
||||
bz_map = interaction.bz_map
|
||||
triplets_at_q = interaction.get_triplets_at_q()[0]
|
||||
|
||||
if neighboring_phonons:
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
import os
|
||||
import pytest
|
||||
import phono3py
|
||||
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def si_pbesol():
|
||||
return phono3py.load("phono3py_si_pbesol.yaml",
|
||||
forces_fc3_filename="FORCES_FC3_si_pbesol",
|
||||
yaml_filename = os.path.join(current_dir, "phono3py_si_pbesol.yaml")
|
||||
forces_fc3_filename = os.path.join(current_dir, "FORCES_FC3_si_pbesol")
|
||||
return phono3py.load(yaml_filename,
|
||||
forces_fc3_filename=forces_fc3_filename,
|
||||
log_level=1)
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
import numpy as np
|
||||
|
||||
si_pbesol_kappa = [107.991, 107.991, 107.991, 0, 0, 0]
|
||||
si_pbesol_kappa_RTA = [107.991, 107.991, 107.991, 0, 0, 0]
|
||||
si_pbesol_kappa_LBTE = [111.802, 111.802, 111.802, 0, 0, 0]
|
||||
|
||||
|
||||
def test_Phono3py(si_pbesol):
|
||||
def test_kappa_RTA(si_pbesol):
|
||||
si_pbesol.mesh_numbers = [9, 9, 9]
|
||||
si_pbesol.init_phph_interaction()
|
||||
si_pbesol.run_thermal_conductivity(temperatures=[300, ])
|
||||
kappa = si_pbesol.thermal_conductivity.kappa.ravel()
|
||||
np.testing.assert_allclose(si_pbesol_kappa, kappa, atol=0.1)
|
||||
np.testing.assert_allclose(si_pbesol_kappa_RTA, kappa, atol=0.1)
|
||||
|
||||
|
||||
def test_kappa_LBTE(si_pbesol):
|
||||
si_pbesol.mesh_numbers = [9, 9, 9]
|
||||
si_pbesol.init_phph_interaction()
|
||||
si_pbesol.run_thermal_conductivity(is_LBTE=True, temperatures=[300, ])
|
||||
kappa = si_pbesol.thermal_conductivity.kappa.ravel()
|
||||
np.testing.assert_allclose(si_pbesol_kappa_LBTE, kappa, atol=0.1)
|
||||
|
|
Loading…
Reference in New Issue