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

17 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-08 12:59 +0000

1# SPDX-FileCopyrightText: 2021 The eminus developers 

2# SPDX-License-Identifier: Apache-2.0 

3"""Slater LDA exchange. 

4 

5Reference: Phys. Rev. 81, 385. 

6""" 

7 

8import numpy as np 

9 

10 

11def lda_x(n, **kwargs): 

12 """Slater exchange functional (spin-paired). 

13 

14 Corresponds to the functional with the label LDA_X and ID 1 in Libxc. 

15 

16 Reference: Phys. Rev. 81, 385. 

17 

18 Args: 

19 n: Real-space electronic density. 

20 

21 Keyword Args: 

22 **kwargs: Throwaway arguments. 

23 

24 Returns: 

25 Exchange energy density and potential. 

26 """ 

27 f = -3 / 4 * (3 / (2 * np.pi)) ** (2 / 3) 

28 rs = (3 / (4 * np.pi * n)) ** (1 / 3) 

29 

30 ex = f / rs 

31 

32 vx = 4 / 3 * ex 

33 return ex, np.array([vx]), None 

34 

35 

36def lda_x_spin(n, zeta, **kwargs): 

37 """Slater exchange functional (spin-polarized). 

38 

39 Corresponds to the functional with the label LDA_X and ID 1 in Libxc. 

40 

41 Reference: Phys. Rev. 81, 385. 

42 

43 Args: 

44 n: Real-space electronic density. 

45 zeta: Relative spin polarization. 

46 

47 Keyword Args: 

48 **kwargs: Throwaway arguments. 

49 

50 Returns: 

51 Exchange energy density and potential. 

52 """ 

53 f = -3 / 4 * (3 / np.pi) ** (1 / 3) 

54 

55 rho13p = ((1 + zeta) * n) ** (1 / 3) 

56 rho13m = ((1 - zeta) * n) ** (1 / 3) 

57 

58 exup = f * rho13p 

59 exdw = f * rho13m 

60 ex = 0.5 * ((1 + zeta) * exup + (1 - zeta) * exdw) 

61 

62 vxup = 4 / 3 * exup 

63 vxdw = 4 / 3 * exdw 

64 return ex, np.array([vxup, vxdw]), None