mirror of https://github.com/phonopy/phono3py.git
Merge pull request #312 from phonopy/int_-to-long
Change dtype=int_ to long
This commit is contained in:
commit
88418e2543
|
@ -107,7 +107,7 @@ class Phono3pyIsotope:
|
|||
(len(self._sigmas), len(grid_points), len(self._iso.band_indices)),
|
||||
dtype="double",
|
||||
)
|
||||
self._grid_points = np.array(grid_points, dtype="int_")
|
||||
self._grid_points = np.array(grid_points, dtype="long")
|
||||
|
||||
for j, gp in enumerate(grid_points):
|
||||
self._iso.set_grid_point(gp)
|
||||
|
|
|
@ -234,14 +234,14 @@ class Phono3py:
|
|||
# Create supercell and primitive cell
|
||||
self._unitcell = unitcell
|
||||
self._supercell_matrix = np.array(
|
||||
shape_supercell_matrix(supercell_matrix), dtype="int_", order="C"
|
||||
shape_supercell_matrix(supercell_matrix), dtype="long", order="C"
|
||||
)
|
||||
pmat = self._determine_primitive_matrix(primitive_matrix)
|
||||
self._primitive_matrix = pmat
|
||||
self._nac_params = None
|
||||
if phonon_supercell_matrix is not None:
|
||||
self._phonon_supercell_matrix = np.array(
|
||||
shape_supercell_matrix(phonon_supercell_matrix), dtype="int_", order="C"
|
||||
shape_supercell_matrix(phonon_supercell_matrix), dtype="long", order="C"
|
||||
)
|
||||
else:
|
||||
self._phonon_supercell_matrix = None
|
||||
|
@ -538,7 +538,7 @@ class Phono3py:
|
|||
|
||||
ndarray
|
||||
Supercell matrix with respect to unit cell.
|
||||
shape=(3, 3), dtype='int_', order='C'
|
||||
shape=(3, 3), dtype='long', order='C'
|
||||
|
||||
"""
|
||||
return self._supercell_matrix
|
||||
|
@ -549,7 +549,7 @@ class Phono3py:
|
|||
|
||||
ndarray
|
||||
Supercell matrix with respect to unit cell.
|
||||
shape=(3, 3), dtype='int_', order='C'
|
||||
shape=(3, 3), dtype='long', order='C'
|
||||
|
||||
"""
|
||||
return self._phonon_supercell_matrix
|
||||
|
@ -743,10 +743,10 @@ class Phono3py:
|
|||
def _set_band_indices(self, band_indices=None):
|
||||
if band_indices is None:
|
||||
num_band = len(self._primitive) * 3
|
||||
self._band_indices = [np.arange(num_band, dtype="int_")]
|
||||
self._band_indices = [np.arange(num_band, dtype="long")]
|
||||
else:
|
||||
self._band_indices = [np.array(bi, dtype="int_") for bi in band_indices]
|
||||
self._band_indices_flatten = np.hstack(self._band_indices).astype("int_")
|
||||
self._band_indices = [np.array(bi, dtype="long") for bi in band_indices]
|
||||
self._band_indices_flatten = np.hstack(self._band_indices).astype("long")
|
||||
|
||||
@property
|
||||
def masses(self) -> np.ndarray:
|
||||
|
@ -1948,7 +1948,7 @@ class Phono3py:
|
|||
List of grid point indices where mode thermal conductivities are
|
||||
calculated. With None, all the grid points that are necessary
|
||||
for thermal conductivity are set internally.
|
||||
shape(num_grid_points, ), dtype='int_'.
|
||||
shape(num_grid_points, ), dtype='long'.
|
||||
boundary_mfp : float, optiona, default is None
|
||||
Mean free path in micrometre to calculate simple boundary
|
||||
scattering contribution to thermal conductivity.
|
||||
|
|
|
@ -281,7 +281,7 @@ class ConductivityBase(ABC):
|
|||
grid_points : array_like or None, optional
|
||||
Grid point indices in BZgrid. When None, ir-grid points are searched
|
||||
internally. Default is None.
|
||||
shape=(grid_points, ), dtype='int_'.
|
||||
shape=(grid_points, ), dtype='long'.
|
||||
temperatures : array_like, optional, default is None
|
||||
Temperatures at which thermal conductivity is calculated.
|
||||
shape=(temperature_points, ), dtype='double'.
|
||||
|
@ -676,7 +676,7 @@ class ConductivityBase(ABC):
|
|||
-------
|
||||
point_operations : ndarray
|
||||
Operations in reduced coordinates.
|
||||
shape=(num_operations, 3, 3), dtype='int_'
|
||||
shape=(num_operations, 3, 3), dtype='long'
|
||||
rotations_cartesian : ndarray
|
||||
Operations in Cartesian coordinates.
|
||||
shape=(num_operations, 3, 3), dtype='double'
|
||||
|
@ -684,7 +684,7 @@ class ConductivityBase(ABC):
|
|||
"""
|
||||
if not self._is_kappa_star:
|
||||
point_operations = np.array(
|
||||
[np.eye(3, dtype="int_")], dtype="int_", order="C"
|
||||
[np.eye(3, dtype="long")], dtype="long", order="C"
|
||||
)
|
||||
rotations_cartesian = np.array(
|
||||
[np.eye(3, dtype="double")], dtype="double", order="C"
|
||||
|
@ -702,10 +702,10 @@ class ConductivityBase(ABC):
|
|||
-------
|
||||
grid_points : ndarray
|
||||
Grid point indices in BZ-grid to be iterated over.
|
||||
shape=(len(grid_points),), dtype='int_'
|
||||
shape=(len(grid_points),), dtype='long'
|
||||
ir_grid_points : ndarray
|
||||
Irreducible grid points in BZ-grid on regular grid.
|
||||
shape=(len(ir_grid_points),), dtype='int_'
|
||||
shape=(len(ir_grid_points),), dtype='long'
|
||||
grid_weights : ndarray
|
||||
Grid weights of `grid_points`. If grid symmetry is not broken,
|
||||
these values are equivalent to numbers of k-star arms.
|
||||
|
@ -713,13 +713,13 @@ class ConductivityBase(ABC):
|
|||
"""
|
||||
ir_grid_points, grid_weights = self._get_ir_grid_points(grid_points)
|
||||
if grid_points is not None: # Specify grid points
|
||||
_grid_points = np.array(grid_points, dtype="int_")
|
||||
_grid_points = np.array(grid_points, dtype="long")
|
||||
_ir_grid_points = ir_grid_points
|
||||
_grid_weights = grid_weights
|
||||
elif not self._is_kappa_star: # All grid points
|
||||
_grid_points = self._pp.bz_grid.grg2bzg
|
||||
_ir_grid_points = _grid_points
|
||||
_grid_weights = np.ones(len(_grid_points), dtype="int_")
|
||||
_grid_weights = np.ones(len(_grid_points), dtype="long")
|
||||
else: # Automatic sampling
|
||||
_grid_points = ir_grid_points
|
||||
_ir_grid_points = ir_grid_points
|
||||
|
@ -777,7 +777,7 @@ class ConductivityBase(ABC):
|
|||
self._pp.bz_grid
|
||||
)
|
||||
ir_grid_points = np.array(
|
||||
self._pp.bz_grid.grg2bzg[ir_grid_points], dtype="int_"
|
||||
self._pp.bz_grid.grg2bzg[ir_grid_points], dtype="long"
|
||||
)
|
||||
if grid_points is None:
|
||||
grid_weights = ir_grid_weights
|
||||
|
@ -787,7 +787,7 @@ class ConductivityBase(ABC):
|
|||
weights[gp] += 1
|
||||
grid_weights = np.array(
|
||||
weights[ir_grid_map[self._pp.bz_grid.bzg2grg[grid_points]]],
|
||||
dtype="int_",
|
||||
dtype="long",
|
||||
)
|
||||
|
||||
return ir_grid_points, grid_weights
|
||||
|
|
|
@ -287,7 +287,7 @@ class ConductivityLBTEBase(ConductivityBase):
|
|||
def _get_rot_grid_points(self):
|
||||
num_ir_grid_points = len(self._ir_grid_points)
|
||||
rot_grid_points = np.zeros(
|
||||
(num_ir_grid_points, len(self._point_operations)), dtype="int_"
|
||||
(num_ir_grid_points, len(self._point_operations)), dtype="long"
|
||||
)
|
||||
if self._is_kappa_star:
|
||||
rotations = self._pp.bz_grid.rotations # rotations of GR-grid
|
||||
|
@ -530,10 +530,10 @@ class ConductivityLBTEBase(ConductivityBase):
|
|||
self._average_collision_matrix_by_degeneracy()
|
||||
num_mesh_points = np.prod(self._pp.mesh_numbers)
|
||||
num_rot = len(self._point_operations)
|
||||
rot_grid_points = np.zeros((num_rot, num_mesh_points), dtype="int_")
|
||||
rot_grid_points = np.zeros((num_rot, num_mesh_points), dtype="long")
|
||||
# Ir-grid points and rot_grid_points in generalized regular grid
|
||||
ir_gr_grid_points = np.array(
|
||||
self._pp.bz_grid.bzg2grg[self._ir_grid_points], dtype="int_"
|
||||
self._pp.bz_grid.bzg2grg[self._ir_grid_points], dtype="long"
|
||||
)
|
||||
for i in range(num_mesh_points):
|
||||
rot_grid_points[:, i] = self._pp.bz_grid.bzg2grg[
|
||||
|
@ -544,7 +544,7 @@ class ConductivityLBTEBase(ConductivityBase):
|
|||
self._expand_reducible_collisions(ir_gr_grid_points, rot_grid_points)
|
||||
self._expand_local_values(ir_gr_grid_points, rot_grid_points)
|
||||
self._combine_reducible_collisions()
|
||||
weights = np.ones(np.prod(self._pp.mesh_numbers), dtype="int_")
|
||||
weights = np.ones(np.prod(self._pp.mesh_numbers), dtype="long")
|
||||
self._symmetrize_collision_matrix()
|
||||
else:
|
||||
self._combine_collisions()
|
||||
|
@ -647,7 +647,7 @@ class ConductivityLBTEBase(ConductivityBase):
|
|||
self._rot_grid_points : ndarray
|
||||
Grid points generated by applying point group to ir-grid-points
|
||||
in BZ-grid.
|
||||
shape=(ir_grid_points, point_operations), dtype='int_'
|
||||
shape=(ir_grid_points, point_operations), dtype='long'
|
||||
|
||||
r_gps : grid points of arms of k-star with duplicates
|
||||
len(r_gps) == order of crystallographic point group
|
||||
|
|
|
@ -372,7 +372,7 @@ class ConductivityRTABase(ConductivityBase):
|
|||
collisions,
|
||||
np.array(
|
||||
np.dot(tetrahedra, self._pp.bz_grid.P.T),
|
||||
dtype="int_",
|
||||
dtype="long",
|
||||
order="C",
|
||||
),
|
||||
self._frequencies,
|
||||
|
|
|
@ -79,7 +79,7 @@ def _get_ir_grid_info(bz_grid: BZGrid, weights, qpoints=None, ir_grid_points=Non
|
|||
-------
|
||||
ir_grid_points : ndarray
|
||||
Ir-grid point indices in BZ-grid.
|
||||
shape=(ir_grid_points, ), dtype='int_'
|
||||
shape=(ir_grid_points, ), dtype='long'
|
||||
ir_grid_map : ndarray, optional, default=None
|
||||
Mapping table to ir-grid point indices in GR-grid.
|
||||
|
||||
|
@ -289,9 +289,9 @@ def main():
|
|||
f_kappa = h5py.File(args.filenames[0], "r")
|
||||
|
||||
if "grid_matrix" in f_kappa:
|
||||
mesh = np.array(f_kappa["grid_matrix"][:], dtype="int_")
|
||||
mesh = np.array(f_kappa["grid_matrix"][:], dtype="long")
|
||||
else:
|
||||
mesh = np.array(f_kappa["mesh"][:], dtype="int_")
|
||||
mesh = np.array(f_kappa["mesh"][:], dtype="long")
|
||||
if "temperature" in f_kappa:
|
||||
temperatures = f_kappa["temperature"][:]
|
||||
else:
|
||||
|
@ -308,7 +308,7 @@ def main():
|
|||
frequencies = np.array(f_kappa["frequency"][ir_grid_points_BZ], dtype="double")
|
||||
else:
|
||||
frequencies = f_kappa["frequency"][:]
|
||||
ir_weights = np.ones(len(frequencies), dtype="int_")
|
||||
ir_weights = np.ones(len(frequencies), dtype="long")
|
||||
primitive_symmetry = Symmetry(primitive)
|
||||
bz_grid = BZGrid(
|
||||
mesh,
|
||||
|
|
|
@ -877,7 +877,7 @@ def init_phph_interaction(
|
|||
if settings.write_phonon:
|
||||
freqs, eigvecs, grid_address = phono3py.get_phonon_data()
|
||||
ir_grid_points, ir_grid_weights, _ = get_ir_grid_points(bz_grid)
|
||||
ir_grid_points = np.array(bz_grid.grg2bzg[ir_grid_points], dtype="int_")
|
||||
ir_grid_points = np.array(bz_grid.grg2bzg[ir_grid_points], dtype="long")
|
||||
filename = write_phonon_to_hdf5(
|
||||
freqs,
|
||||
eigvecs,
|
||||
|
|
|
@ -34,23 +34,27 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from collections.abc import Sequence
|
||||
from typing import Optional, Union
|
||||
|
||||
import numpy as np
|
||||
from phonopy.structure.atoms import PhonopyAtoms
|
||||
|
||||
from phono3py.file_IO import write_grid_address_to_hdf5, write_ir_grid_points
|
||||
from phono3py.phonon.grid import get_ir_grid_points
|
||||
from phono3py.phonon.grid import BZGrid, get_ir_grid_points
|
||||
from phono3py.phonon3.triplets import get_triplets_at_q
|
||||
|
||||
|
||||
def write_grid_points(
|
||||
primitive,
|
||||
bz_grid,
|
||||
band_indices=None,
|
||||
sigmas=None,
|
||||
temperatures=None,
|
||||
is_kappa_star=True,
|
||||
is_lbte=False,
|
||||
compression="gzip",
|
||||
filename=None,
|
||||
primitive: PhonopyAtoms,
|
||||
bz_grid: BZGrid,
|
||||
band_indices: Optional[Union[Sequence, np.ndarray]] = None,
|
||||
sigmas: Optional[Union[Sequence, np.ndarray]] = None,
|
||||
temperatures: Optional[Union[Sequence, np.ndarray]] = None,
|
||||
is_kappa_star: bool = True,
|
||||
is_lbte: bool = False,
|
||||
compression: Union[str, int] = "gzip",
|
||||
filename: bool = None,
|
||||
):
|
||||
"""Write grid points into files."""
|
||||
ir_grid_points, ir_grid_weights = _get_ir_grid_points(
|
||||
|
@ -103,7 +107,11 @@ def write_grid_points(
|
|||
|
||||
|
||||
def show_num_triplets(
|
||||
primitive, bz_grid, band_indices=None, grid_points=None, is_kappa_star=True
|
||||
primitive: PhonopyAtoms,
|
||||
bz_grid: BZGrid,
|
||||
band_indices: Optional[Union[Sequence, np.ndarray]] = None,
|
||||
grid_points: Optional[Union[Sequence, np.ndarray]] = None,
|
||||
is_kappa_star: bool = True,
|
||||
):
|
||||
"""Show numbers of triplets at grid points."""
|
||||
tp_nums = _TripletsNumbers(bz_grid, is_kappa_star=is_kappa_star)
|
||||
|
@ -131,7 +139,7 @@ def show_num_triplets(
|
|||
|
||||
|
||||
class _TripletsNumbers:
|
||||
def __init__(self, bz_grid, is_kappa_star=True):
|
||||
def __init__(self, bz_grid: BZGrid, is_kappa_star: bool = True):
|
||||
self._bz_grid = bz_grid
|
||||
(
|
||||
self.ir_grid_points,
|
||||
|
@ -143,19 +151,19 @@ class _TripletsNumbers:
|
|||
return num_triplets
|
||||
|
||||
|
||||
def _get_ir_grid_points(bz_grid, is_kappa_star=True):
|
||||
def _get_ir_grid_points(bz_grid: BZGrid, is_kappa_star: bool = True):
|
||||
if is_kappa_star:
|
||||
ir_grid_points, ir_grid_weights, _ = get_ir_grid_points(bz_grid)
|
||||
ir_grid_points = np.array(bz_grid.grg2bzg[ir_grid_points], dtype="int_")
|
||||
ir_grid_points = np.array(bz_grid.grg2bzg[ir_grid_points], dtype="long")
|
||||
else:
|
||||
ir_grid_points = np.array(
|
||||
bz_grid.grg2bzg[: np.prod(bz_grid.D_diag)], dtype="int_", order="C"
|
||||
bz_grid.grg2bzg[: np.prod(bz_grid.D_diag)], dtype="long", order="C"
|
||||
)
|
||||
ir_grid_weights = np.ones(len(ir_grid_points), dtype="int_")
|
||||
ir_grid_weights = np.ones(len(ir_grid_points), dtype="long")
|
||||
|
||||
return ir_grid_points, ir_grid_weights
|
||||
|
||||
|
||||
def _get_number_of_triplets(bz_grid, grid_point, swappable=True):
|
||||
def _get_number_of_triplets(bz_grid: BZGrid, grid_point: int, swappable: bool = True):
|
||||
triplets_at_q = get_triplets_at_q(grid_point, bz_grid, swappable=swappable)[0]
|
||||
return len(triplets_at_q)
|
||||
|
|
|
@ -438,7 +438,7 @@ def write_grid_address_to_hdf5(
|
|||
mesh,
|
||||
grid_mapping_table,
|
||||
bz_grid=None,
|
||||
compression="gzip",
|
||||
compression: Union[str, int] = "gzip",
|
||||
filename=None,
|
||||
):
|
||||
"""Write grid addresses to grid_address.hdf5."""
|
||||
|
@ -714,7 +714,7 @@ def write_spectral_function_to_hdf5(
|
|||
if all_band_exist:
|
||||
_band_indices = None
|
||||
else:
|
||||
_band_indices = np.hstack(band_indices).astype("int_")
|
||||
_band_indices = np.hstack(band_indices).astype("long")
|
||||
suffix = _get_filename_suffix(
|
||||
mesh, grid_point=grid_point, band_indices=_band_indices, sigma=sigma
|
||||
)
|
||||
|
|
|
@ -136,9 +136,9 @@ class Isotope:
|
|||
|
||||
num_band = len(self._primitive) * 3
|
||||
if band_indices is None:
|
||||
self._band_indices = np.arange(num_band, dtype="int_")
|
||||
self._band_indices = np.arange(num_band, dtype="long")
|
||||
else:
|
||||
self._band_indices = np.array(band_indices, dtype="int_")
|
||||
self._band_indices = np.array(band_indices, dtype="long")
|
||||
|
||||
if self._bz_grid is None:
|
||||
primitive_symmetry = Symmetry(self._primitive, self._symprec)
|
||||
|
@ -153,7 +153,7 @@ class Isotope:
|
|||
def set_grid_point(self, grid_point):
|
||||
"""Initialize grid points."""
|
||||
self._grid_point = grid_point
|
||||
self._grid_points = np.arange(len(self._bz_grid.addresses), dtype="int_")
|
||||
self._grid_points = np.arange(len(self._bz_grid.addresses), dtype="long")
|
||||
|
||||
if self._phonon_done is None:
|
||||
self._allocate_phonon()
|
||||
|
@ -319,7 +319,7 @@ class Isotope:
|
|||
self._bz_grid.addresses,
|
||||
np.array(
|
||||
np.dot(thm.tetrahedra, self._bz_grid.P.T),
|
||||
dtype="int_",
|
||||
dtype="long",
|
||||
order="C",
|
||||
),
|
||||
self._bz_grid.grg2bzg,
|
||||
|
|
|
@ -76,17 +76,17 @@ class KappaDOSTHM:
|
|||
ir_grid_points : ndarray
|
||||
Irreducible grid point indices in GR-grid (as obtained by
|
||||
get_ir_grid_points).
|
||||
shape=(num_ir_grid_points, ), dtype='int_'
|
||||
shape=(num_ir_grid_points, ), dtype='long'
|
||||
ir_grid_weights : ndarray
|
||||
Weights of irreducible grid points. Its sum is the number of grid
|
||||
points in GR-grid (prod(D_diag)) (as obtained by
|
||||
get_ir_grid_points).
|
||||
shape=(num_ir_grid_points, ), dtype='int_'
|
||||
shape=(num_ir_grid_points, ), dtype='long'
|
||||
ir_grid_map : ndarray
|
||||
Index mapping table to irreducible grid points from all grid points
|
||||
in GR-grid such as, [0, 0, 2, 3, 3, ...]. (as obtained by
|
||||
get_ir_grid_points).
|
||||
shape=(prod(D_diag), ), dtype='int_'
|
||||
shape=(prod(D_diag), ), dtype='long'
|
||||
frequency_points : array_like, optional, default=None
|
||||
This is used as the frequency points. When None, frequency points
|
||||
are created from `num_sampling_points`.
|
||||
|
@ -120,7 +120,7 @@ class KappaDOSTHM:
|
|||
bz_grid.bzg2grg, _ir_grid_map, _ir_grid_points
|
||||
)
|
||||
if ir_grid_weights is None:
|
||||
grid_weights = np.ones(mode_kappa.shape[1], dtype="int_")
|
||||
grid_weights = np.ones(mode_kappa.shape[1], dtype="long")
|
||||
else:
|
||||
grid_weights = ir_grid_weights
|
||||
for j, function in enumerate(("J", "I")):
|
||||
|
@ -164,13 +164,13 @@ class KappaDOSTHM:
|
|||
----------
|
||||
bzg2grg : ndarray
|
||||
Mapping table from BZ-grid to GR-grid.
|
||||
shape=(len(all-BZ-grid-points), ), dtype='int_'
|
||||
shape=(len(all-BZ-grid-points), ), dtype='long'
|
||||
ir_grid_map : ndarray
|
||||
Mapping table from all grid points to ir-grid points in GR-grid.
|
||||
shape=(np.prod(D_diag), ), dtype='int_'
|
||||
shape=(np.prod(D_diag), ), dtype='long'
|
||||
ir_grid_points : ndarray
|
||||
Irreducible grid points in GR-grid. shape=(num_ir_grid_points, ),
|
||||
dtype='int_'
|
||||
dtype='long'
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
@ -184,7 +184,7 @@ class KappaDOSTHM:
|
|||
# ir-grid points in GR-grid to the index of unique grid points.
|
||||
gp_map = {j: i for i, j in enumerate(unique_gps)}
|
||||
bzgp2irgp_map = np.array(
|
||||
[gp_map[ir_grid_map[grgp]] for grgp in bzg2grg], dtype="int_"
|
||||
[gp_map[ir_grid_map[grgp]] for grgp in bzg2grg], dtype="long"
|
||||
)
|
||||
return bzgp2irgp_map
|
||||
|
||||
|
@ -210,7 +210,7 @@ class GammaDOSsmearing:
|
|||
shape=(ir_grid_points, num_band), dtype='double'
|
||||
ir_grid_weights : ndarray
|
||||
Grid point weights at ir-grid points.
|
||||
shape=(ir_grid_points, ), dtype='int_'
|
||||
shape=(ir_grid_points, ), dtype='long'
|
||||
sigma : float
|
||||
Smearing width.
|
||||
num_sampling_points : int, optional, default=100
|
||||
|
|
|
@ -57,23 +57,23 @@ def get_unique_grid_points(grid_points, bz_grid: BZGrid):
|
|||
-------
|
||||
ndarray
|
||||
Unique grid points on tetrahedron vertices around input grid points.
|
||||
shape=(unique_grid_points, ), dtype='int_'.
|
||||
shape=(unique_grid_points, ), dtype='long'.
|
||||
|
||||
"""
|
||||
import phono3py._phono3py as phono3c
|
||||
|
||||
if _check_ndarray_state(grid_points, "int_"):
|
||||
if _check_ndarray_state(grid_points, "long"):
|
||||
_grid_points = grid_points
|
||||
else:
|
||||
_grid_points = np.array(grid_points, dtype="int_")
|
||||
_grid_points = np.array(grid_points, dtype="long")
|
||||
thm = TetrahedronMethod(bz_grid.microzone_lattice)
|
||||
unique_vertices = np.array(
|
||||
np.dot(thm.get_unique_tetrahedra_vertices(), bz_grid.P.T),
|
||||
dtype="int_",
|
||||
dtype="long",
|
||||
order="C",
|
||||
)
|
||||
neighboring_grid_points = np.zeros(
|
||||
len(unique_vertices) * len(_grid_points), dtype="int_"
|
||||
len(unique_vertices) * len(_grid_points), dtype="long"
|
||||
)
|
||||
phono3c.neighboring_grid_points(
|
||||
neighboring_grid_points,
|
||||
|
@ -84,7 +84,7 @@ def get_unique_grid_points(grid_points, bz_grid: BZGrid):
|
|||
bz_grid.gp_map,
|
||||
bz_grid.store_dense_gp_map * 1 + 1,
|
||||
)
|
||||
unique_grid_points = np.array(np.unique(neighboring_grid_points), dtype="int_")
|
||||
unique_grid_points = np.array(np.unique(neighboring_grid_points), dtype="long")
|
||||
return unique_grid_points
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ def get_integration_weights(
|
|||
Grid information in reciprocal space.
|
||||
grid_points : array_like, optional, default=None
|
||||
Grid point indices in BZ-grid. If None, all regular grid points in
|
||||
BZ-grid. shape=(grid_points, ), dtype='int_'
|
||||
BZ-grid. shape=(grid_points, ), dtype='long'
|
||||
bzgp2irgp_map : array_like, optional, default=None
|
||||
Grid point index mapping from bz_grid to index of the first dimension of
|
||||
`grid_values` array, i.e., usually irreducible grid point count.
|
||||
|
@ -131,15 +131,15 @@ def get_integration_weights(
|
|||
np.dot(
|
||||
get_tetrahedra_relative_grid_address(bz_grid.microzone_lattice), bz_grid.P.T
|
||||
),
|
||||
dtype="int_",
|
||||
dtype="long",
|
||||
order="C",
|
||||
)
|
||||
if grid_points is None:
|
||||
_grid_points = bz_grid.grg2bzg
|
||||
elif _check_ndarray_state(grid_points, "int_"):
|
||||
elif _check_ndarray_state(grid_points, "long"):
|
||||
_grid_points = grid_points
|
||||
else:
|
||||
_grid_points = np.array(grid_points, dtype="int_")
|
||||
_grid_points = np.array(grid_points, dtype="long")
|
||||
if _check_ndarray_state(grid_values, "double"):
|
||||
_grid_values = grid_values
|
||||
else:
|
||||
|
@ -149,11 +149,11 @@ def get_integration_weights(
|
|||
else:
|
||||
_sampling_points = np.array(sampling_points, dtype="double")
|
||||
if bzgp2irgp_map is None:
|
||||
_bzgp2irgp_map = np.arange(len(grid_values), dtype="int_")
|
||||
elif _check_ndarray_state(bzgp2irgp_map, "int_"):
|
||||
_bzgp2irgp_map = np.arange(len(grid_values), dtype="long")
|
||||
elif _check_ndarray_state(bzgp2irgp_map, "long"):
|
||||
_bzgp2irgp_map = bzgp2irgp_map
|
||||
else:
|
||||
_bzgp2irgp_map = np.array(bzgp2irgp_map, dtype="int_")
|
||||
_bzgp2irgp_map = np.array(bzgp2irgp_map, dtype="long")
|
||||
|
||||
num_grid_points = len(_grid_points)
|
||||
num_band = _grid_values.shape[1]
|
||||
|
@ -188,7 +188,7 @@ def get_tetrahedra_relative_grid_address(microzone_lattice):
|
|||
"""
|
||||
import phono3py._phono3py as phono3c
|
||||
|
||||
relative_grid_address = np.zeros((24, 4, 3), dtype="int_", order="C")
|
||||
relative_grid_address = np.zeros((24, 4, 3), dtype="long", order="C")
|
||||
phono3c.tetrahedra_relative_grid_address(
|
||||
relative_grid_address, np.array(microzone_lattice, dtype="double", order="C")
|
||||
)
|
||||
|
|
|
@ -156,7 +156,7 @@ class BZGrid:
|
|||
"""Init method.
|
||||
|
||||
mesh : array_like or float
|
||||
Mesh numbers or length. shape=(3,), dtype='int_'
|
||||
Mesh numbers or length. shape=(3,), dtype='long'
|
||||
reciprocal_lattice : array_like
|
||||
Reciprocal primitive basis vectors given as column vectors shape=(3,
|
||||
3), dtype='double', order='C'
|
||||
|
@ -174,7 +174,7 @@ class BZGrid:
|
|||
is_shift : array_like or None, optional
|
||||
[0, 0, 0] (or [False, False, False]) gives Gamma center mesh and
|
||||
value 1 (or True) gives half mesh shift along the basis vectors.
|
||||
Default is None. dtype='int_', shape=(3,)
|
||||
Default is None. dtype='long', shape=(3,)
|
||||
is_time_reveral : bool, optional
|
||||
Inversion symmetry is included in reciprocal point group. Default is
|
||||
True.
|
||||
|
@ -205,9 +205,9 @@ class BZGrid:
|
|||
self._addresses = None
|
||||
self._gp_map = None
|
||||
self._grid_matrix = None
|
||||
self._D_diag = np.ones(3, dtype="int_")
|
||||
self._Q = np.eye(3, dtype="int_", order="C")
|
||||
self._P = np.eye(3, dtype="int_", order="C")
|
||||
self._D_diag = np.ones(3, dtype="long")
|
||||
self._Q = np.eye(3, dtype="long", order="C")
|
||||
self._P = np.eye(3, dtype="long", order="C")
|
||||
self._QDinv = None
|
||||
self._microzone_lattice = None
|
||||
self._rotations = None
|
||||
|
@ -237,7 +237,7 @@ class BZGrid:
|
|||
|
||||
This corresponds to the mesh numbers in transformed reciprocal
|
||||
basis vectors.
|
||||
shape=(3,), dtype='int_'
|
||||
shape=(3,), dtype='long'
|
||||
|
||||
"""
|
||||
return self._D_diag
|
||||
|
@ -247,7 +247,7 @@ class BZGrid:
|
|||
"""Left unimodular matrix after SNF: D=PAQ.
|
||||
|
||||
Left unimodular matrix after SNF: D=PAQ.
|
||||
shape=(3, 3), dtype='int_', order='C'.
|
||||
shape=(3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._P
|
||||
|
@ -257,7 +257,7 @@ class BZGrid:
|
|||
"""Right unimodular matrix after SNF: D=PAQ.
|
||||
|
||||
Right unimodular matrix after SNF: D=PAQ.
|
||||
shape=(3, 3), dtype='int_', order='C'.
|
||||
shape=(3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._Q
|
||||
|
@ -276,9 +276,9 @@ class BZGrid:
|
|||
def PS(self):
|
||||
"""Integer shift vectors of GRGrid."""
|
||||
if self._is_shift is None:
|
||||
return np.zeros(3, dtype="int_")
|
||||
return np.zeros(3, dtype="long")
|
||||
else:
|
||||
return np.array(np.dot(self.P, self._is_shift), dtype="int_")
|
||||
return np.array(np.dot(self.P, self._is_shift), dtype="long")
|
||||
|
||||
@property
|
||||
def grid_matrix(self):
|
||||
|
@ -286,7 +286,7 @@ class BZGrid:
|
|||
|
||||
Grid generating matrix used for SNF.
|
||||
When SNF is used, ndarray, otherwise None.
|
||||
shape=(3, 3), dtype='int_', order='C'.
|
||||
shape=(3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._grid_matrix
|
||||
|
@ -298,7 +298,7 @@ class BZGrid:
|
|||
Integer grid address of the points in Brillouin zone including
|
||||
surface. There are two types of address order by either
|
||||
`store_dense_gp_map` is True or False.
|
||||
shape=(np.prod(D_diag) + some on surface, 3), dtype='int_', order='C'.
|
||||
shape=(np.prod(D_diag) + some on surface, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._addresses
|
||||
|
@ -324,7 +324,7 @@ class BZGrid:
|
|||
"""Transform grid point indices from BZG to GRG.
|
||||
|
||||
Grid index mapping table from BZGrid to GRgrid.
|
||||
shape=(len(addresses), ), dtype='int_'.
|
||||
shape=(len(addresses), ), dtype='long'.
|
||||
|
||||
Equivalent to
|
||||
get_grid_point_from_address(
|
||||
|
@ -339,7 +339,7 @@ class BZGrid:
|
|||
|
||||
Grid index mapping table from GRgrid to BZGrid. Unique one
|
||||
of translationally equivalent grid points in BZGrid is chosen.
|
||||
shape=(prod(D_diag), ), dtype='int_'.
|
||||
shape=(prod(D_diag), ), dtype='long'.
|
||||
|
||||
"""
|
||||
return self._grg2bzg
|
||||
|
@ -370,7 +370,7 @@ class BZGrid:
|
|||
Rotation matrices for GR-grid addresses (g) defined as g'=Rg. This can
|
||||
be different from ``reciprocal_operations`` when GR-grid is used because
|
||||
grid addresses are defined on an oblique lattice.
|
||||
shape=(rotations, 3, 3), dtype='int_', order='C'.
|
||||
shape=(rotations, 3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._rotations
|
||||
|
@ -386,7 +386,7 @@ class BZGrid:
|
|||
|
||||
Reciprocal space rotation matrices in fractional coordinates defined as
|
||||
q'=Rq.
|
||||
shape=(rotations, 3, 3), dtype='int_', order='C'.
|
||||
shape=(rotations, 3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._reciprocal_operations
|
||||
|
@ -411,7 +411,7 @@ class BZGrid:
|
|||
Grid point indices corresponding to the grid addresses. Each
|
||||
returned grid point index is one of those of the
|
||||
translationally equivalent grid points.
|
||||
shape=(n, ), dtype='int_' when multiple addresses are given.
|
||||
shape=(n, ), dtype='long' when multiple addresses are given.
|
||||
Otherwise one integer value is returned.
|
||||
|
||||
"""
|
||||
|
@ -423,7 +423,7 @@ class BZGrid:
|
|||
)
|
||||
|
||||
gps = [get_grid_point_from_address(adrs, self._D_diag) for adrs in addresses]
|
||||
return np.array(self._grg2bzg[gps], dtype="int_")
|
||||
return np.array(self._grg2bzg[gps], dtype="long")
|
||||
|
||||
def _generate_grid(
|
||||
self, mesh, use_grg=False, force_SNF=False, SNF_coordinates="reciprocal"
|
||||
|
@ -454,9 +454,9 @@ class BZGrid:
|
|||
store_dense_gp_map=self._store_dense_gp_map,
|
||||
)
|
||||
if self._store_dense_gp_map:
|
||||
self._grg2bzg = np.array(self._gp_map[:-1], dtype="int_")
|
||||
self._grg2bzg = np.array(self._gp_map[:-1], dtype="long")
|
||||
else:
|
||||
self._grg2bzg = np.arange(np.prod(self._D_diag), dtype="int_")
|
||||
self._grg2bzg = np.arange(np.prod(self._D_diag), dtype="long")
|
||||
|
||||
self._QDinv = np.array(
|
||||
self.Q * (1 / self.D_diag.astype("double")), dtype="double", order="C"
|
||||
|
@ -477,17 +477,17 @@ class BZGrid:
|
|||
import phono3py._recgrid as recgrid
|
||||
|
||||
if self._symmetry_dataset is None:
|
||||
direct_rotations = np.eye(3, dtype="int_", order="C").reshape(1, 3, 3)
|
||||
direct_rotations = np.eye(3, dtype="long", order="C").reshape(1, 3, 3)
|
||||
else:
|
||||
direct_rotations = np.array(
|
||||
self._symmetry_dataset.rotations, dtype="int_", order="C"
|
||||
self._symmetry_dataset.rotations, dtype="long", order="C"
|
||||
)
|
||||
rec_rotations = np.zeros((48, 3, 3), dtype="int_", order="C")
|
||||
rec_rotations = np.zeros((48, 3, 3), dtype="long", order="C")
|
||||
num_rec_rot = recgrid.reciprocal_rotations(
|
||||
rec_rotations, direct_rotations, self._is_time_reversal
|
||||
)
|
||||
self._reciprocal_operations = np.array(
|
||||
rec_rotations[:num_rec_rot], dtype="int_", order="C"
|
||||
rec_rotations[:num_rec_rot], dtype="long", order="C"
|
||||
)
|
||||
self._rotations_cartesian = np.array(
|
||||
[
|
||||
|
@ -498,7 +498,7 @@ class BZGrid:
|
|||
order="C",
|
||||
)
|
||||
self._rotations = np.zeros(
|
||||
self._reciprocal_operations.shape, dtype="int_", order="C"
|
||||
self._reciprocal_operations.shape, dtype="long", order="C"
|
||||
)
|
||||
if not recgrid.transform_rotations(
|
||||
self._rotations, self._reciprocal_operations, self._D_diag, self._Q
|
||||
|
@ -550,8 +550,8 @@ class GridMatrix:
|
|||
Mesh numbers or length. With float number, either conventional or
|
||||
generalized regular grid is computed depending on the given flags
|
||||
(`use_grg`, `force_SNF`). Given ndarry with
|
||||
shape=(3,), dtype='int_': conventional regular grid shape=(3,
|
||||
3), dtype='int_': generalized regular grid
|
||||
shape=(3,), dtype='long': conventional regular grid shape=(3,
|
||||
3), dtype='long': generalized regular grid
|
||||
lattice : array_like
|
||||
Primitive basis vectors in direct space given as row vectors.
|
||||
shape=(3, 3), dtype='double', order='C'
|
||||
|
@ -577,9 +577,9 @@ class GridMatrix:
|
|||
self._mesh = mesh
|
||||
self._lattice = lattice
|
||||
self._grid_matrix = None
|
||||
self._D_diag = np.ones(3, dtype="int_")
|
||||
self._Q = np.eye(3, dtype="int_", order="C")
|
||||
self._P = np.eye(3, dtype="int_", order="C")
|
||||
self._D_diag = np.ones(3, dtype="long")
|
||||
self._Q = np.eye(3, dtype="long", order="C")
|
||||
self._P = np.eye(3, dtype="long", order="C")
|
||||
|
||||
self._set_mesh_numbers(
|
||||
mesh,
|
||||
|
@ -596,7 +596,7 @@ class GridMatrix:
|
|||
|
||||
Grid generating matrix used for SNF.
|
||||
When SNF is used, ndarray, otherwise None.
|
||||
shape=(3, 3), dtype='int_', order='C'.
|
||||
shape=(3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._grid_matrix
|
||||
|
@ -607,7 +607,7 @@ class GridMatrix:
|
|||
|
||||
This corresponds to the mesh numbers in transformed reciprocal
|
||||
basis vectors.
|
||||
shape=(3,), dtype='int_'
|
||||
shape=(3,), dtype='long'
|
||||
|
||||
"""
|
||||
return self._D_diag
|
||||
|
@ -617,7 +617,7 @@ class GridMatrix:
|
|||
"""Left unimodular matrix after SNF: D=PAQ.
|
||||
|
||||
Left unimodular matrix after SNF: D=PAQ.
|
||||
shape=(3, 3), dtype='int_', order='C'.
|
||||
shape=(3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._P
|
||||
|
@ -627,7 +627,7 @@ class GridMatrix:
|
|||
"""Right unimodular matrix after SNF: D=PAQ.
|
||||
|
||||
Right unimodular matrix after SNF: D=PAQ.
|
||||
shape=(3, 3), dtype='int_', order='C'.
|
||||
shape=(3, 3), dtype='long', order='C'.
|
||||
|
||||
"""
|
||||
return self._Q
|
||||
|
@ -694,7 +694,7 @@ class GridMatrix:
|
|||
coordinates,
|
||||
)
|
||||
if num_values == 3:
|
||||
self._D_diag = np.array(mesh, dtype="int_")
|
||||
self._D_diag = np.array(mesh, dtype="long")
|
||||
|
||||
def _run_grg(
|
||||
self,
|
||||
|
@ -785,12 +785,12 @@ class GridMatrix:
|
|||
sym_dataset, length, coordinates=coordinates
|
||||
)
|
||||
elif grid_matrix is not None:
|
||||
_grid_matrix = np.array(grid_matrix, dtype="int_", order="C")
|
||||
_grid_matrix = np.array(grid_matrix, dtype="long", order="C")
|
||||
|
||||
# If grid_matrix is a diagonal matrix, use it as D matrix.
|
||||
gm_diag = np.diagonal(_grid_matrix)
|
||||
if (np.diag(gm_diag) == _grid_matrix).all() and not force_SNF:
|
||||
self._D_diag = np.array(gm_diag, dtype="int_")
|
||||
self._D_diag = np.array(gm_diag, dtype="long")
|
||||
else:
|
||||
import phono3py._recgrid as recgrid
|
||||
|
||||
|
@ -849,7 +849,7 @@ class GridMatrix:
|
|||
inv_tmat_int = np.rint(inv_tmat).astype(int)
|
||||
assert (np.abs(inv_tmat - inv_tmat_int) < 1e-5).all()
|
||||
grid_matrix = np.array(
|
||||
(inv_tmat_int * conv_mesh_numbers).T, dtype="int_", order="C"
|
||||
(inv_tmat_int * conv_mesh_numbers).T, dtype="long", order="C"
|
||||
)
|
||||
return grid_matrix
|
||||
|
||||
|
@ -875,12 +875,12 @@ def get_grid_point_from_address(address, D_diag):
|
|||
----------
|
||||
address : array_like
|
||||
Grid address.
|
||||
shape=(3, ) or (n, 3), dtype='int_'
|
||||
shape=(3, ) or (n, 3), dtype='long'
|
||||
D_diag : array_like
|
||||
This corresponds to mesh numbers. More precisely, this gives
|
||||
diagonal elements of diagonal matrix of Smith normal form of
|
||||
grid generating matrix. See the detail in the docstring of BZGrid.
|
||||
shape=(3,), dtype='int_'
|
||||
shape=(3,), dtype='long'
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
@ -890,18 +890,18 @@ def get_grid_point_from_address(address, D_diag):
|
|||
|
||||
ndarray
|
||||
GR-grid point indices.
|
||||
shape=(n, ), dtype='int_'
|
||||
shape=(n, ), dtype='long'
|
||||
|
||||
"""
|
||||
import phono3py._recgrid as recgrid
|
||||
|
||||
adrs_array = np.array(address, dtype="int_", order="C")
|
||||
mesh_array = np.array(D_diag, dtype="int_")
|
||||
adrs_array = np.array(address, dtype="long", order="C")
|
||||
mesh_array = np.array(D_diag, dtype="long")
|
||||
|
||||
if adrs_array.ndim == 1:
|
||||
return recgrid.grid_index_from_address(adrs_array, mesh_array)
|
||||
|
||||
gps = np.zeros(adrs_array.shape[0], dtype="int_")
|
||||
gps = np.zeros(adrs_array.shape[0], dtype="long")
|
||||
for i, adrs in enumerate(adrs_array):
|
||||
gps[i] = recgrid.grid_index_from_address(adrs, mesh_array)
|
||||
return gps
|
||||
|
@ -917,15 +917,15 @@ def get_ir_grid_points(bz_grid: BZGrid):
|
|||
-------
|
||||
ir_grid_points : ndarray
|
||||
Irreducible grid point indices in GR-grid.
|
||||
shape=(num_ir_grid_points, ), dtype='int_'
|
||||
shape=(num_ir_grid_points, ), dtype='long'
|
||||
ir_grid_weights : ndarray
|
||||
Weights of irreducible grid points. Its sum is the number of
|
||||
grid points in GR-grid (prod(D_diag)).
|
||||
shape=(num_ir_grid_points, ), dtype='int_'
|
||||
shape=(num_ir_grid_points, ), dtype='long'
|
||||
ir_grid_map : ndarray
|
||||
Index mapping table to irreducible grid points from all grid points
|
||||
such as, [0, 0, 2, 3, 3, ...].
|
||||
shape=(prod(D_diag), ), dtype='int_'
|
||||
shape=(prod(D_diag), ), dtype='long'
|
||||
|
||||
"""
|
||||
ir_grid_map = _get_ir_grid_map(bz_grid.D_diag, bz_grid.rotations, PS=bz_grid.PS)
|
||||
|
@ -949,7 +949,7 @@ def get_grid_points_by_rotations(
|
|||
Rotation matrices {R} with respect to basis vectors of GR-grid.
|
||||
Defined by g'=Rg, where g is the grid point address represented by
|
||||
three integers in BZ-grid.
|
||||
dtype='int_', shape=(rotations, 3, 3)
|
||||
dtype='long', shape=(rotations, 3, 3)
|
||||
with_surface : Bool, optional
|
||||
This parameter affects to how to treat grid points on BZ surface.
|
||||
When False, rotated BZ surface points are moved to representative
|
||||
|
@ -961,7 +961,7 @@ def get_grid_points_by_rotations(
|
|||
-------
|
||||
rot_grid_indices : ndarray
|
||||
BZ-grid point indices obtained after rotating a grid point index.
|
||||
dtype='int_', shape=(rotations,)
|
||||
dtype='long', shape=(rotations,)
|
||||
|
||||
"""
|
||||
if reciprocal_rotations is not None:
|
||||
|
@ -993,7 +993,7 @@ def _get_grid_points_by_bz_rotations(bz_gp, bz_grid: BZGrid, rotations, lang="C"
|
|||
def _get_grid_points_by_bz_rotations_c(bz_gp, bz_grid: BZGrid, rotations):
|
||||
import phono3py._recgrid as recgrid
|
||||
|
||||
bzgps = np.zeros(len(rotations), dtype="int_")
|
||||
bzgps = np.zeros(len(rotations), dtype="long")
|
||||
for i, r in enumerate(rotations):
|
||||
bzgps[i] = recgrid.rotate_bz_grid_index(
|
||||
bz_gp,
|
||||
|
@ -1017,7 +1017,7 @@ def _get_grid_points_by_bz_rotations_py(bz_gp, bz_grid: BZGrid, rotations):
|
|||
"""
|
||||
rot_adrs = np.dot(rotations, bz_grid.addresses[bz_gp])
|
||||
grgps = get_grid_point_from_address(rot_adrs, bz_grid.D_diag)
|
||||
bzgps = np.zeros(len(grgps), dtype="int_")
|
||||
bzgps = np.zeros(len(grgps), dtype="long")
|
||||
if bz_grid.store_dense_gp_map:
|
||||
for i, (gp, adrs) in enumerate(zip(grgps, rot_adrs)):
|
||||
indices = np.where(
|
||||
|
@ -1057,20 +1057,20 @@ def _get_grid_address(D_diag):
|
|||
----------
|
||||
D_diag : array_like
|
||||
Three integers that represent the generalized regular grid.
|
||||
shape=(3, ), dtype='int_'
|
||||
shape=(3, ), dtype='long'
|
||||
|
||||
Returns
|
||||
-------
|
||||
gr_grid_addresses : ndarray
|
||||
Integer triplets that represents grid point addresses in
|
||||
generalized regular grid.
|
||||
shape=(prod(D_diag), 3), dtype='int_'
|
||||
shape=(prod(D_diag), 3), dtype='long'
|
||||
|
||||
"""
|
||||
import phono3py._recgrid as recgrid
|
||||
|
||||
gr_grid_addresses = np.zeros((np.prod(D_diag), 3), dtype="int_")
|
||||
recgrid.gr_grid_addresses(gr_grid_addresses, np.array(D_diag, dtype="int_"))
|
||||
gr_grid_addresses = np.zeros((np.prod(D_diag), 3), dtype="long")
|
||||
recgrid.gr_grid_addresses(gr_grid_addresses, np.array(D_diag, dtype="long"))
|
||||
return gr_grid_addresses
|
||||
|
||||
|
||||
|
@ -1139,37 +1139,37 @@ def _relocate_BZ_grid_address(
|
|||
import phono3py._recgrid as recgrid
|
||||
|
||||
if PS is None:
|
||||
_PS = np.zeros(3, dtype="int_")
|
||||
_PS = np.zeros(3, dtype="long")
|
||||
else:
|
||||
_PS = np.array(PS, dtype="int_")
|
||||
bz_grid_addresses = np.zeros((np.prod(D_diag) * 8, 3), dtype="int_", order="C")
|
||||
bzg2grg = np.zeros(len(bz_grid_addresses), dtype="int_")
|
||||
_PS = np.array(PS, dtype="long")
|
||||
bz_grid_addresses = np.zeros((np.prod(D_diag) * 8, 3), dtype="long", order="C")
|
||||
bzg2grg = np.zeros(len(bz_grid_addresses), dtype="long")
|
||||
|
||||
if store_dense_gp_map:
|
||||
bz_map = np.zeros(np.prod(D_diag) + 1, dtype="int_")
|
||||
bz_map = np.zeros(np.prod(D_diag) + 1, dtype="long")
|
||||
else:
|
||||
bz_map = np.zeros(np.prod(D_diag) * 9 + 1, dtype="int_")
|
||||
bz_map = np.zeros(np.prod(D_diag) * 9 + 1, dtype="long")
|
||||
|
||||
# Mpr^-1 = Lr^-1 Lp
|
||||
reclat_T = np.array(np.transpose(reciprocal_lattice), dtype="double", order="C")
|
||||
reduced_basis = get_reduced_bases(reclat_T)
|
||||
tmat_inv = np.dot(np.linalg.inv(reduced_basis.T), reclat_T.T)
|
||||
tmat_inv_int = np.rint(tmat_inv).astype("int_")
|
||||
tmat_inv_int = np.rint(tmat_inv).astype("long")
|
||||
assert (np.abs(tmat_inv - tmat_inv_int) < 1e-5).all()
|
||||
|
||||
num_gp = recgrid.bz_grid_addresses(
|
||||
bz_grid_addresses,
|
||||
bz_map,
|
||||
bzg2grg,
|
||||
np.array(D_diag, dtype="int_"),
|
||||
np.array(np.dot(tmat_inv_int, Q), dtype="int_", order="C"),
|
||||
np.array(D_diag, dtype="long"),
|
||||
np.array(np.dot(tmat_inv_int, Q), dtype="long", order="C"),
|
||||
_PS,
|
||||
np.array(reduced_basis.T, dtype="double", order="C"),
|
||||
store_dense_gp_map * 1 + 1,
|
||||
)
|
||||
|
||||
bz_grid_addresses = np.array(bz_grid_addresses[:num_gp], dtype="int_", order="C")
|
||||
bzg2grg = np.array(bzg2grg[:num_gp], dtype="int_")
|
||||
bz_grid_addresses = np.array(bz_grid_addresses[:num_gp], dtype="long", order="C")
|
||||
bzg2grg = np.array(bzg2grg[:num_gp], dtype="long")
|
||||
return bz_grid_addresses, bz_map, bzg2grg
|
||||
|
||||
|
||||
|
@ -1182,34 +1182,34 @@ def _get_ir_grid_map(D_diag, grg_rotations, PS=None):
|
|||
This corresponds to mesh numbers. More precisely, this gives
|
||||
diagonal elements of diagonal matrix of Smith normal form of
|
||||
grid generating matrix. See the detail in the docstring of BZGrid.
|
||||
shape=(3,), dtype='int_'
|
||||
shape=(3,), dtype='long'
|
||||
grg_rotations : array_like
|
||||
GR-grid rotation matrices.
|
||||
dtype='int_', shape=(grg_rotations, 3)
|
||||
dtype='long', shape=(grg_rotations, 3)
|
||||
PS : array_like
|
||||
GR-grid shift defined.
|
||||
dtype='int_', shape=(3,)
|
||||
dtype='long', shape=(3,)
|
||||
|
||||
Returns
|
||||
-------
|
||||
ir_grid_map : ndarray
|
||||
Grid point mapping from all indices to ir-gird-point indices in GR-grid.
|
||||
dtype='int_', shape=(prod(mesh),)
|
||||
dtype='long', shape=(prod(mesh),)
|
||||
|
||||
"""
|
||||
import phono3py._recgrid as recgrid
|
||||
|
||||
ir_grid_map = np.zeros(np.prod(D_diag), dtype="int_")
|
||||
ir_grid_map = np.zeros(np.prod(D_diag), dtype="long")
|
||||
if PS is None:
|
||||
_PS = np.zeros(3, dtype="int_")
|
||||
_PS = np.zeros(3, dtype="long")
|
||||
else:
|
||||
_PS = np.array(PS, dtype="int_")
|
||||
_PS = np.array(PS, dtype="long")
|
||||
|
||||
num_ir = recgrid.ir_grid_map(
|
||||
ir_grid_map,
|
||||
np.array(D_diag, dtype="int_"),
|
||||
np.array(D_diag, dtype="long"),
|
||||
_PS,
|
||||
np.array(grg_rotations, dtype="int_", order="C"),
|
||||
np.array(grg_rotations, dtype="long", order="C"),
|
||||
)
|
||||
|
||||
if num_ir > 0:
|
||||
|
|
|
@ -67,7 +67,7 @@ def run_phonon_solver_c(
|
|||
See Interaction.get_phonons().
|
||||
grid_points : ndarray
|
||||
Grid point indices.
|
||||
shape=(grid_points, ), dtype='int_'
|
||||
shape=(grid_points, ), dtype='long'
|
||||
grid_address : ndarray
|
||||
See BZGrid.addresses.
|
||||
QDinv : ndarray
|
||||
|
@ -127,7 +127,7 @@ def run_phonon_solver_c(
|
|||
is_nac_q_zero = True
|
||||
_nac_q_direction = np.array(nac_q_direction, dtype="double")
|
||||
|
||||
assert grid_points.dtype == np.dtype("int_")
|
||||
assert grid_points.dtype == np.dtype("long")
|
||||
assert grid_points.flags.c_contiguous
|
||||
assert QDinv.dtype == np.dtype("double")
|
||||
assert QDinv.flags.c_contiguous
|
||||
|
@ -256,4 +256,4 @@ def _get_fc_elements_mapping(dm, fc):
|
|||
fc_p2s = np.arange(len(p2s_map), dtype="intc")
|
||||
fc_s2p = s2pp_map
|
||||
|
||||
return np.array(fc_p2s, dtype="int_"), np.array(fc_s2p, dtype="int_")
|
||||
return np.array(fc_p2s, dtype="long"), np.array(fc_s2p, dtype="long")
|
||||
|
|
|
@ -91,7 +91,7 @@ class CollisionMatrix(ImagSelfEnergy):
|
|||
if not self._is_reducible_collision_matrix:
|
||||
self._num_ir_grid_points = num_ir_grid_points
|
||||
self._rot_grid_points = np.array(
|
||||
self._pp.bz_grid.bzg2grg[rot_grid_points], dtype="int_", order="C"
|
||||
self._pp.bz_grid.bzg2grg[rot_grid_points], dtype="long", order="C"
|
||||
)
|
||||
self._rotations_cartesian = rotations_cartesian
|
||||
|
||||
|
@ -269,8 +269,8 @@ class CollisionMatrix(ImagSelfEnergy):
|
|||
"""
|
||||
map_triplets = self._triplets_map_at_q
|
||||
map_q = self._ir_map_at_q
|
||||
gp2tp = -np.ones(len(map_triplets), dtype="int_")
|
||||
tp2s = -np.ones(len(map_triplets), dtype="int_")
|
||||
gp2tp = -np.ones(len(map_triplets), dtype="long")
|
||||
tp2s = -np.ones(len(map_triplets), dtype="long")
|
||||
swapped = np.zeros(len(map_triplets), dtype="bytes")
|
||||
num_tps = 0
|
||||
|
||||
|
|
|
@ -110,13 +110,13 @@ def get_fc3(
|
|||
if is_compact_fc and "cutoff_distance" not in disp_dataset:
|
||||
s2p_map = primitive.s2p_map
|
||||
p2p_map = primitive.p2p_map
|
||||
s2compact = np.array([p2p_map[i] for i in s2p_map], dtype="int_")
|
||||
s2compact = np.array([p2p_map[i] for i in s2p_map], dtype="long")
|
||||
target_atoms = [i for i in p2s_map if i not in first_disp_atoms]
|
||||
else:
|
||||
# distribute_fc3 prefers pure translation operations in distributing
|
||||
# fc3. Below, fc3 already computed are distributed to the first index
|
||||
# atoms in primitive cell, and then distribute to all the other atoms.
|
||||
s2compact = np.arange(len(supercell), dtype="int_")
|
||||
s2compact = np.arange(len(supercell), dtype="long")
|
||||
target_atoms = [i for i in p2s_map if i not in first_disp_atoms]
|
||||
distribute_fc3(
|
||||
fc3,
|
||||
|
@ -211,7 +211,7 @@ def distribute_fc3(
|
|||
if rot_i in pure_trans_indices:
|
||||
rot_index = rot_i
|
||||
break
|
||||
atom_mapping = np.array(permutations[rot_index], dtype="int_")
|
||||
atom_mapping = np.array(permutations[rot_index], dtype="long")
|
||||
rot = rotations[rot_index]
|
||||
rot_cart_inv = np.array(
|
||||
similarity_transformation(lattice, rot).T, dtype="double", order="C"
|
||||
|
@ -271,10 +271,10 @@ def set_permutation_symmetry_compact_fc3(fc3, primitive):
|
|||
s2pp_map, nsym_list = get_nsym_list_and_s2pp(s2p_map, p2p_map, permutations)
|
||||
phono3c.permutation_symmetry_compact_fc3(
|
||||
fc3,
|
||||
np.array(permutations, dtype="int_", order="C"),
|
||||
np.array(s2pp_map, dtype="int_"),
|
||||
np.array(p2s_map, dtype="int_"),
|
||||
np.array(nsym_list, dtype="int_"),
|
||||
np.array(permutations, dtype="long", order="C"),
|
||||
np.array(s2pp_map, dtype="long"),
|
||||
np.array(p2s_map, dtype="long"),
|
||||
np.array(nsym_list, dtype="long"),
|
||||
)
|
||||
except ImportError as exc:
|
||||
text = (
|
||||
|
@ -325,10 +325,10 @@ def set_translational_invariance_compact_fc3(fc3, primitive: Primitive):
|
|||
permutations = primitive.atomic_permutations
|
||||
s2pp_map, nsym_list = get_nsym_list_and_s2pp(s2p_map, p2p_map, permutations)
|
||||
|
||||
permutations = np.array(permutations, dtype="int_", order="C")
|
||||
s2pp_map = np.array(s2pp_map, dtype="int_")
|
||||
p2s_map = np.array(p2s_map, dtype="int_")
|
||||
nsym_list = np.array(nsym_list, dtype="int_")
|
||||
permutations = np.array(permutations, dtype="long", order="C")
|
||||
s2pp_map = np.array(s2pp_map, dtype="long")
|
||||
p2s_map = np.array(p2s_map, dtype="long")
|
||||
nsym_list = np.array(nsym_list, dtype="long")
|
||||
phono3c.transpose_compact_fc3(
|
||||
fc3, permutations, s2pp_map, p2s_map, nsym_list, 0
|
||||
) # dim[0] <--> dim[1]
|
||||
|
@ -492,7 +492,7 @@ def _solve_fc3(
|
|||
rot_map_syms = get_positions_sent_by_rot_inv(
|
||||
lattice, positions, site_symmetry, symprec
|
||||
)
|
||||
rot_map_syms = np.array(rot_map_syms, dtype="int_", order="C")
|
||||
rot_map_syms = np.array(rot_map_syms, dtype="long", order="C")
|
||||
rot_disps = get_rotated_displacement(displacements_first, site_sym_cart)
|
||||
|
||||
logger.debug("pinv")
|
||||
|
@ -599,10 +599,10 @@ def show_drift_fc3(fc3, primitive=None, name="fc3"):
|
|||
p2p_map = primitive.p2p_map
|
||||
permutations = primitive.atomic_permutations
|
||||
s2pp_map, nsym_list = get_nsym_list_and_s2pp(s2p_map, p2p_map, permutations)
|
||||
permutations = np.array(permutations, dtype="int_", order="C")
|
||||
s2pp_map = np.array(s2pp_map, dtype="int_")
|
||||
p2s_map = np.array(p2s_map, dtype="int_")
|
||||
nsym_list = np.array(nsym_list, dtype="int_")
|
||||
permutations = np.array(permutations, dtype="long", order="C")
|
||||
s2pp_map = np.array(s2pp_map, dtype="long")
|
||||
p2s_map = np.array(p2s_map, dtype="long")
|
||||
nsym_list = np.array(nsym_list, dtype="long")
|
||||
num_patom = fc3.shape[0]
|
||||
num_satom = fc3.shape[1]
|
||||
maxval1 = 0
|
||||
|
|
|
@ -170,8 +170,8 @@ class Interaction:
|
|||
|
||||
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_")
|
||||
self._p2s = np.array(self._primitive.p2s_map, dtype="long")
|
||||
self._s2p = np.array(self._primitive.s2p_map, dtype="long")
|
||||
n_satom, n_patom, _ = self._multi.shape
|
||||
self._all_shortest = np.zeros(
|
||||
(n_patom, n_satom, n_satom), dtype="byte", order="C"
|
||||
|
@ -233,7 +233,7 @@ class Interaction:
|
|||
Returns
|
||||
-------
|
||||
ndarray
|
||||
shape=(3, ), dtype='int_'
|
||||
shape=(3, ), dtype='long'
|
||||
|
||||
"""
|
||||
return self._bz_grid.D_diag
|
||||
|
@ -332,7 +332,7 @@ class Interaction:
|
|||
Returns
|
||||
-------
|
||||
ndarray
|
||||
shape=(num_specified_bands, ), dtype='int_'
|
||||
shape=(num_specified_bands, ), dtype='long'
|
||||
|
||||
"""
|
||||
return self._band_indices
|
||||
|
@ -715,7 +715,7 @@ class Interaction:
|
|||
self.run_phonon_solver_with_eigvec_rotation()
|
||||
else:
|
||||
self._run_phonon_solver_c(
|
||||
np.arange(len(self._bz_grid.addresses), dtype="int_")
|
||||
np.arange(len(self._bz_grid.addresses), dtype="long")
|
||||
)
|
||||
else:
|
||||
self._run_phonon_solver_c(grid_points)
|
||||
|
@ -743,12 +743,12 @@ class Interaction:
|
|||
self._phonon_done[self._bz_grid.gp_Gamma] = 0
|
||||
if is_nac:
|
||||
self._done_nac_at_gamma = True
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="int_"))
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="long"))
|
||||
else:
|
||||
self._done_nac_at_gamma = False
|
||||
_nac_q_direction = self._nac_q_direction
|
||||
self._nac_q_direction = None
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="int_"))
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="long"))
|
||||
self._nac_q_direction = _nac_q_direction
|
||||
|
||||
def run_phonon_solver_with_eigvec_rotation(self):
|
||||
|
@ -860,7 +860,7 @@ class Interaction:
|
|||
in this method.
|
||||
|
||||
"""
|
||||
r_inv = -np.eye(3, dtype="int_")
|
||||
r_inv = -np.eye(3, dtype="long")
|
||||
bz_grid_points_solved = []
|
||||
for bzgp, done in enumerate(self._phonon_done):
|
||||
if done:
|
||||
|
@ -882,7 +882,7 @@ class Interaction:
|
|||
[
|
||||
bzgp_mq,
|
||||
],
|
||||
dtype="int_",
|
||||
dtype="long",
|
||||
)
|
||||
)
|
||||
bz_grid_points_solved.append(bzgp_mq)
|
||||
|
@ -925,9 +925,9 @@ class Interaction:
|
|||
def _set_band_indices(self, band_indices):
|
||||
num_band = len(self._primitive) * 3
|
||||
if band_indices is None:
|
||||
self._band_indices = np.arange(num_band, dtype="int_")
|
||||
self._band_indices = np.arange(num_band, dtype="long")
|
||||
else:
|
||||
self._band_indices = np.array(band_indices, dtype="int_")
|
||||
self._band_indices = np.array(band_indices, dtype="long")
|
||||
|
||||
def _run_c(self, g_zero):
|
||||
import phono3py._phono3py as phono3c
|
||||
|
|
|
@ -263,7 +263,7 @@ class JointDos:
|
|||
)
|
||||
raise RuntimeError(msg)
|
||||
|
||||
self.run_phonon_solver(np.array([gamma_gp, grid_point], dtype="int_"))
|
||||
self.run_phonon_solver(np.array([gamma_gp, grid_point], dtype="long"))
|
||||
|
||||
def run_phonon_solver(self, grid_points=None):
|
||||
"""Calculate phonons at grid_points.
|
||||
|
@ -273,7 +273,7 @@ class JointDos:
|
|||
|
||||
"""
|
||||
if grid_points is None:
|
||||
_grid_points = np.arange(len(self._bz_grid.addresses), dtype="int_")
|
||||
_grid_points = np.arange(len(self._bz_grid.addresses), dtype="long")
|
||||
else:
|
||||
_grid_points = grid_points
|
||||
|
||||
|
@ -306,11 +306,11 @@ class JointDos:
|
|||
"""
|
||||
self._phonon_done[self._bz_grid.gp_Gamma] = 0
|
||||
if is_nac:
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="int_"))
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="long"))
|
||||
else:
|
||||
_nac_q_direction = self._nac_q_direction
|
||||
self._nac_q_direction = None
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="int_"))
|
||||
self.run_phonon_solver(np.array([self._bz_grid.gp_Gamma], dtype="long"))
|
||||
self._nac_q_direction = _nac_q_direction
|
||||
|
||||
def run(self):
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from typing import TYPE_CHECKING, Union
|
||||
from collections.abc import Sequence
|
||||
from typing import TYPE_CHECKING, Optional, Union
|
||||
|
||||
import numpy as np
|
||||
from phonopy.structure.tetrahedron_method import TetrahedronMethod
|
||||
|
@ -49,11 +50,11 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
def get_triplets_at_q(
|
||||
grid_point,
|
||||
grid_point: int,
|
||||
bz_grid: BZGrid,
|
||||
reciprocal_rotations=None,
|
||||
is_time_reversal=True,
|
||||
swappable=True,
|
||||
reciprocal_rotations: Optional[Union[Sequence, np.ndarray]] = None,
|
||||
is_time_reversal: bool = True,
|
||||
swappable: bool = True,
|
||||
):
|
||||
"""Generate q-point triplets.
|
||||
|
||||
|
@ -66,7 +67,7 @@ def get_triplets_at_q(
|
|||
reciprocal_rotations : array_like or None, optional
|
||||
Rotation matrices {R} with respect to reciprocal basis vectors.
|
||||
Defined by q'=Rq.
|
||||
dtype='int_', shape=(rotations, 3, 3)
|
||||
dtype='long', shape=(rotations, 3, 3)
|
||||
is_time_reversal : bool, optional
|
||||
Inversion symemtry is added if it doesn't exist. Default is True.
|
||||
swappable : bool, optional
|
||||
|
@ -77,10 +78,10 @@ def get_triplets_at_q(
|
|||
triplets_at_q : ndarray
|
||||
Symmetry reduced number of triplets are stored as grid point
|
||||
integer numbers in BZGrid system.
|
||||
shape=(n_triplets, 3), dtype='int_'
|
||||
shape=(n_triplets, 3), dtype='long'
|
||||
weights : ndarray
|
||||
Weights of triplets in Brillouin zone
|
||||
shape=(n_triplets,), dtype='int_'
|
||||
shape=(n_triplets,), dtype='long'
|
||||
map_triplets : ndarray or None
|
||||
Mapping table of all triplets to symmetrically independent
|
||||
tripelts in generalized regular grid system. More precisely,
|
||||
|
@ -88,11 +89,11 @@ def get_triplets_at_q(
|
|||
independent q' of q+q'+q''=G. Considering q' is enough because
|
||||
q is fixed and q''=G-q-q' where G is automatically determined
|
||||
to choose smallest |G|.
|
||||
shape=(prod(mesh),), dtype='int_'
|
||||
shape=(prod(mesh),), dtype='long'
|
||||
map_q : ndarray
|
||||
Irreducible q-points stabilized by q-point of specified grid_point
|
||||
in generalized regular grid system.
|
||||
shape=(prod(mesh),), dtype='int_'
|
||||
shape=(prod(mesh),), dtype='long'
|
||||
|
||||
"""
|
||||
if reciprocal_rotations is None:
|
||||
|
@ -117,7 +118,7 @@ def get_triplets_at_q(
|
|||
return triplets_at_q, weights, map_triplets, map_q
|
||||
|
||||
|
||||
def get_all_triplets(grid_point, bz_grid):
|
||||
def get_all_triplets(grid_point: int, bz_grid: BZGrid):
|
||||
"""Return all triplets of a grid point.
|
||||
|
||||
Almost equivalent to ``get_nosym_triplets_at_q``.
|
||||
|
@ -125,20 +126,20 @@ def get_all_triplets(grid_point, bz_grid):
|
|||
|
||||
"""
|
||||
triplets_at_q, _ = _get_BZ_triplets_at_q(
|
||||
grid_point, bz_grid, np.arange(np.prod(bz_grid.D_diag), dtype="int_")
|
||||
grid_point, bz_grid, np.arange(np.prod(bz_grid.D_diag), dtype="long")
|
||||
)
|
||||
|
||||
return triplets_at_q
|
||||
|
||||
|
||||
def get_nosym_triplets_at_q(grid_point, bz_grid: BZGrid):
|
||||
def get_nosym_triplets_at_q(grid_point: int, bz_grid: BZGrid):
|
||||
"""Return triplets information without imposing mesh symmetry.
|
||||
|
||||
See the docstring of get_triplets_at_q.
|
||||
|
||||
"""
|
||||
map_triplets = np.arange(np.prod(bz_grid.D_diag), dtype="int_")
|
||||
map_q = np.arange(np.prod(bz_grid.D_diag), dtype="int_")
|
||||
map_triplets = np.arange(np.prod(bz_grid.D_diag), dtype="long")
|
||||
map_q = np.arange(np.prod(bz_grid.D_diag), dtype="long")
|
||||
triplets_at_q, weights = _get_BZ_triplets_at_q(grid_point, bz_grid, map_triplets)
|
||||
|
||||
return triplets_at_q, weights, map_triplets, map_q
|
||||
|
@ -238,11 +239,11 @@ def _get_triplets_reciprocal_mesh_at_q(
|
|||
fixed_grid_number : int
|
||||
Grid point of q0
|
||||
D_diag : array_like
|
||||
Diagonal part of the diagonal matrix by SNF. shape=(3,), dtype='int_'
|
||||
Diagonal part of the diagonal matrix by SNF. shape=(3,), dtype='long'
|
||||
rec_rotations : array_like
|
||||
Rotation matrices in reciprocal space, where the rotation matrix R is
|
||||
defined like q'=Rq. Time reversal symmetry is taken care of by
|
||||
is_time_reversal. shape=(n_rot, 3, 3), dtype='int_'
|
||||
is_time_reversal. shape=(n_rot, 3, 3), dtype='long'
|
||||
is_time_reversal : bool
|
||||
Inversion symemtry is added if it doesn't exist.
|
||||
swappable : bool
|
||||
|
@ -256,24 +257,24 @@ def _get_triplets_reciprocal_mesh_at_q(
|
|||
independent q' of q+q'+q''=G. Considering q' is enough because q is
|
||||
fixed and q''=G-q-q' where G is automatically determined to choose
|
||||
smallest |G| without considering BZ surface (see docstring of
|
||||
_get_BZ_triplets_at_q.) shape=(prod(mesh),), dtype='int_'
|
||||
_get_BZ_triplets_at_q.) shape=(prod(mesh),), dtype='long'
|
||||
map_q : ndarray
|
||||
Irreducible q-points stabilized by q-point of specified grid_point.
|
||||
shape=(prod(mesh),), dtype='int_'
|
||||
shape=(prod(mesh),), dtype='long'
|
||||
|
||||
"""
|
||||
import phono3py._phono3py as phono3c
|
||||
|
||||
map_triplets = np.zeros(np.prod(D_diag), dtype="int_")
|
||||
map_q = np.zeros(np.prod(D_diag), dtype="int_")
|
||||
map_triplets = np.zeros(np.prod(D_diag), dtype="long")
|
||||
map_q = np.zeros(np.prod(D_diag), dtype="long")
|
||||
|
||||
num_triplets = phono3c.triplets_reciprocal_mesh_at_q(
|
||||
map_triplets,
|
||||
map_q,
|
||||
fixed_grid_number,
|
||||
np.array(D_diag, dtype="int_"),
|
||||
np.array(D_diag, dtype="long"),
|
||||
is_time_reversal * 1,
|
||||
np.array(rec_rotations, dtype="int_", order="C"),
|
||||
np.array(rec_rotations, dtype="long", order="C"),
|
||||
swappable * 1,
|
||||
)
|
||||
assert num_triplets == len(np.unique(map_triplets))
|
||||
|
@ -306,40 +307,40 @@ def _get_BZ_triplets_at_q(bz_grid_index, bz_grid: BZGrid, map_triplets):
|
|||
q''=G-q-q' where G is automatically determined to choose
|
||||
smallest |G| without considering BZ surface (see docstring of
|
||||
_get_BZ_triplets_at_q.)
|
||||
shape=(prod(mesh),), dtype='int_'
|
||||
shape=(prod(mesh),), dtype='long'
|
||||
|
||||
Returns
|
||||
-------
|
||||
triplets : ndarray
|
||||
Symmetry reduced number of triplets are stored as grid point
|
||||
integer numbers.
|
||||
shape=(n_triplets, 3), dtype='int_'
|
||||
shape=(n_triplets, 3), dtype='long'
|
||||
ir_weights : ndarray
|
||||
Weights of triplets at a fixed q0.
|
||||
shape=(n_triplets,), dtype='int_'
|
||||
shape=(n_triplets,), dtype='long'
|
||||
|
||||
"""
|
||||
import phono3py._phono3py as phono3c
|
||||
|
||||
weights = np.zeros(len(map_triplets), dtype="int_")
|
||||
weights = np.zeros(len(map_triplets), dtype="long")
|
||||
for g in map_triplets:
|
||||
weights[g] += 1
|
||||
ir_weights = np.extract(weights > 0, weights)
|
||||
triplets = -np.ones((len(ir_weights), 3), dtype="int_")
|
||||
triplets = -np.ones((len(ir_weights), 3), dtype="long")
|
||||
num_ir_ret = phono3c.BZ_triplets_at_q(
|
||||
triplets,
|
||||
bz_grid_index,
|
||||
bz_grid.addresses,
|
||||
bz_grid.gp_map,
|
||||
map_triplets,
|
||||
np.array(bz_grid.D_diag, dtype="int_"),
|
||||
np.array(bz_grid.D_diag, dtype="long"),
|
||||
bz_grid.Q,
|
||||
bz_grid.store_dense_gp_map * 1 + 1,
|
||||
)
|
||||
|
||||
assert num_ir_ret == len(ir_weights)
|
||||
|
||||
return triplets, np.array(ir_weights, dtype="int_")
|
||||
return triplets, np.array(ir_weights, dtype="long")
|
||||
|
||||
|
||||
def _set_triplets_integration_weights_c(
|
||||
|
@ -357,7 +358,7 @@ def _set_triplets_integration_weights_c(
|
|||
g,
|
||||
g_zero,
|
||||
frequency_points, # f0
|
||||
np.array(np.dot(tetrahedra, pp.bz_grid.P.T), dtype="int_", order="C"),
|
||||
np.array(np.dot(tetrahedra, pp.bz_grid.P.T), dtype="long", order="C"),
|
||||
pp.bz_grid.D_diag,
|
||||
triplets_at_q,
|
||||
frequencies, # f1
|
||||
|
@ -380,7 +381,7 @@ def _set_triplets_integration_weights_py(
|
|||
thm = TetrahedronMethod(pp.bz_grid.microzone_lattice)
|
||||
triplets_at_q = pp.get_triplets_at_q()[0]
|
||||
tetrahedra_vertices = _get_tetrahedra_vertices(
|
||||
np.array(np.dot(thm.tetrahedra, pp.bz_grid.P.T), dtype="int_", order="C"),
|
||||
np.array(np.dot(thm.tetrahedra, pp.bz_grid.P.T), dtype="long", order="C"),
|
||||
triplets_at_q,
|
||||
pp.bz_grid,
|
||||
)
|
||||
|
@ -414,7 +415,7 @@ def _get_tetrahedra_vertices(relative_address, triplets_at_q, bz_grid: BZGrid):
|
|||
|
||||
"""
|
||||
num_triplets = len(triplets_at_q)
|
||||
vertices = np.zeros((num_triplets, 2, 24, 4), dtype="int_")
|
||||
vertices = np.zeros((num_triplets, 2, 24, 4), dtype="long")
|
||||
for i, tp in enumerate(triplets_at_q):
|
||||
for j, adrs_shift in enumerate((relative_address, -relative_address)):
|
||||
adrs = bz_grid.addresses[tp[j + 1]] + adrs_shift
|
||||
|
|
|
@ -1446,7 +1446,7 @@ def test_agno2_BZGrid_with_shift(agno2_cell: PhonopyAtoms):
|
|||
def test_relocate_BZ_grid_address_FCC():
|
||||
"""Test of _relocate_BZ_grid_address by FCC."""
|
||||
D_diag = [4, 4, 4]
|
||||
Q = np.eye(3, dtype="int_")
|
||||
Q = np.eye(3, dtype="long")
|
||||
reciprocal_lattice = np.array([[-1, 1, 1], [1, -1, 1], [1, 1, -1]], dtype="double")
|
||||
bz_grid_addresses, bz_map, bzg2grg = _relocate_BZ_grid_address(
|
||||
D_diag,
|
||||
|
|
Loading…
Reference in New Issue