Papers
Topics
Authors
Recent
Search
2000 character limit reached

SpinAdaptedSecondQuantization.jl

Updated 9 July 2026
  • SpinAdaptedSecondQuantization.jl is an open-source Julia package that enables the automated, symbolic derivation of spin-adapted electronic structure equations for both fermionic and bosonic operators.
  • It employs core abstractions like Term and Expression to manage indices, simplify expressions, and reduce human error in algebraic derivations.
  • The package streamlines workflows from deriving coupled-cluster equations to generating high-performance TensorOperations.jl code and constructing symmetry-adapted quantum circuits.

Searching arXiv for the package and related framework papers. SpinAdaptedSecondQuantization.jl is an open-source Julia package developed for working with automated electronic structure theory development. The package focuses on being user-friendly and extensible, allowing easy use of both user- and pre-defined fermionic and/or bosonic operators, tensors, and orbital spaces. It is spin-adapted, works directly with spin-adapted fermionic operators, and can be used to derive common electronic structure theory equations and expressions, including the coupled cluster energy, ground and excited state equations, and one- and two-electron density matrices; it can also translate expressions into code (Lexander et al., 22 Aug 2025). In related 2025 work, the same spin-adapted second-quantized framework is also presented as a basis for exact product formulas for symmetry-adapted fermionic unitaries and for implementation recipes targeting compact quantum circuits and variational algorithms (Magoulas et al., 17 Nov 2025).

1. Package objectives and software model

The stated goals of SpinAdaptedSecondQuantization.jl are to automate and simplify the derivation of electronic-structure theory equations, avoid human-error-prone hand algebra, work directly with spin-adapted operators so that symbolic expressions resemble “pen-and-paper” derivations, provide an interactive, REPL-friendly Julia API for rapid prototyping, and remain highly extensible through user-defined operator types, tensor types with arbitrary index symmetries, and orbital or index spaces (Lexander et al., 22 Aug 2025). The package is written in pure Julia, installs via Pkg.add("SpinAdaptedSecondQuantization"), and integrates seamlessly with TensorOperations.jl for numeric code generation.

Its internal organization is built around two core abstractions. A Term is the smallest building block and holds a scalar prefactor, a list of Kronecker deltas δpq\delta_{pq}, a list of tensor objects, a list of operators, and a set of summed indices together with constraints on orbital spaces. An Expression is an ordered collection of Terms that automatically collects like terms. This organization supports index renaming, δ\delta-simplification, index reordering to bring terms to a canonical form, and term-fusing (Lexander et al., 22 Aug 2025).

The package also treats spin-adapted fermionic operators as first-class types. Bosonic ladder operators and mixed fermion–boson operators can be added easily, and several tensor categories are explicitly identified: real_tensor(name,…), psym_tensor(name,…), rsym_tensor(name,…), and user-defined tensor types. This software model is designed for symbolic manipulation rather than for a fixed electronic-structure ansatz alone. A plausible implication is that the package is intended as a general research tool for deriving and testing new many-body formalisms rather than only as a code generator for one method family.

2. Spin-adapted algebra and second-quantized representation

SpinAdaptedSecondQuantization.jl works directly with the standard fermionic anticommutation relations

{aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},

where spin orbitals are labeled by the combined index P=(p,σ)P=(p,\sigma) (Lexander et al., 22 Aug 2025). At the symbolic level, the central one-body spin-adapted excitation operator is

Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},

with spatial indices p,qp,q, and its commutator closes on itself:

[Epq,Ers]=δqrEpsδpsErq.[E_{pq},E_{rs}]=\delta_{qr}E_{ps}-\delta_{ps}E_{rq}.

The corresponding two-electron singlet excitation is defined as

epqrs=στapσarτasτaqσ=EpqErsδqrEps,e_{pqrs} =\sum_{\sigma\tau}a^\dagger_{p\sigma}a^\dagger_{r\tau}a_{s\tau}a_{q\sigma} =E_{pq}E_{rs}-\delta_{qr}E_{ps},

which places the package squarely in a spin-adapted second-quantized formalism rather than a raw spin-orbital algebra (Lexander et al., 22 Aug 2025). The molecular Hamiltonian is written as

H=pqhpqEpq+12pqrsgpqrsepqrs+hnuc,H=\sum_{pq}h_{pq}E_{pq} +\tfrac12\sum_{pqrs}g_{pqrs}e_{pqrs} +h_{\rm nuc},

with hpq=ϕph^ϕqh_{pq}=\langle\phi_p|\hat h|\phi_q\rangle and δ\delta0.

The package exposes this algebra directly in Julia syntax. The representative definitions p,qp,q5 illustrate the way tensor declarations, operator expressions, and orbital-space constraints are combined in a single symbolic object (Lexander et al., 22 Aug 2025). This tight coupling between algebra and index-space semantics is one of the package’s defining features.

3. Symbolic derivation of electronic-structure equations

A central mechanism in the package is a reductive commutator engine that applies

δ\delta1

recursively until single-operator commutators or anti-commutators remain, with each pair returning both the new term or terms and the sign δ\delta2 (Lexander et al., 22 Aug 2025). Complementing this, an act_on_ket procedure mimics hand derivations by repeatedly moving one operator at a time through a string until it acts on δ\delta3, collecting resulting terms and index constraints.

This framework is used to derive standard many-electron expressions. For the closed-shell Hartree–Fock reference, the package reproduces

δ\delta4

before applying the exchange combination δ\delta5 (Lexander et al., 22 Aug 2025). For CCSD, the truncated doubles cluster operator is introduced as

δ\delta6

with occupied and virtual constraints on the indices.

The similarity-transformed Hamiltonian is then formed as

δ\delta7

and is truncated automatically by bch(H,T2,4), because fourth order in δ\delta8 is the last nonzero term for CCSD (Lexander et al., 22 Aug 2025). Projection on the reference and biorthogonal bra spaces then produces the correlation energy,

δ\delta9

as well as the singles and doubles amplitude equations. The singles equation is given explicitly as

{aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},0

The same projection machinery is also used to obtain spin-adapted one- and two-electron reduced density matrices by choosing different bra templates. The package description emphasizes that the density-matrix workflow “works exactly like the energy and amplitude projections, but with the proper bra templates inserted” (Lexander et al., 22 Aug 2025). This places reduced-density-matrix derivation and wave-function equation derivation within the same symbolic pipeline.

4. Workflow and code generation

The package paper presents a typical usage workflow with ten explicit stages: importing the package, defining orbital spaces, declaring integrals and operators, optionally transforming to a Fock basis, defining a wave-function ansatz, carrying out the similarity transformation, projecting on the ket, extracting energy or amplitude equations with act_on_bra or project_biorthogonal, simplifying the result, and generating numerical code via print_julia_function (Lexander et al., 22 Aug 2025). This workflow is not merely schematic; the article gives concrete Julia fragments for each phase.

A representative CCSD sequence is p,qp,q6 followed by energy or amplitude extraction and heavy simplification (Lexander et al., 22 Aug 2025). The package therefore serves as a symbolic front end for algebraic derivation, while also supporting transition to executable numerical kernels.

That transition is performed by automatic code generation into TensorOperations.jl’s @tensor syntax. The function p,qp,q7 produces a Julia function of the form p,qp,q8 which is described as ready to drop into a high-performance CCSD implementation (Lexander et al., 22 Aug 2025). In that sense, SpinAdaptedSecondQuantization.jl bridges symbolic derivation and production-style tensor code.

5. Quantum-circuit constructions and symmetry-adapted unitaries

Later work extends the same spin-adapted second-quantized perspective to symmetry-preserving quantum simulation. In that formulation, singlet-adapted singles, perfect-pairing doubles, and general doubles with intermediate singlet and triplet coupling are defined as anti-Hermitian generators that conserve particle number {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},1, spin projection {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},2, and are built to preserve total spin {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},3 (Magoulas et al., 17 Nov 2025). The corresponding unitaries are factorized exactly through a Wei–Norman decomposition,

{aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},4

where the scalar functions {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},5 are obtained from the Wei–Norman system.

For the simplest nontrivial case, a 5-dimensional algebra is obtained that is isomorphic to {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},6, and analytic expressions are given for two of the parameters while the remaining ones are obtained numerically from a {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},7 Wei–Norman ODE (Magoulas et al., 17 Nov 2025). The same paper states that, for the more complex doubles {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},8 and {aP,aQ}=0,{aP,aQ}=0,{aP,aQ}=δPQ,\{a_P,a_Q\}=0,\qquad \{a^\dagger_P,a^\dagger_Q\}=0,\qquad \{a_P,a^\dagger_Q\}=\delta_{PQ},9, one follows the same procedure while grouping commuting subsets to reduce the system; numerical integration over P=(p,σ)P=(p,\sigma)0 yields smooth, almost-periodic P=(p,σ)P=(p,\sigma)1.

The associated circuit constructions are expressed through fermionic-excitation-based circuits and are accompanied by rough upper bounds such as

P=(p,σ)P=(p,\sigma)2

plus parity staircases and single-qubit rotations (Magoulas et al., 17 Nov 2025). The same work also introduces the minimum universal symmetry-adapted operator pool pDint0, defined as perfect-pairing doubles together with intermediate-singlet doubles, and characterizes it as the smallest universal symmetry-adapted set because it enforces all symmetries and recovers the exact energy variationally.

A closely related implementation recipe focuses on the seniority-2 “ii→ab” case and defines the spin-adapted singlet generator

P=(p,σ)P=(p,\sigma)3

with

P=(p,σ)P=(p,\sigma)4

or equivalently

P=(p,σ)P=(p,\sigma)5

This generator, together with its commutators, spans a five-dimensional Lie algebra with nonzero commutation relations explicitly tabulated in the paper; because the basis elements are all anti-Hermitian and close under commutation, they form a compact real Lie algebra

P=(p,σ)P=(p,\sigma)6

with two central directions (Jain et al., 18 Nov 2025). The same paper describes an exact and computationally efficient factorization derived from fermionic double excitation and deexcitation rotations, reformulated as a low-dimensional nonlinear optimization over matrix exponentials in the adjoint representation. In the package context, this indicates a route by which symbolic spin-adapted generators can be connected to symmetry-conserving quantum circuits without relying on symbolic manipulations for the factorization step.

6. Performance, limits, and broader symmetry adaptation

The package paper reports timings on a high-core server for coupled-cluster truncations without P=(p,σ)P=(p,\sigma)7: CCS at P=(p,σ)P=(p,\sigma)8 total, CCSD at P=(p,σ)P=(p,\sigma)9, CCSDT at Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},0, CCSDTQ at Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},1, CCSDTQP at Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},2, and up to CCSDTQPH78 at approximately Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},3 (Lexander et al., 22 Aug 2025). The bottlenecks are identified as index renaming and canonicalization, which scale factorially in the number of summed indices, although beyond CCSDT other steps such as commutation and nested BCH expansions dominate. Simplifications that recognize exchange relations or remove redundant symmetry partners can be costly, but are said to pay off by drastically reducing final equation size.

The same source also states several current limits and planned extensions: the package is currently optimized for single-reference coupled cluster, including BCH, excited states, and density matrices; planned extensions include unitary transformations such as UCC, response theory formalisms, multi-configurational references, and more aggressive code-generation optimizations such as factorizing intermediates, Kronecker-delta elimination in generated code, and exploiting sparsity (Lexander et al., 22 Aug 2025). Direct support for exotic multi-particle systems via combined fermion–boson operators, with QED-CCSD given as an example, is also listed.

A broader mathematical context is provided by work on spin adaptation of cumulant expansions of reduced density matrices, which is explicitly described as suitable for implementation in a package like SpinAdaptedSecondQuantization.jl (Liebert et al., 22 May 2025). There, the cumulants Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},4 of the Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},5-particle reduced density matrices are constructed for Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},6 to Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},7, spin-adapted creation and annihilation operators are treated as irreducible tensor operators, and complete spin adaptation is tied to Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},8- and Epq=apαaqα+apβaqβ,E_{pq}=a^\dagger_{p\alpha}a_{q\alpha}+a^\dagger_{p\beta}a_{q\beta},9-representability constraints. In particular, complete p,qp,q0-representability is enforced by constraining the variances of p,qp,q1 and p,qp,q2, which require the 2-RDM and 4-RDM, respectively.

That framework also emphasizes size-extensivity, stating that cumulants measure linked correlations only and satisfy p,qp,q3 for two non-interacting subsystems (Liebert et al., 22 May 2025). It extends further to spin–orbit-coupled systems through total-p,qp,q4 adaptation and then to other compact Lie groups through irreducible tensor operators and generalized Clebsch–Gordan coefficients. This suggests that SpinAdaptedSecondQuantization.jl is not limited to conventional singlet-adapted coupled-cluster derivations, but sits within a wider program of symmetry-adapted symbolic many-body theory in which operator algebra, density-matrix constraints, and exact unitary factorization can be formulated within a common second-quantized language.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to SpinAdaptedSecondQuantization.jl.