by Bimal Gaudel
We want to predict
Many-body methods (CC, CI, PT, etc.)
Want predictive accuracy on large systems: proteins, complexes, etc.
We know how to break the scaling wall.
Fragmentation based techniques Gordon et al. (Chem. Rev., 2012)
Formalism that truncate the operator and wavefunctions directly
Use of spatially localized basis sets

CCSD(T) \(\to\) DLPNO-CCSD(T)
\(\mathcal{O}(N^7)\) \(\to\) \(\mathcal{O}(N)\)
\[e^{- \opr{T}}\opr{H}e^{\opr{T}}\ket{\Phi} = E\ket{\Phi}\]
\[\opr{T} = \sum_{μ} t_μ \opr{τ}_μ\]
Standard virtuals
\[\opr{τ} \equiv a_{i_1\dots i_k}^\alert{a_1\dots a_k} \equiv a_{a_1}^† \dots a_{a_k}^† a_{i_k}\dots a_{i_1}\]
\[\begin{aligned} R_{a_1 a_2}^{i_1 i_2} = g_{a_1 a_2}^{i_1 i_2} + f_{a_1}^{a_3} t_{a_3 a_2}^{i_1 i_2} + \ldots \end{aligned}\]
Cluster-specific-virtuals
\[\opr{τ} \equiv a_{i_1 \dots i_k}^\alert{{a_1^{i_1 \dots i_k}}\dots{a_k^{i_1 \dots i_k}}} \equiv a^†_{a_1^{i_1 \dots i_k }} \dots a^†_{a_k^{i_1 \dots i_k}} a_{i_k}\dots a_{i_1}\]
\[\begin{aligned} R_{a_1^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2} = g_{a_1^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2} + f_{a_1^{i_1 i_2}}^{a_3^{i_1 i_2}} t_{a_3^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2} + \ldots \end{aligned}\]
MP2
PNO-MP2
\[\begin{aligned} R_{a_1 a_2}^{i_1 i_2} = &g_{a_1 a_2}^{i_1 i_2} + f_{a_1}^{a_3} t_{a_3 a_2}^{i_1 i_2} \\ &+ f_{a_2}^{a_3} t_{a_1 a_3}^{i_1 i_2} - f_{i_3}^{i_1} t_{a_1 a_2}^{i_3 i_2} - f_{i_3}^{i_2} t_{a_1 a_2}^{i_1 i_3} \end{aligned}\]
\[\begin{aligned} R_{a_1^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2} = &g_{a_1^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2} + f_{a_1^{i_1 i_2}}^{a_3^{i_1 i_2}} t_{a_3^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2} + f_{a_2^{i_1 i_2}}^{a_3^{i_1 i_2}} t_{a_1^{i_1 i_2} a_3^{i_1 i_2}}^{i_1 i_2} \\ &- f_{i_3}^{i_1} t_{a_1^{i_3 i_2} a_2^{i_3 i_2}}^{i_3 i_2} s_{a_1^{i_1 i_2}}^{a_1^{i_3 i_2}} s_{a_2^{i_1 i_2}}^{a_2^{i_3 i_2}} - f_{i_3}^{i_2} t_{a_1^{i_1 i_3} a_2^{i_1 i_3}}^{i_1 i_3} s_{a_1^{i_1 i_2}}^{a_1^{i_1 i_3}} s_{a_2^{i_1 i_2}}^{a_2^{i_1 i_3}} \end{aligned}\]
Consider this tensor network
\[{\overline{g}}_{\alertPink{i_3} i_4}^{\alertPink{a_3} a_4}t_{a_1 \alertPink{a_3}}^{i_1 i_2}t_{a_2 a_4}^{\alertPink{i_3} i_4}\]
Then we ask: is the following equivalent to the above?
\[{\overline{g}}_{i_4 \alertPink{i_3}}^{a_4 \alertPink{a_3}}t_{a_1 a_4}^{i_1 i_2}t_{a_2 \alertPink{a_3}}^{i_4 \alertPink{i_3}}\]
Turns out yes: just by relabeling the dummy indices \(i_3 \leftrightarrow i_4\) and \(a_3 \leftrightarrow a_4\)
Now consider a pair of tensors with dependent indices
\[\mathbf{T}_1 = \overline{g}_{i_2 a_1^\alertPink{i_1}}^{\alertTeal{a_2}^\alertOrange{i_3} a_3^{i_4}} \text{ and } \mathbf{T}_2 = \overline{g}_{i_2 a_1^{i_4}}^{a_3^\alertPink{i_1} \alertTeal{a_2}^\alertOrange{i_3}}\]
Turns out they are equivalent modulo a phase (\(- 1\)) and index relabeling (\(i_1 \leftrightarrow i_4\)).
\[\mathbf{T}_1 \equiv -1 \times \mathbf{T}_2\left.\right|_{i_1 \leftrightarrow i_4} = - \overline{g}_{i_2 a_1^{i_1}}^{a_3^\alertPink{i_4} \alertTeal{a_2}^\alertOrange{i_3}}\]
Not obvious as in the previous example.
Antisymmetry property of tensor \(\overline{g}\) was used.
Weak algorithms can lead to easy mistakes:
Different but might appear equivalent:
\[g_{i_2 a_1^{i_1}}^{\alertPink{i_3} \alertTeal{a_2^{i_4}}} \qquad g_{i_2 a_1^{i_1}}^{\alertTeal{a_2^{i_4}} \alertPink{i_3}}\]
Equivalent but might appear different:
\[g_{i_2 i_3}^{a_2^{ \alertPink{i_4} \alertTeal{i_5} } a_3^{ \alertPink{i_4} \alertTeal{i_5} }} s_{ \alertPink{i_4} }^{i_2} \qquad g_{i_2 i_3}^{a_2^{ \alertPink{i_4} \alertTeal{i_5} }a_3^{ \alertPink{i_4} \alertTeal{i_5} }} s_{ \alertTeal{i_5} }^{i_2}\]

\[B_{a_1^{i_1 i_2}}^{i_1} [p_1] B_{a_2^{i_1 i_2}}^{i_2} [p_1] \tilde{a}_{i_1 i_2}^{a_1^{i_1 i_2} a_2^{i_1 i_2}}\]
Canonicalizing \(D_{i_1 i_2} D_{i_3 i_4} \dots D_{i_{N-1} i_N} U^{π[i_1 \dots i_N]}\)

Our graph-theoretic solution surpasses Butler-Portugal-based methods in speed
How to implement?
\[f_{a_1}^{a_3} t_{a_3 a_2}^{i_1 i_2}\]
\[f_{a_1^{i_1 i_2}}^{a_3^{i_1 i_2}} t_{a_3^{i_1 i_2} a_2^{i_1 i_2}}^{i_1 i_2}\]
\[R(a,b,i,j) \leftarrow \sum_c f(a,c) \times t(c,b,i,j)\]
for i in range(0, I):
for j in range(0, J):
# Bounds are functions of (i,j)
curr_A = get_dim_a(i, j)
curr_C = get_dim_c(i, j)
for a in range(0, curr_A): # <--- Dependent bound
for b in range(0, curr_B): # <--- Dependent bound
for c in range(0, curr_C): # <--- Dependent bound
# Indexing requires pointer chasing
R[...][a][b] += F[a][c] * T[...][c][b]We asked: could we make use of an existing tensor framework?
Understanding a general product between Tensor-of-Scalars (ToS)
\[\sum_{k} A\left(i, j, k, l \right) \times B \left(j,k,l,m\right) \to C\left(m,i,j,l\right)\]
\[i j k l\alert{,}j k l m \to m i j l\]
Semantics
Foundation
The properties of the scalar ring.
We asked: could we make use of an existing tensor framework?
\[\sum_{c^\alert{i j}} f(a^\alert{i j},c^\alert{i j}) \times t(c^\alert{i j},b^\alert{i j},i,j)\]
ToT
\[i j\alertTeal{;} a^{i j} c^{i j}\alert{,} i j\alertTeal{;} b^{i j} c^{i j} \to i j\alertTeal{;} a^{i j} b^{i j}\]
If we view the inner tensors of a ToT as ‘generalized scalars’ \[i j\alert{,} i j \to i j\]
We have not defined the ring-like equivalence for these generalized scalars yet.
Viewing the CSV-tensors with dependent indices as ToTs gives a powerful starting point to implement CSV-methods.
Built-in semantics
\[i j\alertTeal{;} a^{i j} c^{i j}\alert{,} i j\alertTeal{;} b^{i j} c^{i j} \to i j\alertTeal{;} a^{i j} b^{i j}\]
\(\{i, j\}\) determines which inner tensors can contract. Less error prone.
Familiar dense/block-sparse tensor algebra
\[i j\alert{,} i j \to i j\]
Implemented in TiledArray.
One of the major goals was to automate the many-body method implementation.
Common steps of method development
Long realized automation is crucial
This work
We have designed SeQuant after a modern three-stage compiler.
Three stages: Front end
Expr objects from method derivation serve as the AST
\(g_{ij}^{a^{ij}b^{ij}}\left( 2t_{a^{ij}b^{ij}}^{ij} - t_{a^{ij}b^{ij}}^{ji} \right)\)
We have designed SeQuant after a modern three-stage compiler.
Three stages: Middle end
Intermediate Representation (IR)
\(g_{ij}^{a^{ij}b^{ij}}\left( 2t_{a^{ij}b^{ij}}^{ij} - t_{a^{ij}b^{ij}}^{ji} \right)\)
We have designed SeQuant after a modern three-stage compiler.
Three stages: Middle end (Optimizations)
\(\text{O}, \text{V}\): dimension of indices \(i_k\) and \(a_k\)s. With \(\text{V} \gg \text{O}\)
\[(g_{\alert{i_3} i_4}^{a_3 a_4} t_{a_1 a_2}^{i_1 \alert{i_3}}) t_{a_3 a_4}^{i_2 i_4}\]
\[\text{O}^3\text{V}^4\]
\[(g_{i_3 i_4}^\alert{a_3 a_4} t_\alert{a_3 a_4}^{i_2 i_4}) t_{a_1 a_2}^{i_1 i_3}\]
\[\text{O}^3\text{V}^2\]
\[\frac{1}{16}\alert{(\bar{g}_{k l}^{c d} t_{c d}^{i j})} t_{a b}^{k l} + \frac{1}{8}\alert{(\bar{g}_{k l}^{c d} t_{c d}^{i j})} t_{a}^{k} t_{b}^{l}\]
Three stages: Middle end (Canonicalizer for semantic enforcing)
The graph canonicalizer again is crucial at this stage.
\[\mathbf{T}_1 = \overline{g}_{i_2 a_1^\alertPink{i_1}}^{\alertTeal{a_2}^\alertOrange{i_3} a_3^{i_4}} \text{ and } \mathbf{T}_2 = \overline{g}_{i_2 a_1^{i_4}}^{a_3^\alertPink{i_1} \alertTeal{a_2}^\alertOrange{i_3}}\] \[\mathbf{T}_1 \equiv \mathbf{T}_2\] \[\left(i_4,i_3,i_1,i_2;a_1^{i_1},a_3^{i_4},a_2^{i_3}\right) \text{ and } \left(i_1,i_3,i_4,i_2;a_1^{i_1},a_3^{i_4},a_2^{i_3}\right) \text{ with a phase of } (-1)\]
Three stages: Back end (Interpreter)
The interpreter builds on top of the IR.
Handles
Result abstract classThree stages: Back end (Interpreter)
The interpreter builds on top of the IR.

SeQuant—a C++ library/framework for
Symbolic Derivation: wide range of theories: including PNO-CC
Automatic Evaluation: let code compilation not break our workflow
Performant and Scalable:
TiledArray tensor framework)Extensible Architecture: more numerical tensor frameworks and quantum chemistry packages? welcome
Automation of standard many-body methods
SeQuant has accelerated the development by avoiding algebraic complexity of derivation, optimization, and evaluation in the following works.
How about CSV-CC
However
We are facing some challenges regarding memory bottlenecks.

How does this change the field?
Moving closer to the ultimate goal:
A fully automated workflow where we design, test, and deploy the next generation of predictive theories with unprecedented speed.


SeQuant for Symbolics and Numerics