def _set_integration_weights_c(self, thm): import phono3py._phono3py as phono3c unique_vertices = thm.get_unique_tetrahedra_vertices() neighboring_grid_points = np.zeros( len(unique_vertices) * len(self._grid_points), dtype='uintp') phono3c.neighboring_grid_points( neighboring_grid_points, self._grid_points, unique_vertices, self._mesh, self._grid_address, self._bz_map) unique_grid_points = np.array(np.unique(neighboring_grid_points), dtype='uintp') self._run_phonon_solver_c(unique_grid_points) freq_points = np.array( self._frequencies[self._grid_point, self._band_indices], dtype='double', order='C') phono3c.integration_weights( self._integration_weights, freq_points, thm.get_tetrahedra(), self._mesh, self._grid_points, self._frequencies, self._grid_address, self._bz_map)
def _set_triplets_integration_weights_c(g, g_zero, interaction, frequency_points, neighboring_phonons=False): import phono3py._phono3py as phono3c reciprocal_lattice = np.linalg.inv(interaction.get_primitive().get_cell()) mesh = interaction.get_mesh_numbers() thm = TetrahedronMethod(reciprocal_lattice, mesh=mesh) grid_address = interaction.get_grid_address() bz_map = interaction.get_bz_map() triplets_at_q = interaction.get_triplets_at_q()[0] if neighboring_phonons: unique_vertices = thm.get_unique_tetrahedra_vertices() for i, j in zip((1, 2), (1, -1)): neighboring_grid_points = np.zeros(len(unique_vertices) * len(triplets_at_q), dtype='intc') phono3c.neighboring_grid_points(neighboring_grid_points, triplets_at_q[:, i].flatten(), j * unique_vertices, mesh, grid_address, bz_map) interaction.set_phonons(np.unique(neighboring_grid_points)) phono3c.triplets_integration_weights(g, g_zero, frequency_points, thm.get_tetrahedra(), mesh, triplets_at_q, interaction.get_phonons()[0], grid_address, bz_map)
def get_unique_grid_points(grid_points, bz_grid): """Collect grid points on tetrahedron vertices around input grid points. Find grid points of 24 tetrahedra around each grid point and collect those grid points that are unique. Parameters ---------- grid_points : array_like Grid point indices. bz_grid : BZGrid Grid information in reciprocal space. Returns ------- ndarray Unique grid points on tetrahedron vertices around input grid points. shape=(unique_grid_points, ), dtype='int_'. """ import phono3py._phono3py as phono3c if _check_ndarray_state(grid_points, "int_"): _grid_points = grid_points else: _grid_points = np.array(grid_points, dtype="int_") thm = TetrahedronMethod(bz_grid.microzone_lattice) unique_vertices = np.array( np.dot(thm.get_unique_tetrahedra_vertices(), bz_grid.P.T), dtype="int_", order="C", ) neighboring_grid_points = np.zeros( len(unique_vertices) * len(_grid_points), dtype="int_" ) phono3c.neighboring_grid_points( neighboring_grid_points, _grid_points, unique_vertices, bz_grid.D_diag, bz_grid.addresses, bz_grid.gp_map, bz_grid.store_dense_gp_map * 1 + 1, ) unique_grid_points = np.array(np.unique(neighboring_grid_points), dtype="int_") return unique_grid_points
def _set_triplets_integration_weights_c(g, g_zero, interaction, frequency_points, neighboring_phonons=False): import phono3py._phono3py as phono3c reciprocal_lattice = np.linalg.inv(interaction.primitive.cell) mesh = interaction.mesh_numbers thm = TetrahedronMethod(reciprocal_lattice, mesh=mesh) grid_address = interaction.grid_address bz_map = interaction.bz_map triplets_at_q = interaction.get_triplets_at_q()[0] if neighboring_phonons: unique_vertices = thm.get_unique_tetrahedra_vertices() for i, j in zip((1, 2), (1, -1)): neighboring_grid_points = np.zeros(len(unique_vertices) * len(triplets_at_q), dtype=bz_map.dtype) phono3c.neighboring_grid_points( neighboring_grid_points, np.array(triplets_at_q[:, i], dtype='uintp').ravel(), j * unique_vertices, mesh, grid_address, bz_map) interaction.run_phonon_solver(np.unique(neighboring_grid_points)) frequencies = interaction.get_phonons()[0] phono3c.triplets_integration_weights( g, g_zero, frequency_points, # f0 thm.get_tetrahedra(), mesh, triplets_at_q, frequencies, # f1 frequencies, # f2 grid_address, bz_map, g.shape[0])