Coverage for eminus/xc/lda_xc_gdsmfb.py: 100.00%

53 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-02 10:16 +0000

1# SPDX-FileCopyrightText: 2024 The eminus developers 

2# SPDX-License-Identifier: Apache-2.0 

3"""GDSMFB LDA exchange-correlation. 

4 

5Reference: Phys. Rev. Lett. 119, 135001. 

6""" 

7 

8import dataclasses 

9 

10from .lda_xc_ksdt import Coefficients, lda_xc_ksdt, lda_xc_ksdt_spin 

11 

12 

13@dataclasses.dataclass 

14class Zeta0Coeffs(Coefficients): 

15 """Coefficient class using the parameters for zeta=0. 

16 

17 Reference: Phys. Rev. Lett. 119, 135001. 

18 """ 

19 

20 omega: float = 1 

21 b1: float = 0.3436902 

22 b2: float = 7.82159531356 

23 b3: float = 0.300483986662 

24 b4: float = 15.8443467125 

25 c1: float = 0.8759442 

26 c2: float = -0.230130843551 

27 c3: float = 1 

28 d1: float = 0.72700876 

29 d2: float = 2.38264734144 

30 d3: float = 0.30221237251 

31 d4: float = 4.39347718395 

32 d5: float = 0.729951339845 

33 e1: float = 0.25388214 

34 e2: float = 0.815795138599 

35 e3: float = 0.0646844410481 

36 e4: float = 15.0984620477 

37 e5: float = 0.230761357474 

38 

39 

40@dataclasses.dataclass 

41class Zeta1Coeffs(Coefficients): 

42 """Coefficient class using the parameters for zeta=1. 

43 

44 Reference: Phys. Rev. Lett. 119, 135001. 

45 """ 

46 

47 omega: float = 2 ** (1 / 3) 

48 b1: float = 0.84987704 

49 b2: float = 3.04033012073 

50 b3: float = 0.0775730131248 

51 b4: float = 7.57703592489 

52 c1: float = 0.91126873 

53 c2: float = -0.0307957123308 

54 c3: float = 1 

55 d1: float = 1.48658718 

56 d2: float = 4.92684905511 

57 d3: float = 0.0849387225179 

58 d4: float = 8.3269821188 

59 d5: float = 0.218864952126 

60 e1: float = 0.27454097 

61 e2: float = 0.400994856555 

62 e3: float = 2.88773194962 

63 e4: float = 6.33499237092 

64 e5: float = 24.823008753 

65 

66 

67@dataclasses.dataclass 

68class PhiParams: 

69 """Parameter class holding the spin-interpolation function parameters. 

70 

71 Reference: Phys. Rev. Lett. 119, 135001. 

72 """ 

73 

74 # Sign of parameters is different from the supplemental material 

75 g1: float = 2 / 3 

76 g2: float = 3.18747258 

77 g3: float = 7.74662802 

78 lambda1: float = 1.85909536 

79 lambda2: float = 0 

80 

81 

82def lda_xc_gdsmfb(n, T=0, **kwargs): 

83 """GDSMFB exchange-correlation functional (spin-paired). 

84 

85 Similar to the functional with the label LDA_XC_GDSMFB and ID 577 in Libxc, but the 

86 implementations differ: https://gitlab.com/libxc/libxc/-/issues/525 

87 Exchange and correlation cannot be separated. 

88 

89 Reference: Phys. Rev. Lett. 119, 135001. 

90 

91 Args: 

92 n: Real-space electronic density. 

93 

94 Keyword Args: 

95 T: Temperature in Hartree. 

96 **kwargs: Throwaway arguments. 

97 

98 Returns: 

99 GDSMFB exchange-correlation energy density and potential. 

100 """ 

101 return lda_xc_ksdt( 

102 n, T=T, zeta0_coeffs=Zeta0Coeffs, zeta1_coeffs=Zeta1Coeffs, phi_params=PhiParams, **kwargs 

103 ) 

104 

105 

106def lda_xc_gdsmfb_spin(n, zeta, T=0, **kwargs): 

107 """GDSMFB exchange-correlation functional (spin-polarized). 

108 

109 Similar to the functional with the label LDA_XC_GDSMFB and ID 577 in Libxc, but the 

110 implementations differ: https://gitlab.com/libxc/libxc/-/issues/525 

111 Exchange and correlation cannot be separated. 

112 

113 Reference: Phys. Rev. Lett. 119, 135001. 

114 

115 Args: 

116 n: Real-space electronic density. 

117 zeta: Relative spin polarization. 

118 

119 Keyword Args: 

120 T: Temperature in Hartree. 

121 **kwargs: Throwaway arguments. 

122 

123 Returns: 

124 GDSMFB exchange-correlation energy density and potential. 

125 """ 

126 return lda_xc_ksdt_spin( 

127 n, 

128 zeta, 

129 T=T, 

130 zeta0_coeffs=Zeta0Coeffs, 

131 zeta1_coeffs=Zeta1Coeffs, 

132 phi_params=PhiParams, 

133 **kwargs, 

134 )