@@ -35,7 +35,22 @@ FFTDF --- Fast Fourier transform based density fitting
35
35
36
36
FFTDF represents the method to compute ERIs in
37
37
reciprocal space with the Fourier transformed Coulomb kernel by using
38
- numerical fast Fourier transform (FFT).
38
+ numerical fast Fourier transform (FFT), which is implmented in the
39
+ PySCF class :class: `FFTDF `.
40
+ An :class: `FFTDF ` object can be initialized as follows::
41
+
42
+ >>> import numpy as np
43
+ >>> from pyscf.pbc import gto, df, scf
44
+ >>> cell = gto.M(atom='He 1 1 1', a=np.eye(3)*2, basis='3-21g')
45
+ >>> fftdf = df.FFTDF(cell)
46
+ >>> print(fftdf)
47
+ <pyscf.pbc.df.fft.FFTDF object at 0x111e278d0>
48
+ >>> mf = scf.RHF(cell)
49
+ >>> print(mf.with_df)
50
+ <pyscf.pbc.df.fft.FFTDF object at 0x1206b0f28>
51
+
52
+ As the default integral scheme of PBC calculations,
53
+ an :class: `FFTDF ` object is created when initializing the PBC mean-field object and held in the attribute :attr: `with_df `.
39
54
40
55
4-index ERI tensor and integral transformation
41
56
----------------------------------------------
@@ -44,11 +59,11 @@ For a general 4-index ERI, we have
44
59
.. math ::
45
60
46
61
(i_{\mathbf {k}_i} j_{\mathbf {k}_j}|k_{\mathbf {k}_k} l_{\mathbf {k}_l}) =
47
- \Omega \sum _{\mathbf {G}}^{' } \rho _{i_{\mathbf {k}_i},j_{\mathbf {k}_j}}(\mathbf {G})
62
+ \Omega \sum _{\mathbf {G}\neq \mathbf {k}_i- \mathbf {k}_j } \rho _{i_{\mathbf {k}_i},j_{\mathbf {k}_j}}(\mathbf {G})
48
63
\frac {4 \pi }{|\mathbf {k}_j-\mathbf {k}_i+\mathbf {G}|^2 }
49
64
\rho _{k_{\mathbf {k}_k},l_{\mathbf {k}_l}}(\mathbf {G}_{ikjl}-\mathbf {G}) \;,
50
65
51
- where
66
+ where :math: ` \mathbf {G}` is a reciprocal lattice vector,
52
67
53
68
.. math ::
54
69
@@ -62,20 +77,21 @@ and :math:`\rho_{i_{\mathbf{k}_i},j_{\mathbf{k}_j}}(\mathbf{G})` is the Fourier
62
77
= \frac {1 }{\Omega } \int _{\Omega } d\mathbf {r} \phi _{i_{\mathbf {k}_i}}^{*}(\mathbf {r}) \phi _{j_{\mathbf {k}_j}}(\mathbf {r})
63
78
e^{-i(\mathbf {k}_j - \mathbf {k}_i + \mathbf {G})\cdot \mathbf {r}} \;.
64
79
65
- Note that the 4 k points (corresponding to the 4 AO indices) should follow the momentum
80
+ Note that the four k points (corresponding to the four AO indices) should follow the momentum
66
81
conservation law:
67
82
68
83
.. math ::
69
- (\mathbf {k}_j - \mathbf {k}_i + \mathbf {k}_l - \mathbf {k}_k) \cdot a = 2 n \pi .
84
+ (\mathbf {k}_j - \mathbf {k}_i + \mathbf {k}_l - \mathbf {k}_k) = \mathbf {G} .
70
85
71
- To evaluate these 4-index ERIs, PySCF provides the function :func: `FFTDF.get_eri `.
86
+ To evaluate these 4-index ERIs, :class: ` FFTDF ` provides the function :func: `FFTDF.get_eri `.
72
87
By default, four :math: `\Gamma ` points are assigned to the four AO indices.
73
88
As the format of molecular ERI tensor, the PBC ERI tensor is reshaped to a 2D
74
89
array::
75
90
76
- >>> eri = fftdf.get_eri()
91
+ >>> kpts = cell.make_kpts([2,2,2])
92
+ >>> eri = fftdf.get_eri() # \Gamma points only
77
93
>>> print(eri.shape)
78
- (4, 4 )
94
+ (3, 3 )
79
95
>>> eri = fftdf.get_eri([kpts[0],kpts[0],kpts[1],kpts[1]])
80
96
>>> print(eri.shape)
81
97
(4, 4)
@@ -84,7 +100,7 @@ In addition, one can perform AO to MO transformations using the function :func:`
84
100
Similar to :func: `FFTDF.get_eri `, the
85
101
returned integral tensor is reshaped to a 2D array::
86
102
87
- >>> orbs = numpy .random.random((4,2,2)) # MO coefficients
103
+ >>> orbs = np .random.random((4,2,2)) # MO coefficients
88
104
>>> eri_mo = fftdf.ao2mo(orbs, [kpts[0],kpts[0],kpts[1],kpts[1]])
89
105
>>> print(eri_mo.shape)
90
106
(4, 4)
@@ -96,11 +112,11 @@ Hartree-Fock Coulomb matrix (J) and exchange matrix (K). This method can take
96
112
one density matrix or a list of density matrices as input and return the J and K
97
113
matrices for each density matrix::
98
114
99
- >>> dm = numpy .random.random((2,2))
115
+ >>> dm = np .random.random((2,2))
100
116
>>> j, k = fftdf.get_jk(dm)
101
117
>>> print(j.shape)
102
118
(2, 2)
103
- >>> dm = numpy .random.random((3,2,2))
119
+ >>> dm = np .random.random((3,2,2))
104
120
>>> j, k = fftdf.get_jk(dm)
105
121
>>> print(j.shape)
106
122
(3, 2, 2)
@@ -109,11 +125,11 @@ When k points are specified, the input density matrices should have the correct
109
125
shape that matches the number of k points::
110
126
111
127
>>> kpts = cell.make_kpts([1,1,3])
112
- >>> dm = numpy .random.random((3,2,2))
128
+ >>> dm = np .random.random((3,2,2))
113
129
>>> j, k = fftdf.get_jk(dm, kpts=kpts)
114
130
>>> print(j.shape)
115
131
(3, 2, 2)
116
- >>> dm = numpy .random.random((5,3,2,2))
132
+ >>> dm = np .random.random((5,3,2,2))
117
133
>>> j, k = fftdf.get_jk(dm, kpts=kpts)
118
134
>>> print(j.shape)
119
135
(5, 3, 2, 2)
@@ -140,7 +156,7 @@ nuclear-type integrals of Gamma point::
140
156
>>> vnuc = fftdf.get_pp(kpts)
141
157
>>> print(vnuc.shape)
142
158
(8, 2, 2)
143
- >>> vnuc = fftdf.get_pp(kpts )
159
+ >>> vnuc = fftdf.get_pp()
144
160
>>> print(vnuc.shape)
145
161
(2, 2)
146
162
0 commit comments