Spectral function is divided by pi

This commit is contained in:
Atsushi Togo 2020-09-09 10:52:39 +09:00
parent d962f16eb7
commit 5a22eb3725
2 changed files with 18 additions and 2 deletions

View File

@ -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)

View File

@ -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)