Skip to content

Commit ebd760e

Browse files
committed
fix some errors
1 parent 5accabe commit ebd760e

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

source/theory/pbc/df.rst

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,22 @@ FFTDF --- Fast Fourier transform based density fitting
3535

3636
FFTDF represents the method to compute ERIs in
3737
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`.
3954

4055
4-index ERI tensor and integral transformation
4156
----------------------------------------------
@@ -44,11 +59,11 @@ For a general 4-index ERI, we have
4459
.. math::
4560
4661
(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})
4863
\frac{4\pi}{|\mathbf{k}_j-\mathbf{k}_i+\mathbf{G}|^2}
4964
\rho_{k_{\mathbf{k}_k},l_{\mathbf{k}_l}}(\mathbf{G}_{ikjl}-\mathbf{G}) \;,
5065
51-
where
66+
where :math:`\mathbf{G}` is a reciprocal lattice vector,
5267

5368
.. math::
5469
@@ -62,20 +77,21 @@ and :math:`\rho_{i_{\mathbf{k}_i},j_{\mathbf{k}_j}}(\mathbf{G})` is the Fourier
6277
= \frac{1}{\Omega} \int_{\Omega} d\mathbf{r} \phi_{i_{\mathbf{k}_i}}^{*}(\mathbf{r}) \phi_{j_{\mathbf{k}_j}}(\mathbf{r})
6378
e^{-i(\mathbf{k}_j - \mathbf{k}_i + \mathbf{G})\cdot\mathbf{r}} \;.
6479
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
6681
conservation law:
6782

6883
.. math::
69-
(\mathbf{k}_j - \mathbf{k}_i + \mathbf{k}_l - \mathbf{k}_k) \cdot a = 2n\pi.
84+
(\mathbf{k}_j - \mathbf{k}_i + \mathbf{k}_l - \mathbf{k}_k) = \mathbf{G}.
7085
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`.
7287
By default, four :math:`\Gamma` points are assigned to the four AO indices.
7388
As the format of molecular ERI tensor, the PBC ERI tensor is reshaped to a 2D
7489
array::
7590

76-
>>> eri = fftdf.get_eri()
91+
>>> kpts = cell.make_kpts([2,2,2])
92+
>>> eri = fftdf.get_eri() # \Gamma points only
7793
>>> print(eri.shape)
78-
(4, 4)
94+
(3, 3)
7995
>>> eri = fftdf.get_eri([kpts[0],kpts[0],kpts[1],kpts[1]])
8096
>>> print(eri.shape)
8197
(4, 4)
@@ -84,7 +100,7 @@ In addition, one can perform AO to MO transformations using the function :func:`
84100
Similar to :func:`FFTDF.get_eri`, the
85101
returned integral tensor is reshaped to a 2D array::
86102

87-
>>> orbs = numpy.random.random((4,2,2)) # MO coefficients
103+
>>> orbs = np.random.random((4,2,2)) # MO coefficients
88104
>>> eri_mo = fftdf.ao2mo(orbs, [kpts[0],kpts[0],kpts[1],kpts[1]])
89105
>>> print(eri_mo.shape)
90106
(4, 4)
@@ -96,11 +112,11 @@ Hartree-Fock Coulomb matrix (J) and exchange matrix (K). This method can take
96112
one density matrix or a list of density matrices as input and return the J and K
97113
matrices for each density matrix::
98114

99-
>>> dm = numpy.random.random((2,2))
115+
>>> dm = np.random.random((2,2))
100116
>>> j, k = fftdf.get_jk(dm)
101117
>>> print(j.shape)
102118
(2, 2)
103-
>>> dm = numpy.random.random((3,2,2))
119+
>>> dm = np.random.random((3,2,2))
104120
>>> j, k = fftdf.get_jk(dm)
105121
>>> print(j.shape)
106122
(3, 2, 2)
@@ -109,11 +125,11 @@ When k points are specified, the input density matrices should have the correct
109125
shape that matches the number of k points::
110126

111127
>>> kpts = cell.make_kpts([1,1,3])
112-
>>> dm = numpy.random.random((3,2,2))
128+
>>> dm = np.random.random((3,2,2))
113129
>>> j, k = fftdf.get_jk(dm, kpts=kpts)
114130
>>> print(j.shape)
115131
(3, 2, 2)
116-
>>> dm = numpy.random.random((5,3,2,2))
132+
>>> dm = np.random.random((5,3,2,2))
117133
>>> j, k = fftdf.get_jk(dm, kpts=kpts)
118134
>>> print(j.shape)
119135
(5, 3, 2, 2)
@@ -140,7 +156,7 @@ nuclear-type integrals of Gamma point::
140156
>>> vnuc = fftdf.get_pp(kpts)
141157
>>> print(vnuc.shape)
142158
(8, 2, 2)
143-
>>> vnuc = fftdf.get_pp(kpts)
159+
>>> vnuc = fftdf.get_pp()
144160
>>> print(vnuc.shape)
145161
(2, 2)
146162

0 commit comments

Comments
 (0)