QMTensors

ElemCo.QMTensors — Module

QMTensors module

This module provides definitions for useful quantum-mechanical tensors.

source

Exported types and functions

ElemCo.QMTensors.SpinMatrix — Type
SpinMatrix

A type to store a one-electron matrix (spin aware).

The first matrix corresponds to the alpha electron, and the second matrix is beta. If the matrix is restricted, the beta matrix refers to the alpha matrix.

source
ElemCo.QMTensors.SpinVector — Type
SpinVector

A simple container for spin-dependent vectors (α and β). Fields α and β store the alpha and beta spin components respectively.

Constructors

  • SpinVector(v, w): Create with separate α and β vectors
  • SpinVector(v): Create restricted vector (β === α)
source
ElemCo.QMTensors.calc_tri_sym_antisym! — Method
calc_tri_sym_antisym!(out_s, out_a, A, fac=nothing)

Compute symmetric and antisymmetric combinations of a 3-index array A[p,q,x] in a single pass over the data.

$out\_s[pq,x] = fac (A[p,q,x] + A[q,p,x])$ (symmetric in p,q)

$out\_a[pq,x] = fac (A[p,q,x] - A[q,p,x])$ (antisymmetric in p,q)

where pq is the upper triangular index for p ≤ q.

fac is an optional common prefactor of both combinations — e.g. fac=½ for the ± average, the pair-space density convention of the αβ kext CoupledCluster.pm_K2ab!. The default nothing applies none and, being resolved by dispatch, emits exactly the unscaled kernel.

For each column q, the strided row A[q, 1:q, x] is copied into a small contiguous buffer, then sum/difference is computed with stride-1 SIMD access. Multi-threaded over x.

qmin restricts the fold to the rows tri(p,q) with q ≥ qmin (all p ≤ q), i.e. packed rows uppertriangular_index(1,qmin) to the end; rows below are left UNTOUCHED. Used by the ± store build, which persists only rows at/above its per-block floor and never generates the rest (see IntegralTools.pm_integrals!) — with the default qmin=1 the full fold is emitted unchanged.

source
ElemCo.QMTensors.detri_doubles — Method
detri_doubles(T2)

Convert a doubles amplitude tensor T2 in the form (a,b,ij) to the full form (a,b,i,j). Here, ij is the upper triangular index for occupied orbitals i <= j.

source
ElemCo.QMTensors.detri_samespin_doubles — Method
detri_samespin_doubles(T2::AbstractMatrix{T})

Convert a doubles amplitude tensor T2 in the form (ab,ij) to the full form (a,b,i,j) using the permutational symmetry $T^{ij}_{ab} = T^{ji}_{ba} = -T^{ij}_{ba} = -T^{ji}_{ab}$.

Here, ab and ij are the strict upper triangular indices for virtual and occupied orbitals a < b, i < j.

source
ElemCo.QMTensors.swapped_uppertriangular_cut — Method
swapped_uppertriangular_cut(norb)

Return all indices for original dimension norb×norb corresponding to the upper triangular part, but with the two indices swapped, i.e., (j,i) instead of (i,j).

source

Internal types and functions