コード例 #1
0
ファイル: triplets.py プロジェクト: phonopy/phono3py
def _get_BZ_triplets_at_q(grid_point, bz_grid: BZGrid, map_triplets):
    """Grid point triplets are searched considering BZ surface.

    Looking for q+q'+q''=G with smallest |G|. In this condition,
    a pair in (q, q', q'') can be translationally equivalent points.
    This is treated on BZ-grid.

    Note
    ----
    Symmetry information of triplets is encoded in ``map_triplets``.

    Parameters
    ----------
    grid_number : int
        Grid point of q0 as defined by bz_grid.
    bz_grid : BZGrid
        Data structure to represent BZ grid.
    map_triplets : ndarray or None
        Mapping table of all triplets to symmetrically
        independent tripelts. More precisely, this gives a list of
        index mapping from all q-points to 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_'

    Returns
    -------
    triplets : ndarray
        Symmetry reduced number of triplets are stored as grid point
        integer numbers.
        shape=(n_triplets, 3), dtype='int_'
    ir_weights : ndarray
        Weights of triplets at a fixed q0.
        shape=(n_triplets,), dtype='int_'

    """
    import phono3py._phono3py as phono3c

    weights = np.zeros(len(map_triplets), dtype="int_")
    for g in map_triplets:
        weights[g] += 1
    ir_weights = np.extract(weights > 0, weights)
    triplets = -np.ones((len(ir_weights), 3), dtype="int_")
    num_ir_ret = phono3c.BZ_triplets_at_q(
        triplets,
        grid_point,
        bz_grid.addresses,
        bz_grid.gp_map,
        map_triplets,
        np.array(bz_grid.D_diag, dtype="int_"),
        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_")
コード例 #2
0
def _get_BZ_triplets_at_q(grid_point, bz_grid_address, bz_map, map_triplets,
                          mesh):
    import phono3py._phono3py as phono3c

    weights = np.zeros(len(map_triplets), dtype='intc')
    for g in map_triplets:
        weights[g] += 1
    ir_weights = np.extract(weights > 0, weights)
    triplets = np.zeros((len(ir_weights), 3), dtype=bz_map.dtype)
    # triplets are overwritten.
    num_ir_ret = phono3c.BZ_triplets_at_q(triplets, grid_point,
                                          bz_grid_address, bz_map,
                                          map_triplets,
                                          np.array(mesh, dtype='intc'))
    assert num_ir_ret == len(ir_weights)

    return triplets, np.array(ir_weights, dtype='intc')
コード例 #3
0
ファイル: triplets.py プロジェクト: zjyx147/phono3py
def _get_BZ_triplets_at_q(grid_point, bz_grid_address, bz_map, map_triplets,
                          mesh):
    """grid_address is overwritten."""

    import phono3py._phono3py as phono3c

    weights = np.zeros_like(map_triplets)
    for g in map_triplets:
        weights[g] += 1
    ir_weights = np.extract(weights > 0, weights)
    triplets = np.zeros((len(ir_weights), 3), dtype='intc')
    num_ir_ret = phono3c.BZ_triplets_at_q(triplets, grid_point,
                                          bz_grid_address, bz_map,
                                          map_triplets,
                                          np.array(mesh, dtype='intc'))

    return triplets, ir_weights