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

10 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"""Modified Chachiyo LDA correlation. 

4 

5Reference: Comput. Theor. Chem. 1172, 112669. 

6""" 

7 

8from .lda_c_chachiyo import lda_c_chachiyo, lda_c_chachiyo_spin 

9 

10 

11def lda_c_chachiyo_mod(n, **kwargs): 

12 """Modified Chachiyo parametrization of the correlation functional (spin-paired). 

13 

14 Corresponds to the functional with the label LDA_C_CHACHIYO_MOD and ID 307 in Libxc. 

15 

16 Reference: Comput. Theor. Chem. 1172, 112669. 

17 

18 Args: 

19 n: Real-space electronic density. 

20 

21 Keyword Args: 

22 **kwargs: Throwaway arguments. 

23 

24 Returns: 

25 Modified Chachiyo correlation energy density and potential. 

26 """ 

27 # Same as lda_c_chachiyo 

28 return lda_c_chachiyo(n, **kwargs) 

29 

30 

31def chachiyo_scaling_mod(zeta): 

32 """Weighting factor between the paramagnetic and the ferromagnetic case. 

33 

34 Reference: Comput. Theor. Chem. 1172, 112669. 

35 

36 Args: 

37 zeta: Relative spin polarization. 

38 

39 Returns: 

40 Weighting factor and its derivative. 

41 """ 

42 gzeta = ((1 + zeta) ** (2 / 3) + (1 - zeta) ** (2 / 3)) / 2 

43 fzeta = 2 * (1 - gzeta**3) 

44 

45 dfdzeta = -2 * gzeta**2 * (1 / (1 + zeta) ** (1 / 3) - 1 / (1 - zeta) ** (1 / 3)) 

46 return fzeta, dfdzeta 

47 

48 

49def lda_c_chachiyo_mod_spin(n, zeta, **kwargs): 

50 """Modified Chachiyo parametrization of the correlation functional (spin-polarized). 

51 

52 Corresponds to the functional with the label LDA_C_CHACHIYO_MOD and ID 307 in Libxc. 

53 

54 Reference: Comput. Theor. Chem. 1172, 112669. 

55 

56 Args: 

57 n: Real-space electronic density. 

58 zeta: Relative spin polarization. 

59 

60 Keyword Args: 

61 **kwargs: Throwaway arguments. 

62 

63 Returns: 

64 Modified Chachiyo correlation energy density and potential. 

65 """ 

66 return lda_c_chachiyo_spin(n, zeta, weight_function=chachiyo_scaling_mod, **kwargs)