Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Erik committed Mar 4, 2024
1 parent 3cf7c00 commit dedbb7a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ With this, the Coulomb matrix elements between four plane-waves can be written a
```math
\begin{gather*}
\bra{pq}V_C\ket{rs}=\int e^{-i(q-r)\cdot r_2} e^{-i(p-s)\cdot r_2} \frac{4\pi}{|p-s|^2} \mathrm{d}r_2=\\
\frac{4\pi}{|p-s|^2}\int e^{-i\left[(p-s)-(r-q)\right]\cot r_2} \mathrm{d}r_2=\\
\frac{4\pi}{|p-s|^2}\int e^{-i\left[(p-s)-(r-q)\right]\cdot r_2} \mathrm{d}r_2=\\
\frac{4\pi}{|p-s|^2}\delta\left((p-s)-(r-q)\right)\,,
\end{gather*}
```
Expand Down Expand Up @@ -92,6 +92,7 @@ $$h_{tuvw}=\sum_{\substack{p, p \neq 0}} \frac{4\pi}{|p|^2} \rho^\ast_{tw}(p) \r

**Notes:**
- We perform a spin-less DFT calculation. Therefore, the Kohn-Sham orbitals we use from the DFT calculation do not include spin. For the VQE and FCI calculation we use each Kohn-Sham orbital as a spin orbital which can hold two electrons, one with spin-up one with spin-down. Therefore 2 occupied Kohn-Sham orbitals correspond to 4 electrons, each occupying one spin orbital.
- The calculation of ERIs via pair densities is currently only implemented for $\Gamma$-point calculations.
- The implementation of calculation the ERIs via pair densities is inspired by [WEST](https://west-code.org/) and its implementation on [GitHub](https://github.com/west-code-development/West), especially the code in the [compute_eri_vc function](https://github.com/west-code-development/West/blob/master/Wfreq/solve_eri.f90#L327). Publications related when citing WEST: [Large Scale GW Calculations, M. Govoni and G. Galli, J. Chem. Theory Comput. 11, 2680 (2015)](https://pubs.acs.org/doi/10.1021/ct500958p) and [GPU Acceleration of Large-Scale Full-Frequency GW Calculations, V. Yu and M. Govoni, J. Chem. Theory Comput. 18, 4690 (2022)](https://pubs.acs.org/doi/10.1021/acs.jctc.2c00241). We note that, although inspiration was taken from the WEST implementation, no code from WEST was used.


Expand Down
5 changes: 0 additions & 5 deletions eri_pair_densities.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import os
import numpy as np
from scipy import signal
import xmltodict
from wfc import Wfc
import calc_matrix_elements

# Calculate ERIs via h_ijkl = 4\pi \sum_p (\rho*_il(p) \rho_jk(p))/p²
# with \rho_ij(p)=\int dr \rho_ij(r) e^(-ipr) which is the Fourier transform of
Expand Down
29 changes: 16 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,24 @@
p, c_ip_orbitals, wfc1_ncpp.atoms, wfc1_ncpp.cell_volume
)

# Electron repulsion
eri_file = os.path.join("eri", "eri_sym_rs_tuvw_0_4_f64.txt")

(
n_elements_pqrs,
n_states_pqrs,
indices_pqrs,
mat_pqrs,
) = load_eri_from_file(eri_file, "tuvw")
eri_hashmap = EriHashmap()
eri_hashmap.update(indices_pqrs, mat_pqrs)
h_pqrs: np.ndarray = eri_hashmap.get_tuvw(orbitals_indices) / wfc1_ncpp.cell_volume
# # Load Electron repulsion integrals from Rust calculation
# eri_file = os.path.join("eri", "eri_sym_rs_tuvw_0_4_f64.txt")

# (
# n_elements_pqrs,
# n_states_pqrs,
# indices_pqrs,
# mat_pqrs,
# ) = load_eri_from_file(eri_file, "tuvw")
# eri_hashmap = EriHashmap()
# eri_hashmap.update(indices_pqrs, mat_pqrs)
# h_pqrs: np.ndarray = eri_hashmap.get_tuvw(orbitals_indices) / wfc1_ncpp.cell_volume

# Cacluate ERIs via pair density instead of loading from Rust and CUDA output
h_pqrs_pair_density: np.ndarray = (
assert (
wfc1_ncpp.gamma_only is True
), "Calculating ERIs via pair densities is only implemented for the gamma-point!"
h_pqrs: np.ndarray = (
eri_pair_densities.eri_gamma(p=p, c_ip=c_ip_orbitals) / wfc1_ncpp.cell_volume
)

Expand Down

0 comments on commit dedbb7a

Please sign in to comment.