1 PROGRAM SUMMARY

  • Program title: ADG

  • Licensing provisions: GNU General Public License Version 3 or later

  • Programming language: Python 3

  • Repository and DOI: https://github.com/adgproject/adg DOI: https://doi.org/10.5281/zenodo.4541533

  • Nature of problem: As formal and numerical developments in many-body-perturbation-theory-based ab initio methods make higher orders reachable, manually producing and evaluating all the diagrams becomes rapidly untractable as both their number and complexity grow quickly. Thus, derivations are prone to mistakes and oversights.

  • Solution method: BIMSRG diagrams are encoded as square matrices known as oriented adjacency matrices in graph theory, and then turned into graph objects using the NetworkX package. These objects are used to eventually evaluate many-body expressions on a purely diagrammatic basis. The new capabilities add to those available in version (v2.0) of the code, i.e. the production and evaluation of HF-MBPT, diagonal and off-diagonal BMBPT diagrams.

2 Introduction

The intrinsic cost to solve the many-body Schrödinger equation scales exponentially with the particle number A. This poses a great challenge to push ab initio calculations based on essentially exact methods such as configuration interaction [1,2,3] (CI) or quantum Monte-Carlo (QMC) approaches [4,5,6] beyond the lightest nuclei. During the last two decades the use of methods that systematically expand the exact solution with respect to a simple yet sufficiently rich A-body reference state has emerged as an invaluable paradigm to extend nuclear many-body theory to heavier masses. Indeed, truncating the expansion provides a solution whose numerical cost scales polynomially with A. The most prominent examples of such methods are many-body perturbation theory (MBPT) [7,8,9,10,11,12], self-consistent Green’s function (SCGF) theory [13,14,15,16,17], coupled-cluster (CC) theory [18,19,20,21] and the in-medium similarity renormalization group (IMSRG) approach [22,23,24,25,26,27,28].

Expansion methods, whenever based on a symmetry-conserving Slater-determinant reference state, efficiently describe weakly correlated closed-shell nuclei. Contrarily, they fail to describe strongly-correlated open-shell nuclei due to the inherent degeneracies of elementary excitations out of such a Slater-determinant reference state. Within the last ten years, extending these methods to symmetry-breaking reference states has shown to be a powerful idea to systematically overcome the limitation to closed-shell systems. In singly open-shell nuclei, U(1) global-gauge symmetry associated with particle-number conservation is relaxed through the use of a Bogoliubov quasiparticle vacuum as the reference state. In doubly open-shell nuclei, SU(2) rotational symmetry associated with angular-momentum conservation is (further) allowed to break via the use of deformed Slater determinants or Bogoliubov vacua as reference states. The breaking of U(1) symmetry, specifically, entails an explicit extension of the formalism based on the more general Bogoliubov algebra. This has been successfully achieved in Gorkov’s extension of SCGF theory (GGF) [29,30,31], in Bogoliubov coupled-cluster (BCC) theory [32, 33] and in Bogoliubov many-body perturbation theory (BMBPT) [12, 34,35,36,37]. The present work similarly generalizes the single-reference IMSRG method to Bogoliubov in-medium similarity renormalization group (BIMSRG) theory.

In recent years, various flavors of the IMSRG paradigm have led to unprecedented ab initio calculations of atomic nuclei up to one hundred interacting particles [38], of global benchmarks [39] or of deformed nuclei [40]. Calculations of open-shell nuclei have been performed via the multi-reference IMSRG (MR-IMSRG) formulated with respect to a correlated vacuum, thus requiring a more elaborate formalism than for the standard, i.e. single-reference, flavors [41,42,43]. The presently developed BIMSRG method provides a simple alternative whose advantages and drawbacks compared to MR-IMSRG can be gauged in future calculations.

The development of novel many-body theories applicable to a large set of nuclei and the need for accurate implementations, i.e., for advanced truncation schemes, takes the derivation of the working equations to the edge of what is humanly doable. The design of BIMSRG at the BIMSRG(3) truncation level, for instance, is a perfect example with a total of 82 new diagrams to derive even when exploiting symmetries to reduce their number. Consequently, the general discussion of the BIMSRG formalism is accompanied here by the use of a new, extended version of the ADG code [36, 44] that is capable of performing the sophisticated formal derivations in an automated fashion.

The present work is structured as follows. The general BIMSRG formalism is introduced in Sect. 2 before being specialized to the use of normal-ordered operators with respect to a Bogoliubov vacuum in Sect. 3. Section 4 provides the diagrammatic formulation of the BIMSRG that is used to design the automated derivation of the working equations at arbitrary BIMSRG(n) truncation levels through the ADG code described in Sect. 5. The conclusions and outlook are given in Sect. 7, and an appendix provides the details for the BIMSRG(2) approximation.

3 The BIMSRG formalism

3.1 Grand potential

The second-quantized form of the Hamiltonian in an arbitrary basis \(\{ c^\dagger _p, c_p \}\) of the one-body Hilbert space \(\mathcal{H}_1\) is given by

$$\begin{aligned} H \equiv&\frac{1}{(1!)^2} \sum _{pq} {t}^{}_{pq} c^\dagger _p c_q \nonumber \\&+\frac{1}{(2!)^2} \sum _{pqrs} {v}^{}_{pqrs} c^\dagger _p c^\dagger _q c_s c_r \nonumber \\&+\frac{1}{(3!)^2} \sum _{pqrstu} {w}^{}_{pqrstu} c^\dagger _p c^\dagger _q c^\dagger _r c_u c_t c_s, \end{aligned}$$
(1)

where \( {t}^{}_{pq}\) denotes matrix elements of the kinetic energy whereas \( {v}^{}_{pqrs}\) and \( {w}^{}_{pqrstu}\) denote anti-symmetric matrix elements of two- and three-nucleon interactions, respectively. The generalization to Hamiltonians with even higher many-body, e.g. four-body, interactions is straightforward (but tedious).

In the following a constraint term involving the particle-number operator

$$\begin{aligned} A \equiv \sum _{p} c^\dagger _{p} c_{p}, \end{aligned}$$
(2)

is required to control the average particle-number in the many-body states of interest, hence we work with the grand potentialFootnote 1,

$$\begin{aligned} \varOmega \equiv H -\mu A, \end{aligned}$$
(3)

instead of the Hamiltonian.

3.2 Bogoliubov algebra

Bogoliubov quasi-particle operators are defined through a linear transformation of particle creation and annihilation operators [45]

$$\begin{aligned} \beta ^\dagger _{p}&\equiv \sum _k U_{kp} c^\dagger _{k} + V_{kp} c_{k}, \end{aligned}$$
(4a)
$$\begin{aligned} \beta _{p}&\equiv \sum _k U^*_{kp} c_{k} + V_{kp}^* c^\dagger _{k}. \end{aligned}$$
(4b)

They obey standard Fermionic anti-commutation relations

$$\begin{aligned} \left\{ \beta ^\dagger _{p} , \beta ^\dagger _{q} \right\}&= 0, \end{aligned}$$
(5a)
$$\begin{aligned} \left\{ \beta _{p} , \beta _{q} \right\}&= 0, \end{aligned}$$
(5b)
$$\begin{aligned} \left\{ \beta _{p} , \beta ^\dagger _{q} \right\}&= \delta _{pq}. \end{aligned}$$
(5c)

The set of transformation coefficients \(\{U,V\}\) in Eq. (4) defines a unitary Bogoliubov transformation satisfying

$$\begin{aligned} U^\dagger U + V^\dagger V&= 1, \end{aligned}$$
(6a)
$$\begin{aligned} UU^\dagger + V^\star V^T&= 1, \end{aligned}$$
(6b)
$$\begin{aligned} U^T V + V^T U&= 0, \end{aligned}$$
(6c)
$$\begin{aligned} U V^\dagger + V^\star U^T&= 0. \end{aligned}$$
(6d)

The set of quasi-particle operators introduced in Eq. (4) also defines a many-body Bogoliubov vacuum \(|\varPhi \rangle \) through

$$\begin{aligned} \beta _p | \varPhi \rangle =0, \quad \forall p. \end{aligned}$$
(7)

Due to the mixing of single-particle creation and annihilation operators in Eq. (4), \(|\varPhi \rangle \) breaks U(1) global-gauge symmetry associated with the conservation of particle number, i.e., it is not an eigenstate of the particle-number operator. In practice, transformation coefficients \(\{U,V\}\) are typically obtained by solving Hartree-Fock-Bogoliubov (HFB) mean-field equations.

Using \(|\varPhi \rangle \) as the reference state, excitations are systematically obtained via the action of an arbitrary numberFootnote 2 of quasi-particle creation operators

$$\begin{aligned} | \varPhi ^{pq} \big \rangle&\equiv \beta ^\dagger _p \beta ^\dagger _q | \varPhi \big \rangle , \end{aligned}$$
(8a)
$$\begin{aligned} | \varPhi ^{pqrs} \rangle&\equiv \beta ^\dagger _p \beta ^\dagger _q \beta ^\dagger _r \beta ^\dagger _s | \varPhi \big \rangle ,\\&\vdots \,\nonumber \end{aligned}$$
(8b)

Combining the reference state with the complete set of its elementary excitations provides a basis of Fock space \(\mathcal{F}\).Footnote 3

3.3 Flow equation

Just like standard (i.e., symmetry-conserving) single-reference IMSRG, BIMSRG is based on a unitary transformation U(s) of the grand potential \(\varOmega \)

$$\begin{aligned} \varOmega (s) \equiv U(s) \varOmega U^\dagger (s), \end{aligned}$$
(9)

that is parameterized by the continuous variable \(s \in \mathbb {R}\). The similarity transformation (Eq. (9)) can be re-cast into a first-order ordinary differential equation (ODE)

$$\begin{aligned} \frac{\mathrm {d} }{\mathrm {d} s} \varOmega (s) = \left[ \eta (s), \varOmega (s)\right] , \end{aligned}$$
(10)

involving an anti-Hermitian generator \(\eta (s)\) that indirectly parametrizes the transformation. The ODE on the similarity transformed grand potential is to be solved with the initial condition \(\varOmega (0)=\varOmega \).

The generator is chosenFootnote 4 such that the reference state is decoupled from its quasi-particle excitations at the end of the flow [26, 46]

$$\begin{aligned} \lim _{s \rightarrow \infty } \left\langle \varPhi ^{pq} | \varOmega (s) | \varPhi \right\rangle&= 0, \end{aligned}$$
(11a)
$$\begin{aligned} \lim _{s \rightarrow \infty } \left\langle \varPhi ^{pqrs} | \varOmega (s) | \varPhi \right\rangle&= 0, \\&\vdots \nonumber \end{aligned}$$
(11b)

The exact A-body ground-state energy \(\text {E}_{0}\) can then be obtained from the vacuum expectation value of the flowing grand potential

$$\begin{aligned} \lim _{s \rightarrow \infty } \left\langle \varPhi | \varOmega (s) | \varPhi \right\rangle&= \text {E}_0 -\mu \text {A}. \end{aligned}$$
(12)

3.4 Magnus formulation

A different way to implement IMSRG methods is to solve for the unitary transformation itself. In the so-called Magnus formulation of the approach [47], the transformation is parameterized as

$$\begin{aligned} U(s) \equiv e^{M(s)}, \end{aligned}$$
(13)

where the Magnus operatorFootnote 5\(M(s)\) satisfies \(M^\dagger (s) = -M(s)\) and \(M(0) = 0\). One can now solve for \(M(s)\) by integrating the ODE [48, 49]

$$\begin{aligned} \frac{\mathrm {d} }{\mathrm {d} s} M(s) = \sum _{l=0}^\infty \frac{B_l}{l!} \text {ad}^{(l)}_M(\eta ). \end{aligned}$$
(14)

Here, the \(B_l\) are Bernoulli numbers and \(\text {ad}_M(\eta )\) characterizes the adjoint action defined recursively through

$$\begin{aligned} \text {ad}^{(0)}_M(\eta )&\equiv \eta (s), \end{aligned}$$
(15a)
$$\begin{aligned} \text {ad}^{(l)}_M(\eta )&\equiv \left[ M(s), \text {ad}^{(l-1)}_M(\eta )\right] . \end{aligned}$$
(15b)

Once the Magnus operator is obtained, any arbitrary operator O, including \(\varOmega \), can be transformed consistently by using the Baker-Campbell-Hausdorff (BCH) formula

$$\begin{aligned} O(s)&\equiv e^{M(s)} O e^{-M(s)} = \sum _{k=0}^\infty \frac{1}{k!} \text {ad}_M^{(k)}(O). \end{aligned}$$
(16)

3.5 Particle-number adjustment

Because U(1) is a symmetry of the nuclear many-body Hamiltonian, i.e.,

$$\begin{aligned}{}[\varOmega , A] = 0, \end{aligned}$$
(17)

the identity

$$\begin{aligned}{}[\varOmega (s), A(s)] = 0, \end{aligned}$$
(18)

is satisfied throughout the BIMSRG flow,Footnote 6 up to truncations, such that

$$\begin{aligned} \lim _{s \rightarrow \infty } \left\langle \varPhi | A(s) | \varPhi \right\rangle&= \text {A}. \end{aligned}$$
(19)

Two difficulties arise to ensure that Eq. (19) is indeed fulfilled. First, for the targeted particle number \(\text {A}\) to be obtained in an exact calculation, the chemical potential \(\mu \) must be fixed such that \(\text {E}_0 -\mu \text {A}\) is the lowest of all eigenvalues of \(\varOmega \) over Fock space. This is achievable only if the ground-state energy is strictly convex as a function of the particle number in the neighborhood of \(\text {A}\), which is generally but not always true for atomic nuclei. Second, approximations made during the flow are such that the symmetry properties embodied by Eqs. (18) and (19) are explicitly violated in practice, i.e., they could only be ensured by an exact BIMSRG calculation.

These two features require a control of Eq. (19) throughout the flow. Following the strategies used in other expansion methods based on Bogoliubov reference states [32, 35, 37], it can typically be achieved by an adjustment of the average particle number of the reference state along the flow. Providing the reference state with an explicit s dependence, one allows its average particle number to be adapted along the flow

$$\begin{aligned} \left\langle \varPhi (s) | A | \varPhi (s) \right\rangle = A_{\text {aux}}(s), \end{aligned}$$
(20)

such that Eq. (19) is eventually fulfilled. Numerically, this can be achieved by iteratively solving constrained HFB calculations and BIMSRG flow equations, where the constrained value for the reference-state particle number is estimated from the BIMSRG correction until convergence is achieved.

Ultimately, the solution of the truncated BIMSRG flow needs to be complemented by a symmetry-restoration step. While this step has been formalized in the context of BMBPT and BCC (see Refs. [34, 44]) the extension to BIMSRG and GGF has not been laid down yet.

4 Bogoliubov normal ordering

Because BIMSRG relies on the use of Bogoliubov product states, algebraic equations are conveniently obtained by formulating the approach in terms of normal-ordered operators obtained via the use of Wick’s theorem [50] with respect to the Bogoliubov vacuum \(|\varPhi \rangle \).

4.1 Normal-ordered operators

Let us consider a generic particle-number-conserving operator containing up to N-body terms

$$\begin{aligned} O&\equiv \sum _{n=0}^N o^{[2n]}, \end{aligned}$$
(21)

where the class \(o^{[2n]}\) contains a single n-body operator

$$\begin{aligned} o^{[2n]}&\equiv o^{nn}\nonumber \\&= \frac{1}{n!n!} \sum _{l_1\ldots l_{2n}} o^{nn}_{l_1 \ldots l_{n} l_{n+1} \ldots l_{2n}} c^\dagger _{l_1} \ldots c^\dagger _{l_n} c_{l_{2n}} \ldots c_{l_{n+1}}. \end{aligned}$$
(22)

In Eq. (22), n-body matrix elements \(o^{nn}_{l_1 \ldots l_{n} l_{n+1} \ldots l_{2n}}\) are mode-2n tensors, i.e., they are data arrays carrying 2n indices associated with the n particle creation and n annihilation operators they multiply. They are fully anti-symmetric with respect to the permutation of the n first, resp. n last, indices

$$\begin{aligned} o^{nn}_{l_1 \ldots l_{n} l_{n+1} \ldots l_{2n}} = \epsilon (\sigma ) \, o^{nn}_{\sigma \left( l_1 \ldots l_n | l_{n+1} \ldots l_{2n}\right) }, \end{aligned}$$
(23)

where \(\epsilon (\sigma )\) refers to the signature of the permutation \(\sigma \). The notation \(\sigma (\ldots | \ldots )\) denotes a separation between the n first and the n last indices such that permutations are only considered between members of the same group. If O is Hermitian, n-body matrix elements \(o^{nn}_{l_1 \ldots l_n l_{n+1} \ldots l_{2n}}\) satisfy

$$\begin{aligned} o^{nn *}_{l_1 \ldots l_n l_{n+1} \ldots l_{2n}}&= o^{nn}_{l_{n+1} \ldots l_{2n} l_1 \ldots l_n}. \end{aligned}$$
(24)

After normal ordering with respect to \(|\varPhi \rangle \), the operator O can be expressed as

$$\begin{aligned} O&\equiv \sum _{n=0}^N O^{[2n]}, \end{aligned}$$
(25)

where the class \(O^{[2n]}\) groups all terms containing a normal-ordered product of 2n quasiparticle operators. We further differentiate these terms according to the number of quasiparticle creation and annihilation operators they contained, i.e.,

$$\begin{aligned} O^{[2n]}&\equiv \sum _{\begin{array}{c} i,j=0\\ i+j=2n \end{array}}^{2n} O^{ij}, \end{aligned}$$
(26)

where \(O^{ij}\) gathers terms with i, resp. j, quasiparticle creation, resp. annihilation, operators and reads

$$\begin{aligned} O^{ij}&\equiv \frac{1}{i!j!} \sum _{k_1 \ldots k_{i+j}} O^{ij}_{k_1 \ldots k_{i} k_{i+1} \ldots k_{i+j}} \, \beta ^{\dagger }_{k_1} \ldots \beta ^{\dagger }_{k_i} \beta _{k_{i+j}} \ldots \beta _{k_{i+1}}. \end{aligned}$$
(27)

Matrix elements \(O^{ij}_{k_1 \ldots k_{i+j}}\) are mode-\((i+j)\) tensors, i.e., they are data arrays carrying \(i+j\) indices associated with the i (j) quasi-particle creation (annihilation) operators they multiply. They are fully anti-symmetric with respect to the permutation of the i first, resp. j last, indices

$$\begin{aligned} O^{ij}_{k_1 \ldots k_{i} k_{i+1} \ldots k_{i+j}}&= \epsilon (\sigma ) \, O^{ij}_{\sigma \left( k_1 \ldots k_i | k_{i+1} \ldots k_{i+j}\right) }, \end{aligned}$$
(28)

and satisfy

$$\begin{aligned} O^{ij *}_{k_1 \ldots k_i k_{i+1} \ldots k_{i+j}}&= O^{ji}_{k_{i+1} \ldots k_{i+j} k_1 \ldots k_i}, \end{aligned}$$
(29)

if O is Hermitian. Explicit expressions of such anti-symmetrized matrix elements up to the class \(O^{[6]}\) can be found in Refs. [32, 51]. Note that for an operator consisting only of quasiparticle creation (\(j=0\)) or annihilation operators (\(i=0\)) one set of indices is empty, and we have

$$\begin{aligned} O^{20 *}_{pq} = O^{02}_{pq}, \end{aligned}$$
(30a)
$$\begin{aligned} O^{40 *}_{pqrs} = O^{04}_{pqrs}. \end{aligned}$$
(30b)

All operators at play in the present context, e.g., \(\varOmega (s)\), \(\eta (s)\) and \(M(s)\), can now be written in such a normal-ordered form. To give one explicit example, the original grand potential originating from the Hamiltonian introduced in Eq. (1) reads

$$\begin{aligned} \varOmega&\equiv \varOmega (s=0)\nonumber \\&= \varOmega ^{[0]} + \varOmega ^{[2]} + \varOmega ^{[4]}+ \varOmega ^{[6]} \, \nonumber \\&\equiv \varOmega ^{00} + {\varOmega }^{20}_{} + {\varOmega }^{11}_{} + {\varOmega }^{02}_{} \nonumber \\&+ {\varOmega }^{40}_{} + {\varOmega }^{31}_{} + {\varOmega }^{22}_{} + {\varOmega }^{13}_{} + {\varOmega }^{04}_{} \nonumber \\&+ {\varOmega }^{60}_{} + {\varOmega }^{51}_{} + {\varOmega }^{42}_{} + {\varOmega }^{33}_{} + {\varOmega }^{24}_{} + {\varOmega }^{15}_{} + {\varOmega }^{06}_{}, \end{aligned}$$
(31)

i.e., it contains up to \(\varOmega ^{[6]}\) terms. By virtue of the normal ordering, one trivially finds that

$$\begin{aligned} \frac{\langle \varPhi | \varOmega | \varPhi \rangle }{\langle \varPhi | \varPhi \rangle } = {\varOmega }^{00}_{}. \end{aligned}$$
(32)

Whenever \(| \varPhi \rangle \) corresponds to the HFB vacuum, it is not coupled via \(\varOmega \) to two-quasi-particle excitations by virtue of Brillouin’s theorem, i.e.,

$$\begin{aligned} {\varOmega }^{20}_{k_1k_2} = {\varOmega }^{02}_{k_1k_2} = 0, \quad \forall (k_1,k_2). \end{aligned}$$
(33)

4.2 Flow equation

The BIMSRG flow equation can now be written as a system of coupled ODEs for the ij-components of the derivative of the grand potential, i.e.,

$$\begin{aligned} \left( \frac{d\varOmega }{ds}\right) ^{ij}(s) \equiv {\left[ \eta (s), \varOmega (s) \right] }^{ij}_{}, \end{aligned}$$
(34)

where \( {[\,, \,]}^{ij}_{}\) denotes the ij-component of the normal-ordered operator resulting from the commutator. Since the Hermitian adjoints of \(\varOmega (s)\) and \(\eta (s)\) satisfy

$$\begin{aligned} \left( {\varOmega }^{ij}_{}(s)\right) ^\dagger&= {\varOmega }^{ji}_{}(s) , \end{aligned}$$
(35a)
$$\begin{aligned} \left( {\eta }^{ij}_{}(s)\right) ^\dagger&= - {\eta }^{ji}_{}(s), \end{aligned}$$
(35b)

the derivative of \(\varOmega \) is itself Hermitian, as expected. Consequently, the system of ODEs contains redundant equations and one only needs to explicitly solve for \(i\ge j\) before deducing the results for \(i < j\).

4.3 Magnus formulation

Similarly, the ODE for the Magnus operator is transformed into a set of coupled ODEs

$$\begin{aligned} \left( \frac{dM}{ds}\right) ^{ij}(s) \equiv \sum _{l=0}^\infty \frac{B_l}{l!} \left( \text {ad}^{(l)}_M(\eta )\right) ^{ij}, \end{aligned}$$
(36)

where \((\text {ad}^{(l)}_M(\eta ))^{ij}\) denotes the ij-component of the normal-ordered operator resulting from the l-fold nested commutators. Eventually, the ij-component of the normal-ordered transformed operator associated with any observable O of interest is obtained through

$$\begin{aligned} O^{ij}(s)&= \sum _{k=0}^\infty \frac{1}{k!} \left( \text {ad}_M^{(k)}(O)\right) ^{ij}. \end{aligned}$$
(37)

As before, the (anti-)Hermiticity of O(s) (\(M(s)\)) is used to avoid redundancies.

4.4 Approximation schemes

The BIMSRG formalism discussed so far defines a way to exactly solve the A-body Schrödinger equation to access nuclear ground-states observables. As such, it is computationally intractable. For actual applications, appropriate truncation schemes have to be devised to make calculations feasible.

The ODE in Eq. (10) is characterized by the commutator \([ \eta (s), \varOmega (s) ]\) appearing on the right-hand side. Given two operators \(A\) and \(B\) containing terms up to class \(A^{[2N_A]}\) and \(B^{[2N_B]}\), respectively, the commutator \(C\equiv [A,B]\) contains terms up to class \(C^{[2N_C]}\) with \(N_C=N_A+ N_B-1\). Consequently, the maximum class of \(\varOmega (s)\), and thus of \(\eta (s)\), increases at each propagation step of the ODE and the system of coupled ODEs (34) grows rapidly. Carrying the associated operators (or, equivalently, the coefficient tensors defining them) and solving the growing numbers of coupled ODEs becomes quickly intractable.

Adapting the truncation scheme of standard IMSRG calculations and denoting it as BIMSRG(n), only terms \(O^{[2m]}\) with \(m \le n\) in all the operators at play will be retained throughout the flow. The rationale behind this truncation can be justified via perturbation theory arguments and relies on the fact that the omitted terms are (naively) of higher order than the included ones. Of course, whenever the accuracy at hand is insufficient, one must go to the next truncation level. At present, the typical working truncation scheme employed in standard IMSRG calculations is IMSRG(2) but there is a concerted effort to move towards IMSRG(3).

A similar truncation scheme can be applied to the Magnus formulation, i.e., operators in Eqs. (14) and (16), including those that appear in the construction of \((\text {ad}^{(l)}_M(\eta ))^{ij}\), are restricted to contributions \(O^{[2m]}\) with \(m \le n\). The summations on the right-hand sides of Eqs. (14) and (16) are cut off once the size of the terms drops below a desired numerical threshold [47] .

5 Diagrammatic method

The manual derivation of the BIMSRG tensor networks based on a straightforward application of Wick’s theorem is already quite tedious at the BIMSRG(2) truncation level. Given that the goal is to employ more refined truncation schemes, eventually, a systematic and less error-prone methodology for deriving the BIMSRG(n) working equations is highly desirable. To set the stage for the code that will automate this derivation (see Sect. 5), we now introduce a diagrammatic method for evaluating BIMSRG commutators.

5.1 Fundamental commutator

The IMSRG method, whether formulated through Eq. (34) or through Eqs. (36)–(37), entirely relies on the (repeated) computation of the elementary commutator

$$\begin{aligned} C\equiv [A,B] = AB- BA, \end{aligned}$$
(38)

where \(A\) and \(B\) denote operators whose normal-ordered contributions \(A^{[2n]}\) (\(B^{[2n]}\)) range from \(n=0\) to \(n=N_A\) (\(n=N_B\)).

More specifically, the goal is to compute each normal-ordered component of the operator \(C\)

$$\begin{aligned} C^{ij} \equiv [A,B]^{ij}, \end{aligned}$$
(39)

whose maximum class \(C^{2N_C}\) is such that \(N_C= N_A+ N_B-1\).Footnote 7 Thus, the objective is to work out the general case characterized by the triplet \((N_A, N_B; N_C)\). As for the application of present interest, the derivation of the BIMSRG(n) equations relies on restricting the procedure to \(N_A=N_B=n\) and to further limiting the output terms to \(C^{[2m]}\) with \(m\le n\), i.e., it corresponds to working out the restricted case characterized by \((N_A, N_B; N_C) = (n, n; n)\). With this at hand, and at the price of (repeatedly) replacing \(A\) and \(B\) with the operators of interest, the BIMSRG(n) algebraic equations are obtained.

5.2 Rationale of the approach

In principle, the computation of Eqs. (38)–(39) is straightforward: Indeed, it boils down to the application of the standard time-independent Wick’s theorem to a product of two normal-ordered operators.Footnote 8 Furthermore, the fact that one is actually interested in the commutator of the two operators allows one to reduce the computation to so-called connected terms, i.e., to terms where at least one elementary contraction occurs between the two operators in the application of Wick’s theorem.

A straightforward application of Wick’s theorem quickly becomes cumbersome as \(N_A\) and \(N_B\) grow. Furthermore, it would involve numerous repetitions since many algebraic contributions are in fact identical. By identifying the corresponding patterns, one can design a diagrammatic representation of the various normal-ordered contributions to the commutator and evaluate their algebraic expressions such that a single diagram captures all these identical contributions at once. This approach eventually allows us to design an optimal code that automatically generates all needed diagrams and algebraic expressions in a matter of seconds. This will constitute the present extension of the ADG code [36, 44]. The diagrammatic framework introduced below shares similarities with the effective Hamiltonian diagrams occuring in BCC theory since, beyond closed vacuum-to-vacuum diagrams, linked diagrams with external legs need to be considered [52].

Fig. 1
figure 1

Diagrammatic representation of all normal-ordered contributions to an operator O containing classes of terms up to \(O^{[6]}\). Each term denotes a fully anti-symmetric Hugenholtz vertex. The convention is that reading an operator from left to right corresponds to an up-down reading of the associated diagram

5.3 Diagrammatic representation

The diagrammatic representation of an arbitrary operator O is given by a sum of Hugenholtz vertices denoting its normal-ordered contributions \(O^{ij}\). In Fig. 1, such a representation is displayed for an operator O containing classes of terms up to \(O^{[6]}\). In the following, \(d_{O^{ij}} \equiv i+j\) describes the degree of a given vertex.Footnote 9 All terms \(O^{ij}\) belonging to the same class \(O^{[2n]}\) share the same degree \(d_{O^{ij}} = 2n\).

In the diagrammatic method presented below, a graphical representation of each of the three operators \(A\), \(B\) and \(C\) occuring in Eq. (38) is needed. The corresponding vertices are introduced in Fig. 2.

Fig. 2
figure 2

Vertices associated with operators \(A\), \(B\) and \(C\)

The diagrammatic representation of \(O^{ij}\) involves the vertex itself along with i (j) lines traveling out of (into) the vertex and representing quasi-particle creation (annihilation) operators. The diagram is meant to be labelled in order to eventually translate it into an algebraic expression. The canonical rule to do so consists of first assigning indices \(k_1 \ldots k_i\) consecutively from the leftmost to the rightmost line above the vertex, while \(k_{i+1} \ldots k_{i+j}\) must be similarly assigned consecutively to lines below the vertex. Next, the anti-symmetric matrix element \(O^{ij}_{k_1 \ldots k_i k_{i+1} \ldots k_{i+j}}\) is to be assigned to the vertex. This canonical labelling is illustrated in Fig. 3 for the diagram representing the operator \(O^{22}\).

In case the left-right labelling of the incoming and/or outgoing legs does not match the canonical ordering employed in the amplitude \(O^{ij}_{k_1 \ldots k_i k_{i+1} \ldots k_{i+j}}\), the latter must be multiplied with the sign \((-1)^{l_p}\), where \(l_p\) denotes the signature of the permutation of the incoming and/or outgoing legs necessary to bring them into the canonical ordering. This additional rule is illustrated in Fig. 3 for \(O^{22}\).

Fig. 3
figure 3

Left: canonical labelling of the legs and associated vertex in the diagrammatic representation of the operator \(O^{22}\). Right: sign rule to apply when departing from the canonical labelling through the crossing of the legs associated with the two creation operators

Beyond operators, the elementary contractions occurring in standard Wick’s theorem need to be represented diagrammatically. Given that the operators are conveniently expressed in the quasi-particle basis associated with the Bogoliubov vacuum, the four elementary contractions take the simplest possible form

$$\begin{aligned} \mathbf {R}_{k_1k_2}&= \begin{pmatrix} \frac{\langle \varPhi |\, \beta ^{\dagger }_{k_1} \beta ^{}_{k_2} | \varPhi \rangle }{\langle \varPhi | \varPhi \rangle } &{}\quad \frac{\langle \varPhi |\, \beta ^{}_{k_1} \beta ^{}_{k_2} | \varPhi \rangle }{\langle \varPhi | \varPhi \rangle } \\ \frac{\langle \varPhi |\, \beta ^{\dagger }_{k_1} \beta ^{\dagger }_{k_2} | \varPhi \rangle }{\langle \varPhi | \varPhi \rangle } &{}\quad \frac{\langle \varPhi |\, \beta ^{}_{k_1} \beta ^{\dagger }_{k_2} | \varPhi \rangle }{\langle \varPhi | \varPhi \rangle } \end{pmatrix} \nonumber \\&\equiv \begin{pmatrix} R^{+-}_{k_1k_2} &{}\quad R^{--}_{k_1k_2} \\ R^{++}_{k_1k_2} &{}\quad R^{-+}_{k_1k_2} \end{pmatrix} \nonumber \\&= \begin{pmatrix} 0 &{}\quad 0 \\ 0 &{}\quad \delta _{k_1k_2} \end{pmatrix}, \end{aligned}$$
(40)

such that the sole non-zero contraction \(R^{-+}_{k_1k_2} = \delta _{k_1k_2}\) needs to be considered. The diagrammatic representation of this contraction is provided in Fig. 4 and connects two up-going lines associated with one annihilation and one creation operator, both carrying the same quasi-particle index. For simplicity, one can eventually represent the contraction as a line carrying a single up-going arrow along with one quasi-particle index.

Fig. 4
figure 4

Diagrammatic representation of the single non-zero elementary contraction. The convention is that the left-to-right reading of a matrix element corresponds to the up-down reading of the diagram

The complete set of diagrams contributing to \(C=[A,B]\) can now be systematically generated and evaluated by assembling the building blocks according to a specific set of rules. In principle, both contributions \(+AB\) and \(-BA\) need to be processed explicitly. However, given that the first term is considered for arbitrary values of \(N_A\) and \(N_B\), the diagrams making up the second term can easily be deduced from those contributing to the first one by (i) adding a global minus sign and (ii) performing a systematic exchange \(A\leftrightarrow B\). Thus, the rules to produce and evaluate relevant diagrams are only specified for \(+AB\) below while it is understood that this term is to be combined with the diagrams for \(-BA\) eventually. As explained below, summing the two terms making up the commutator leads to the cancellation of a specific category of contributions.

5.4 Diagram generation

The complete set of relevant diagrams are generated from the basic building blocks by applying the following set of topological rules:

  1. 1.

    A diagram contributing to \(C\) combines a top vertex \(A\) and a bottom vertex \(B\) connected by a number \(n_l\) of elementary contractions \(R^{-+}\). Because \(A\) and \(B\) are normal ordered, contractions starting and ending at the same vertex cannot be of the \(R^{-+}\) type and are therefore necessarily zero according to Eq. (40). Consequently, each contraction necessarily connects \(A\) and \(B\).

  2. 2.

    The fact that \(C\) actually represents the commutator of \(A\) and \(B\) immediately forces all relevant diagrams to be connected,Footnote 10 i.e., in each diagrams \(A\) and \(B\) are connected by at least one contraction and \(n_l >0\). Indeed, terms with \(n_l =0\) contribute identically to \(AB\) and \(BA\) and cancel out. Consequently, contributions involving \(A^{00}\) and \(B^{00}\) along with the class of terms \(C^{[2(N_A+N_B)]}\) can be omitted from the outset. As a result,

    1. (a)

      Normal-ordered contributions \(A^{kl}\) and \(B^{mn}\) can be limited to classes \(d_{A^{kl}} \equiv k+l=2,\ldots ,2N_A\) and \(d_{B^{mn}} \equiv m+n=2,\ldots ,2N_B\), respectively.

    2. (b)

      \(C\) receives non-zero contributions \(C^{ij}\) for \(d_{C^{ij}} \equiv i+j =0,\ldots , 2(N_A+N_B-1)\).

  3. 3.

    To generate all relevant contributions to \(C^{ij}\), normal-ordered contributions to \(A\) and \(B\) must be contracted in all possible ways. Not all combinations of \(A^{kl}\) and \(B^{mn}\) can actually contribute to a given term \(C^{ij}\): The condition

    $$\begin{aligned} i-j = (k-l) + (m-n), \end{aligned}$$
    (41)

    must be fulfilled, which allows one to discard a large set of combinations from the outset. Whenever Eq. (41) is satisfied, the number of contractions involved in the diagram denoted by \(C^{ij}(kl,mn)\) is

    $$\begin{aligned} n_l = k+m-i = l+n-j. \end{aligned}$$
    (42)
  4. 4.

    Specific properties of \(A\) and \(B\) typically translate into properties of \(C\) such that only a subset of the normal-ordered contributions \(C^{ij}\) has to be computed explicitly. For example, if \(A\) is anti-Hermitian and \(B\) is Hermitian, \(C\) is Hermitian and it is sufficient to only evaluate the subset of terms \(\{C^{ij}, i\ge j\}\).

  5. 5.

    A convenient way to classify diagrams is to introduce the maximal vertex degree of a diagram, defined as \(d_\mathrm {max} \equiv \max (d_{A^{kl}}, d_{B^{mn}}, d_{C^{ij}})\). In particular, the diagrams arising for the first time at order BIMSRG(n) correspond to all the topologies characterized by \(d_\mathrm {max} = n\).

5.5 Diagram evaluation

Once the complete set of diagrams contributing to \(C^{ij}\) is generated, the expressions of the associated amplitudes, i.e., of the anti-symmetrized matrix elements \(C^{ij}_{k_1 \ldots k_{i} k_{i+1} \ldots k_{i+j}}\), are obtained by applying a set of algebraic rules to each contributing diagram

  1. 1.

    Label outgoing (incoming) external lines with quasi-particle indices \(k_1 \ldots k_i \) (\(k_{i+1} \ldots k_{i+j}\)).

  2. 2.

    Label the \(n_l\) internal lines with different quasi-particle indices, e.g., pqr, ....

  3. 3.

    Attribute to vertices \(A^{kl}\) and \(B^{mn}\) their associated canonical amplitudes.

  4. 4.

    Sum over the \(n_l\) internal line labels.

  5. 5.

    Include a factor \((n_l!)^{-1}\) for the equivalent internal lines. Equivalent internal lines begin and end at the same two vertices. By virtue of the fact that each diagram contains only two vertices and that there is no self contraction, the \(n_l\) internal lines are necessarily equivalent in the present context.

  6. 6.

    Multiply by a phase factor \((-1)^{n_c}\), where \(n_c\) is the number of line crossings in the diagram (vertices are not considered line crossings).

  7. 7.

    Sum over all distinct permutations P of labels of inequivalent incoming (outgoing) external lines, including a parity factor \((-1)^{\sigma (P)}\) associated with the signature \(\sigma (P)\) of the permutation. Incoming (outgoing) external lines are inequivalent if they do not originate from the same vertex.

These algebraic rules are fully consistent with the ones for BCC [32] since they originate from the application of standard Wick’s theorem under the same conditions.Footnote 11

5.6 Elementary example

Let us demonstrate the use of both the topological and algebraic rules for a simple example. For this purpose, we consider the diagram built out of \(A^{(22)}\) and \(B^{(31)}\) and contributing to \(C^{31}\), i.e., diagram \(C^{31}(22,31)\). Such a combination is indeed allowed by Eq. (41) and the corresponding fully labeled diagram is displayed in Fig. 5. Contracting \(A^{(22)}\) and \(B^{(31)}\) consistently with Eq. (42), \(n_l=2\) internal lines are necessary to obtain three outgoing external lines, and one incoming.

Fig. 5
figure 5

Fully-labeled form of diagram \(C^{31}(22,31)\)

Fig. 6
figure 6

Diagrams contributing to the (2, 2; 2) commutator under the hypothesis that \(C\) is Hermitian or anti-Hermitian, i.e., only the subset \(\{C^{ij}, i\ge j\}\) is explicitly computed

The diagram possesses one pair (pq) of equivalent internal lines and two pairs \((k_1,k_3)\) and \((k_2,k_3)\) of inequivalent external lines. As drawn, the amplitudes are given in canonical form and the diagram displays no line crossing. As a result, the algebraic expression of the anti-symmetrized matrix element is given by

$$\begin{aligned} C^{31}_{k_1k_2k_3k_4}(22,31) \!=\! P(k_1k_2/k_3) \frac{1}{2} \sum _{pq} A^{22}_{k_1k_2 pq} B^{31}_{pq k_3k_4}. \end{aligned}$$
(43)

In Eq. (43), the permutation operator \(P(s_1/s_2)=P(s_2/s_1)\) generically performs an appropriate anti-symmetrization of the matrix element it acts on. The operator does so by permuting all indices in set \(s_1\) with all indices in set \(s_2\) while including a sign associated with the signature of the permutation. In the above example, the operator is defined by

$$\begin{aligned} P(k_1k_2/k_3)&\equiv 1 - P_{k_1k_3} - P_{k_2 k_3}, \end{aligned}$$
(44)

where, e.g., \(P_{k_1k_3}\) commutes indices \(k_1\) and \(k_3\). Because the elementary commutator involves two operators, the required permutation operators necessarily involve only two sets of indices; i.e. \(s_1\) and \(s_2\). This is at variance with, e.g., BCC where a larger number of operators may appear such that permutation operators involving more than two sets of indices are called for [32].Footnote 12 Still, the content of the two sets of indices presently depend on the classes of terms entering \(A\), \(B\) and \(C\). As an example, the complete list of permutation operators involved at the BIMSRG(2) level is provided in Eq. (A.2).

Because \(C^{31}_{k_1k_2k_3k_4}(22,31)\) is anti-symmetric with respect to the exchange of any pair of labels within the triplet \((k_1,k_2,k_3)\), it is sufficient to compute it explicitly for, e.g., the subset \(k_1<k_2<k_3\).

5.7 BIMSRG(2)

The working-horse of standard IMSRG calculations is the IMSRG(2) approximation. Let us now formulate the corresponding approximation in BIMSRG. In either the direct integration of the flow equation for the grand potential or the Magnus expansion, the BIMSRG(2) truncation scheme is defined by the (repeated) use of the \((N_{A}, N_{B}; N_{C})=(2,2;2)\) approximation to the elementary commutator under the hypothesis that \(C\) is Hermitian/anti-Hermitian.

The diagrams contributing to \(\{C^{ij}, i\ge j\}\) in this approximation are displayed in Fig. 6. They correspond to all diagrams with topologies characterized by \(d_\mathrm {max} \le 2\). Allowing the exchange \([A\leftrightarrow B]\) and exploiting the (anti-)Hermiticity of \(C\), these 28 diagrams actually account for a total of 82 diagrams.

The algebraic expressions of the BIMSRG(2) flow equations are obtained by applying the algebraic rules to the diagrams displayed in Fig. 6 and by identifying

$$\begin{aligned} A&\rightarrow \eta (s),\nonumber \\ B&\rightarrow \varOmega (s), \\ C&\rightarrow \frac{\mathrm {d} {\varOmega }^{}_{}}{\mathrm {d} s}(s), \nonumber \end{aligned}$$
(45)

for the case of direct integration or

$$\begin{aligned} A&\rightarrow M(s),\nonumber \\ B&\rightarrow \text {ad}_M^{(l-1)}(\eta ), \\ C&\rightarrow \text {ad}_M^{(l)}(\eta ), \nonumber \end{aligned}$$
(46)

in the case of the Magnus expansion. The evaluated expressions are collected in Appendix  A.

5.8 BIMSRG(n)

While the BIMSRG(2) truncation is an efficient workhorse, one eventually wishes to push to BIMSRG(3) in order to obtain high-accuracy results. The numerical code described below allows one to obtain the corresponding equations in a matter of seconds, as detailed in Table 1. The additional 82 diagramsFootnote 13 arising in the \((N_{A}, N_{B}; N_{C})=(3,3;3)\) approximation are too numerous and the equations too lengthy to be displayed in this article; the interested reader is invited to run the ADG code accordingly.

For orientation, Table 2 lists the number of diagrams arising from the commutator in the \((N_{A}, N_{B}; N_{C})=(n,n;n)\) approximation up to \(n=9\), i.e. all diagrams with topologies characterized by \(d_\mathrm {max} = n\) up to \(n=9\) (BIMSRG(9)). Of course, the number of diagrams increases rapidly. The restriction obtained by virtue of the (anti-)Hermiticity of \(C\) can go up to a factor of 2 in the ideal case where the number of \(C^{kk}\) terms is very small with respect to other diagrams. Together with using the symmetry in the truncation, this yields an ideal reduction by a factor of 4 in the number of distinct diagrams that have to be considered explicitly.

Table 1 Time needed to obtain all diagrams at the BIMSRG(n) truncation level and incorporate them in the LaTeX output file on a laptop. This time does not incorporate the PDFLaTeX compilation time, which can be several hours at high orders and result in a document of several hundred pages
Table 2 Number of new diagrams appearing at each order of the BIMSRG(n) truncation. The naive counting refers to computing explicitly all diagrams contributing to both \(+AB\) and \(-BA\). The growing number of diagrams can be reduced by using the symmetry in the truncation and the Hermiticity of \(C\)

6 ADG code

Given the set of diagrammatic rules, all diagrams contributing to \(C=[A,B]\) in the \((N_A,N_B;N_C)\) scheme are automatically produced and evaluated via the ADG code. The values of \(N_A\) and \(N_B\) do not have to be the same whereas \(N_C\) can be chosen to take any value between 0 and \(N_A+N_B-1\); i.e. the code is not limited to the specific constraints of the BIMSRG(n) truncation scheme.

The code generates expressions according to the following algorithms.

6.1 Diagram generation

  1. 1.

    Select either \(A\) or \(B\) to be the top vertex and associate \(B\) (resp. \(A\)) with the bottom vertex.

    1. (a)

      Select a valid vertex degree \(d_C\) in \(\{0,2,\dots ,2N_C\}\) stipulating the total number of external lines of the output operator.

      1. i.

        Partition \(d_C\) between incoming and outgoing external lines, i.e. pick integers i and j to select \(C^{ij}\) such that \(d_{C^{ij}} \equiv i+j = d_C\).

        1. A.

          Connect the external legs to \(A\) and \(B\) vertices in all possible ways. This must be done while keeping the number of these connections strictly smaller than \(2N_A\) and \(2N_B\), respectively, in order to allow for at least one contraction between \(A\) and \(B\). Additionally, the numbers of external legs connected to vertex \(A\) and to vertex \(B\) have to be either both even or both odd, restricting the number of configurations.

        2. B.

          Add \(n_l\) internal lines connecting vertex \(A\) to vertex \(B\) in all possible ways. The possible values of \(n_l\) must be such that Eq. (42) is fulfilled with the degrees \(d_{A^{kl}}\) and \(d_{B^{mn}}\) of the involved vertices \(A^{kl}\) and \(B^{mn}\) being in \(\{2,4,\dots ,2N_A\}\) and \(\{2,4,\dots ,2N_B\}\), respectively.

      2. ii.

        Go back to i. and exhaust all valid partitions.

    2. (b)

      Go back to (a) and exhaust all valid vertex degrees \(d_C\).

  2. 2.

    Go back to 1. and repeat the operation with permuted vertices.

6.2 Diagram evaluation

  1. 1.

    If the top vertex corresponds to the operator \(B\), insert a minus sign as the diagram is associated to the \(-BA\) term of the commutator.

  2. 2.

    If incoming (resp. outgoing) external legs are tied to both \(A\) and \(B\) vertices, write a permutation operator P associated to both groups of lines. Permutations are to be taken between the group of lines entering (resp. leaving) vertex \(A\) and the group entering (resp. leaving) vertex \(B\).

  3. 3.

    Write a symmetry factor \(1/(n_l!)\) where \(n_l\) is the number of internal lines connecting the two vertices.

  4. 4.

    For each vertex, write the matrix element of the corresponding operator with the quasi-particle labels of the attached out-going and incoming lines in canonical order.

  5. 5.

    Add the factor \((-1)^{n_c}\) where \(n_c\) denotes the number of lines crossing.

  6. 6.

    Write a summation over the quasi-particle labels associated to the internal lines.

6.3 Output of the program

The typical output associated to a BIMSRG diagram in the code isFootnote 14

Diagram 56 (\(-BA\)):

$$\begin{aligned} C^{22}_{k_1 k_2 k_3 k_4}(40,04) = - \frac{1}{2}\sum _{p_{1}p_{2}} B^{04}_{k_{3}k_{4} p_{1}p_{2}} A^{40}_{p_{1}p_{2} k_{1}k_{2}} \end{aligned}$$
figure a

7 Use of the ADG program

ADG has been designed to work on any computer with a Python3 distribution, and successfully tested on common Linux distributions as well as MacOS. In addition to the Python base, the setuptools and distutils packages must already be installed, which is the case in most current distributions. Having pip installed eases the process but is not technically required. The NumPy, NetworkX and SciPy libraries are automatically downloaded during the installation process. Additionally, one needs a LaTeX distribution installed with the PDFLaTeX compiler for ADG to produce a pdf file from the output, if so desired.

7.1 Installation

7.1.1 From the Python Package Index

The easiest way to install ADG is to obtain it from the Python Package IndexFootnote 15 by entering the following command

figure b

Provided setuptools is already installed, pip takes care of downloading and installing ADG as well as NumPy, SciPy and NetworkX. Once a new version of ADG is released, one can install it by entering the command

figure c

7.1.2 From the source files

Once the ADG source files are downloaded from the GitHub repository,Footnote 16 one must enter the project folder and either run

figure d

or

figure e

With this method, pipFootnote 17 also takes care of downloading and installing NumPy, NetworkX and SciPy.

7.2 Run the program

7.2.1 Batch mode

The most convenient way to use ADG is to run it in batch mode with the appropriate flags. For example, to run the program and generate BIMSRG diagrams at order 3, i.e. using \(N_A = N_B = N_C = 3\), one can use

figure f

where the -o flag is for the order, -t for the type of theory, -d indicates that the diagrams must be drawn and -c that ADG must compile the LaTeX output. The program supports less conventional truncation schemes as well. Two integers after the -o flag will be interpreted as settings for \(N_A= N_B\) and \(N_C\) respectively, and three integers as \(N_A\), \(N_B\) and \(N_C\) respectively. A complete list of the command-line options can be found in the program’s documentation (see Sect. 6.4) or by typing

figure g

Currently, ADG supports HF-MBPT by using -t MBPT, straight BMBPT by using -t BMBPT, off-diagonal BMBPT by using -t PBMBPT and BIMSRG by using -t BIMSRG. Though the algorithms described in the previous sections can be used regardless of the truncation order, ADG has been arbitrarily restricted to order 10 or less to avoid major overloads of the system due to rapidly growing number of expressions or diagrams. Users are advised to first launch calculations at low orders (2, 3 or 4 typically) to develop an intuition for the time and memory needs for specific applications.

7.2.2 Interactive mode

As an alternative to the batch mode, ADG can be run on a terminal by entering the command

figure h

A set of questions must be answered using the keyboard to configure and launch the calculation. The interactive mode then proceeds identically to the batch mode.

7.3 Steps of a program run

Here, we briefly describe the main steps of a typical ADG run:

  • Select options by using the command-line flags or keyboard input by the user in an interactive session.

  • ADG creates a list of adjacency matrices for the appropriate theory and order using NumPy, and feeds them to NetworkX, which creates MultiDiGraph objects.

  • If needed, checks are performed on the list of graphs to remove topologically equivalent or ill-defined graphs.

  • The list of topologically unique graphs is used to produce Diagram objects that store the graph as well as some of its associated properties depending on the theory (HF status, excitation level, etc.). The expressions associated to the graphs are eventually extracted.

  • The program prints on the terminal the number of diagrams per category and writes the LaTeX output file, the details of which depend on the options selected by the user, as well as a list of adjacency matrices associated to the diagrams. Other output files may be produced, depending on the theory and the user’s input.

  • If asked by the user, the program performs the PDFLaTeX compilation.

  • Unnecessary temporary files are removed and the programs exits.

7.4 Documentation

7.4.1 Local documentation

Once the source files have been downloaded, a quick start guide is available in the README.md file. Once ADG is installed, it is possible to read its manpages through

figure i

or a brief description of the program and its options through

figure j

A more detailed HTML documentation can be generated directly from the source files by going into the docs directory and running

figure k

The documentation is then stored in docs/build/html, with the main file being index.html. A list of other supported documentation formats is available by running

figure l

7.4.2 Online documentation

The full HTML documentation is available online under https://adg.readthedocs.io/, and support for the program can be obtained by reporting bugs or other issues on the GitHub repository’s tracker at https://github.com/adgproject/adg.

8 Conclusion and outlook

A novel single-reference expansion many-body method appropriate to the ab initio description of superfluid nuclei is formulated in terms of a particle-number-breaking Bogoliubov vacuum: The Bogoliubov in-medium similarity renormalization group (BIMSRG) formalism. Such an extension of the standard, i.e., symmetry-conserving, single-reference IMSRG approach parallels those developed recently within the framework of coupled cluster, self-consistent Green’s function and many-body perturbation theories. Furthermore, BIMSRG complements the already existing multi-reference in-medium similarity renormalization group (MR-IMSRG) formalism that is also applicable to open-shell systems.

The derivation of BIMSRG equations relies on the computation of the commutator between two operators of potentially high ranks. To perform such a computation efficiently, a diagrammatic method is designed on the basis of a normal-ordered form of the operators with respect to the Bogoliubov vacuum. While low-rank truncations of the commutator can easily be worked out manually on the basis of the diagrammatic rules, it becomes impractical and error-prone to work out higher orders, e.g. BIMSRG(3) equations, in this way. To overcome this limitation, we introduce the third version (v3.0) of the ADG code, which can automatically (1) generate all valid BIMSRG(n) diagrams and (2) evaluate their algebraic expressions in a matter of seconds. This is achieved in such a way that equations can easily be retrieved for both the flow equation and the Magnus expansion variants of BIMSRG.

Based on this work, the first objective is to perform full-fledged ab initio calculations of singly open-shell nuclei at the BIMSRG(2) level by employing a spherical implementation that also makes use of angular-momentum coupling tools [53]. Later on, an extension to BIMSRG(3) can be envisioned. Another future direction is to extend the ADG code [36, 44] to automatically derive equations at play within MR-IMSRG, in particular to systematically and safely access those defining the MR-IMSRG(3) approximation.