From b39a7895f41c3c1297b041b52fca0af8d4de9a19 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Mon, 3 Feb 2020 16:46:12 -0600 Subject: [PATCH] added kconserv array --- src/nuclei/EZFIO.cfg | 17 +++++++++++ src/nuclei/kconserv_complex.irp.f | 26 +++++++++++++++++ src/utils_periodic/import_kconserv.irp.f | 36 ++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 src/nuclei/kconserv_complex.irp.f create mode 100644 src/utils_periodic/import_kconserv.irp.f diff --git a/src/nuclei/EZFIO.cfg b/src/nuclei/EZFIO.cfg index 34c27c46..b95385f5 100644 --- a/src/nuclei/EZFIO.cfg +++ b/src/nuclei/EZFIO.cfg @@ -37,3 +37,20 @@ type: logical doc: If true, the calculation uses periodic boundary conditions interface: ezfio, provider, ocaml default: false + +[io_kconserv] +doc: Read/Write kconserv array from/to disk [ Write | Read | None ] +type: Disk_access +interface: ezfio,provider,ocaml +default: None + +[kpt_num] +doc: Number of k-points +type: integer +interface: ezfio, provider + +[kconserv] +type: integer +doc: array containing information about k-point symmetry +size: (nuclei.kpt_num,nuclei.kpt_num,nuclei.kpt_num) +interface: ezfio diff --git a/src/nuclei/kconserv_complex.irp.f b/src/nuclei/kconserv_complex.irp.f new file mode 100644 index 00000000..11eb7daf --- /dev/null +++ b/src/nuclei/kconserv_complex.irp.f @@ -0,0 +1,26 @@ +BEGIN_PROVIDER [integer, kconserv, (kpt_num,kpt_num,kpt_num)] + implicit none + BEGIN_DOC + ! Information about k-point symmetry + ! + ! for k-points I,J,K: kconserv(I,J,K) gives L such that + ! k_I + k_J = k_K + k_L + ! two-electron integrals of the form + ! (where i,j,k have momentum k_I, k_J, k_K) + ! will only be nonzero if x has momentum k_L (as described above) + ! + END_DOC + integer :: i,j,k,l + + if (read_kconserv) then + call ezfio_get_nuclei_kconserv(kconserv) + print *, 'kconserv read from disk' + else + print*,'kconserv must be provided' + stop -1 + endif + if (write_kconserv) then + call ezfio_set_nuclei_kconserv(kconserv) + print *, 'kconserv written to disk' + endif +END_PROVIDER diff --git a/src/utils_periodic/import_kconserv.irp.f b/src/utils_periodic/import_kconserv.irp.f new file mode 100644 index 00000000..0dff268b --- /dev/null +++ b/src/utils_periodic/import_kconserv.irp.f @@ -0,0 +1,36 @@ +program import_kconserv + + PROVIDE ezfio_filename + call run +end + +subroutine run + use map_module + implicit none + BEGIN_DOC + ! read kconserv in physicists' notation order + ! if kconserv(i,j,k)=l, then is allowed by symmetry + ! NOTE: pyscf stores this internally in the order of chemists' notation (ik|jl) + END_DOC + + integer :: iunit + integer :: getunitandopen + + integer ::i,j,k,l + integer, allocatable :: A(:,:,:) + + allocate(A(kpt_num,kpt_num,kpt_num)) + + A = 0 + iunit = getunitandopen('kconserv','r') + do + read (iunit,*,end=10) i,j,k,l + A(i,j,k) = l + enddo + 10 continue + close(iunit) + call ezfio_set_nuclei_kconserv(A) + call ezfio_set_nuclei_io_kconserv("Read") + deallocate(A) + +end