From dedbb7a4a8f1052989960fc4c1ee80d7caa00fbc Mon Sep 17 00:00:00 2001 From: S-Erik Date: Mon, 4 Mar 2024 10:30:48 +0100 Subject: [PATCH] Minor changes --- README.md | 3 ++- eri_pair_densities.py | 5 ----- main.py | 29 ++++++++++++++++------------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 541c49a..eefae00 100644 --- a/README.md +++ b/README.md @@ -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*} ``` @@ -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. diff --git a/eri_pair_densities.py b/eri_pair_densities.py index 6880d7c..d3588b4 100644 --- a/eri_pair_densities.py +++ b/eri_pair_densities.py @@ -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 diff --git a/main.py b/main.py index 54c497a..e3f8d32 100644 --- a/main.py +++ b/main.py @@ -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 )