def test_base(self): """Base tests for PhononBands""" filename = data.ref_file("trf2_5.out_PHBST.nc") phbands = PhononBands.from_file(filename) print(phbands) self.serialize_with_pickle(phbands, protocols=[-1], test_eq=False) self.assertEqual(phbands.minfreq, 0.0) #self.assertEqual(phbands.maxfreq, 30) #dos = phbands.get_dos() # Test XYZ vib _, filename = tempfile.mkstemp(text=True) phbands.create_xyz_vib(iqpt=0, filename=filename, max_supercell=[4,4,4])
# This example shows how to plot the phonon fatbands of AlAs. # See tutorial/lesson_rf2.html from abipy.tests import get_reference_file from abipy.phonons import PhononBands # Path to the PHBST file produced by anaddb. filename = get_reference_file("trf2_5.out_PHBST.nc") # Create the object from file. phbands = PhononBands.from_file(filename) # Mapping reduced coordinates -> labels qlabels = { (0,0,0): "$\Gamma$", (0.375, 0.375, 0.75): "K", (0.5, 0.5, 1.0): "X", (0.5, 0.5, 0.5): "L", (0.5, 0.0, 0.5): "X", (0.5, 0.25, 0.75): "W", } # Plot the phonon band structure. phbands.plot_fatbands(title="AlAs phonon fatbands without LO-TO splitting", qlabels=qlabels)
# This example shows how to plot the phonon band structure of AlAs. # See tutorial/lesson_rf2.html # FIXME: LO-TO splitting and phonon displacements instead of eigenvectors. from abipy.tests import get_reference_file from abipy.phonons import PhononBands, PHDOS_Reader, PHDOS_File # Path to the PHBST file produced by anaddb. phbst_file = get_reference_file("trf2_5.out_PHBST.nc") # Create the object from file. phbands = PhononBands.from_file(phbst_file) # Read the Phonon DOS from the netcd file produced by anaddb (prtdos 2) phdos_file = get_reference_file("trf2_5.out_PHDOS.nc") with PHDOS_Reader(phdos_file) as ncdata: dos = ncdata.read_phdos() # plot phonon bands and DOS. phbands.plot_with_dos(dos, title="AlAs Phonon bands and DOS")