1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

Merge pull request #104 from TREX-CoE/gammcor

Added Cholesky decomposition of ERI and RDM
This commit is contained in:
Anthony Scemama 2022-12-01 19:15:58 +01:00 committed by GitHub
commit 0c18b60f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 94 additions and 42 deletions

View File

@ -15,7 +15,7 @@ jobs:
get_commit_message:
name: Get commit message
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
message: ${{ steps.commit_message.outputs.message }}
steps:
@ -34,8 +34,8 @@ jobs:
trexio_ubuntu:
runs-on: ubuntu-latest
name: x86 Ubuntu latest
runs-on: ubuntu-20.04
name: x86 Ubuntu 20.04
needs: get_commit_message
steps:
@ -101,8 +101,8 @@ jobs:
trexio_macos:
runs-on: macos-latest
name: x86 MacOS latest
runs-on: macos-11
name: x86 MacOS 11
steps:
- uses: actions/checkout@v2

View File

@ -16,7 +16,7 @@ jobs:
get_commit_message:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Get commit message
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
message: ${{ steps.commit_message.outputs.message }}
steps:
@ -39,7 +39,7 @@ jobs:
if: >-
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
(github.repository == 'TREX-CoE/trexio' && startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
manylinux_tag: [2010_x86_64, 2014_x86_64, 2_24_x86_64]
@ -182,7 +182,7 @@ jobs:
publish_wheels:
name: Publish all wheels on PyPI
needs: [build_linux_wheels, build_macos_wheels]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout the branch

View File

@ -20,7 +20,7 @@ jobs:
run: sudo apt-get update
- name: install dependencies
run: sudo apt-get install emacs26
run: sudo apt-get install emacs
# this step is needed to pull the git submodule org-html-themes
#- name: initialize submodules

4
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "python/examples"]
path = python/examples
url = git@github.com:TREX-CoE/trexio-tutorials.git
url = https://github.com/TREX-CoE/trexio-tutorials.git
[submodule "docs/org-html-themes"]
path = docs/org-html-themes
url = git@github.com:fniessen/org-html-themes.git
url = https://github.com/fniessen/org-html-themes.git

View File

@ -17,6 +17,8 @@ CHANGES
- Added OCaml binding
- Added spin and energy in MOs
- Added CSF group
- Added Cholesky-decomposed two-electron integrals
- Added Cholesky-decomposed RDMs for Gammcor
- Added `trexio_flush` functionality
- Optional compilation `--without-fortran`

View File

@ -6,7 +6,7 @@
# TREXIO_INCLUDE_DIRS - The TREXIO include directories;
# TREXIO_LIBRARIES - The libraries needed to use TREXIO;
# If TREXIO has been installed in a non-standard location, one can set an
# If TREXIO has been installed in a non-standard location, one can set an
# environment variable $TREXIO_DIR in the current shell:
# $ export TREXIO_DIR=<custom_path>
# to indicate the prefix used during the TREXIO installation
@ -45,13 +45,13 @@ set(TREXIO_SEARCH_PATHS
/opt
)
find_path(TREXIO_INCLUDE_DIR
NAMES trexio.h
find_path(TREXIO_INCLUDE_DIR
NAMES trexio.h
HINTS $ENV{TREXIO_DIR}
PATH_SUFFIXES include/trexio include
PATHS ${TREXIO_SEARCH_PATHS}
)
# No need to specify platform-specific prefix (e.g. libtrexio on Unix) or
# suffix (e.g. .so on Unix or .dylib on MacOS) in NAMES. CMake takes care of that.
@ -70,8 +70,8 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TREXIO DEFAULT_MSG TREXIO_LIBRARY TREXIO_INCLUDE_DIR )
MARK_AS_ADVANCED(TREXIO_INCLUDE_DIR TREXIO_LIBRARY)
# Mot setting _INCLUDE_DIR and _LIBRARIES is considered a bug,
# Mot setting _INCLUDE_DIR and _LIBRARIES is considered a bug,
# see https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/How-To-Find-Libraries
set(TREXIO_LIBRARIES ${TREXIO_LIBRARY})
set(TREXIO_INCLUDE_DIRS ${TREXIO_INCLUDE_DIR})
set(TREXIO_INCLUDE_DIRS ${TREXIO_INCLUDE_DIR})

100
trex.org
View File

@ -651,15 +651,25 @@ prim_factor =
** Two-electron integrals (~mo_2e_int~ group)
The operators as the same as those defined in the
The operators are the same as those defined in the
[[#ao_two_e][AO two-electron integrals section]]. Here, the integrals are given in
the basis of molecular orbitals.
The Cholesky decomposition of the integrals can also be stored:
\[
\A_{ijkl} = \sum_{\alpha} G_{il\alpha} G_{jl\alpha}
\]
#+NAME: mo_2e_int
| Variable | Type | Dimensions | Description |
|----------+----------------+------------------------------------+-----------------------------------------|
| ~eri~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Electron repulsion integrals |
| ~eri_lr~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Long-range Electron repulsion integrals |
| Variable | Type | Dimensions | Description |
|-----------------------+----------------+-----------------------------------------+-----------------------------------------------|
| ~eri~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Electron repulsion integrals |
| ~eri_lr~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Long-range Electron repulsion integrals |
| ~eri_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for ERI |
| ~eri_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_cholesky_num)~ | Cholesky decomposition of the ERI |
| ~eri_lr_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for long range ERI |
| ~eri_lr_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_cholesky_num)~ | Cholesky decomposition of the long range ERI |
#+CALL: json(data=mo_2e_int, title="mo_2e_int")
@ -667,8 +677,12 @@ prim_factor =
:results:
#+begin_src python :tangle trex.json
"mo_2e_int": {
"eri" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "eri_lr" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
"eri" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "eri_lr" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "eri_cholesky_num" : [ "dim" , [] ]
, "eri_cholesky" : [ "float sparse", [ "rdm.2e_cholesky_num", "mo.num", "mo.num" ] ]
, "eri_lr_cholesky_num" : [ "dim" , [] ]
, "eri_lr_cholesky" : [ "float sparse", [ "rdm.2e_cholesky_num", "mo.num", "mo.num" ] ]
} ,
#+end_src
:end:
@ -833,17 +847,43 @@ prim_factor =
\frac{1}{2} \sum_{ijlk} \Gamma_{ijkl} \langle k l | i j \rangle
\]
To compress the storage, the Cholesky decomposition of the RDMs can
be stored:
\[
\Gamma_{ijkl} = \sum_{\alpha} G_{ij\alpha} G_{kl\alpha}
\]
Warning: as opposed to electron repulsion integrals, the
decomposition is made such that the Cholesky vectors are expanded
in a two-electron basis
$f_{ij}(\mathbf{r}_1,\mathbf{r}_2) = \phi_i(\mathbf{r}_1) \phi_j(\mathbf{r}_2)$,
whereas in electron repulsion integrals each Cholesky vector is
expressed in a basis of a one-electron function
$g_{ik}(\mathbf{r}_1) = \phi_i(\mathbf{r}_1) \phi_k(\mathbf{r}_1)$.
#+NAME: rdm
| Variable | Type | Dimensions | Description |
|-----------+----------------+------------------------------------+-----------------------------------------------------------------------|
| ~1e~ | ~float~ | ~(mo.num, mo.num)~ | One body density matrix |
| ~1e_up~ | ~float~ | ~(mo.num, mo.num)~ | \uparrow-spin component of the one body density matrix |
| ~1e_dn~ | ~float~ | ~(mo.num, mo.num)~ | \downarrow-spin component of the one body density matrix |
| ~2e~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Two-body reduced density matrix (spin trace) |
| ~2e_upup~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \uparrow\uparrow component of the two-body reduced density matrix |
| ~2e_dndn~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \downarrow\downarrow component of the two-body reduced density matrix |
| ~2e_updn~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \uparrow\downarrow component of the two-body reduced density matrix |
| ~2e_dnup~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \downarrow\uparrow component of the two-body reduced density matrix |
| Variable | Type | Dimensions | Description |
|------------------------+----------------+----------------------------------------------+-----------------------------------------------------------------------|
| ~1e~ | ~float~ | ~(mo.num, mo.num)~ | One body density matrix |
| ~1e_up~ | ~float~ | ~(mo.num, mo.num)~ | \uparrow-spin component of the one body density matrix |
| ~1e_dn~ | ~float~ | ~(mo.num, mo.num)~ | \downarrow-spin component of the one body density matrix |
| ~2e~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Two-body reduced density matrix (spin trace) |
| ~2e_upup~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \uparrow\uparrow component of the two-body reduced density matrix |
| ~2e_dndn~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \downarrow\downarrow component of the two-body reduced density matrix |
| ~2e_updn~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \uparrow\downarrow component of the two-body reduced density matrix |
| ~2e_dnup~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \downarrow\uparrow component of the two-body reduced density matrix |
| ~2e_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
| ~2e_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (spin trace) |
| ~2e_upup_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
| ~2e_upup_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_upup_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\uparrow\uparrow) |
| ~2e_dndn_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
| ~2e_dndn_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_dndn_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\downarrow\downarrow) |
| ~2e_updn_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
| ~2e_updn_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_updn_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\uparrow\downarrow) |
| ~2e_dnup_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
| ~2e_dnup_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_dnup_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\downarrow\uparrow) |
#+CALL: json(data=rdm, title="rdm")
@ -851,14 +891,24 @@ prim_factor =
:results:
#+begin_src python :tangle trex.json
"rdm": {
"1e" : [ "float" , [ "mo.num", "mo.num" ] ]
, "1e_up" : [ "float" , [ "mo.num", "mo.num" ] ]
, "1e_dn" : [ "float" , [ "mo.num", "mo.num" ] ]
, "2e" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_upup" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_dndn" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_updn" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_dnup" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
"1e" : [ "float" , [ "mo.num", "mo.num" ] ]
, "1e_up" : [ "float" , [ "mo.num", "mo.num" ] ]
, "1e_dn" : [ "float" , [ "mo.num", "mo.num" ] ]
, "2e" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_upup" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_dndn" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_updn" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_dnup" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "2e_cholesky_num" : [ "dim" , [] ]
, "2e_cholesky" : [ "float sparse", [ "rdm.2e_cholesky_num", "mo.num", "mo.num" ] ]
, "2e_upup_cholesky_num" : [ "dim" , [] ]
, "2e_upup_cholesky" : [ "float sparse", [ "rdm.2e_upup_cholesky_num", "mo.num", "mo.num" ] ]
, "2e_dndn_cholesky_num" : [ "dim" , [] ]
, "2e_dndn_cholesky" : [ "float sparse", [ "rdm.2e_dndn_cholesky_num", "mo.num", "mo.num" ] ]
, "2e_updn_cholesky_num" : [ "dim" , [] ]
, "2e_updn_cholesky" : [ "float sparse", [ "rdm.2e_updn_cholesky_num", "mo.num", "mo.num" ] ]
, "2e_dnup_cholesky_num" : [ "dim" , [] ]
, "2e_dnup_cholesky" : [ "float sparse", [ "rdm.2e_dnup_cholesky_num", "mo.num", "mo.num" ] ]
} ,
#+end_src
:end: