Add test for q-points mode at Gamma with q-direction

This commit is contained in:
Atsushi Togo 2024-09-13 19:24:22 +09:00
parent 2bbcbd2b79
commit ada5786f9e
1 changed files with 17 additions and 1 deletions

View File

@ -6,7 +6,7 @@ from phonopy import Phonopy
from phonopy.units import VaspToTHz
def testQpoints(ph_nacl_nofcsym: Phonopy):
def test_Qpoints(ph_nacl_nofcsym: Phonopy):
"""Test phonon calculation at specific q-points by NaCl."""
phonon = ph_nacl_nofcsym
qpoints = [[0, 0, 0], [0, 0, 0.5]]
@ -18,3 +18,19 @@ def testQpoints(ph_nacl_nofcsym: Phonopy):
freqs = phonon.qpoints.frequencies[i] / VaspToTHz
np.testing.assert_allclose(dm_eigs, eigs)
np.testing.assert_allclose(freqs**2 * np.sign(freqs), eigs)
def test_Qpoints_with_NAC_qdirection(ph_nacl: Phonopy):
"""Test phonon calculation at specific q-points by NaCl."""
phonon = ph_nacl
qpoints = [[0, 0, 0]]
phonon.run_qpoints(qpoints)
freqs = phonon.get_qpoints_dict()["frequencies"]
np.testing.assert_allclose(
freqs, [[0, 0, 0, 4.61643516, 4.61643516, 4.61643516]], atol=1e-5
)
phonon.run_qpoints(qpoints, nac_q_direction=[1, 0, 0])
freqs = phonon.get_qpoints_dict()["frequencies"]
np.testing.assert_allclose(
freqs, [[0, 0, 0, 4.61643516, 4.61643516, 7.39632718]], atol=1e-5
)