-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathslater.py
146 lines (121 loc) · 3.73 KB
/
slater.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env python3
"""
slater
======
This module contains functions which are useful to
process Slater-Condon data generated from the RSPt software.
"""
import numpy as np
from math import pi
from numba import jit
# ----------------------------------------------------------
# Slater-Condon integrals
@jit
def get_Slater_F(r, f1, f2, k):
r"""
Return Slater integral :math:`F^{(k)}`.
Calculate :math:`F^{(k)}` for radial functions `f1` and `f2`,
and the radial grid `r`.
A just-in-time (JIT) compilation is used for speed-up reasons.
Parameters
----------
r : (M) array
Radial grid.
f1 : (M) array
Radial function.
f2 : (M) array
Radial function.
k : int
Order of Slater integral to evaluate.
Returns
-------
s : float
Slater integral :math:`F^{(k)}`.
Notes
-----
The Slater integrals are calculated according to [1]_:
.. math:: F^{(k)} = \int_{0}^{\infty} \int_{0}^{\infty} dr dr' (r r' f_1(r) f_2(r'))^2 \frac{\mathrm{min}(r,r')^k}{\mathrm{max}(r,r')^{k+1}}
.. [1] J. Luder, "Theory of L-edge spectroscopy of strongly correlated systems", Phys Rev. B 96, 245131 (2017).
Examples
--------
>>> import numpy as np
>>> from math import pi
>>> from rspt2spectra.slater import get_Slater_F
>>> r = np.linspace(1e-6,1,300)
>>> f1 = np.sin(2*pi*r)/np.sqrt(2)
>>> f2 = np.sin(4*pi*r)/np.sqrt(2)
>>> k = 0
>>> print(get_Slater_F(r,f1,f2,k))
0.00816015659426
>>> k = 2
>>> print(get_Slater_F(r,f1,f2,k))
0.00503862918722
"""
# Define integration trapezoidal integration weights
dr = np.zeros_like(r)
dr[1:-1] = (r[2:] - r[:-2]) / 2.
dr[0] = (r[1] - r[0]) / 2.
dr[-1] = (r[-1] - r[-2]) / 2.
n = len(r)
s = 0
for i in range(n):
for j in range(n):
s += (dr[i] * dr[j] * (r[i] * r[j] * f1[i] * f2[j]) ** 2
* min(r[i], r[j]) ** k
/ max(r[i], r[j]) ** (k + 1))
return s
@jit
def get_Slater_G(r, f1, f2, k):
r"""
Return Slater integral :math:`G^{(k)}`.
Calculate :math:`G^{(k)}` for radial functions `f1` and `f2`,
and the radial grid `r`.
A just-in-time (JIT) compilation is used for speed-up reasons.
Parameters
----------
r : (M) array
Radial grid.
f1 : (M) array
Radial function.
f2 : (M) array
Radial function.
k : int
Order of Slater integral to evaluate.
Returns
-------
s : float
Slater integral :math:`G^{(k)}`.
Notes
-----
The Slater integrals are calculated according to [1]_:
.. math:: G^{(k)} = \int_{0}^{\infty} \int_{0}^{\infty} dr dr' (r r')^2 f_1(r) f_2(r) f_1(r') f_2(r') \frac{\mathrm{min}(r,r')^k}{\mathrm{max}(r,r')^{k+1}}
.. [1] J. Luder, "Theory of L-edge spectroscopy of strongly correlated systems", Phys Rev. B 96, 245131 (2017).
Examples
--------
>>> import numpy as np
>>> from math import pi
>>> from rspt2spectra.slater import get_Slater_G
>>> r = np.linspace(1e-6,1,300)
>>> f1 = np.sin(2*pi*r)/np.sqrt(2)
>>> f2 = np.sin(4*pi*r)/np.sqrt(2)
>>> k = 1
>>> print(get_Slater_G(r,f1,f2,k))
0.000834095400633
>>> k = 3
>>> print(get_Slater_G(r,f1,f2,k))
0.00121035494022
"""
# Define integration trapezoidal integration weights
dr = np.zeros_like(r)
dr[1:-1] = (r[2:] - r[:-2]) / 2.
dr[0] = (r[1] - r[0]) / 2.
dr[-1] = (r[-1] - r[-2]) / 2.
n = len(r)
s = 0
for i in range(n):
for j in range(n):
s += (dr[i] * dr[j] * (r[i] * r[j]) ** 2
* f1[i] * f2[i] * f1[j] * f2[j]
* min(r[i], r[j]) ** k
/ max(r[i], r[j]) ** (k + 1))
return s