Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
def _set_triplets_integration_weights_c(g, g_zero, pp, frequency_points):
    import phono3py._phono3py as phono3c

    thm = TetrahedronMethod(pp.bz_grid.microzone_lattice)
    triplets_at_q = pp.get_triplets_at_q()[0]
    frequencies = pp.get_phonons()[0]
    phono3c.triplets_integration_weights(
        g,
        g_zero,
        frequency_points,  # f0
        np.array(np.dot(thm.get_tetrahedra(), pp.bz_grid.P.T), dtype="int_", order="C"),
        pp.bz_grid.D_diag,
        triplets_at_q,
        frequencies,  # f1
        frequencies,  # f2
        pp.bz_grid.addresses,
        pp.bz_grid.gp_map,
        pp.bz_grid.store_dense_gp_map * 1 + 1,
        g.shape[0],
    )
Ejemplo n.º 3
0
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])