From 5a22eb37258910195bdb8f61d1af46cdeaed46bd Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Wed, 9 Sep 2020 10:52:39 +0900 Subject: [PATCH] Spectral function is divided by pi --- phono3py/phonon3/spectral_function.py | 18 +++++++++++++++++- test/phonon3/test_spectral_function.py | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/phono3py/phonon3/spectral_function.py b/phono3py/phonon3/spectral_function.py index b87400f2..66bba41c 100644 --- a/phono3py/phonon3/spectral_function.py +++ b/phono3py/phonon3/spectral_function.py @@ -242,6 +242,22 @@ class SpectralFunction(object): assert (np.abs(self._frequency_points - fpoints) < 1e-8).all() def _run_spectral_function(self, i, grid_point): + """Compute spectral functions from self-energies + + Note + ---- + Spectral function A is defined by + + -1 G_0 + A = -- Im ----------- + pi 1 - G_0 Pi + + where pi = 3.14..., and Pi is the self energy. It is expected that + the integral of A over frequency is approximately 1 for each phonon + mode. + + """ + if self._log_level: print("* Spectral function") frequencies = self._interaction.get_phonons()[0] @@ -255,7 +271,7 @@ class SpectralFunction(object): def _get_spectral_function(self, gammas, deltas, freq): fpoints = self._frequency_points - nums = 4 * freq ** 2 * gammas + nums = 4 * freq ** 2 * gammas / np.pi denoms = ((fpoints ** 2 - freq ** 2 - 2 * freq * deltas) ** 2 + (2 * freq * gammas) ** 2) vals = np.where(denoms > 0, nums / denoms, 0) diff --git a/test/phonon3/test_spectral_function.py b/test/phonon3/test_spectral_function.py index 3ccbb699..8ffa606e 100644 --- a/test/phonon3/test_spectral_function.py +++ b/test/phonon3/test_spectral_function.py @@ -63,5 +63,5 @@ def test_SpectralFunction(si_pbesol): np.testing.assert_allclose( shifts, np.swapaxes(sf.shifts, -2, -1).ravel(), atol=1e-2) np.testing.assert_allclose( - spec_funcs, np.swapaxes(sf.spectral_functions, -2, -1).ravel(), + spec_funcs, np.swapaxes(sf.spectral_functions * np.pi, -2, -1).ravel(), atol=1e-2, rtol=1e-2)