mirror of https://github.com/phonopy/phono3py.git
1889 lines
47 KiB
Python
1889 lines
47 KiB
Python
"""Test for imag_free_energy.py."""
|
|
|
|
import numpy as np
|
|
import pytest
|
|
|
|
from phono3py import Phono3py
|
|
|
|
|
|
def test_imag_self_energy_at_bands(si_pbesol: Phono3py):
|
|
"""Imaginary part of self energy spectrum of Si.
|
|
|
|
* at frequencies of band indices.
|
|
|
|
"""
|
|
si_pbesol.mesh_numbers = [9, 9, 9]
|
|
si_pbesol.init_phph_interaction()
|
|
if si_pbesol._make_r0_average:
|
|
gammas_ref = [
|
|
[0.00021545, 0.00021545, 0.00084089, 0.04680453, 0.04391903, 0.04391903],
|
|
[0.00382068, 0.00496605, 0.02735089, 0.01380481, 0.04135883, 0.029786],
|
|
]
|
|
else:
|
|
gammas_ref = [
|
|
[0.00021669, 0.00021669, 0.00084313, 0.04670244, 0.04380733, 0.04380733],
|
|
[0.00382813, 0.0049497, 0.02727924, 0.01382784, 0.04133946, 0.02980282],
|
|
]
|
|
for i, grgp in enumerate((1, 103)):
|
|
_, gammas = si_pbesol.run_imag_self_energy(
|
|
[
|
|
si_pbesol.grid.grg2bzg[grgp],
|
|
],
|
|
[
|
|
300,
|
|
],
|
|
frequency_points_at_bands=True,
|
|
)
|
|
# print(gammas.ravel())
|
|
np.testing.assert_allclose(gammas.ravel(), gammas_ref[i], rtol=0, atol=1e-2)
|
|
|
|
|
|
def test_imag_self_energy_at_bands_detailed(si_pbesol: Phono3py):
|
|
"""Imaginary part of self energy spectrum of Si.
|
|
|
|
* at frequencies of band indices.
|
|
* contribution from each triplet is returned.
|
|
|
|
"""
|
|
si_pbesol.mesh_numbers = [9, 9, 9]
|
|
si_pbesol.init_phph_interaction()
|
|
_, gammas, detailed_gammas = si_pbesol.run_imag_self_energy(
|
|
si_pbesol.grid.grg2bzg[[1, 103]],
|
|
[
|
|
300,
|
|
],
|
|
frequency_points_at_bands=True,
|
|
keep_gamma_detail=True,
|
|
)
|
|
|
|
weights_1 = [
|
|
2,
|
|
2,
|
|
2,
|
|
2,
|
|
1,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
6,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
6,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
6,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
6,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
12,
|
|
6,
|
|
]
|
|
weights_103 = [2] * 364 + [1]
|
|
|
|
gammas_1_ref = gammas[:, :, 0].ravel()
|
|
gammas_103_ref = gammas[:, :, 1].ravel()
|
|
gammas_1 = np.dot(weights_1, detailed_gammas[0][0, 0].sum(axis=-1).sum(axis=-1))
|
|
gammas_103 = np.dot(weights_103, detailed_gammas[1][0, 0].sum(axis=-1).sum(axis=-1))
|
|
np.testing.assert_allclose(
|
|
gammas_1[:2].sum(), gammas_1_ref[:2].sum(), rtol=0, atol=1e-2
|
|
)
|
|
np.testing.assert_allclose(
|
|
gammas_1[-2:].sum(), gammas_1_ref[-2:].sum(), rtol=0, atol=1e-2
|
|
)
|
|
np.testing.assert_allclose(gammas_1[2:4], gammas_1_ref[2:4], rtol=0, atol=1e-2)
|
|
np.testing.assert_allclose(gammas_103, gammas_103_ref, rtol=0, atol=1e-2)
|
|
|
|
|
|
@pytest.mark.parametrize("with_given_freq_points", [False, True])
|
|
def test_imag_self_energy_npoints(si_pbesol: Phono3py, with_given_freq_points: bool):
|
|
"""Imaginary part of self energy spectrum of Si.
|
|
|
|
* at 10 frequency points sampled uniformly.
|
|
|
|
"""
|
|
if si_pbesol._make_r0_average:
|
|
ref_gammas = [
|
|
[
|
|
0.00000000,
|
|
0.00051598,
|
|
0.00194418,
|
|
0.00614691,
|
|
0.00162083,
|
|
0.00970749,
|
|
0.00353066,
|
|
0.00731984,
|
|
0.00162686,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00051598,
|
|
0.00194418,
|
|
0.00614691,
|
|
0.00162083,
|
|
0.00970749,
|
|
0.00353066,
|
|
0.00731984,
|
|
0.00162686,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00088565,
|
|
0.00656764,
|
|
0.00867634,
|
|
0.00170325,
|
|
0.01690743,
|
|
0.01349900,
|
|
0.02901140,
|
|
0.01273512,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.01918681,
|
|
0.05297584,
|
|
0.04305304,
|
|
0.02805370,
|
|
0.04377473,
|
|
0.06225918,
|
|
0.50035489,
|
|
0.27502450,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02066231,
|
|
0.04931179,
|
|
0.04213945,
|
|
0.02907118,
|
|
0.05228489,
|
|
0.03443653,
|
|
0.50724519,
|
|
0.28034918,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02066231,
|
|
0.04931179,
|
|
0.04213945,
|
|
0.02907118,
|
|
0.05228489,
|
|
0.03443653,
|
|
0.50724519,
|
|
0.28034918,
|
|
0.00000000,
|
|
],
|
|
[
|
|
-0.00000000,
|
|
0.00231716,
|
|
0.00355335,
|
|
0.03489072,
|
|
0.00709568,
|
|
0.02008815,
|
|
0.01662680,
|
|
0.02924063,
|
|
0.01043312,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00262906,
|
|
0.00381874,
|
|
0.02768903,
|
|
0.00826331,
|
|
0.01980611,
|
|
0.01719952,
|
|
0.03277970,
|
|
0.01787071,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00525958,
|
|
0.00888770,
|
|
0.04924217,
|
|
0.01406585,
|
|
0.03184290,
|
|
0.05631297,
|
|
0.06688341,
|
|
0.08304821,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02085635,
|
|
0.02799420,
|
|
0.05086482,
|
|
0.02056579,
|
|
0.04031371,
|
|
0.09202142,
|
|
0.25428652,
|
|
0.26568153,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02212879,
|
|
0.03162412,
|
|
0.04661931,
|
|
0.03069041,
|
|
0.04365270,
|
|
0.05690000,
|
|
0.46061428,
|
|
0.32499384,
|
|
0.00000000,
|
|
],
|
|
[
|
|
-0.00000000,
|
|
0.02358234,
|
|
0.02866248,
|
|
0.04372230,
|
|
0.02373747,
|
|
0.04001464,
|
|
0.06215455,
|
|
0.42344655,
|
|
0.31899128,
|
|
0.00000000,
|
|
],
|
|
]
|
|
else:
|
|
ref_gammas = [
|
|
[
|
|
0.00000000,
|
|
0.00054081,
|
|
0.00194158,
|
|
0.00622583,
|
|
0.00163585,
|
|
0.00978467,
|
|
0.00355448,
|
|
0.00731102,
|
|
0.00162748,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00054081,
|
|
0.00194158,
|
|
0.00622583,
|
|
0.00163585,
|
|
0.00978467,
|
|
0.00355448,
|
|
0.00731102,
|
|
0.00162748,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00088422,
|
|
0.00654596,
|
|
0.00883017,
|
|
0.00171625,
|
|
0.01684764,
|
|
0.01350382,
|
|
0.02897440,
|
|
0.01279260,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.01917970,
|
|
0.05310768,
|
|
0.04276705,
|
|
0.02790667,
|
|
0.04371058,
|
|
0.06226158,
|
|
0.50091341,
|
|
0.27495914,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02063842,
|
|
0.04941879,
|
|
0.04187151,
|
|
0.02892275,
|
|
0.05230939,
|
|
0.03442249,
|
|
0.50771368,
|
|
0.28022971,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02063842,
|
|
0.04941879,
|
|
0.04187151,
|
|
0.02892275,
|
|
0.05230939,
|
|
0.03442249,
|
|
0.50771368,
|
|
0.28022971,
|
|
0.00000000,
|
|
],
|
|
[
|
|
-0.00000000,
|
|
0.00232330,
|
|
0.00355773,
|
|
0.03475333,
|
|
0.00710164,
|
|
0.02016255,
|
|
0.01658460,
|
|
0.02925112,
|
|
0.01045985,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00262851,
|
|
0.00381385,
|
|
0.02766221,
|
|
0.00817568,
|
|
0.01988199,
|
|
0.01723836,
|
|
0.03281213,
|
|
0.01786515,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00524095,
|
|
0.00883733,
|
|
0.04932620,
|
|
0.01398277,
|
|
0.03176217,
|
|
0.05637511,
|
|
0.06680493,
|
|
0.08310406,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02088739,
|
|
0.02810689,
|
|
0.05111945,
|
|
0.02050179,
|
|
0.04033510,
|
|
0.09200282,
|
|
0.25409682,
|
|
0.26587691,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02212442,
|
|
0.03164236,
|
|
0.04650615,
|
|
0.03066326,
|
|
0.04361261,
|
|
0.05691939,
|
|
0.46020445,
|
|
0.32500277,
|
|
0.00000000,
|
|
],
|
|
[
|
|
-0.00000000,
|
|
0.02359466,
|
|
0.02879263,
|
|
0.04348834,
|
|
0.02377393,
|
|
0.04001628,
|
|
0.06220649,
|
|
0.42322997,
|
|
0.31900494,
|
|
0.00000000,
|
|
],
|
|
]
|
|
|
|
ref_freq_points = [
|
|
0.00000000,
|
|
3.41024688,
|
|
6.82049376,
|
|
10.23074063,
|
|
13.64098751,
|
|
17.05123439,
|
|
20.46148127,
|
|
23.87172814,
|
|
27.28197502,
|
|
30.69222190,
|
|
]
|
|
|
|
si_pbesol.mesh_numbers = [9, 9, 9]
|
|
si_pbesol.init_phph_interaction()
|
|
if with_given_freq_points:
|
|
fpoints, gammas = si_pbesol.run_imag_self_energy(
|
|
si_pbesol.grid.grg2bzg[[1, 103]],
|
|
[
|
|
300,
|
|
],
|
|
frequency_points=ref_freq_points,
|
|
)
|
|
else:
|
|
fpoints, gammas = si_pbesol.run_imag_self_energy(
|
|
si_pbesol.grid.grg2bzg[[1, 103]],
|
|
[
|
|
300,
|
|
],
|
|
num_frequency_points=10,
|
|
)
|
|
|
|
# print(",".join([f"{val:.8f}" for val in fpoints]))
|
|
# for line in gammas.reshape(-1, 10):
|
|
# print("[", ",".join([f"{val:.8f}" for val in line]), "],")
|
|
|
|
np.testing.assert_allclose(ref_gammas, gammas.reshape(-1, 10), rtol=0, atol=1e-2)
|
|
np.testing.assert_allclose(ref_freq_points, fpoints.ravel(), rtol=0, atol=1e-5)
|
|
|
|
|
|
def test_imag_self_energy_npoints_with_sigma(si_pbesol: Phono3py):
|
|
"""Imaginary part of self energy spectrum of Si.
|
|
|
|
* at 10 frequency points sampled uniformly.
|
|
* with smearing method
|
|
|
|
"""
|
|
ref_freq_points = [
|
|
0.00000000,
|
|
3.45491354,
|
|
6.90982709,
|
|
10.36474063,
|
|
13.81965418,
|
|
17.27456772,
|
|
20.72948127,
|
|
24.18439481,
|
|
27.63930835,
|
|
31.09422190,
|
|
]
|
|
if si_pbesol._make_r0_average:
|
|
ref_gammas = [
|
|
[
|
|
0.00000000,
|
|
0.00041506,
|
|
0.00143965,
|
|
0.00825963,
|
|
0.00202149,
|
|
0.00732327,
|
|
0.00389552,
|
|
0.00641912,
|
|
0.00297687,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00041506,
|
|
0.00143965,
|
|
0.00825963,
|
|
0.00202149,
|
|
0.00732327,
|
|
0.00389552,
|
|
0.00641912,
|
|
0.00297687,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00072570,
|
|
0.00711098,
|
|
0.00931416,
|
|
0.00202686,
|
|
0.01269001,
|
|
0.01155621,
|
|
0.02333201,
|
|
0.11729894,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02248240,
|
|
0.05500631,
|
|
0.04347097,
|
|
0.02239399,
|
|
0.02385814,
|
|
0.05584392,
|
|
0.43672628,
|
|
0.84641772,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.01984028,
|
|
0.04361189,
|
|
0.04446874,
|
|
0.03551081,
|
|
0.03076592,
|
|
0.04043030,
|
|
0.48284919,
|
|
0.80928445,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.01984028,
|
|
0.04361189,
|
|
0.04446874,
|
|
0.03551081,
|
|
0.03076592,
|
|
0.04043030,
|
|
0.48284919,
|
|
0.80928445,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00224317,
|
|
0.00332166,
|
|
0.03220828,
|
|
0.00890233,
|
|
0.02594953,
|
|
0.01011824,
|
|
0.02358940,
|
|
0.01242541,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00288804,
|
|
0.00431127,
|
|
0.02580087,
|
|
0.00947799,
|
|
0.02570167,
|
|
0.01128341,
|
|
0.03736793,
|
|
0.02378157,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00557189,
|
|
0.00977275,
|
|
0.04893809,
|
|
0.01551857,
|
|
0.04776112,
|
|
0.05419744,
|
|
0.06642549,
|
|
0.20193208,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02259670,
|
|
0.02942983,
|
|
0.04584053,
|
|
0.02090207,
|
|
0.04959725,
|
|
0.10131908,
|
|
0.22198722,
|
|
0.49220668,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02347494,
|
|
0.03243416,
|
|
0.04077649,
|
|
0.03005826,
|
|
0.04951265,
|
|
0.06012485,
|
|
0.41587615,
|
|
0.52890177,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02646648,
|
|
0.03039681,
|
|
0.04291884,
|
|
0.02722076,
|
|
0.03705847,
|
|
0.08995939,
|
|
0.32617655,
|
|
0.50774483,
|
|
0.00000000,
|
|
],
|
|
]
|
|
else:
|
|
ref_gammas = [
|
|
[
|
|
0.00000000,
|
|
0.00046029,
|
|
0.00143860,
|
|
0.00826301,
|
|
0.00203560,
|
|
0.00746195,
|
|
0.00389360,
|
|
0.00642767,
|
|
0.00291728,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00046029,
|
|
0.00143860,
|
|
0.00826301,
|
|
0.00203560,
|
|
0.00746195,
|
|
0.00389360,
|
|
0.00642767,
|
|
0.00291728,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00071545,
|
|
0.00715263,
|
|
0.00950813,
|
|
0.00207048,
|
|
0.01268396,
|
|
0.01154058,
|
|
0.02338437,
|
|
0.11718631,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02242054,
|
|
0.05481156,
|
|
0.04304817,
|
|
0.02226551,
|
|
0.02380441,
|
|
0.05602348,
|
|
0.43710790,
|
|
0.84620157,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.01975435,
|
|
0.04396936,
|
|
0.04400210,
|
|
0.03531839,
|
|
0.03074892,
|
|
0.04034627,
|
|
0.48306584,
|
|
0.80881708,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.01975435,
|
|
0.04396936,
|
|
0.04400210,
|
|
0.03531839,
|
|
0.03074892,
|
|
0.04034627,
|
|
0.48306584,
|
|
0.80881708,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00224835,
|
|
0.00330612,
|
|
0.03210358,
|
|
0.00888799,
|
|
0.02593986,
|
|
0.01005313,
|
|
0.02358822,
|
|
0.01240071,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00288498,
|
|
0.00430468,
|
|
0.02583317,
|
|
0.00936948,
|
|
0.02559304,
|
|
0.01125217,
|
|
0.03737522,
|
|
0.02372173,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00554574,
|
|
0.00975355,
|
|
0.04906091,
|
|
0.01541312,
|
|
0.04760672,
|
|
0.05423798,
|
|
0.06633807,
|
|
0.20217767,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02261273,
|
|
0.02954525,
|
|
0.04609366,
|
|
0.02079095,
|
|
0.04958274,
|
|
0.10135670,
|
|
0.22190369,
|
|
0.49239981,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02349047,
|
|
0.03242621,
|
|
0.04064508,
|
|
0.03001210,
|
|
0.04942973,
|
|
0.06021902,
|
|
0.41562743,
|
|
0.52883866,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.02647988,
|
|
0.03052183,
|
|
0.04250035,
|
|
0.02721119,
|
|
0.03703768,
|
|
0.09005459,
|
|
0.32601504,
|
|
0.50769018,
|
|
0.00000000,
|
|
],
|
|
]
|
|
|
|
si_pbesol.sigmas = [
|
|
0.1,
|
|
]
|
|
si_pbesol.mesh_numbers = [9, 9, 9]
|
|
si_pbesol.init_phph_interaction()
|
|
fpoints, gammas = si_pbesol.run_imag_self_energy(
|
|
si_pbesol.grid.grg2bzg[[1, 103]],
|
|
[
|
|
300,
|
|
],
|
|
num_frequency_points=10,
|
|
)
|
|
|
|
# print(",".join([f"{val:.8f}" for val in fpoints]))
|
|
# for line in gammas.reshape(-1, 10):
|
|
# print("[", ",".join([f"{val:.8f}" for val in line]), "],")
|
|
|
|
np.testing.assert_allclose(ref_gammas, gammas.reshape(-1, 10), rtol=0, atol=1e-2)
|
|
np.testing.assert_allclose(ref_freq_points, fpoints.ravel(), rtol=0, atol=1e-5)
|
|
si_pbesol.sigmas = None
|
|
|
|
|
|
def test_imag_self_energy_detailed(si_pbesol: Phono3py):
|
|
"""Imaginary part of self energy spectrum of Si.
|
|
|
|
* specified frequency points
|
|
* contribution from each triplet is returned.
|
|
|
|
"""
|
|
if si_pbesol._make_r0_average:
|
|
ref_detailed_gamma = [
|
|
0.00000000,
|
|
0.00653802,
|
|
0.02363130,
|
|
0.01692507,
|
|
0.01004761,
|
|
0.02173881,
|
|
0.01858746,
|
|
0.16194774,
|
|
0.09666959,
|
|
0.00000000,
|
|
]
|
|
else:
|
|
ref_detailed_gamma = [
|
|
0.00000000,
|
|
0.00653581,
|
|
0.02368459,
|
|
0.01690030,
|
|
0.01000954,
|
|
0.02176237,
|
|
0.01858609,
|
|
0.16210109,
|
|
0.09666557,
|
|
0.00000000,
|
|
]
|
|
ref_freq_points = [
|
|
0.00000000,
|
|
3.41024688,
|
|
6.82049376,
|
|
10.23074063,
|
|
13.64098751,
|
|
17.05123439,
|
|
20.46148127,
|
|
23.87172814,
|
|
27.28197502,
|
|
30.69222190,
|
|
]
|
|
si_pbesol.mesh_numbers = [9, 9, 9]
|
|
si_pbesol.init_phph_interaction()
|
|
_, _, detailed_gammas = si_pbesol.run_imag_self_energy(
|
|
si_pbesol.grid.grg2bzg[
|
|
[
|
|
1,
|
|
]
|
|
],
|
|
[
|
|
300,
|
|
],
|
|
frequency_points=ref_freq_points,
|
|
keep_gamma_detail=True,
|
|
)
|
|
print(
|
|
",".join(
|
|
[f"{val:.8f}" for val in detailed_gammas[0][0, 0].sum(axis=(1, 2, 3, 4))]
|
|
)
|
|
)
|
|
|
|
np.testing.assert_allclose(
|
|
ref_detailed_gamma,
|
|
detailed_gammas[0][0, 0].sum(axis=(1, 2, 3, 4)),
|
|
rtol=0,
|
|
atol=1e-2,
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize("scattering_class", [1, 2])
|
|
def test_imag_self_energy_scat_classes(si_pbesol: Phono3py, scattering_class: int):
|
|
"""Imaginary part of self energy spectrum of Si.
|
|
|
|
* specified frequency points
|
|
* scattering event class 1
|
|
|
|
"""
|
|
if si_pbesol._make_r0_average:
|
|
gammas_classes = [
|
|
[
|
|
0.00000000,
|
|
0.00050914,
|
|
0.00157211,
|
|
0.00563846,
|
|
0.00015305,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00050914,
|
|
0.00157211,
|
|
0.00563846,
|
|
0.00015305,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00085927,
|
|
0.00259949,
|
|
0.00534777,
|
|
0.00032918,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.01895563,
|
|
0.01821133,
|
|
0.01325340,
|
|
0.00019835,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02035501,
|
|
0.01816242,
|
|
0.01117072,
|
|
0.00020856,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02035501,
|
|
0.01816242,
|
|
0.01117072,
|
|
0.00020856,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.00231716,
|
|
0.00298696,
|
|
0.03268244,
|
|
0.00004072,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00262906,
|
|
0.00348700,
|
|
0.02574137,
|
|
0.00005105,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00525958,
|
|
0.00633951,
|
|
0.03649681,
|
|
0.00007564,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02085635,
|
|
0.01763752,
|
|
0.03894488,
|
|
0.00003533,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02212879,
|
|
0.02748914,
|
|
0.01944958,
|
|
0.00004234,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.02358234,
|
|
0.02205344,
|
|
0.02055215,
|
|
0.00003810,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00000683,
|
|
0.00037207,
|
|
0.00050845,
|
|
0.00146778,
|
|
0.00970749,
|
|
0.00353066,
|
|
0.00731984,
|
|
0.00162686,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000683,
|
|
0.00037207,
|
|
0.00050845,
|
|
0.00146778,
|
|
0.00970749,
|
|
0.00353066,
|
|
0.00731984,
|
|
0.00162686,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00002638,
|
|
0.00396814,
|
|
0.00332857,
|
|
0.00137407,
|
|
0.01690743,
|
|
0.01349900,
|
|
0.02901140,
|
|
0.01273512,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00023118,
|
|
0.03476451,
|
|
0.02979964,
|
|
0.02785536,
|
|
0.04377473,
|
|
0.06225918,
|
|
0.50035489,
|
|
0.27502450,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00030731,
|
|
0.03114938,
|
|
0.03096873,
|
|
0.02886262,
|
|
0.05228489,
|
|
0.03443653,
|
|
0.50724519,
|
|
0.28034918,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00030731,
|
|
0.03114938,
|
|
0.03096873,
|
|
0.02886262,
|
|
0.05228489,
|
|
0.03443653,
|
|
0.50724519,
|
|
0.28034918,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00056639,
|
|
0.00220827,
|
|
0.00705496,
|
|
0.02008815,
|
|
0.01662680,
|
|
0.02924063,
|
|
0.01043312,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00033174,
|
|
0.00194766,
|
|
0.00821226,
|
|
0.01980611,
|
|
0.01719952,
|
|
0.03277970,
|
|
0.01787071,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00254819,
|
|
0.01274535,
|
|
0.01399022,
|
|
0.03184290,
|
|
0.05631297,
|
|
0.06688341,
|
|
0.08304821,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.01035668,
|
|
0.01191994,
|
|
0.02053046,
|
|
0.04031371,
|
|
0.09202142,
|
|
0.25428652,
|
|
0.26568153,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00413498,
|
|
0.02716973,
|
|
0.03064807,
|
|
0.04365270,
|
|
0.05690000,
|
|
0.46061428,
|
|
0.32499384,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00660905,
|
|
0.02317015,
|
|
0.02369937,
|
|
0.04001464,
|
|
0.06215455,
|
|
0.42344655,
|
|
0.31899128,
|
|
0.00000000,
|
|
],
|
|
]
|
|
else:
|
|
gammas_classes = [
|
|
[
|
|
0.00000000,
|
|
0.00053353,
|
|
0.00155303,
|
|
0.00572261,
|
|
0.00015904,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00053353,
|
|
0.00155303,
|
|
0.00572261,
|
|
0.00015904,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00086235,
|
|
0.00260313,
|
|
0.00543624,
|
|
0.00032385,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.01895345,
|
|
0.01823921,
|
|
0.01325169,
|
|
0.00019884,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02034551,
|
|
0.01819463,
|
|
0.01117239,
|
|
0.00020891,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02034551,
|
|
0.01819463,
|
|
0.01117239,
|
|
0.00020891,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.00232330,
|
|
0.00298877,
|
|
0.03257165,
|
|
0.00004097,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00262851,
|
|
0.00348107,
|
|
0.02571148,
|
|
0.00005101,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00524095,
|
|
0.00631419,
|
|
0.03654861,
|
|
0.00007457,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02088739,
|
|
0.01763613,
|
|
0.03903139,
|
|
0.00003508,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02212442,
|
|
0.02747888,
|
|
0.01942910,
|
|
0.00004210,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.02359466,
|
|
0.02208502,
|
|
0.02054993,
|
|
0.00003803,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
],
|
|
[
|
|
0.00000000,
|
|
0.00000728,
|
|
0.00038854,
|
|
0.00050322,
|
|
0.00147681,
|
|
0.00978467,
|
|
0.00355448,
|
|
0.00731102,
|
|
0.00162748,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000728,
|
|
0.00038854,
|
|
0.00050322,
|
|
0.00147681,
|
|
0.00978467,
|
|
0.00355448,
|
|
0.00731102,
|
|
0.00162748,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00002187,
|
|
0.00394283,
|
|
0.00339393,
|
|
0.00139240,
|
|
0.01684764,
|
|
0.01350382,
|
|
0.02897440,
|
|
0.01279260,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00022625,
|
|
0.03486847,
|
|
0.02951536,
|
|
0.02770783,
|
|
0.04371058,
|
|
0.06226158,
|
|
0.50091341,
|
|
0.27495914,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00029291,
|
|
0.03122415,
|
|
0.03069912,
|
|
0.02871384,
|
|
0.05230939,
|
|
0.03442249,
|
|
0.50771368,
|
|
0.28022971,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00029291,
|
|
0.03122415,
|
|
0.03069912,
|
|
0.02871384,
|
|
0.05230939,
|
|
0.03442249,
|
|
0.50771368,
|
|
0.28022971,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00056896,
|
|
0.00218168,
|
|
0.00706067,
|
|
0.02016255,
|
|
0.01658460,
|
|
0.02925112,
|
|
0.01045985,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00033277,
|
|
0.00195072,
|
|
0.00812467,
|
|
0.01988199,
|
|
0.01723836,
|
|
0.03281213,
|
|
0.01786515,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00252314,
|
|
0.01277760,
|
|
0.01390821,
|
|
0.03176217,
|
|
0.05637511,
|
|
0.06680493,
|
|
0.08310406,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.01047076,
|
|
0.01208806,
|
|
0.02046671,
|
|
0.04033510,
|
|
0.09200282,
|
|
0.25409682,
|
|
0.26587691,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00416347,
|
|
0.02707706,
|
|
0.03062116,
|
|
0.04361261,
|
|
0.05691939,
|
|
0.46020444,
|
|
0.32500277,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00670761,
|
|
0.02293840,
|
|
0.02373590,
|
|
0.04001628,
|
|
0.06220649,
|
|
0.42322997,
|
|
0.31900494,
|
|
0.00000000,
|
|
],
|
|
]
|
|
|
|
freq_points = [
|
|
0.00000000,
|
|
3.41024688,
|
|
6.82049376,
|
|
10.23074063,
|
|
13.64098751,
|
|
17.05123439,
|
|
20.46148127,
|
|
23.87172814,
|
|
27.28197502,
|
|
30.69222190,
|
|
]
|
|
|
|
si_pbesol.mesh_numbers = [9, 9, 9]
|
|
si_pbesol.init_phph_interaction()
|
|
_, gammas = si_pbesol.run_imag_self_energy(
|
|
si_pbesol.grid.grg2bzg[[1, 103]],
|
|
[
|
|
300,
|
|
],
|
|
frequency_points=freq_points,
|
|
scattering_event_class=scattering_class,
|
|
)
|
|
|
|
# print(",".join([f"{val:.8f}" for val in gammas.ravel()]))
|
|
|
|
np.testing.assert_allclose(
|
|
gammas_classes[scattering_class - 1],
|
|
gammas.ravel(),
|
|
rtol=0,
|
|
atol=1e-2,
|
|
)
|
|
|
|
|
|
def test_imag_self_energy_nacl_npoints(nacl_pbe: Phono3py):
|
|
"""Imaginary part of self energy spectrum of NaCl.
|
|
|
|
* at 10 frequency points sampled uniformly.
|
|
|
|
"""
|
|
ref_freq_points_nacl = [
|
|
0.0,
|
|
1.63223063,
|
|
3.26446125,
|
|
4.89669188,
|
|
6.5289225,
|
|
8.16115313,
|
|
9.79338375,
|
|
11.42561438,
|
|
13.057845,
|
|
14.69007563,
|
|
]
|
|
if nacl_pbe._make_r0_average:
|
|
ref_gammas_nacl = [
|
|
-0.00000000,
|
|
0.03444344,
|
|
0.00296190,
|
|
0.00995132,
|
|
0.04048613,
|
|
0.12896394,
|
|
0.30069255,
|
|
0.03939077,
|
|
0.00239450,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.03444344,
|
|
0.00296190,
|
|
0.00995132,
|
|
0.04048613,
|
|
0.12896394,
|
|
0.30069255,
|
|
0.03939077,
|
|
0.00239450,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.00657903,
|
|
0.00226484,
|
|
0.00981263,
|
|
0.03409971,
|
|
0.09241457,
|
|
0.14150024,
|
|
0.01741770,
|
|
0.00662391,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.21066682,
|
|
0.10639954,
|
|
0.03332928,
|
|
0.58912853,
|
|
0.88915724,
|
|
0.22361111,
|
|
0.00218072,
|
|
0.00007959,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.21066682,
|
|
0.10639954,
|
|
0.03332928,
|
|
0.58912853,
|
|
0.88915724,
|
|
0.22361111,
|
|
0.00218072,
|
|
0.00007959,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.12276466,
|
|
0.06860480,
|
|
0.02233716,
|
|
0.39686549,
|
|
0.59869124,
|
|
0.09705438,
|
|
0.00638271,
|
|
0.00004106,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02849354,
|
|
0.00857747,
|
|
0.00732109,
|
|
0.03185655,
|
|
0.10739965,
|
|
0.19867896,
|
|
0.03666808,
|
|
0.00156201,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.08982201,
|
|
0.02720259,
|
|
0.01733289,
|
|
0.08427259,
|
|
0.47096454,
|
|
0.44401037,
|
|
0.13185056,
|
|
0.01080419,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.19565691,
|
|
0.04806971,
|
|
0.03224006,
|
|
0.19087573,
|
|
1.03600654,
|
|
0.25216106,
|
|
0.12383447,
|
|
0.00063831,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.13720381,
|
|
0.04404631,
|
|
0.04538619,
|
|
0.11331213,
|
|
0.65756232,
|
|
0.35607291,
|
|
0.06603592,
|
|
0.00422206,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.19857224,
|
|
0.11162084,
|
|
0.02398068,
|
|
0.45400316,
|
|
0.84250476,
|
|
0.30483417,
|
|
0.02484116,
|
|
0.00060345,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.14296266,
|
|
0.04254436,
|
|
0.03358157,
|
|
0.18849049,
|
|
0.62321643,
|
|
0.22408437,
|
|
0.04408339,
|
|
0.00022909,
|
|
0.00000000,
|
|
]
|
|
else:
|
|
ref_gammas_nacl = [
|
|
-0.00000000,
|
|
0.03412227,
|
|
0.00297577,
|
|
0.01003931,
|
|
0.04045780,
|
|
0.12658706,
|
|
0.30073860,
|
|
0.03955197,
|
|
0.00240808,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.03412227,
|
|
0.00297577,
|
|
0.01003931,
|
|
0.04045780,
|
|
0.12658706,
|
|
0.30073860,
|
|
0.03955197,
|
|
0.00240808,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.00685045,
|
|
0.00229162,
|
|
0.00998147,
|
|
0.03575956,
|
|
0.09125745,
|
|
0.14177508,
|
|
0.01645454,
|
|
0.00688951,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.20963039,
|
|
0.10608340,
|
|
0.03415151,
|
|
0.58428262,
|
|
0.89036902,
|
|
0.22136832,
|
|
0.00222831,
|
|
0.00008074,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.20963039,
|
|
0.10608340,
|
|
0.03415151,
|
|
0.58428262,
|
|
0.89036902,
|
|
0.22136832,
|
|
0.00222831,
|
|
0.00008074,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.12229825,
|
|
0.06829476,
|
|
0.02275518,
|
|
0.39469016,
|
|
0.60149184,
|
|
0.09607742,
|
|
0.00627083,
|
|
0.00003641,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.02865843,
|
|
0.00862395,
|
|
0.00744270,
|
|
0.03233683,
|
|
0.10742672,
|
|
0.19870264,
|
|
0.03663654,
|
|
0.00155614,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.09000678,
|
|
0.02716669,
|
|
0.01726417,
|
|
0.08473104,
|
|
0.47222920,
|
|
0.44492775,
|
|
0.13129503,
|
|
0.01088453,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.19661360,
|
|
0.04906932,
|
|
0.03243540,
|
|
0.19297825,
|
|
1.04352920,
|
|
0.25267591,
|
|
0.12478784,
|
|
0.00064712,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.13715676,
|
|
0.04413874,
|
|
0.04550499,
|
|
0.11318286,
|
|
0.65612382,
|
|
0.35706399,
|
|
0.06590075,
|
|
0.00392933,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.19838954,
|
|
0.11210084,
|
|
0.02401306,
|
|
0.45270625,
|
|
0.84299483,
|
|
0.30604381,
|
|
0.02503964,
|
|
0.00058749,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.14215741,
|
|
0.04224664,
|
|
0.03269874,
|
|
0.18628124,
|
|
0.62264056,
|
|
0.22466635,
|
|
0.04542087,
|
|
0.00022448,
|
|
0.00000000,
|
|
]
|
|
|
|
nacl_pbe.mesh_numbers = [9, 9, 9]
|
|
nacl_pbe.init_phph_interaction()
|
|
fpoints, gammas = nacl_pbe.run_imag_self_energy(
|
|
nacl_pbe.grid.grg2bzg[[1, 103]],
|
|
[
|
|
300,
|
|
],
|
|
num_frequency_points=10,
|
|
)
|
|
|
|
# print(",".join([f"{val:.8f}" for val in gammas.ravel()]))
|
|
|
|
np.testing.assert_allclose(ref_gammas_nacl, gammas.ravel(), rtol=0, atol=2e-2)
|
|
np.testing.assert_allclose(ref_freq_points_nacl, fpoints.ravel(), rtol=0, atol=1e-5)
|
|
|
|
|
|
def test_imag_self_energy_nacl_nac_npoints(nacl_pbe: Phono3py):
|
|
"""Imaginary part of self energy spectrum of NaCl.
|
|
|
|
* at 10 frequency points sampled uniformly.
|
|
* at q->0
|
|
|
|
"""
|
|
ref_freq_points_nacl_nac = [
|
|
0.0,
|
|
1.63223063,
|
|
3.26446125,
|
|
4.89669188,
|
|
6.5289225,
|
|
8.16115313,
|
|
9.79338375,
|
|
11.42561438,
|
|
13.057845,
|
|
14.69007563,
|
|
]
|
|
if nacl_pbe._make_r0_average:
|
|
ref_gammas_nacl_nac = [
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.20515277,
|
|
0.10909453,
|
|
0.03621036,
|
|
0.69387687,
|
|
1.04033956,
|
|
0.24559392,
|
|
0.00013794,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.20515277,
|
|
0.10909453,
|
|
0.03621036,
|
|
0.69387687,
|
|
1.04033956,
|
|
0.24559392,
|
|
0.00013794,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.12702162,
|
|
0.06721975,
|
|
0.02254801,
|
|
0.43358877,
|
|
0.65296584,
|
|
0.15225307,
|
|
0.00008361,
|
|
0.00000000,
|
|
0.00000000,
|
|
]
|
|
else:
|
|
ref_gammas_nacl_nac = [
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.20357357,
|
|
0.10824350,
|
|
0.03724068,
|
|
0.68895266,
|
|
1.04602464,
|
|
0.24280786,
|
|
0.00013578,
|
|
0.00000000,
|
|
0.00000000,
|
|
-0.00000000,
|
|
0.20357357,
|
|
0.10824350,
|
|
0.03724068,
|
|
0.68895266,
|
|
1.04602464,
|
|
0.24280786,
|
|
0.00013578,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.00000000,
|
|
0.12602521,
|
|
0.06669333,
|
|
0.02319212,
|
|
0.43037527,
|
|
0.65646275,
|
|
0.15052589,
|
|
0.00008238,
|
|
0.00000000,
|
|
0.00000000,
|
|
]
|
|
|
|
nacl_pbe.mesh_numbers = [9, 9, 9]
|
|
nacl_pbe.init_phph_interaction(nac_q_direction=[1, 0, 0])
|
|
fpoints, gammas = nacl_pbe.run_imag_self_energy(
|
|
[nacl_pbe.grid.gp_Gamma], [300], num_frequency_points=10
|
|
)
|
|
|
|
# print(",".join([f"{val:.8f}" for val in gammas.ravel()]))
|
|
|
|
np.testing.assert_allclose(
|
|
ref_freq_points_nacl_nac, fpoints.ravel(), rtol=0, atol=1e-5
|
|
)
|
|
np.testing.assert_allclose(ref_gammas_nacl_nac, gammas.ravel(), rtol=0, atol=2e-2)
|