示例#1
0
    def test_Amm2(self):
        data = np.loadtxt(StringIO(dos_str))
        phonon = self._get_phonon("Amm2",
                                  [3, 2, 2],
                                  [[1, 0, 0],
                                   [0, 0.5, -0.5],
                                   [0, 0.5, 0.5]])
        mesh = [11, 11, 11]
        primitive = phonon.get_primitive()
        phonon.run_mesh([11, 11, 11])
        qpoints = phonon.mesh.qpoints
        weights = phonon.mesh.weights
        frequencies = phonon.mesh.frequencies
        grid_address = phonon.mesh.grid_address
        ir_grid_points = phonon.mesh.ir_grid_points
        grid_mapping_table = phonon.mesh.grid_mapping_table
        thm = TetrahedronMesh(primitive,
                              frequencies,
                              mesh,
                              grid_address,
                              grid_mapping_table,
                              ir_grid_points)
        thm.set(value='I', division_number=40)
        freq_points = thm.get_frequency_points()
        dos = np.zeros_like(freq_points)

        for i, iw in enumerate(thm):
            dos += np.sum(iw * weights[i], axis=1)

        dos_comp = np.transpose([freq_points, dos]).reshape(10, 8)
        self.assertTrue(np.abs(dos_comp - data).all() < 1e-5)
示例#2
0
    def test_Amm2(self):
        data = np.loadtxt(StringIO(dos_str))
        phonon = self._get_phonon("Amm2",
                                  [3, 2, 2],
                                  [[1, 0, 0],
                                   [0, 0.5, -0.5],
                                   [0, 0.5, 0.5]])
        mesh = [11, 11, 11]
        primitive = phonon.get_primitive()
        phonon.set_mesh([11, 11, 11])
        qpoints, weights, frequencies, _ = phonon.get_mesh()
        (grid_address,
         ir_grid_points,
         grid_mapping_table) = phonon.get_mesh_grid_info()
        thm = TetrahedronMesh(primitive,
                              frequencies,
                              mesh,
                              grid_address,
                              grid_mapping_table,
                              ir_grid_points)
        thm.set(value='I', division_number=40)
        freq_points = thm.get_frequency_points()
        dos = np.zeros_like(freq_points)

        for i, iw in enumerate(thm):
            dos += np.sum(iw * weights[i], axis=1)

        dos_comp = np.transpose([freq_points, dos]).reshape(10, 8)
        self.assertTrue(np.abs(dos_comp - data).all() < 1e-5)
示例#3
0
def test_Amm2():
    """Test of DOS calculation using TetrahedronMesh for Amm2 crystal."""
    data = np.loadtxt(StringIO(dos_str))
    phonon = _get_phonon("Amm2", [3, 2, 2],
                         [[1, 0, 0], [0, 0.5, -0.5], [0, 0.5, 0.5]])
    mesh = [11, 11, 11]
    primitive = phonon.primitive
    phonon.run_mesh([11, 11, 11])
    weights = phonon.mesh.weights
    frequencies = phonon.mesh.frequencies
    grid_address = phonon.mesh.grid_address
    ir_grid_points = phonon.mesh.ir_grid_points
    grid_mapping_table = phonon.mesh.grid_mapping_table
    thm = TetrahedronMesh(
        primitive,
        frequencies,
        mesh,
        np.array(grid_address, dtype="int_"),
        np.array(grid_mapping_table, dtype="int_"),
        ir_grid_points,
    )
    thm.set(value="I", division_number=40)
    freq_points = thm.get_frequency_points()
    dos = np.zeros_like(freq_points)

    for i, iw in enumerate(thm):
        dos += np.sum(iw * weights[i], axis=1)

    dos_comp = np.transpose([freq_points, dos]).reshape(10, 8)
    np.testing.assert_allclose(dos_comp, data, atol=1e-5)
示例#4
0
from phonopy.structure.symmetry import Symmetry
from phonopy.interface.vasp import read_vasp
from phonopy.file_IO import parse_FORCE_SETS, parse_BORN
from phonopy.structure.spglib import get_stabilized_reciprocal_mesh
from phonopy.structure.tetrahedron_method import TetrahedronMethod
from phonopy.phonon.tetrahedron_mesh import TetrahedronMesh

cell = read_vasp(sys.argv[1])
phonon = Phonopy(cell, [[2, 0, 0], [0, 2, 0], [0, 0, 2]], is_auto_displacements=False)
force_sets = parse_FORCE_SETS()
phonon.set_force_sets(force_sets)
phonon.set_post_process([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]])
primitive = phonon.get_primitive()
born = parse_BORN(primitive)
phonon.set_nac_params(born)
symmetry = phonon.get_primitive_symmetry()
mesh = [20, 20, 20]
# phonon.set_mesh(mesh)
# phonon.set_total_DOS(sigma=0.1)
# phonon.plot_total_DOS().show()

rotations = symmetry.get_pointgroup_operations()
thm = TetrahedronMesh(phonon.get_dynamical_matrix(),
                      mesh,
                      rotations,
                      is_gamma_center=True)
                      
thm.run_dos()
for f, iw in zip(thm.get_frequency_points(), thm.get_integration_weights()):
    print f, iw