mirror of https://github.com/phonopy/phono3py.git
Merge pull request #200 from phonopy/remove-v1-compativility
Remove v1 compatibility
This commit is contained in:
commit
7f55f9bee9
|
@ -33,8 +33,6 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
from phonopy.units import VaspToTHz
|
||||
|
||||
|
@ -53,7 +51,6 @@ class Phono3pyIsotope:
|
|||
sigmas=None,
|
||||
frequency_factor_to_THz=VaspToTHz,
|
||||
use_grg=False,
|
||||
store_dense_gp_map=True,
|
||||
symprec=1e-5,
|
||||
cutoff_frequency=None,
|
||||
lapack_zheev_uplo="L",
|
||||
|
@ -66,13 +63,6 @@ class Phono3pyIsotope:
|
|||
else:
|
||||
self._sigmas = sigmas
|
||||
|
||||
if not store_dense_gp_map:
|
||||
warnings.warn(
|
||||
"Phono3pyIsotope init parameter of store_dense_gp_map is deprecated. "
|
||||
"This will be always set True.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
|
||||
self._iso = Isotope(
|
||||
mesh,
|
||||
primitive,
|
||||
|
@ -80,7 +70,6 @@ class Phono3pyIsotope:
|
|||
band_indices=band_indices,
|
||||
frequency_factor_to_THz=frequency_factor_to_THz,
|
||||
use_grg=use_grg,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
symprec=symprec,
|
||||
cutoff_frequency=cutoff_frequency,
|
||||
lapack_zheev_uplo=lapack_zheev_uplo,
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
from phonopy.structure.cells import Primitive, Supercell
|
||||
from phonopy.structure.symmetry import Symmetry
|
||||
|
@ -72,7 +70,6 @@ class Phono3pyJointDos:
|
|||
SNF_coordinates="reciprocal",
|
||||
is_mesh_symmetry=True,
|
||||
is_symmetry=True,
|
||||
store_dense_gp_map=True,
|
||||
symprec=1e-5,
|
||||
output_filename=None,
|
||||
log_level=0,
|
||||
|
@ -94,14 +91,6 @@ class Phono3pyJointDos:
|
|||
self._is_mesh_symmetry = is_mesh_symmetry
|
||||
self._is_symmetry = is_symmetry
|
||||
|
||||
if not store_dense_gp_map:
|
||||
warnings.warn(
|
||||
"Phono3pyJointDos init parameter of store_dense_gp_map is deprecated. "
|
||||
"This will be set always True.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._store_dense_gp_map = store_dense_gp_map
|
||||
|
||||
self._use_grg = use_grg
|
||||
self._SNF_coordinates = SNF_coordinates
|
||||
self._symprec = symprec
|
||||
|
@ -165,7 +154,7 @@ class Phono3pyJointDos:
|
|||
use_grg=self._use_grg,
|
||||
force_SNF=False,
|
||||
SNF_coordinates=self._SNF_coordinates,
|
||||
store_dense_gp_map=self._store_dense_gp_map,
|
||||
store_dense_gp_map=True,
|
||||
)
|
||||
|
||||
def initialize(self, mesh_numbers):
|
||||
|
@ -180,7 +169,6 @@ class Phono3pyJointDos:
|
|||
frequency_factor_to_THz=self._frequency_factor_to_THz,
|
||||
frequency_scale_factor=self._frequency_scale_factor,
|
||||
is_mesh_symmetry=self._is_mesh_symmetry,
|
||||
store_dense_gp_map=self._store_dense_gp_map,
|
||||
symprec=self._symprec,
|
||||
filename=self._filename,
|
||||
log_level=self._log_level,
|
||||
|
|
|
@ -153,13 +153,10 @@ class Phono3py:
|
|||
is_mesh_symmetry=True,
|
||||
use_grg=False,
|
||||
SNF_coordinates="reciprocal",
|
||||
symmetrize_fc3q=None,
|
||||
store_dense_gp_map=True,
|
||||
store_dense_svecs=True,
|
||||
make_r0_average: bool = False,
|
||||
symprec=1e-5,
|
||||
calculator: Optional[str] = None,
|
||||
log_level=0,
|
||||
lapack_zheev_uplo=None,
|
||||
):
|
||||
"""Init method.
|
||||
|
||||
|
@ -213,14 +210,11 @@ class Phono3py:
|
|||
`reciprocal` or `direct`. Space of coordinates to generate grid
|
||||
generating matrix either in direct or reciprocal space. The default
|
||||
is `reciprocal`.
|
||||
symmetrize_fc3q : Deprecated.
|
||||
See Phono3py.init_phph_interaction().
|
||||
store_dense_gp_map : bool, optional, Deprecated.
|
||||
Use dense format of BZ grid system. Default is True.
|
||||
store_dense_svecs : bool, optional, Deprecated.
|
||||
Shortest vectors are stored in the dense array format. This is
|
||||
expected to be always True. Setting False is for rough compatibility
|
||||
with v1.x. Default is True.
|
||||
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.
|
||||
symprec : float, optional
|
||||
Tolerance used to find crystal symmetry. Default is 1e-5.
|
||||
calculator : str, optional.
|
||||
|
@ -228,8 +222,6 @@ class Phono3py:
|
|||
of physical units. Default is None, which is equivalent to "vasp".
|
||||
log_level : int, optional
|
||||
Verbosity control. Default is 0. This can be 0, 1, or 2.
|
||||
lapack_zheev_uplo : Deprecated.
|
||||
See Phono3py.init_phph_interaction().
|
||||
|
||||
"""
|
||||
self._symprec = symprec
|
||||
|
@ -239,21 +231,13 @@ class Phono3py:
|
|||
self._use_grg = use_grg
|
||||
self._SNF_coordinates = SNF_coordinates
|
||||
|
||||
if not store_dense_gp_map:
|
||||
if not make_r0_average:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of store_dense_gp_map is deprecated. "
|
||||
"This will be set always True.",
|
||||
"Phono3py init parameter of make_r0_average is deprecated. "
|
||||
"This is always True but exists for backward compatibility.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._store_dense_gp_map = store_dense_gp_map
|
||||
|
||||
if not store_dense_svecs:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of store_dense_svecs is deprecated. "
|
||||
"This will be set always True.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._store_dense_svecs = store_dense_svecs
|
||||
self._make_r0_average = make_r0_average
|
||||
|
||||
self._cutoff_frequency = cutoff_frequency
|
||||
self._calculator: Optional[str] = calculator
|
||||
|
@ -361,26 +345,6 @@ class Phono3py:
|
|||
)
|
||||
self.sigma_cutoff = sigma_cutoff
|
||||
|
||||
if symmetrize_fc3q is not None:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of symmetrize_fc3q is deprecated. "
|
||||
"Set this at Phono3py.init_phph_interaction().",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._symmetrize_fc3q = symmetrize_fc3q
|
||||
else:
|
||||
self._symmetrize_fc3q = None
|
||||
|
||||
if lapack_zheev_uplo is not None:
|
||||
warnings.warn(
|
||||
"Phono3py init parameter of lapack_zheev_uplo is deprecated. "
|
||||
"Set this at Phono3py.init_phph_interaction().",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self._lapack_zheev_uplo = lapack_zheev_uplo
|
||||
else:
|
||||
self._lapack_zheev_uplo = None
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
"""Return phono3py release version number.
|
||||
|
@ -1331,8 +1295,7 @@ class Phono3py:
|
|||
nac_q_direction=None,
|
||||
constant_averaged_interaction=None,
|
||||
frequency_scale_factor=None,
|
||||
symmetrize_fc3q=False,
|
||||
make_r0_average=False,
|
||||
symmetrize_fc3q: bool = False,
|
||||
lapack_zheev_uplo="L",
|
||||
openmp_per_triplets=None,
|
||||
):
|
||||
|
@ -1367,10 +1330,6 @@ class Phono3py:
|
|||
symmetrize_fc3q : bool, optional
|
||||
fc3 in phonon space is symmetrized by permutation symmetry.
|
||||
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.
|
||||
lapack_zheev_uplo : str, optional
|
||||
'L' or 'U'. Default is 'L'. This is passed to LAPACK zheev
|
||||
used for phonon solver.
|
||||
|
@ -1389,16 +1348,6 @@ class Phono3py:
|
|||
msg = "Phono3py.fc2 of instance is not found."
|
||||
raise RuntimeError(msg)
|
||||
|
||||
if self._symmetrize_fc3q is None:
|
||||
_symmetrize_fc3q = symmetrize_fc3q
|
||||
else:
|
||||
_symmetrize_fc3q = self._symmetrize_fc3q
|
||||
|
||||
if self._lapack_zheev_uplo is None:
|
||||
_lapack_zheev_uplo = lapack_zheev_uplo
|
||||
else:
|
||||
_lapack_zheev_uplo = self._lapack_zheev_uplo
|
||||
|
||||
self._interaction = Interaction(
|
||||
self._primitive,
|
||||
self._bz_grid,
|
||||
|
@ -1410,9 +1359,9 @@ class Phono3py:
|
|||
frequency_scale_factor=frequency_scale_factor,
|
||||
cutoff_frequency=self._cutoff_frequency,
|
||||
is_mesh_symmetry=self._is_mesh_symmetry,
|
||||
symmetrize_fc3q=_symmetrize_fc3q,
|
||||
make_r0_average=make_r0_average,
|
||||
lapack_zheev_uplo=_lapack_zheev_uplo,
|
||||
symmetrize_fc3q=symmetrize_fc3q,
|
||||
make_r0_average=self._make_r0_average,
|
||||
lapack_zheev_uplo=lapack_zheev_uplo,
|
||||
openmp_per_triplets=openmp_per_triplets,
|
||||
)
|
||||
self._interaction.nac_q_direction = nac_q_direction
|
||||
|
@ -2545,9 +2494,7 @@ class Phono3py:
|
|||
else:
|
||||
t_mat = np.dot(inv_supercell_matrix, primitive_matrix)
|
||||
|
||||
return get_primitive(
|
||||
supercell, t_mat, self._symprec, store_dense_svecs=self._store_dense_svecs
|
||||
)
|
||||
return get_primitive(supercell, t_mat, self._symprec, store_dense_svecs=True)
|
||||
|
||||
def _determine_primitive_matrix(self, primitive_matrix):
|
||||
pmat = get_primitive_matrix(primitive_matrix, symprec=self._symprec)
|
||||
|
@ -2571,7 +2518,7 @@ class Phono3py:
|
|||
use_grg=self._use_grg,
|
||||
force_SNF=False,
|
||||
SNF_coordinates=self._SNF_coordinates,
|
||||
store_dense_gp_map=self._store_dense_gp_map,
|
||||
store_dense_gp_map=True,
|
||||
)
|
||||
|
||||
def _init_dynamical_matrix(self):
|
||||
|
|
|
@ -77,8 +77,6 @@ def load(
|
|||
is_mesh_symmetry=True,
|
||||
is_compact_fc=False,
|
||||
use_grg=False,
|
||||
store_dense_gp_map=True,
|
||||
store_dense_svecs=True,
|
||||
symprec=1e-5,
|
||||
log_level=0,
|
||||
) -> Phono3py:
|
||||
|
@ -229,12 +227,6 @@ def load(
|
|||
cells. Default is False.
|
||||
use_grg : bool, optional
|
||||
Use generalized regular grid when True. Default is False.
|
||||
store_dense_gp_map : bool, optional, Deprecated
|
||||
Use new format of BZ grid system. Default is True.
|
||||
store_dense_svecs : bool, optional, Deprecated
|
||||
Shortest vectors are stored in the dense array format. This is expected
|
||||
to be always True. Setting False is for rough compatibility with v1.x.
|
||||
Default is True.
|
||||
symprec : float, optional
|
||||
Tolerance used to find crystal symmetry. Default is 1e-5.
|
||||
log_level : int, optional
|
||||
|
@ -305,8 +297,6 @@ def load(
|
|||
is_symmetry=is_symmetry,
|
||||
is_mesh_symmetry=is_mesh_symmetry,
|
||||
use_grg=use_grg,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
store_dense_svecs=store_dense_svecs,
|
||||
calculator=calculator,
|
||||
log_level=log_level,
|
||||
)
|
||||
|
|
|
@ -741,6 +741,7 @@ def init_phono3py(
|
|||
is_symmetry=settings.is_symmetry,
|
||||
is_mesh_symmetry=settings.is_mesh_symmetry,
|
||||
use_grg=settings.use_grg,
|
||||
make_r0_average=settings.is_fc3_r0_average,
|
||||
symprec=symprec,
|
||||
calculator=interface_mode,
|
||||
log_level=log_level,
|
||||
|
@ -1036,7 +1037,6 @@ def init_phph_interaction(
|
|||
constant_averaged_interaction=ave_pp,
|
||||
frequency_scale_factor=updated_settings["frequency_scale_factor"],
|
||||
symmetrize_fc3q=settings.is_symmetrize_fc3_q,
|
||||
make_r0_average=settings.is_fc3_r0_average,
|
||||
lapack_zheev_uplo=settings.lapack_zheev_uplo,
|
||||
)
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ class Isotope:
|
|||
bz_grid=None,
|
||||
frequency_factor_to_THz=VaspToTHz,
|
||||
use_grg=False,
|
||||
store_dense_gp_map=True,
|
||||
symprec=1e-5,
|
||||
cutoff_frequency=None,
|
||||
lapack_zheev_uplo="L",
|
||||
|
@ -146,7 +145,7 @@ class Isotope:
|
|||
lattice=self._primitive.cell,
|
||||
symmetry_dataset=primitive_symmetry.dataset,
|
||||
use_grg=use_grg,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
store_dense_gp_map=True,
|
||||
)
|
||||
|
||||
def set_grid_point(self, grid_point):
|
||||
|
|
|
@ -36,8 +36,10 @@
|
|||
import numpy as np
|
||||
from phonopy.structure.tetrahedron_method import TetrahedronMethod
|
||||
|
||||
from phono3py.phonon.grid import BZGrid
|
||||
|
||||
def get_unique_grid_points(grid_points, bz_grid):
|
||||
|
||||
def get_unique_grid_points(grid_points, bz_grid: BZGrid):
|
||||
"""Collect grid points on tetrahedron vertices around input grid points.
|
||||
|
||||
Find grid points of 24 tetrahedra around each grid point and
|
||||
|
@ -88,7 +90,7 @@ def get_unique_grid_points(grid_points, bz_grid):
|
|||
def get_integration_weights(
|
||||
sampling_points,
|
||||
grid_values,
|
||||
bz_grid,
|
||||
bz_grid: BZGrid,
|
||||
grid_points=None,
|
||||
bzgp2irgp_map=None,
|
||||
function="I",
|
||||
|
|
|
@ -37,7 +37,8 @@ import sys
|
|||
|
||||
import numpy as np
|
||||
from phonopy.harmonic.dynamical_matrix import get_dynamical_matrix
|
||||
from phonopy.structure.cells import sparse_to_dense_svecs
|
||||
from phonopy.structure.atoms import PhonopyAtoms
|
||||
from phonopy.structure.cells import Primitive
|
||||
from phonopy.structure.grid_points import get_qpoints
|
||||
from phonopy.units import VaspToTHz
|
||||
|
||||
|
@ -126,8 +127,8 @@ class Gruneisen:
|
|||
self,
|
||||
fc2,
|
||||
fc3,
|
||||
supercell,
|
||||
primitive,
|
||||
supercell: PhonopyAtoms,
|
||||
primitive: Primitive,
|
||||
nac_params=None,
|
||||
nac_q_direction=None,
|
||||
ion_clamped=False,
|
||||
|
@ -151,12 +152,7 @@ class Gruneisen:
|
|||
)
|
||||
self._nac_q_direction = nac_q_direction
|
||||
|
||||
svecs, multi = self._pcell.get_smallest_vectors()
|
||||
if self._pcell.store_dense_svecs:
|
||||
self._svecs = svecs
|
||||
self._multi = multi
|
||||
else:
|
||||
self._svecs, self._multi = sparse_to_dense_svecs(svecs, multi)
|
||||
self._svecs, self._multi = self._pcell.get_smallest_vectors()
|
||||
|
||||
if self._ion_clamped:
|
||||
num_atom_prim = len(self._pcell)
|
||||
|
|
|
@ -40,11 +40,7 @@ from typing import Literal, Optional, Union
|
|||
|
||||
import numpy as np
|
||||
from phonopy.harmonic.dynamical_matrix import DynamicalMatrix, get_dynamical_matrix
|
||||
from phonopy.structure.cells import (
|
||||
Primitive,
|
||||
compute_all_sg_permutations,
|
||||
sparse_to_dense_svecs,
|
||||
)
|
||||
from phonopy.structure.cells import Primitive, compute_all_sg_permutations
|
||||
from phonopy.structure.symmetry import Symmetry
|
||||
from phonopy.units import AMU, EV, Angstrom, Hbar, THz, VaspToTHz
|
||||
|
||||
|
@ -171,12 +167,7 @@ class Interaction:
|
|||
|
||||
self._band_index_count = 0
|
||||
|
||||
svecs, multi = self._primitive.get_smallest_vectors()
|
||||
if self._primitive.store_dense_svecs:
|
||||
self._svecs = svecs
|
||||
self._multi = multi
|
||||
else:
|
||||
self._svecs, self._multi = sparse_to_dense_svecs(svecs, multi)
|
||||
self._svecs, self._multi = self._primitive.get_smallest_vectors()
|
||||
self._masses = np.array(self._primitive.masses, dtype="double")
|
||||
self._p2s = np.array(self._primitive.p2s_map, dtype="int_")
|
||||
self._s2p = np.array(self._primitive.s2p_map, dtype="int_")
|
||||
|
|
|
@ -68,7 +68,6 @@ class JointDos:
|
|||
frequency_factor_to_THz=VaspToTHz,
|
||||
frequency_scale_factor=1.0,
|
||||
is_mesh_symmetry=True,
|
||||
store_dense_gp_map=False,
|
||||
symprec=1e-5,
|
||||
filename=None,
|
||||
log_level=False,
|
||||
|
@ -93,7 +92,6 @@ class JointDos:
|
|||
self._frequency_factor_to_THz = frequency_factor_to_THz
|
||||
self._frequency_scale_factor = frequency_scale_factor
|
||||
self._is_mesh_symmetry = is_mesh_symmetry
|
||||
self._store_dense_gp_map = store_dense_gp_map
|
||||
self._symprec = symprec
|
||||
self._filename = filename
|
||||
self._log_level = log_level
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import numpy as np
|
||||
from phonopy.structure.cells import sparse_to_dense_svecs
|
||||
|
||||
|
||||
class RealToReciprocal:
|
||||
|
@ -50,12 +49,7 @@ class RealToReciprocal:
|
|||
self._p2s_map = primitive.p2s_map
|
||||
self._s2p_map = primitive.s2p_map
|
||||
# Reduce supercell atom index to primitive index
|
||||
svecs, multi = self._primitive.get_smallest_vectors()
|
||||
if self._primitive.store_dense_svecs:
|
||||
self._svecs = svecs
|
||||
self._multi = multi
|
||||
else:
|
||||
self._svecs, self._multi = sparse_to_dense_svecs(svecs, multi)
|
||||
self._svecs, self._multi = self._primitive.get_smallest_vectors()
|
||||
self._fc3_reciprocal = None
|
||||
|
||||
def run(self, triplet):
|
||||
|
|
|
@ -70,8 +70,6 @@ def get_triplets_at_q(
|
|||
Inversion symemtry is added if it doesn't exist. Default is True.
|
||||
swappable : bool, optional
|
||||
q1 and q2 among (q0, q1, q2) can be swapped. Deafult is True.
|
||||
store_dense_gp_map : bool, optional
|
||||
See the detail in the docstring of ``_relocate_BZ_grid_address``.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
@ -343,7 +341,10 @@ def _get_BZ_triplets_at_q(bz_grid_index, bz_grid: BZGrid, map_triplets):
|
|||
|
||||
|
||||
def _set_triplets_integration_weights_c(
|
||||
g, g_zero, pp: Union["Interaction", "JointDos"], frequency_points
|
||||
g: np.ndarray,
|
||||
g_zero: np.ndarray,
|
||||
pp: Union["Interaction", "JointDos"],
|
||||
frequency_points,
|
||||
):
|
||||
import phono3py._phono3py as phono3c
|
||||
|
||||
|
|
|
@ -57,7 +57,10 @@ def test_kappa_LBTE_aln(aln_lda: Phono3py):
|
|||
def test_kappa_LBTE_aln_with_r0_ave(aln_lda: Phono3py):
|
||||
"""Test direct solution by AlN."""
|
||||
aln_lda.mesh_numbers = [7, 7, 5]
|
||||
aln_lda.init_phph_interaction(make_r0_average=True)
|
||||
make_r0_average_orig = aln_lda._make_r0_average
|
||||
aln_lda._make_r0_average = True
|
||||
aln_lda.init_phph_interaction()
|
||||
aln_lda._make_r0_average = make_r0_average_orig
|
||||
aln_lda.run_thermal_conductivity(
|
||||
is_LBTE=True,
|
||||
temperatures=[
|
||||
|
|
|
@ -369,7 +369,7 @@ def test_kappa_RTA_aln_with_sigma_and_r0_ave(aln_lda: Phono3py):
|
|||
|
||||
|
||||
def _get_kappa(
|
||||
ph3,
|
||||
ph3: Phono3py,
|
||||
mesh,
|
||||
is_isotope=False,
|
||||
is_full_pp=False,
|
||||
|
@ -377,9 +377,10 @@ def _get_kappa(
|
|||
make_r0_average=False,
|
||||
):
|
||||
ph3.mesh_numbers = mesh
|
||||
ph3.init_phph_interaction(
|
||||
make_r0_average=make_r0_average, openmp_per_triplets=openmp_per_triplets
|
||||
)
|
||||
make_r0_average_orig = ph3._make_r0_average
|
||||
ph3._make_r0_average = make_r0_average
|
||||
ph3.init_phph_interaction(openmp_per_triplets=openmp_per_triplets)
|
||||
ph3._make_r0_average = make_r0_average_orig
|
||||
ph3.run_thermal_conductivity(
|
||||
temperatures=[
|
||||
300,
|
||||
|
|
|
@ -12,16 +12,15 @@ import phono3py
|
|||
from phono3py import Phono3py
|
||||
|
||||
cwd = Path(__file__).parent
|
||||
store_dense_gp_map = True
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
"""Activate v1 emulation with --v1 option."""
|
||||
"""Activate v2 emulation with --v2 option."""
|
||||
parser.addoption(
|
||||
"--v1",
|
||||
action="store_false",
|
||||
default=True,
|
||||
help="Run with phono3py v1.x emulation.",
|
||||
"--v2",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Run with phono3py v2.x emulation.",
|
||||
)
|
||||
|
||||
|
||||
|
@ -59,12 +58,10 @@ def si_pbesol(request) -> Phono3py:
|
|||
"""
|
||||
yaml_filename = cwd / "phono3py_si_pbesol.yaml"
|
||||
forces_fc3_filename = cwd / "FORCES_FC3_si_pbesol"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
forces_fc3_filename=forces_fc3_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -80,12 +77,10 @@ def si_pbesol_grg(request) -> Phono3py:
|
|||
"""
|
||||
yaml_filename = cwd / "phono3py_si_pbesol.yaml"
|
||||
forces_fc3_filename = cwd / "FORCES_FC3_si_pbesol"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
forces_fc3_filename=forces_fc3_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
use_grg=True,
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -101,14 +96,12 @@ def si_pbesol_nosym(request) -> Phono3py:
|
|||
"""
|
||||
yaml_filename = cwd / "phono3py_si_pbesol.yaml"
|
||||
forces_fc3_filename = cwd / "FORCES_FC3_si_pbesol"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
forces_fc3_filename=forces_fc3_filename,
|
||||
is_symmetry=False,
|
||||
produce_fc=False,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -123,14 +116,12 @@ def si_pbesol_nomeshsym(request) -> Phono3py:
|
|||
"""
|
||||
yaml_filename = cwd / "phono3py_si_pbesol.yaml"
|
||||
forces_fc3_filename = cwd / "FORCES_FC3_si_pbesol"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
forces_fc3_filename=forces_fc3_filename,
|
||||
is_mesh_symmetry=False,
|
||||
produce_fc=False,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -145,13 +136,11 @@ def si_pbesol_compact_fc(request) -> Phono3py:
|
|||
"""
|
||||
yaml_filename = cwd / "phono3py_si_pbesol.yaml"
|
||||
forces_fc3_filename = cwd / "FORCES_FC3_si_pbesol"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
forces_fc3_filename=forces_fc3_filename,
|
||||
is_compact_fc=True,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -165,11 +154,9 @@ def si_pbesol_111(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_Si111.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -186,11 +173,9 @@ def si_pbesol_111_alm(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si111.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="alm",
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -218,11 +203,9 @@ def si_pbesol_111_222_fd(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -239,11 +222,9 @@ def si_pbesol_111_222_alm(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="alm",
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -261,11 +242,9 @@ def si_pbesol_111_222_alm_fd(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="alm|",
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -283,11 +262,9 @@ def si_pbesol_111_222_fd_alm(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="|alm",
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -306,11 +283,9 @@ def si_pbesol_111_222_alm_cutoff(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="alm",
|
||||
fc_calculator_options="cutoff = 3",
|
||||
log_level=1,
|
||||
|
@ -330,11 +305,9 @@ def si_pbesol_111_222_alm_cutoff_fc2(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="alm",
|
||||
fc_calculator_options="cutoff = 3|",
|
||||
log_level=1,
|
||||
|
@ -354,11 +327,9 @@ def si_pbesol_111_222_alm_cutoff_fc3(request) -> Phono3py:
|
|||
pytest.importorskip("alm")
|
||||
|
||||
yaml_filename = cwd / "phono3py_params_Si-111-222.yaml"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
fc_calculator="alm",
|
||||
fc_calculator_options="|cutoff = 3",
|
||||
log_level=1,
|
||||
|
@ -374,11 +345,9 @@ def nacl_pbe(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_NaCl222.yaml.xz"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
@ -392,11 +361,9 @@ def nacl_pbe_compact_fc(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_NaCl222.yaml.xz"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
is_compact_fc=True,
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -410,11 +377,9 @@ def nacl_pbe_cutoff_fc3(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_NaCl222.yaml.xz"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
ph3 = phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
produce_fc=False,
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -444,11 +409,9 @@ def nacl_pbe_cutoff_fc3_all_forces(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_NaCl222.yaml.xz"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
ph3 = phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
produce_fc=False,
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -469,11 +432,9 @@ def nacl_pbe_cutoff_fc3_compact_fc(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_NaCl222.yaml.xz"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
ph3 = phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
produce_fc=False,
|
||||
log_level=1,
|
||||
)
|
||||
|
@ -493,11 +454,9 @@ def aln_lda(request) -> Phono3py:
|
|||
|
||||
"""
|
||||
yaml_filename = cwd / "phono3py_params_AlN332.yaml.xz"
|
||||
enable_v2 = request.config.getoption("--v1")
|
||||
# enable_v2 = request.config.getoption("--v2")
|
||||
return phono3py.load(
|
||||
yaml_filename,
|
||||
store_dense_gp_map=enable_v2,
|
||||
store_dense_svecs=enable_v2,
|
||||
log_level=1,
|
||||
)
|
||||
|
||||
|
|
|
@ -205,14 +205,8 @@ nacl_jdos_gamma_at_300K = [
|
|||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(105, True)])
|
||||
def test_jdos_si(si_pbesol: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
"""Test joint-DOS by Si.
|
||||
|
||||
store_dense_gp_map=False : 103
|
||||
store_dense_gp_map=True : 105
|
||||
|
||||
"""
|
||||
def test_jdos_si(si_pbesol: Phono3py):
|
||||
"""Test joint-DOS by Si."""
|
||||
si_pbesol.mesh_numbers = [9, 9, 9]
|
||||
jdos = Phono3pyJointDos(
|
||||
si_pbesol.phonon_supercell,
|
||||
|
@ -220,10 +214,9 @@ def test_jdos_si(si_pbesol: Phono3py, gp: int, store_dense_gp_map: bool):
|
|||
si_pbesol.fc2,
|
||||
mesh=si_pbesol.mesh_numbers,
|
||||
num_frequency_points=10,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
log_level=1,
|
||||
)
|
||||
jdos.run([gp])
|
||||
jdos.run([105])
|
||||
|
||||
# print(", ".join(["%.7f" % fp for fp in jdos.frequency_points]))
|
||||
np.testing.assert_allclose(si_freq_points, jdos.frequency_points, atol=1e-5)
|
||||
|
@ -233,8 +226,7 @@ def test_jdos_si(si_pbesol: Phono3py, gp: int, store_dense_gp_map: bool):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(105, True)])
|
||||
def test_jdso_si_nomeshsym(si_pbesol: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdso_si_nomeshsym(si_pbesol: Phono3py):
|
||||
"""Test joint-DOS without considering mesh symmetry by Si."""
|
||||
si_pbesol.mesh_numbers = [9, 9, 9]
|
||||
jdos = Phono3pyJointDos(
|
||||
|
@ -244,10 +236,9 @@ def test_jdso_si_nomeshsym(si_pbesol: Phono3py, gp: int, store_dense_gp_map: boo
|
|||
mesh=si_pbesol.mesh_numbers,
|
||||
num_frequency_points=10,
|
||||
is_mesh_symmetry=False,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
log_level=1,
|
||||
)
|
||||
jdos.run([gp])
|
||||
jdos.run([105])
|
||||
# print(", ".join(["%.7f" % fp for fp in jdos.frequency_points]))
|
||||
np.testing.assert_allclose(si_freq_points, jdos.frequency_points, atol=1e-5)
|
||||
# print(", ".join(["%.7f" % jd for jd in jdos.joint_dos.ravel()]))
|
||||
|
@ -256,8 +247,7 @@ def test_jdso_si_nomeshsym(si_pbesol: Phono3py, gp: int, store_dense_gp_map: boo
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(105, True)])
|
||||
def test_jdos_nacl(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdos_nacl(nacl_pbe: Phono3py):
|
||||
"""Test joint-DOS by NaCl."""
|
||||
nacl_pbe.mesh_numbers = [9, 9, 9]
|
||||
jdos = Phono3pyJointDos(
|
||||
|
@ -267,10 +257,9 @@ def test_jdos_nacl(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
|||
mesh=nacl_pbe.mesh_numbers,
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
num_frequency_points=10,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
log_level=1,
|
||||
)
|
||||
jdos.run([gp])
|
||||
jdos.run([105])
|
||||
# print(", ".join(["%.7f" % fp for fp in jdos.frequency_points]))
|
||||
np.testing.assert_allclose(nacl_freq_points, jdos.frequency_points, atol=1e-5)
|
||||
# print(", ".join(["%.7f" % jd for jd in jdos.joint_dos.ravel()]))
|
||||
|
@ -279,8 +268,7 @@ def test_jdos_nacl(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(0, True)])
|
||||
def test_jdos_nacl_gamma(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdos_nacl_gamma(nacl_pbe: Phono3py):
|
||||
"""Test joint-DOS at Gamma-point by NaCl."""
|
||||
nacl_pbe.mesh_numbers = [9, 9, 9]
|
||||
jdos = Phono3pyJointDos(
|
||||
|
@ -291,10 +279,9 @@ def test_jdos_nacl_gamma(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
|||
nac_params=nacl_pbe.nac_params,
|
||||
nac_q_direction=[1, 0, 0],
|
||||
num_frequency_points=10,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
log_level=1,
|
||||
)
|
||||
jdos.run([gp])
|
||||
jdos.run([0])
|
||||
# print(", ".join(["%.7f" % fp for fp in jdos.frequency_points]))
|
||||
np.testing.assert_allclose(nacl_freq_points_gamma, jdos.frequency_points, atol=1e-5)
|
||||
# print(", ".join(["%.7f" % jd for jd in jdos.joint_dos.ravel()]))
|
||||
|
@ -303,8 +290,7 @@ def test_jdos_nacl_gamma(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(105, True)])
|
||||
def test_jdos_nacl_at_300K(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdos_nacl_at_300K(nacl_pbe: Phono3py):
|
||||
"""Test joint-DOS at 300K by NaCl."""
|
||||
nacl_pbe.mesh_numbers = [9, 9, 9]
|
||||
jdos = Phono3pyJointDos(
|
||||
|
@ -317,10 +303,9 @@ def test_jdos_nacl_at_300K(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool
|
|||
temperatures=[
|
||||
300,
|
||||
],
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
log_level=1,
|
||||
)
|
||||
jdos.run([gp])
|
||||
jdos.run([105])
|
||||
# print(", ".join(["%.7f" % fp for fp in jdos.frequency_points]))
|
||||
np.testing.assert_allclose(
|
||||
nacl_freq_points_at_300K, jdos.frequency_points, atol=1e-5
|
||||
|
@ -363,29 +348,22 @@ def test_jdos_nacl_nac_gamma_at_300K_npoints(nacl_pbe: Phono3py):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(0, False), (0, True)])
|
||||
def test_jdos_nac_direction_phonon_NaCl(
|
||||
nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool
|
||||
):
|
||||
def test_jdos_nac_direction_phonon_NaCl(nacl_pbe: Phono3py):
|
||||
"""Test JDOS of NaCl with nac_q_direction."""
|
||||
jdos = _get_jdos(
|
||||
nacl_pbe,
|
||||
[7, 7, 7],
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
)
|
||||
jdos.nac_q_direction = [1, 0, 0]
|
||||
jdos.set_grid_point(gp)
|
||||
jdos.set_grid_point(0)
|
||||
frequencies, _, _ = jdos.get_phonons()
|
||||
np.testing.assert_allclose(
|
||||
frequencies[0], [0, 0, 0, 4.59488262, 4.59488262, 7.41183870], rtol=0, atol=1e-6
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(0, False), (0, True)])
|
||||
def test_jdos_nac_direction_phonon_NaCl_second_error(
|
||||
nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool
|
||||
):
|
||||
def test_jdos_nac_direction_phonon_NaCl_second_error(nacl_pbe: Phono3py):
|
||||
"""Test JDOS of NaCl with nac_q_direction.
|
||||
|
||||
Second setting non-gamma grid point must raise exception.
|
||||
|
@ -395,18 +373,14 @@ def test_jdos_nac_direction_phonon_NaCl_second_error(
|
|||
nacl_pbe,
|
||||
[7, 7, 7],
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
)
|
||||
jdos.nac_q_direction = [1, 0, 0]
|
||||
jdos.set_grid_point(gp)
|
||||
jdos.set_grid_point(0)
|
||||
with pytest.raises(RuntimeError):
|
||||
jdos.set_grid_point(1)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp1,gp2,store_dense_gp_map", [(0, 1, False), (0, 1, True)])
|
||||
def test_jdos_nac_direction_phonon_NaCl_second_no_error(
|
||||
nacl_pbe: Phono3py, gp1: int, gp2: int, store_dense_gp_map: bool
|
||||
):
|
||||
def test_jdos_nac_direction_phonon_NaCl_second_no_error(nacl_pbe: Phono3py):
|
||||
"""Test JDOS of NaCl with nac_q_direction.
|
||||
|
||||
Second setting non-gamma grid point should not raise exception because
|
||||
|
@ -418,28 +392,25 @@ def test_jdos_nac_direction_phonon_NaCl_second_no_error(
|
|||
nacl_pbe,
|
||||
[7, 7, 7],
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
)
|
||||
jdos.nac_q_direction = [1, 0, 0]
|
||||
jdos.set_grid_point(gp1)
|
||||
jdos.set_grid_point(0)
|
||||
jdos.nac_q_direction = None
|
||||
jdos.set_grid_point(gp2)
|
||||
jdos.set_grid_point(1)
|
||||
frequencies, _, _ = jdos.get_phonons()
|
||||
np.testing.assert_allclose(
|
||||
frequencies[0], [0, 0, 0, 4.59488262, 4.59488262, 4.59488262], rtol=0, atol=1e-6
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(103, False), (105, True)])
|
||||
def test_jdos_nac_NaCl_300K_C(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdos_nac_NaCl_300K_C(nacl_pbe: Phono3py):
|
||||
"""Test running JDOS of NaCl in C mode."""
|
||||
jdos = _get_jdos(
|
||||
nacl_pbe,
|
||||
[9, 9, 9],
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
)
|
||||
jdos.set_grid_point(gp)
|
||||
jdos.set_grid_point(105)
|
||||
jdos.frequency_points = nacl_freq_points_at_300K
|
||||
jdos.temperature = 300
|
||||
jdos.run_phonon_solver()
|
||||
|
@ -450,16 +421,14 @@ def test_jdos_nac_NaCl_300K_C(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: b
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(103, False), (105, True)])
|
||||
def test_jdos_nac_NaCl_300K_Py(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdos_nac_NaCl_300K_Py(nacl_pbe: Phono3py):
|
||||
"""Test running JDOS of NaCl in Py (JDOS) mode."""
|
||||
jdos = _get_jdos(
|
||||
nacl_pbe,
|
||||
[9, 9, 9],
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
)
|
||||
jdos.set_grid_point(gp)
|
||||
jdos.set_grid_point(105)
|
||||
jdos.frequency_points = nacl_freq_points_at_300K
|
||||
jdos.temperature = 300
|
||||
jdos.run_phonon_solver()
|
||||
|
@ -470,16 +439,14 @@ def test_jdos_nac_NaCl_300K_Py(nacl_pbe: Phono3py, gp: int, store_dense_gp_map:
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gp,store_dense_gp_map", [(103, False), (105, True)])
|
||||
def test_jdos_nac_NaCl_300K_PyPy(nacl_pbe: Phono3py, gp: int, store_dense_gp_map: bool):
|
||||
def test_jdos_nac_NaCl_300K_PyPy(nacl_pbe: Phono3py):
|
||||
"""Test running JDOS of NaCl in Py (JDOS) and Py (tetrahedron) mode."""
|
||||
jdos = _get_jdos(
|
||||
nacl_pbe,
|
||||
[9, 9, 9],
|
||||
nac_params=nacl_pbe.nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
)
|
||||
jdos.set_grid_point(gp)
|
||||
jdos.set_grid_point(105)
|
||||
jdos.frequency_points = nacl_freq_points_at_300K
|
||||
jdos.temperature = 300
|
||||
jdos.run_phonon_solver()
|
||||
|
@ -490,12 +457,12 @@ def test_jdos_nac_NaCl_300K_PyPy(nacl_pbe: Phono3py, gp: int, store_dense_gp_map
|
|||
)
|
||||
|
||||
|
||||
def _get_jdos(ph3: Phono3py, mesh, nac_params=None, store_dense_gp_map=False):
|
||||
def _get_jdos(ph3: Phono3py, mesh, nac_params=None):
|
||||
bz_grid = BZGrid(
|
||||
mesh,
|
||||
lattice=ph3.primitive.cell,
|
||||
symmetry_dataset=ph3.primitive_symmetry.dataset,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
store_dense_gp_map=True,
|
||||
)
|
||||
jdos = JointDos(
|
||||
ph3.primitive,
|
||||
|
@ -503,7 +470,6 @@ def _get_jdos(ph3: Phono3py, mesh, nac_params=None, store_dense_gp_map=False):
|
|||
bz_grid,
|
||||
ph3.fc2,
|
||||
nac_params=nac_params,
|
||||
store_dense_gp_map=store_dense_gp_map,
|
||||
cutoff_frequency=1e-4,
|
||||
)
|
||||
return jdos
|
||||
|
|
|
@ -5,6 +5,7 @@ from phonopy import Phonopy
|
|||
from phonopy.structure.atoms import PhonopyAtoms
|
||||
from phonopy.structure.symmetry import Symmetry
|
||||
|
||||
from phono3py import Phono3py
|
||||
from phono3py.phonon3.triplets import (
|
||||
_get_BZ_triplets_at_q,
|
||||
_get_triplets_reciprocal_mesh_at_q,
|
||||
|
@ -68,7 +69,7 @@ def test_get_triplets_at_q_type1(si_pbesol_111):
|
|||
np.testing.assert_equal(weights, weights_ref)
|
||||
|
||||
|
||||
def test_get_triplets_at_q_type2(si_pbesol_111):
|
||||
def test_get_triplets_at_q_type2(si_pbesol_111: Phono3py):
|
||||
"""Test triplets under type2 grid."""
|
||||
pcell = si_pbesol_111.primitive
|
||||
psym = si_pbesol_111.primitive_symmetry
|
||||
|
|
Loading…
Reference in New Issue