コード例 #1
0
ファイル: test_unfolding.py プロジェクト: ritwik-das/phonopy
def test_Unfolding_SC(ph_nacl):
    """Test to reproduce unfoled band structure

    Atomic positions are considered as the lattice ponts.

    Results are written to "bin-unfolding_to_atoms-test.dat".
    This data can be plotted by

    % plot_band.py bin-unfolding_to_atoms-test.dat

    Increase nd to get better plot.
    The test is done with nd=10.

    """

    # ph = _get_phonon(ph_nacl)
    ph = ph_nacl
    nd = 10
    qpoints = np.array([[
        x,
    ] * 3 for x in range(nd)]) / float(nd) - 0.5
    unfolding_supercell_matrix = np.diag([4, 4, 4])
    mapping = np.arange(len(ph.supercell), dtype=int)
    unfolding = Unfolding(ph, unfolding_supercell_matrix,
                          ph.supercell.scaled_positions, mapping, qpoints)
    unfolding.run()
    weights = _get_weights(unfolding, qpoints)
    # _write_weights(weights, "unfolding_to_atoms.dat")
    filename_out = os.path.join(data_dir, "bin-unfolding_to_atoms-test.dat")
    _compare(weights,
             os.path.join(data_dir, "bin-unfolding_to_atoms.dat"),
             filename_out=None)
コード例 #2
0
ファイル: test_unfolding.py プロジェクト: ritwik-das/phonopy
def test_Unfolding_NaCl(ph_nacl):
    """Test to reproduce proper band structure of primitive cell

    Results are written to "bin-unfolding-test.dat".
    This data can be plotted by

    % plot_band.py bin-unfolding-test.dat

    Increase nd to get better plot.
    The test is done with nd=10.

    """

    # ph = _get_phonon(ph_nacl)
    ph = ph_nacl
    nd = 10
    qpoints = np.array([[
        x,
    ] * 3 for x in range(nd)]) / float(nd) - 0.5
    unfolding_supercell_matrix = [[-2, 2, 2], [2, -2, 2], [2, 2, -2]]
    mapping = np.arange(len(ph.supercell), dtype=int)
    unfolding = Unfolding(ph, unfolding_supercell_matrix,
                          ph.supercell.scaled_positions, mapping, qpoints)
    unfolding.run()
    weights = _get_weights(unfolding, qpoints)
    # _write_weights(weights, "unfolding.dat")
    filename_out = os.path.join(data_dir, "bin-unfolding-test.dat")
    _compare(weights,
             os.path.join(data_dir, "bin-unfolding.dat"),
             filename_out=None)
コード例 #3
0
 def _prepare_unfolding(self, qpoints, unfolding_supercell_matrix):
     supercell = get_supercell(self._cell, np.diag([2, 2, 2]))
     phonon = self._get_phonon(supercell)
     mapping = range(supercell.get_number_of_atoms())
     self._unfolding = Unfolding(phonon, unfolding_supercell_matrix,
                                 supercell.get_scaled_positions(), mapping,
                                 qpoints)