1 Program summary

  • Program title: HF-SHELL

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

  • Programming language: Fortran

  • Repository and DOI: github.com/wryssens/hf-shell

    DOI: https://doi.org/10.5281/zenodo.4008440

  • Description of problem: HF-SHELL solves the self-consistent mean-field problem at finite temperature for nuclear shell-model Hamiltonians on the level of the Hartree-Fock (HF), the HF-Bogoliubov (HFB) or the HF+Bardeen-Cooper-Schrieffer (HF+BCS) approximations. The code also includes the option for zero-temperature calculations. The particle-number projection after variation method of Ref. [1] is implemented to reduce the grand-canonical ensemble of mean-field theory to the canonical ensemble. The code can be used to calculate nuclear state densities and to generate free energy surfaces at finite temperature as a function of the nuclear shape.

  • Solution method: The HF basis is iterated through the heavy-ball algorithm of Ref. [2], and is supplemented by the two-basis method [3] in the case of the HFB approximation.

  • Additional comments: The code is fast: for the examples provided, a single calculation on a laptop takes from much less than a second for \(^{24}\)Mg up to a few seconds for \(^{162}\)Dy. A complete calculation of the state density of \(^{162}\)Dy as a function of the excitation energy (involving roughly 500 individual mean-field calculations) takes about ten minutes. The code uses only a small amount of memory requiring less than 300 MB of memory in all the examples shown. Several symmetry restrictions are imposed on the allowed nuclear configuration: time reversal, z-signature and reflection symmetries. In addition, the matrix elements of the relevant mean-field transformation (for HF, HFB or HF+BCS) are assumed to be real. The model space and effective interaction should be specified in the proton-neutron formalism, in which protons and neutrons can occupy different valence shells.

2 Introduction

Self-consistent mean-field approximations are an important tool in nuclear physics [4]. Due to their computational simplicity, they can be applied across the nuclear chart, but they often miss important many-body correlations. A partial solution to this deficiency is to allow for spontaneous symmetry breaking. Symmetry breaking lowers the energy of the mean-field solution, but results in the loss of good quantum numbers, making a direct comparison between theory and experimental results difficult. On the other hand, spontaneous breaking of symmetries offers an intuitive picture of various aspects of nuclear structure. For example, intrinsic quadrupole deformation arises naturally in a mean-field formalism that breaks rotational symmetry, and has been a cornerstone in our understanding of heavy nuclei. Because of their computational simplicity and the physical interpretation of symmetry breaking, mean-field methods remain widely used.

More advanced many-body methods are generally limited by their high computational cost and are usually limited to relatively small model spaces. In such model spaces where advanced many-body methods are feasible, mean-field calculations are usually not competitive in terms of approximating the solution to the many-body problem. Yet mean-field configurations are of interest in that they provide a benchmark and allow for physically valuable insight into more complex many-body calculations. Their computational simplicity offers an advantage even in small model spaces when carrying out a sequence of many-body calculations become prohibitively costly. Mean-field configurations are also useful as the starting point of numerous many-body methods, such as the random-phase approximation, symmetry restoration methods [5], and the Monte Carlo Shell Model method [6].

The configuration-interaction (CI) shell model is one such advanced many-body method. It provides an exact solution for a given effective Hamiltonian in a valence model space. Direct diagonalization methods can be applied only in relatively small model spaces, while the shell model Monte Carlo (SMMC) method enables calculations in model spaces that are many orders of magnitude larger [7]. SMMC calculations are computationally intensive and have not been applied to large regions across the nuclear chart. Mean-field calculations within the same CI shell-model space are much faster and provide insight into the interpretation of CI shell-model results; see, e.g., Refs. [8,9,10].

Aside from describing ground-state properties, mean-field methods have also been applied to describe nuclear properties at finite excitation energy, especially in the context of compound-nucleus reactions. Since the compound nucleus equilibrates on a time scale that is short compared to its decay, a commonly used method is a finite-temperature mean-field theory, see, e.g., Ref. [11] for an application to induced fission.

One of the most important statistical nuclear properties is the nuclear level density (NLD), which is a necessary input to the statistical theory of nuclear reactions. NLD models are often based on mean-field approximations, either directly using the mean-field partition function as in Ref. [12], or by providing a single-particle spectrum for combinatorial models as in Ref. [13]. These models are often global, especially when based on energy density functionals, but they have to be augmented by phenomenological modeling of collective effects, such as the so-called “rotational correction” [14]. The SMMC method on the other hand, provides exact NLDs (up to statistical errors) that already include the effects of collectivity. Its requires, however, suitable effective interactions in different mass regions. Mean-field densities count only the intrinsic states, and the ratio of the SMMC density to the mean-field density provides a microscopic estimate of the NLD enhancement due to collective states built on top of intrinsic states [9]. The understanding of this collective enhancement can lead to an improved treatment of collective corrections in global mean-field based NLD models.

Many zero-temperature mean-field codes have been developed. Most publicly available codes are designed for use with energy density functionals; see, e.g., Refs. [15,16,17,18,19] and many others. A zero-temperature code that performs variation after particle-number projection and is suitable for CI shell model Hamiltonians, was recently introduced in Ref. [20]. Published codes suitable for other types of effective nuclear interactions also exist but are less common; see, e.g., Refs. [21, 22]. However, little is available for finite-temperature mean-field approaches. To our knowledge HFBTHO [23] and HFODD [24] are the only published energy density functional codes that allow for finite-temperature calculations. The code HFGRAD [25] is the only published code for use with CI shell-model Hamiltonians, and it includes Hartree–Fock (HF) mean-field routines for both zero- and finite-temperature properties. The finite-temperature mean-field code developed previously and used in Refs. [9, 26] is unpublished but offers comparable functionality and also includes the Hartree–Fock–Bogoliubov (HFB) mean-field approximation.

To address this lack of published finite-temperature mean-field codes for shell model Hamiltonians, we present here the code HF-SHELL, which solves the self-consistent mean-field equations for CI shell-model Hamiltonians both at zero and at finite temperature. Its required computational resources are relatively low, with runtimes on the order of seconds and memory usage of a few hundred MB. As described below, HF-SHELL generalizes substantially the codes of Refs. [9] and [25], enabling the treatment of pairing correlations, triaxial deformations and the use of quadrupole constraints at finite temperature. The code is particularly suited for the calculation of nuclear level densities as it includes the particle-number projection techniques developed in Ref. [1]. Numerically, the code offers a robust self-consistency cycle through the use of the heavy-ball method of Ref. [2], which is similar in spirit to the gradient method of Refs. [25, 27].

This paper is organized as follows: in Sect. 2 we summarize the mean-field equations at finite temperature for the HF, the HF plus Bardeen–Cooper–Schrieffer (BCS) and the HFB approximations. In Sect. 3 we describe the calculation of nuclear state densities by using the ensemble reduction techniques of Ref. [1]. In Sect. 4 we discuss several other observables that are calculated by the code, and in Sect. 5 we describe the numerical techniques used to iterate and find the self-consistent solution. In Sect. 6 we present several examples that demonstrate results obtained by the code, and in Sect. 7 we explain how to use the code, and describe in detail its input and output. We conclude in Sect. 8.

3 Finite-temperature mean-field approximations

The zero-temperature mean-field equations are well documented in the literature and textbooks [5]. However, their extension to finite temperature is not as well discussed in the literature and we will briefly review key aspects of the formalism, following the original presentation in Ref. [28]. For more details, we refer the reader to Refs. [29, 30].

While the zero-temperature formalism is based on pure states, the finite-temperature mean-field approximation is formulated in terms of a statistical mixture or density matrix \({\hat{D}}\). In the following we assume that \({\hat{D}}\) is normalized, i.e., \({{\,\mathrm{Tr}\,}}{\hat{D}} =1\). The thermal expectation values of an observable \(\hat{O}\) can be calculated from

$$\begin{aligned} \langle \hat{O} \rangle _T = {{\,\mathrm{Tr}\,}}\left( \hat{D} \hat{O} \right) \,, \end{aligned}$$
(1)

where the trace is taken over Fock space. At a given temperature T and chemical potentials \(\mu _p\) and \(\mu _n\) (for protons and neutrons, respectively), we minimize the grand-canonical potential \(\varOmega \)

$$\begin{aligned} \varOmega (T,\mu _p,\mu _n) = E - T S - \mu _p N_p - \mu _n N_n \;, \end{aligned}$$
(2)

where the energy E, entropy S and average particle numbers \(N_q\) (\(q=p,n\)) are given by

$$\begin{aligned} E =&{{\,\mathrm{Tr}\,}}\left( \hat{D} \hat{H} \right) \, , \end{aligned}$$
(3a)
$$\begin{aligned} S =&-{{\,\mathrm{Tr}\,}}\left( \hat{D} \ln \hat{D} \right) \, , \end{aligned}$$
(3b)
$$\begin{aligned} N_q =&{{\,\mathrm{Tr}\,}}\left( \hat{D} \hat{N}_q \right) \;, \end{aligned}$$
(3c)

and we have set Boltzmann’s constant \(k_B = 1\) in the definition of the entropy. The minimization of \(\varOmega \) with respect to \({\hat{D}}\) leads to the grand-canonical ensemble

$$\begin{aligned} {\hat{D}}_{\mathrm{gc}}&= \frac{1}{Z_{\mathrm{gc}}}e^{-\beta \hat{H} + \alpha _p \hat{N}_p + \alpha _n \hat{N}_n} \, , \end{aligned}$$
(4)

where \(\beta = 1/T\), \(\alpha _q = \beta \mu _q\), and \(Z_{\mathrm{gc}}\) is the grand-canonical partition function

$$\begin{aligned} Z_{\mathrm{gc}} = {{\,\mathrm{Tr}\,}}e^{-\beta \hat{H} + \alpha _p \hat{N}_p + \alpha _n \hat{N}_n } \;. \end{aligned}$$
(5)

The presence of \(Z_{\mathrm{gc}}\) in Eq. (4) ensures the normalization of the density operator, i.e., \({{\,\mathrm{Tr}\,}}{\hat{D}}_\mathrm{gc}=1\).

The finite-temperature HF, HF+BCS and HFB approximations are obtained from the general variational principle for \(\varOmega \) using different forms for the density operator \(\hat{D}\). The chemical potentials are determined to reproduce the given particle number \(N_q\) for each species (protons and neutrons) on average, i.e., \({{\,\mathrm{Tr}\,}}({\hat{D}}_\mathrm{gc} {\hat{N}}_q) = N_q\).

3.1 Hamiltonian and model space

The CI shell model basis we employ is the many-particle space spanned by a set of spherical single-particle states characterized by their good quantum numbers nljm, where n is the principal radial quantum number, l is the orbital angular momentum, and j is the total angular momentum with z-projection m. While this set of orbitals usually originates from a physical one-body potential (e.g., harmonic oscillator or Woods–Saxon central potential plus spin-orbit interaction), the relevant quantities that describe the CI shell model are the single-particle energies, the two-body interaction matrix elements between pairs of the single-particle orbitals, and the matrix elements of relevant one-body operators such as the quadrupole operator.

In traditional shell-model applications, the chosen orbitals span the valence space outside of an inert core and only the valence nucleons are considered. For “no-core” shell model calculations, there is no core, and all nucleons are included in the calculation. Although the examples we provide here include an inert core, the code can in principle also be used for no-core calculations. We have, however, not included explicit strategies to improve the scaling of storage and CPU requirements with the size of the model space, and calculations might become impractical in very large no-core shell model spaces.

We use the proton–neutron formalism, in which protons and neutrons need not occupy the same valence spaces. In the following, we assume the single-particle space to include \(M_p\) proton orbitals and \(M_n\) neutron orbitals.

The CI shell model Hamiltonian consists of a one-body part \(\hat{H}^{(1)} \) and a two-body interaction. In general

$$\begin{aligned} \hat{H}&= \hat{H}^{(1)} + \hat{H}^{(2)}_{pp} + \hat{H}^{(2)}_{nn} + \hat{H}^{(2)}_{pn} \, , \end{aligned}$$
(6)

where

$$\begin{aligned} \hat{H}^{(1)}&= \sum _{i}^{M_p} \epsilon _{p,i}^{\mathrm{SM}} \hat{a}_{p,i}^{\dagger } \hat{a}_{p,i} + \sum _{i}^{M_n} \epsilon _{n,i}^{\mathrm{SM}} \hat{a}_{n,i}^{\dagger } \hat{a}_{n,i} \, , \end{aligned}$$
(7a)
$$\begin{aligned} \hat{H}^{(2)}_{qq}&= \frac{1}{4} \sum _{ijkl}^{M_q} {\bar{v}}^{qq}_{ijkl} \, \hat{a}_{q,i}^{\dagger } \hat{a}_{q,j}^{\dagger } \hat{a}_{q,l} \hat{a}_{q,k} \;\;\; (q=p,n) \,, \end{aligned}$$
(7b)
$$\begin{aligned} \hat{H}^{(2)}_{pn}&= \sum _{ik}^{M_p} \sum _{jl}^{M_n} v^{pn}_{ijkl} \, \hat{a}_{p,i}^{\dagger } \hat{a}_{n,j}^{\dagger } \hat{a}_{n,l} \hat{a}_{p,k} \, . \end{aligned}$$
(7c)

The operators \(\hat{a}^{\dagger }, \hat{a}\) are the fermion creation and annihilation operators corresponding to the shell-model single-particle basis. The one-body Hamiltonian in Eq. (6) is characterized by single-particle energies \(\epsilon ^{\mathrm{SM}}_p, \epsilon ^{\mathrm{SM}}_{n}\) and a set of two-body matrix elements (TBMEs) \({\bar{v}}^{pp}, {\bar{v}}^{nn}\) and \(v^{pn}\). The pp and nn matrix elements \({\bar{v}}^{pp}\) and \({\bar{v}}^{nn}\) are antisymmetrized, but the pn matrix elements \(v^{pn}\) are not.

HF-SHELL accepts input in terms of the angular momentum coupled TBMEs. We express the uncoupled TBMEs in term of the coupled matrix elements with good angular momentum JM

$$\begin{aligned} {\bar{v}}^{qq}_{ijkl}&= \sqrt{1 + \delta _{ij}} \sqrt{1 + \delta _{kl}} \nonumber \\&\sum _{JM} \left( j_i m_i j_j m_j | J M \right) \left( j_k m_k j_l m_l | J M \right) {\bar{v}}^{J,qq}_{ijkl}\, , \end{aligned}$$
(8a)
$$\begin{aligned} v^{pn}_{ijkl}&= \sum _{JM} \left( j_i m_i j_j m_j | J M \right) \left( j_k m_k j_l m_l | J M \right) v^{J,pn}_{ijkl} \, , \end{aligned}$$
(8b)

where the \(\left( j_i m_i j_j m_j | J M \right) \) are Clebsch–Gordan coefficients. While the uncoupled matrix elements depend explicitly on the magnetic quantum numbers of the single-particle states, the coupled matrix elements are independent of them and of M. The good angular momentum TBMEs \( {\bar{v}}^{J,qq}\) and \(v^{J,pn}\) are part of the input to the code. The formatting of the input regarding the model space and the interaction are discussed in Sect. 7.2.

While essentially all textbooks present the mean-field formulation for just one nucleon species, we will explicitly use both species in the formalism such that the text follows more closely the implementation in the code.

3.2 The HF approximation

The HF approximation is obtained using the variational principle for \(\varOmega \) when we assume a density matrix of the form

$$\begin{aligned} \hat{D}_{\mathrm{HF}} = \frac{1}{Z_{\mathrm{HF}}^{0}} \prod _{q=p,n} e^{-\beta \hat{K}_q + \alpha _q \hat{N}_q} \, , \end{aligned}$$
(9)

where \(\hat{K}_q = \sum _{ij=1}^{M_q} K_{q,ij} \hat{a}^{\dagger }_{q,i} \hat{a}_{q,j}\) are one-body operators, and \(Z^{\mathrm{HF}}_{0} = \prod _{q=p,n} {{\,\mathrm{Tr}\,}}e^{-\beta \hat{K}_q + \alpha _q \hat{N}_q }\) is the corresponding partition function with \(\alpha _q=\beta \mu _q\). The one-body density matrix \(\rho _q\) is defined by \(\rho _{q,ij} = {{\,\mathrm{Tr}\,}}( \hat{D} \hat{a}^{\dagger }_{q,j} \hat{a}_{q,i})\). Using Wick’s theorem for statistical mixtures [31], we find

$$\begin{aligned} \rho _q&= \frac{1}{1 + e^{\beta K_q - \alpha _q}}\;. \end{aligned}$$
(10)

We can express the energy, entropy and particle numbers in Eq. (3c) in terms of the one-body density matrices \(\rho _q\)

$$\begin{aligned} E_{\mathrm{HF}} =&\sum _{q=p,n} \left[ {{\,\mathrm{tr}\,}}\left( \epsilon ^{\mathrm{SM}}_q \rho _q \right) + \frac{1}{2} {{\,\mathrm{tr}\,}}\left( \varGamma _{q} \rho _{q} \right) \right] \;, \end{aligned}$$
(11a)
$$\begin{aligned} S_{\mathrm{HF}} =&- \sum _{q=p,n} \left\{ {{\,\mathrm{tr}\,}}(\rho _q \ln \rho _q) + {{\,\mathrm{tr}\,}}[(1-\rho _q)\ln (1-\rho _q)]\right\} \;, \end{aligned}$$
(11b)
$$\begin{aligned} N_q =&{{\,\mathrm{tr}\,}}\rho _q \,, \end{aligned}$$
(11c)

where \({{\,\mathrm{tr}\,}}\) indicates a trace over the single-particle space of the relevant nucleon species, e.g.,

$$\begin{aligned} {{\,\mathrm{tr}\,}}\left( \varGamma _{p} \rho _{p}\right)&= \sum _{ij=1}^{M_p} \varGamma _{p,ij} \rho _{p,ji} \, . \end{aligned}$$
(12)

The matrices \(\varGamma _{p}\) and \(\varGamma _{n}\) in Eq. (11a) are given by

$$\begin{aligned} \varGamma _{p,ij}&= \sum _{kl=1}^{M_p} {\bar{v}}^{pp}_{ikjl} \rho _{p,lk}+ \sum _{kl=1}^{M_n} v^{pn}_{ikjl} \rho _{n,lk} \, , \end{aligned}$$
(13a)
$$\begin{aligned} \varGamma _{n,ij}&= \sum _{kl=1}^{M_n} {\bar{v}}^{nn}_{ikjl}\rho _{n,lk} + \sum _{kl=1}^{M_p} v^{pn}_{kilj} \rho _{p,lk} \, . \end{aligned}$$
(13b)

Using the variational principle for \(\varOmega \) with respect to the density operator \(\hat{D}_{\mathrm{HF}}\), or equivalently with respect to the matrix elements of \(\hat{K}_q\), we find

$$\begin{aligned} K_q&= h_q \equiv \epsilon ^{\mathrm{SM}}_q + \varGamma _q \; , \end{aligned}$$
(14)

where \(h_q\) is the single-particle HF Hamiltonian for \(q=p,n\). Combining Eqs. (10) and (14), we find the self-consistent finite-temperature HF equation

$$\begin{aligned} \rho _q&= \frac{1}{1 + e^{\beta (\epsilon ^{\mathrm{SM}}_q + \varGamma _q ) - \alpha _q}}\;. \end{aligned}$$
(15)

The formulation of the self-consistent problem can be simplified by transforming to the HF single-particle basis in which both \(h_p\) and \(h_n\) are diagonal with the HF single-particle energies \(\epsilon _q\) along the diagonal. We call this basis the HF basis and denote the fermion creation and annihilation operators in this basis by \(\hat{c}_q^{\dagger }, \hat{c}_q\). In the HF basis, the one-body density matrices are diagonal with occupation numbers \(f_{q,i}\)

$$\begin{aligned} \rho _{q,ij}&= \delta _{ij}f_{q,i} = \delta _{ij} \frac{1}{1 + e^{\beta \epsilon _{q,i} - \alpha _q }} \, , \end{aligned}$$
(16)

where \(\epsilon _{q,i}\) are the HF single-particle energies. Eq. (16) implies that \(\rho _q^2 \not = \rho _q\), in contrast to the zero-temperature HF density matrix. This is since the nuclear configuration at finite temperature is no longer a single Slater determinant but a statistical mixture \(D_{\mathrm{HF}}\) of such determinants.

The entropy can be easily calculated in the HF basis

$$\begin{aligned} S_{\mathrm{HF}}&= - \sum _{q= p,n} \sum _{i=1}^{M_q} \left[ f_{q,i} \ln f_{q,i} + (1-f_{q,i})\ln (1-f_{q,i})\right] \, . \end{aligned}$$
(17)

3.3 The HFB approximation

The HFB density matrix assumes a more general form than Eq. (9)

$$\begin{aligned} \hat{D}_{\mathrm{HFB}} = \frac{1}{Z^0_{\mathrm{HFB}}} \prod _{q = p, n} e^{-\beta \hat{K}_q + \alpha _q \hat{N}_q } \, , \end{aligned}$$
(18)

where \(\hat{K}_q\) is given by the bilinear form

$$\begin{aligned} \hat{K}_q&= \frac{1}{2} \begin{pmatrix} \hat{a}_q \\ \hat{a}_q^{\dagger } \end{pmatrix}^{\dagger } \begin{pmatrix} K^{11}_q &{} K^{20}_q \\ {-K^{20,*}_q} &{} -K^{11,{*}}_q \end{pmatrix} \begin{pmatrix} \hat{a}_q \\ \hat{a}_q^{\dagger } \end{pmatrix} \nonumber \, ,\\&= \frac{1}{2} \begin{pmatrix} \hat{a}_q \\ \hat{a}_q^{\dagger } \end{pmatrix}^{\dagger } {\mathcal {K}}_q \begin{pmatrix} \hat{a}_q \\ \hat{a}_q^{\dagger } \end{pmatrix} \, . \end{aligned}$$
(19)

We define both the one-body density matrix \(\rho _q\) and the anomalous density matrix \(\kappa _q\)

$$\begin{aligned} \rho _{q,ij}&= {{\,\mathrm{Tr}\,}}\left( \hat{D}_{\mathrm{HFB}} \hat{a}^{\dagger }_j \hat{a}_i \right) \,,&\;\; \kappa _{q,ij}&= {{\,\mathrm{Tr}\,}}\left( \hat{D}_{\mathrm{HFB}} \hat{a}_j \hat{a}_i \right) \, . \end{aligned}$$
(20)

Together they form the generalized density matrices \({\mathcal {R}}_q\), each of dimension \(2M_q \times 2 M_q\)

$$\begin{aligned} {\mathcal {R}}_q&= \begin{pmatrix} \rho _q &{}\quad \kappa _q \\ -\kappa _{q}^* &{}\quad 1 - \rho _{q}^* \end{pmatrix} \, . \end{aligned}$$
(21)

Using Wick’s theorem, \(\mathcal{R}_q\) can be expressed in terms of the matrix representation \(\mathcal{K}_q\) of the operator \(\hat{K}_q\) (see Eq. (19))

$$\begin{aligned} {\mathcal {R}}_{q}= \frac{1}{1 + e^{\beta {\mathcal {K}}_q - \alpha _q {\mathcal {N}}_q}} \, , \end{aligned}$$
(22)

where

$$\begin{aligned} {\mathcal {N}}_q&= \begin{pmatrix} 1 &{}\quad 0 \\ 0 &{}\quad -1 \end{pmatrix} \, , \end{aligned}$$
(23)

is the matrix representation of the number operator \({\hat{N}}_q\). We can express the total energy as a function of \(\rho _q\) and \(\kappa _q\)

$$\begin{aligned} E_{\mathrm{HFB}}&= \sum _{q=p,n}\left[ {{\,\mathrm{tr}\,}}\left( \epsilon ^{\mathrm{SM}}_q \rho _q \right) +\frac{1}{2} {{\,\mathrm{tr}\,}}\left( \varGamma _q \rho _q \right) +\frac{1}{2} {{\,\mathrm{tr}\,}}\left( \varDelta _q \kappa ^\dagger _q \right) \right] \, . \end{aligned}$$
(24)

The HF potentials \(\varGamma _{p}, \varGamma _{n}\) are given by Eq. (13) as in the HF case, while the pairing potentials \(\varDelta _q\) are defined by

$$\begin{aligned} \varDelta _{q,ij}&= \frac{1}{2} \sum _{kl=1}^{M_q}{\bar{v}}^{qq}_{ijkl} \kappa _{q,kl}\, . \end{aligned}$$
(25)

The variation of \(\varOmega \) with respect to the matrix elements of \({\mathcal {K}}_p\) and \({\mathcal {K}}_n\) leads to the condition that

$$\begin{aligned} {\mathcal {K}}_q&= \begin{pmatrix} h_q &{} \quad \varDelta _q \\ -\varDelta ^{*}_q &{}\quad - h^*_q \end{pmatrix} \, . \end{aligned}$$
(26)

Equation (26) together with Eqs. (21) and (22) form the HFB self-consistent equations for \(\rho _q\) and \(\kappa _q\).

We define the HFB Hamiltonian \({\mathcal {H}}_q\) to include the contribution of the chemical potential, i.e., \( {\mathcal {H}}_q = {\mathcal {K}}_q - \mu _q {\mathcal {N}}_q\) [5]. It is convenient to work in the quasi-particle basis that diagonalizes \({\mathcal {H}}_q\). For \(k=1, \ldots , 2 M_q\), we have

$$\begin{aligned} {\mathcal {H}}_q \begin{pmatrix} U_{q,k} \\ V_{q,k} \end{pmatrix}&= E^{\mathrm{qp}}_{q,k} \begin{pmatrix} U_{q,k} \\ V_{q,k} \end{pmatrix} \, , \end{aligned}$$
(27)

where \(E^{\mathrm{qp}}_{q,k}\) are the quasi-particle energies and \(U_{q,k}\), \(V_{q,k}\) are column vectors of dimension \(M_q\). The corresponding matrices \(U_q\) and \(V_q\) define a unitary Bogoliubov transformation \({\mathcal {W}}_q\) of dimension \(2M_q \times 2M_q\), which transforms the set of single-particle operators \(a^\dagger _q, a_q\) into the set of quasi-particle operators \({\hat{\beta }}^{\dagger }_q, {\hat{\beta }}_q\)

$$\begin{aligned} \begin{pmatrix} {\hat{\beta }}_q \\ {\hat{\beta }}_q^{\dagger } \\ \end{pmatrix} = {\mathcal {W}}_q \begin{pmatrix} \hat{a}_q \\ \hat{a}_q^{\dagger } \\ \end{pmatrix} = \begin{pmatrix} U_q^{\dagger } &{}\quad V_q^{\dagger } \\ V^{T}_q &{}\quad U^T_q \\ \end{pmatrix} \begin{pmatrix} \hat{a}_q \\ \hat{a}_q^{\dagger } \\ \end{pmatrix} \, . \end{aligned}$$
(28)

This transformation brings the generalized density matrix in Eq. (21) into a diagonal form

$$\begin{aligned} {\mathcal {R}}_q&= {\mathcal {W}}_q \begin{pmatrix} f_q &{}\quad 0 \\ 0 &{}\quad 1 - f_q \end{pmatrix} {\mathcal {W}}_q^{\dagger } \, , \end{aligned}$$
(29)

where \(f_q\) is a diagonal matrix with the quasi-particle occupations along its diagonal

$$\begin{aligned} f_{q,k}&= \frac{1}{1 + e^{\beta E^{\mathrm{qp}}_{q,k}}} \, . \end{aligned}$$
(30)

As in the HF case, non-vanishing quasi-particle occupations imply that the generalized density matrix is no longer a projector, i.e. \({\mathcal {R}}^2_q \not = {\mathcal {R}}_q\). In contrast to the zero-temperature HFB approximation, the corresponding finite-temperature configuration is no longer described by the quasi-particle vacuum.

In the quasi-particle basis, the HFB entropy is given by an expression similar to the HF entropy

$$\begin{aligned} S_{\mathrm{HFB}} = - \sum _{q=p,n}\sum _{i=1}^{M_q} \left[ f_{q,i} \ln f_{q,i} + (1 - f_{q,i}) \ln (1-f_{q,i}) \right] \, , \end{aligned}$$
(31)

but the \(f_{q,i}\) are now the quasi-particle occupations of Eq. (30).

The formalism simplifies when the HFB Hamiltonian is invariant under time-reversal symmetry. In that case, the quasi-particle states come in doubly degenerate pairs (\(k,{\bar{k}}\)) that are related through time-reversal, and the corresponding Bogoliubov matrix \(\mathcal{W}_{q,T}\) can be expressed as a matrix of dimension \(M_q \times M_q\) [1, 5]:

$$\begin{aligned} \begin{pmatrix} {\hat{\beta }}_{q,k} \\ {\hat{\beta }}^{\dagger }_{q,{\bar{k}}} \end{pmatrix}&= {\mathcal {W}}^{\dagger }_{q,T} \begin{pmatrix} \hat{a}_{q,k} \\ \hat{a}^{\dagger }_{q,{\bar{k}}} \end{pmatrix} \, ,&{\mathcal {W}}_{q,T}&= \begin{pmatrix} U_q &{}\quad -V^*_q \\ V_q &{}\quad U^*_q \end{pmatrix} \, , \end{aligned}$$
(32)

where k runs over only half the number of single-particle states (\(k=1,\ldots ,M_q/2\)).

Finally, we remark on the concept of the canonical basis. As is the case at zero-temperature, one can decompose the Bogoliubov transformation in Eq. (28) following the Bloch–Messiah–Zumino theorem [5, 32, 33]. However, at finite temperature the matrices \(\rho \) and \(\kappa \) cannot be brought simultaneously into a diagonal form for \(\rho \) and a canonical form for \(\kappa \) by a single unitary transformation of the single-particle basis. Thus, the notion of canonical basis does not generalize to the finite-temperature HFB equations.

3.4 The HF+BCS approximation

The HF+BCS approximation consists of a further simplification of the HFB approximation for time-reversal invariant systems. In addition to time-reversal symmetry, we assume that the interaction in the pairing channel acts mainly between time-reversal partners in the HF basis. In that basis we assume

$$\begin{aligned} \varDelta _{q,ij}&\approx \varDelta _{q,i} \delta _{i {\bar{j}}} \, . \end{aligned}$$
(33)

The Bogoliubov transformation can then be decomposed into a set of \(M_q/2\) uncoupled transformations

$$\begin{aligned} \begin{pmatrix} {\hat{\beta }}_{q,k} \\ {\hat{\beta }}_{q,{\bar{k}}}^{\dagger } \\ \end{pmatrix} = \begin{pmatrix} u_{q,k}^* &{}\quad -v_{q,k}^* \\ v_{q,k} &{}\quad u_{q,k} \\ \end{pmatrix} \begin{pmatrix} \hat{c}_{q,k} \\ \hat{c}_{q,{\bar{k}}}^{\dagger } \\ \end{pmatrix} \, , \end{aligned}$$
(34)

where the \(u_k,v_k\) are now numbers. The diagonalization of the HFB Hamiltonian leads to

$$\begin{aligned} |u_{q,k}|^2&= \frac{1}{2} \left( 1 + \frac{\epsilon _{q,k} - \mu _q}{E^{\mathrm{qp}}_{q,k}}\right) \, , \end{aligned}$$
(35a)
$$\begin{aligned} |v_{q,k}|^2&= \frac{1}{2} \left( 1 - \frac{\epsilon _{q,k} - \mu _q}{E^{\mathrm{qp}}_{q,k}}\right) \, , \end{aligned}$$
(35b)

with quasi-particle energies given by

$$\begin{aligned} E^{\mathrm{qp}}_{q,k} = \sqrt{\left( \epsilon _{q,k} - \mu _q\right) ^2 + \varDelta _{q,k}^2} \, . \end{aligned}$$
(36)

The quasi-particle occupations retain the form of Eq. (30). The matrices \(\rho _q\) and \(\kappa _q\) take a simple form in each of the two-dimensional subspace composed of the time-reversed partners

$$\begin{aligned} \rho _{q}&= \begin{pmatrix} \rho _{q,kk} &{}\quad 0 \\ 0 &{}\quad \rho _{q,{\bar{k}}{\bar{k}}} \end{pmatrix} \, , \qquad \kappa _q&= \begin{pmatrix} 0 &{}\quad \kappa _{q,k{\bar{k}}} \\ \kappa _{q,{\bar{k}}k} &{}\quad 0 \end{pmatrix} \, , \end{aligned}$$
(37)

with

$$\begin{aligned} \rho _{q,kk}&= \rho _{q, {\bar{k}}{\bar{k}}} = \, f_{q,k} + |v_{q,k}|^2 (1 - 2 f_{q,k}) \, , \end{aligned}$$
(38a)
$$\begin{aligned} \kappa _{q,k{\bar{k}}}&= -\kappa _{q,{\bar{k}}k} = \, u_{q,k} v^*_{q,k} (1 - 2 f_{q,k}) . \end{aligned}$$
(38b)

Together with the definition of the pairing gaps in Eq. (25), these equations lead to finite-temperature gap equations for each nucleon species [28]

$$\begin{aligned} \varDelta _{q,i}&= -\frac{1}{2} \sum _{j=1}^{M_q/2} {\bar{v}}^{qq}_{i{\bar{i}}j{\bar{j}}} ( 1 - 2 f_{q,j}) \frac{\varDelta _{q,j}}{E^{\mathrm{qp}}_{q,j}} \,. \end{aligned}$$
(39)

The sum in Eq. (39) ranges over half of the single-particle states (such that the other half are their time-reversed partners). At zero temperature, the quasi-particle occupations vanish and Eq. (39) reduces to the well known gap equations.

3.5 Self-consistent symmetries

If conserved symmetries are present, the number of variational parameters of the mean-field equations (the matrix elements of the HF or Bogoliubov transformation) can be significantly reduced, resulting in a lesser numerical effort. The code assumes good parity and a conserved z-signature \(\hat{R}_z = e^{i \pi \hat{J}_z}\), as well as the reality of the matrix elements of the HF and HFB transformations. We also assume time-reversal symmetry, which implies that the mean-field description is suitable for even-even nuclei only. Finally, the proton-neutron formalism as presented here implies there is no mixing of proton and neutron single-particle orbitals.

3.6 Iterative solutions of the mean-field equations

The mean-field equations are nonlinear. In the HF approximation, the one-body density matrix \(\rho \) can be obtained from the diagonalization of the single-particle Hamiltonian, which in turn depends on \(\rho \). In the HFB approximation, the generalized density matrix \({\mathcal {R}}\) is the result of the diagonalization of \({\mathcal {H}}\), which in turn depends on \({\mathcal {R}}\) through the mean fields \(\varGamma \) and the pairing gaps \(\varDelta \).

For this reason, the self-consistent mean-field equations are solved by iterations. In HFB, starting from an initial guess for \(\rho \) and \(\kappa \), we construct the fields \(\varGamma , \varDelta \) and diagonalize the resulting Hamiltonian \({\mathcal {H}}\) to obtain new matrices \(\rho \) and \(\kappa \). Several methods have been proposed in the literature. The most straightforward method of iterating and re-diagonalizing \({\mathcal {H}}\) which is constructed from the improved \(\rho \) and \(\kappa \) often leads to convergence issues, as small changes in the matrix can give rise to large differences in the nuclear configuration.

Gradient methods [27, 34, 35] evolve the configuration in a more gradual way, and are less susceptible to convergence issues. Such methods are particularly suitable for calculations in large model spaces since the iterations can be implemented without storing the full matrix \({\mathcal {H}}\). This advantage is not significant for relatively small model spaces such as those used in shell-model calculations, but the robustness of the self-consistency cycle remains an attractive feature. Here we employ the heavy-ball optimization method of Ref. [2], a simple extension of the original method of Ref. [34], which we describe in Sect. 5.

3.7 Mean-field partition functions

It is not immediately apparent that the finite-temperature mean-field approximations satisfy the usual thermodynamical relations, which we refer to as thermodynamic consistency. In this section we show that the finite-temperature mean-field approximations are thermodynamically consistent.

The starting point is the grand-canonical partition function, which can be obtained from the relation between the partition function and the grand-canonical potential, \(\ln Z = -\beta \varOmega \). In the HF approximation, we find

$$\begin{aligned} Z^{\mathrm{HF}}_{\mathrm{gc}}&= e^{-\beta U^0_{\mathrm{HF}}} \prod _{q=p,n} \prod _{i=1}^{M_q} \left[ 1 + e^{-\beta \epsilon _{q,i} + \alpha _q}\right] \, , \end{aligned}$$
(40)

with

$$\begin{aligned} U^0_{\mathrm{HF}} =&- \frac{1}{2} \sum _{q=p,n}{{\,\mathrm{tr}\,}}\left( \varGamma _q \rho _q\right) . \end{aligned}$$
(41)

Similarly, in the HFB approximation, we have

$$\begin{aligned} Z^{\mathrm{HFB}}_{\mathrm{gc}}&= e^{-\beta U_{\mathrm{HFB}}^0} \prod _{q=p,n} \prod _{i=1}^{M_q} \left( 1 + e^{-\beta E^{\mathrm{qp}}_{q,i}} \right) \, , \end{aligned}$$
(42)

with

$$\begin{aligned} U_{\mathrm{HFB}}^0 =&- \frac{1}{2} \sum _{q=p,n} {{\,\mathrm{tr}\,}}( \varGamma _q \rho _q ) - \frac{1}{2} \sum _{q=p,n} {{\,\mathrm{tr}\,}}( \varDelta _q \kappa ^{\dagger }_q ) \, . \end{aligned}$$
(43)

The grand-canonical partition function in the HF+BCS approximation is formally identical to Eq. (42).

Thermodynamic consistency requires that the following relations hold

$$\begin{aligned} E^{\mathrm{HF}}&= - \left. \frac{\partial \ln Z^{\mathrm{HF}}_\mathrm{gc}}{\partial \beta }\right| _{\alpha _p, \alpha _n} \, , \end{aligned}$$
(44)
$$\begin{aligned} N_q^{\mathrm{HF}}&= \left. \frac{\partial \ln Z^\mathrm{HF}_{\mathrm{gc}}}{\partial \alpha _q}\right| _{\beta , \alpha _{q' \not = q}} \, , \end{aligned}$$
(45)

and similarly for the HFB and HF+BCS approximations. The validity of Eqs. (44) and (45) is a nontrivial observation, since the single-particle Hamiltonian \(\hat{h}\) depends on the temperature and chemical potential, as do the pairing gaps \(\varDelta \) in the HFB or HF+BCS approximations.

Following Appendix B of Ref. [9], we prove Eq. (45) for protons in the HF approximation. The validity of Eq. (44), as well as the analogous equations for the HFB and HF+BCS approximations can be proven along similar lines. We rewrite the derivative in Eq. (45) in the form

$$\begin{aligned} \left. \frac{\partial \ln Z^{\mathrm{HF}}_{\mathrm{gc}}}{\partial \alpha _p}\right| _{\beta , \alpha _{n}}&= \left. - \frac{ \partial (\beta \varOmega _{\mathrm{HF}})}{\partial \alpha _p}\right| _{\beta , \alpha _{n}} \nonumber \\&= N_p - \left. \frac{ \partial (\beta \varOmega _\mathrm{HF})}{\partial \hat{D}_{\mathrm{HF}}}\right| _{\beta , \alpha _{n}, \alpha _p} \left. \frac{ \partial \hat{D}_{\mathrm{HF}}}{\partial \alpha _p}\right| _{\beta , \alpha _{n}} \, . \end{aligned}$$
(46)

The second term on the r.h.s. of Eq. (46) vanishes since \(\hat{D}^{\mathrm{HF}}\) is an extremum of the grand-canonical potential \(\varOmega \).

We emphasize the importance of the temperature-dependent constants \(U^0\) in the mean-field approximations to the grand-canonical partition function, which implies \(Z_{\mathrm{gc}} \not = Z^0\) (where \(Z^0\) is the partition function of the non-interacting particles). This is often overlooked in introductory texts, with the exception of Ref. [29]. Without the inclusion \(U^0\), the mean-field approximations would not satisfy Eqs. (44), (45) and their HFB and HF+BCS analogues.

3.8 The zero-temperature limit

We first discuss the zero-temperature limit in the presence of pairing correlations, i.e., we assume that a finite pairing gap exists for low temperatures in the HFB or HF+BCS approximations. The quasi-particle energies are all strictly positive and all quasi-particle occupations of Eq. (30) vanish as \(T \rightarrow 0\). The generalized density matrix then assumes its zero-temperature form

$$\begin{aligned} \lim _{T \rightarrow 0} {\mathcal {R}}_q = \begin{pmatrix} 0 &{}\quad 0 \\ 0 &{}\quad 1 \end{pmatrix} \, . \end{aligned}$$
(47)

In this limit, \({\mathcal {R}}_q\) is idempotent, and we recover the interpretation of the self-consistent mean-field solution as a pure state – the vacuum of a set of quasi-particle operators determined by the Bogoliubov transformation.

The \(T\rightarrow 0\) limit is less straightforward when pairing correlations collapse at low temperatures or in the HF approximation; see Ref. [36] and Appendix B of Ref. [37]. When the highest HF single-particle level is degenerate and partially occupied (open shell), the \(T\rightarrow 0\) limit is a statistical mixture, in which all the degenerate orbitals of the highest HF single-particle level have the same occupation probability. Thus, we do not recover the single Slater determinant description of the \(T=0\) HF approximation. This zero-temperature limit is known as the uniform filling approximation. When the highest HF single-particle level is fully occupied (closed shell), the statistical mixture reduces to a projector and the usual \(T=0\) HF description is obtained.

4 Canonical partition functions and calculation of state densities

The finite-temperature mean-field approximations discussed above are all formulated in the grand-canonical ensemble. For a finite nucleus however, both the proton and neutron numbers are fixed, and it is necessary to reduce the formulation to the canonical ensemble. One could incorporate particle-number projection operators \(\hat{P}_n\) and \(\hat{P}_p\) into the ansatz for the density operator \(\hat{D}\) and apply the variational principle for the canonical free energy. This procedure is known as variation after projection (VAP) [38]. The method is however impractical at finite temperature because the entropy term depends on the logarithm of a particle-projected density operator. This approach has been implemented only in relatively small model spaces where direct diagonalization is feasible, see, e.g., Ref. [39].

In contrast, projection after variation, in which particle-number projection operators are applied to the self-consistent grand-canonical mean-field solution is more tractable. Here we summarize the ensemble-reduction method of Ref. [1], which starts from the particle-number projected partition function. We only include the key formulas that are implemented in the code, and refer the interested reader to the original reference for more details. We assume time-reversal symmetry; for a generalization to the case where time-reversal symmetry may be broken see Ref. [40].

In the HF approximation, the number-projected canonical partition function \(Z^{\mathrm{HF}}_{\mathrm{c}} \) is given by

$$\begin{aligned} Z^{\mathrm{HF}}_{\mathrm{c}}&= e^{-\beta U_{\mathrm{HF}}^0} {{\,\mathrm{Tr}\,}}\left( \prod _{q = p,n} \hat{P}_q e^{-\beta \hat{h}_q + \alpha _q \hat{N}_q} \right) \,. \end{aligned}$$
(48)

The particle-number projection can be carried out explicitly using a discrete Fourier transform, leading to

$$\begin{aligned} Z^{\mathrm{HF}}_{\mathrm{c}}&= e^{-\beta U_{\mathrm{HF}}^0} \prod _{q =p,n} C_q \left( \sum _{\ell =1}^{M_q} e^{-i\phi _{q,\ell } N_q} \zeta ^\mathrm{HF}_{q,\ell } \right) \, , \end{aligned}$$
(49a)
$$\begin{aligned} C_q&= \frac{e^{-\alpha _q N_q}}{M_q}\, , \end{aligned}$$
(49b)
$$\begin{aligned} \zeta _{q,\ell }^{\mathrm{HF}}&= \prod _{k=1}^{M_q} \Big ( 1 + e^{-\beta \epsilon _{q,k} + \alpha _q + i \phi _{q,\ell }}\Big ) \, , \end{aligned}$$
(49c)

where the quadrature gauge angles are \(\phi _{q,\ell } = \frac{2 \pi \ell }{M_q}\).

In the HFB approximation, we assume time-reversal symmetry for which the Bogoliubov transformation has the form of Eq. (32). We also define the auxiliary matrices \({\mathcal {N}}_q\) and \({\mathcal {E}}_q\)

$$\begin{aligned} {\mathcal {N}}_q = \begin{pmatrix} 1 &{}\quad 0 \\ 0 &{}\quad -1 \end{pmatrix} \, ,&{\mathcal {E}}_q = \begin{pmatrix} E^{\mathrm{qp}}_q &{}\quad 0 \\ 0 &{}\quad -E^{\mathrm{qp}}_q \end{pmatrix} \, , \end{aligned}$$
(50)

where \(E^{\mathrm{qp}}_q = E^{\mathrm{qp}}_1, \ldots E^{\mathrm{qp}}_{M_q/2}\) are the quasiparticle energies of every pair. Note that both these matrices are of dimension \(M_q \times M_q\). The canonical partition function is then given by

$$\begin{aligned}&Z^{\mathrm{HFB}}_{\mathrm{c}} = e^{-\beta U_{\mathrm{HFB}}^0 } \prod _{q=p,n} C_q \left( \sum _{\ell =1}^{M_q} e^{-i \phi _{q,\ell } N_q} \zeta ^\mathrm{HFB}_{q,\ell } \right) \, , \end{aligned}$$
(51a)
$$\begin{aligned}&C_q = e^{- \frac{\beta }{2}{{\,\mathrm{tr}\,}}\left( h_q - \mu _q \right) } \frac{e^{-\alpha _q N_q}}{M_q} \, , \end{aligned}$$
(51b)
$$\begin{aligned}&\zeta ^{\mathrm{HFB}}_{q,\ell } = (-1)^{\ell } \text {det} \Big (1 + {\mathcal {W}}^{\dagger }_{T,q} e^{i \phi _{q,\ell } {\mathcal {N}}_q} {\mathcal {W}}_{T,q} e^{-\beta {\mathcal {E}}_q}\Big ) \, , \end{aligned}$$
(51c)

where \({\mathcal {W}}_{T,q}\) is the reduced Bogoliubov transformation matrix of Eq. (32).

In the HF+BCS approximation, this expression can be rewritten using the \(u_q, v_q\) parameters of the BCS transformation in the HF basis

$$\begin{aligned}&Z^{\mathrm{BCS}}_{\mathrm{c}} =e^{-\beta U_{\mathrm{BCS}}^0} \prod _{q=p,n} C_q \left( \sum _{\ell =1}^{M_q} e^{-i \phi _{q,\ell } N_q} \zeta ^\mathrm{BCS}_{q,\ell } \right) \, , \end{aligned}$$
(52a)
$$\begin{aligned}&C_q = e^{- \frac{\beta }{2}{{\,\mathrm{tr}\,}}\left( h_q - \mu _q \right) }\frac{e^{-\alpha _q N_q}}{M_q} \, , \end{aligned}$$
(52b)
$$\begin{aligned}&\zeta ^{\mathrm{BCS}}_{q,\ell } = (-1)^{\ell } \prod _{k=1}^{M_q/2} \Big [ e^{+\beta E^{\mathrm{qp}}_{q,k}} \big (|u_{q,k}|^2 + e^{2 i \phi _{q,\ell }} |v_{q,k}|^2\big ) \nonumber \\&+ e^{- \beta E^{\mathrm{qp}}_{q,k}} \big (|v_{q,k}|^2 + e^{2 i\phi _{q,\ell }}|u_{q,k}|^2\big ) + 2 e^{ i \phi _{q,\ell }} \Big ] \, , \end{aligned}$$
(52c)

where now the product in Eq. (52c) ranges over only half the single-particle states.

Individual terms in Eqs. (49a), (51a) and (52a) can be very small or very large at low temperatures. For this reason, the code calculates the logarithm of the relevant canonical partition function. In particular, we use the QDR-decomposition technique discussed in Appendix B of Ref. [1] to calculate the determinant in Eq. (51c) in a numerically stable way.

The state density is related to the canonical partition function \(Z_c\) through an inverse Laplace transform, which we evaluate using the saddle-point approximationFootnote 1 [41, 42]

$$\begin{aligned} \rho (E, N_p, N_n)&= \frac{1}{2 \pi i} \int _{-i \infty }^{+i \infty } d \beta ' e^{\beta ' E} Z_{\mathrm{c}} \nonumber \\&\approx \left( 2 \pi \left| \frac{\partial E}{\partial \beta }\right| \right) ^{-1/2} e^{\mathrm{S_{\mathrm{c}}}(\beta )} \, . \end{aligned}$$
(53)

In Eq. (53), the saddle-point condition determines the inverse temperature \(\beta \) as a function of the canonical energy \(E_c\) as

$$\begin{aligned} E = -\frac{\partial \ln Z_{\mathrm{c}}}{\partial \beta } \equiv E_\mathrm{c}(\beta ). \end{aligned}$$
(54)

The canonical entropy \(S_{\mathrm{c}}\) can then be obtained from the canonical partition function and energy

$$\begin{aligned} S_{\mathrm{c}} = \ln Z_{\mathrm{c}} + \beta E_{\mathrm{c}} \, . \end{aligned}$$
(55)

We emphasize that Eq. (53) is an expression for the nuclear state density, which counts all many-body states, including the \((2 J + 1)\)-fold degeneracy of a level with spin J. In contrast, the nuclear level density counts each degenerate level with spin J only once. In the spin-cutoff model [43], these densities are related by

$$\begin{aligned} \rho _{\mathrm{level}}(E)&= \frac{1}{\sqrt{2 \pi \sigma ^2}} \rho _\mathrm{state}(E) \, , \end{aligned}$$
(56)

where \(\sigma \) is the spin-cutoff parameter.

The most efficient way to calculate the state density in practice is to (i) perform mean-field calculations at many different inverse temperatures \(\beta \) and (ii) use a finite-difference formula to evaluate the canonical energy and entropy. The code performs the relevant Fourier sum, either Eq. (51a), Eq. (49a) or Eq. (52a), after the iterative process is completed. Calculations for several temperatures can be carried out in a single execution of the code, and the output is given in tabulated form. To obtain the state or level density using Eqs. (55), (54) and (53) we include an auxiliary script level_densities.py which processes this tabulated output as discussed in Sect. 7.6.

5 Observables

Other than the total energy, entropy and particle numbers, the code outputs information on several other observables as discussed below.

Decomposition of the energy We decompose the total energy into three parts

$$\begin{aligned} E_{\mathrm{tot}} = E_{\mathrm{sp}} + E_{\mathrm{2b}} + E_{\mathrm{pair}} \, , \end{aligned}$$
(57)

where we define the single-particle, two-body and pairing energies by

$$\begin{aligned} E_{\mathrm{sp}}&= {{\,\mathrm{tr}\,}}\Big ( \epsilon ^{\mathrm{SM}}_p \rho _p \Big ) + {{\,\mathrm{tr}\,}}\Big ( \epsilon ^{\mathrm{SM}}_n \rho _n \Big ) \, , \end{aligned}$$
(58a)
$$\begin{aligned} E_{\mathrm{2b}}&= \frac{1}{2} {{\,\mathrm{tr}\,}}\Big ( \varGamma _p \rho _p \Big ) + \frac{1}{2} {{\,\mathrm{tr}\,}}\Big ( \varGamma _n \rho _n \Big ) \, , \end{aligned}$$
(58b)
$$\begin{aligned} E_{\mathrm{pair}}&= \frac{1}{2} {{\,\mathrm{tr}\,}}\Big ( \varDelta _p \kappa ^{\dagger }_p \Big ) +\frac{1}{2} {{\,\mathrm{tr}\,}}\Big ( \varDelta _n \kappa ^{\dagger }_n \Big ) \, . \end{aligned}$$
(58c)

Quadrupole moments

The code utilizes several different parameterizations of quadrupole deformation to characterize the nuclear shape following Ref. [17]. The intrinsic quadrupole deformation operators \(\hat{Q}_{2m}\) (\(m=-2,\ldots ,2\)) are defined as

$$\begin{aligned} \hat{Q}_{2m}=\sqrt{\frac{16\pi }{5}} \sum _i {r_i}^2 {Y}_{2m}(\theta _i,\varphi _i) \end{aligned}$$
(59)

where the sum is over both protons and neutrons and is a spherical harmonic. Because of the self-consistent symmetries assumed in the code, only \(\langle \hat{Q}_{20} \rangle _T\) and \(\text {Re}\langle \hat{Q}_{22} \rangle _T = \text {Re}\langle \hat{Q}_{2-2} \rangle _T \) do not vanish. In order to calculate the single-particle matrix elements of these operators, the code requires an input file which contains the (reduced) matrix elements of \(r^2\) for the model space, see Sec. 7.3. If such file is not provided, the code will calculate the matrix elements for harmonic oscillator basis functions; see, e.g., Ch. 6 in Ref. [44].

For triaxial shapes, it is perhaps more intuitive to use the \(q,\gamma \) variables defined as

$$\begin{aligned} q&= \sqrt{\langle \hat{Q}_{20}\rangle _T^2 + 2 \langle \hat{Q}_{22} \rangle _T^2} \, , \end{aligned}$$
(60a)
$$\begin{aligned} \gamma&= \text {atan2} \left( \sqrt{2} \, \langle \hat{Q}_{22} \rangle _T , \langle \hat{Q}_{20} \rangle _T \right) \, . \end{aligned}$$
(60b)

Another set of variables, \(q_1\) and \(q_2\), is useful to parametrize in an unambiguous way individual sextants of the full \((q, \gamma )\) plane. They are given by

$$\begin{aligned} q_{1}&= q\cos \gamma - \frac{1}{\sqrt{3}}q\sin \gamma \, , \end{aligned}$$
(61a)
$$\begin{aligned} q_{2}&= \frac{2}{\sqrt{3}}q\sin \gamma \, . \end{aligned}$$
(61b)

The code also outputs the variance of the total quadrupole moment

$$\begin{aligned} \text {var} (Q^2) = \sum _{m=-2}^{2} \langle \hat{Q}^*_{2 m} \hat{Q}_{2 m}\rangle _T - \langle \hat{Q}^*_{2 m}\rangle _T \langle \hat{Q}_{2 m}\rangle _T\, . \end{aligned}$$
(62)

Average pairing gaps

Unlike the case of a simple seniority interaction, there is no unique definition of a pairing gap for a general two-body interaction. The pairing gap matrices \(\varDelta _q\) (which simplify in the BCS approximation) are orbital dependent. In order to extract meaningful information about the strength of pairing correlations, we define average pairing gaps. Assuming all matrices to be real and time-reversal to be conserved, we define

$$\begin{aligned} \langle v^2 \varDelta \rangle _q&= \frac{\sum _{ij=1}^{M_q} \rho _{q,ij} \varDelta _{q,j{\bar{i}}}}{{{\,\mathrm{tr}\,}}\rho _q} \, , \end{aligned}$$
(63a)
$$\begin{aligned} \langle u v \varDelta \rangle _q&= \frac{\sum _{ij=1}^{M_q} \kappa _{q,ij} \varDelta _{q,ji}}{ \sum _{ij=1}^{M_q} |\kappa _{q,ij}|} \, . \end{aligned}$$
(63b)

In the BCS case, these expressions reduce to the definitions of Ref. [45]Footnote 2

$$\begin{aligned} \langle v^2 \varDelta \rangle _q&= \frac{\sum _{k=1}^{M_q} v^2_k \varDelta _{k}}{ \sum _{k=1}^{M_q} v^2_k} \, , \end{aligned}$$
(64a)
$$\begin{aligned} \langle u v \varDelta \rangle _q&= \frac{\sum _{k=1}^{M_q} u_k v_k \varDelta _{k}}{ \sum _{k=1}^{M_q} u_k v_k} \, . \end{aligned}$$
(64b)

The average pairing gaps as defined by Eqs. (63a) and (64b) are not equivalent to the average gaps defined by Eqs. (63b) and (64b). However, in the shell-model single-particle spaces we use they typically differ by 5% or less.

Belyaev moment of inertia

The code calculates and outputs the Belyaev moments of inertia \({\mathcal {I}}_{\mu \mu }\) around the three main axes \(\mu = x,y,z\) [46]. We denote by \(J_{\mu , q, kl}\), the matrix elements of \(\hat{J}_{\mu }\) for nucleon species q in the HF basis, and assume time-reversal symmetry. In the HF approximation, the moments of inertia are given byFootnote 3

$$\begin{aligned} {\mathcal {I}}^{\mathrm{HF}}_{q,\mu \mu }&= \sum _{k,l=1}^{M_q/2} \left( 2 |J_{\mu , q, kl}|^2 + 2 |J_{\mu , q, {\bar{k}}l}|^2 \right) \frac{f_{q,l} - f_{q,k}}{\epsilon _{q,k} - \epsilon _{q,l}} \, . \end{aligned}$$
(65)

For terms in Eq. (65) involving degenerate single-particle states, we take the appropriate limit

$$\begin{aligned} \lim _{\epsilon _{q,k} \rightarrow \epsilon _{q,l}} \frac{f_{q,l} - f_{q,k}}{\epsilon _{q,k} - \epsilon _{q,l}}&= \beta e^{\beta \epsilon _{q,k}} f_{q,k}^2 \, . \end{aligned}$$
(66)

In the BCS approximation, assuming \(u_{q}, v_{q}\) to be real, we have [48]

$$\begin{aligned} {\mathcal {I}}^{\mathrm{BCS}}_{q,\mu \mu }&= \sum _{k,l=1}^{M_q/2} \left( 2 |J_{\mu , q, kl}|^2 + 2 |J_{\mu , q, {\bar{k}}l}|^2 \right) W^\mathrm{BCS}_{q,kl} \, , \end{aligned}$$
(67a)
$$\begin{aligned} W^{\mathrm{BCS}}_{q,kl}&= (u_{q,k} u_{q,l} + v_{q,k} v_{q,l})^2 \, \frac{f_{q,l} - f_{q,k}}{E^{\mathrm{qp}}_{q,k} - E^{\mathrm{qp}}_{q,l}} \nonumber \\&+(u_k v_l - v_k u_l)^2 \, \frac{1 - f_{q,k} - f_{q,l}}{E^\mathrm{qp}_{q,k} + E^{\mathrm{qp}}_{q,l}}\, . \end{aligned}$$
(67b)

In the HFB approximation, we have in the quasi-particle basis

$$\begin{aligned} {\mathcal {I}}^{\mathrm{HFB}}_{q,\mu \mu } = {2} \sum _{k,l=1}^{M_q} \Bigg [&\left( |J^{20}_{\mu ,q, kl}|^2 + |J^{20}_{\mu , q, k{\bar{l}}}|^2 \right) \frac{1 - f_{q,k} - f_{q,l}}{E^{\mathrm{qp}}_{q,k} + E^{ \mathrm qp}_{q,l}} \nonumber \\&\quad + \left( |J^{11}_{\mu , q, kl}|^2 + |J^{11}_{\mu , q, k{\bar{l}}}|^2 \right) \frac{f_{q,l} - f_{q,k}}{E^{\mathrm{qp}}_{q,k} - E^\mathrm{qp}_{q,l}} \Bigg ] \, , \end{aligned}$$
(68)

where the indices range over half of the quasi-particle space, and the matrices \(J^{20}_{\mu ,q}\) and \(J^{11}_{\mu ,q}\) are given by [5]

$$\begin{aligned} J^{20}_{\mu ,q}&= U^{\dagger }_q J_{\mu ,q} V^{*}_q - V^{\dagger }_q J^{T}_{\mu ,q} U^{*}_q \, , \end{aligned}$$
(69a)
$$\begin{aligned} J^{11}_{\mu ,q}&= U^{\dagger }_q J_{\mu ,q} U_q - V^{\dagger }_q J^{T}_{\mu ,q} V_q \, . \end{aligned}$$
(69b)

For degenerate quasi-particle energies in the BCS and HFB approximations, we can apply formulas analogous to Eq. (66).

6 Methods of solution

In order to solve the self-consistent mean-field equations, HF-SHELL uses methods similar to those discussed in Refs. [2] and [17]. We will summarize these methods and present the relevant equations. A schematic diagram of the code is shown in Fig. 5.

6.1 Heavy-ball algorithm

The heavy-ball algorithm was recently proposed [2] to iteratively diagonalize the single-particle Hamiltonian \(\hat{h}\). We assume a set of orthonormal single-particle wavefunctions \(|\psi ^{(i)}_{q,k} \rangle \) (\(q=p,n\) and \(k=1, \ldots , M_q\)), given at iteration i. For the next iteration \(i+1\), we define

$$\begin{aligned} | \phi ^{(i+1)}_{q,k} \rangle = | \psi ^{(i)}_{q,k} \rangle - \alpha \left( \hat{h}_q^{(i)} - \epsilon _{q,k}^{(i)}\right) | \psi ^{(i)}_{q,k} \rangle + \mu |\delta \psi ^{(i)}_{q,k} \rangle \end{aligned}$$
(70)

where \({\hat{h}}^{(i)}_q\) is the single-particle Hamiltonian for species q calculated from the one-body density matrix at iteration i, and the quantities \(\epsilon ^{(i)}_{q,k}\) and \(|\delta \psi ^{(i)}_{q,k} \rangle \) are given by

$$\begin{aligned}&\epsilon _{q,k}^{(i)} = \langle \psi ^{(i)}_{q,k} | \hat{h}^{(i)}_q |\psi ^{(i)}_{q,k} \rangle \, , \end{aligned}$$
(71a)
$$\begin{aligned}&|\delta \psi ^{(i)}_{q,k} \rangle = | \psi ^{(i)}_{q,k} \rangle - | \psi ^{(i-1)}_{q,k} \rangle \, . \end{aligned}$$
(71b)

The parameters \(\alpha \) and \(\mu \)Footnote 4 in Eq. (70) are called the stepsize and momentum, respectively. When \(\mu = 0\), this algorithm reduces to the gradient descent methodFootnote 5 of Ref. [34]. For \(\mu \not = 0\), the algorithm can achieve convergence faster than the gradient descent method, at the moderate cost of storing the \(|\delta \psi {^{(i)}}_{q,k}\rangle \) and virtually no extra CPU cost. Finally, the wavefunctions \(|\phi _k^{(i+1)} \rangle \) are not orthonormal, and we employ a Gram-Schmidt procedure to construct an orthonormal basis \(|\psi ^{(i+1)}_{q,k} \rangle \), from which we can start a new iteration.

The convergence of the algorithm is sensitive to the values of \(\alpha \) and \(\mu \) [2]. Their values can be input by the user, but we recommend not doing so in most cases. In the absence of such input, the code uses the following values:

$$\begin{aligned} \alpha&= 0.9 \frac{4}{\left( \sqrt{\delta \epsilon } + \sqrt{0.1}\right) ^2} \, ,&\, \end{aligned}$$
(72a)
$$\begin{aligned} \mu&= \left( \frac{\sqrt{\delta \epsilon /0.1} - 1}{\sqrt{\delta \epsilon /0.1} + 1}\right) ^2 , \end{aligned}$$
(72b)

where \(\delta \epsilon \) (measured in MeV) is the difference between the largest and smallest estimates \(\epsilon ^{(i)}_{q,k}\) of eigenvalues of the current single-particle Hamiltonian. The speed-up of the heavy-ball algorithm with respect to ordinary gradient descent is modest. Speed-ups are often smaller than a factor of two, but can be up to a factor of four for heavier nuclei such as the lanthanides discussed below in Sect. 6. The reason why this performance gain is not a large as those reported in Ref. [2] is the difference in the span of the single-particle spectra. Shell model Hamiltonians do not typically have single-particle spectra for which \(\delta \epsilon \) is larger than a few MeV.

In special circumstances Eqs. (72b) might not work well. One such case occurs when calculating quadrupole constrained surfaces for light nuclei at low temperatures in the absence of pairing correlations (or in the HF approximation). The Lagrange parameters for the quadrupole constraints can then take very large values and the single-particle spectrum is effectively dominated by them. We advise the user in such cases to input by hand values for \(\alpha \) and \(\mu \).

6.2 Two-basis method for the HFB problem

In the HF approximation, the heavy-ball algorithm is the main component of the self-consistency cycle. For the HF+BCS approximation, this algorithm needs to be supplemented by the calculation of the \(u_q,v_q\) pairs in Eqs. (35a) and (35b), but this does not add significant complexity. For the HFB approximation, however, it is not immediately obvious how to employ the heavy-ball algorithm to diagonalize the HFB Hamiltonian.

Dedicated gradient-based algorithms for the HFB approximation exist [27, 35], but we employ a simpler approach: the two-basis method. This approach consists of rewriting Eq. (27) as

$$\begin{aligned} \tilde{{\mathcal {H}}}_q \begin{pmatrix} {\tilde{U}}_{q,k} \\ {\tilde{V}}_{q,k} \\ \end{pmatrix}&= \begin{pmatrix} \epsilon _{q} - \mu _q &{} {\tilde{\varDelta }}_{q} \\ - {\tilde{\varDelta }}^{*}_{q} &{} - \epsilon _{q} + \mu _q \\ \end{pmatrix} \begin{pmatrix} {\tilde{U}}_{q,k} \\ {\tilde{V}}_{q,k} \\ \end{pmatrix} \, , \end{aligned}$$
(73)

where the tildes indicate matrices calculated in the HF basis, in which the matrices \(\epsilon _{q}-\mu _q\) are diagonal. The vectors \(({\tilde{U}}_{q,k}, {\tilde{V}}_{q,k})^T\) are then obtained at every iteration by diagonalizing the HFB Hamiltonian \(\tilde{{\mathcal {H}}_q}\).

The two-basis method was originally proposed in Ref. [3] to simplify HFB calculations in large model spaces. In HF-SHELL, we explicitly store the entire HF basis, rendering the method exact. Our reason to adopt this method is to make the treatment of the HFB approximation as similar as possible to the simpler HF and HF+BCS approximations, thus making the code more transparent.

6.3 Quadrupole constraints

It is often of interest to investigate the properties of a self-consistent mean-field solution as a function of various collective variables such as the nuclear quadrupole moment. HF-SHELL allows the user to constrain this quantity in the optimization process. We use the method of Lagrange multipliers, in which the grand potential potential \(\varOmega \) is replaced by

$$\begin{aligned} \varOmega \rightarrow \varOmega - \lambda _{20} \langle \hat{Q}_{20} \rangle _T - \lambda _{22} \langle \hat{Q}_{22} \rangle _T \, . \end{aligned}$$
(74)

Here \(\lambda _{20}\) and \(\lambda _{22}\) are Lagrange multipliers conjugate to the quadrupole moments \(\hat{Q}_{20}\) and \(\hat{Q}_{22}\). This effectively introduces an external potential field in the single-particle Hamiltonian

$$\begin{aligned} \hat{h}_q \rightarrow \hat{h}_q - \lambda _{20} \hat{Q}_{20,q} - \lambda _{22} \hat{Q}_{22,q} \, , \end{aligned}$$
(75)

but otherwise does not affect the equations in Sect. 2.

The code allows for two different types of quadrupole constraints. The first is the linear constraint type, in which the Lagrange multipliers are kept fixed throughout the iterations to predefined values. It is not very practical for generating free energy surfaces since a regular discretization of the Lagrange parameters will not result in a regular discretization of the quadrupole deformations of the mean-field solutions [49]. The second method is the Augmented Lagrangian approach, which allows the user to specify the desired quadrupole deformations \(Q_{20}^{\mathrm{target}}\) and \(Q_{22}^{\mathrm{target}}\). The method is based on an iterative method that adjust the Lagrange parameters. At iteration \(i+1\), we obtain new Lagrange parameters based on the current quadrupole deformation [49]

$$\begin{aligned} \lambda _{2 m}^{(i+1)}&= \lambda _{2 m}^{(i)} + 2 C_{m} \left( \langle \hat{Q}_{2 m} \rangle _T^{(i)} - Q_{2 m}^{\mathrm{target}} \right) \, , \end{aligned}$$
(76)

where \(C_{m}\) are parameters, and we initialize \(\lambda _{2 m}^{(0)} = 0\). If the parameters \(C_{m}\) are left unspecified by the user (which we recommend), HF-SHELL uses reasonable estimates that work in essentially every situation we have encountered. In addition to the update of Eq. (76), the code employs a corrective gradient scheme to force the heavy-ball update to favor the constraints. The details of this algorithm will be presented elsewhere [50].

A similar method could be easily implemented to constrain the expectation value of any one-body operator, provided it respects the self-consistent symmetries assumed by the code.

6.4 Convergence

For convergence, we require the following two conditions to hold when proceeding from iteration \(i-1\) to i

$$\begin{aligned}&\left| \frac{ E_{\mathrm{tot}}^{(i)} - E_{\mathrm{tot}}^{(i-1)}}{E_\mathrm{tot}^{(i)}} \right| \le \texttt {e\_prec} \, , \end{aligned}$$
(77a)
$$\begin{aligned}&\sum _{m = 0,2}\left| \langle {\hat{Q}}_{2m} \rangle ^{(i)}_T - \langle {\hat{Q}}_{2m} \rangle _T^{(i-1)} \right| \le \texttt {q\_prec} \, , \end{aligned}$$
(77b)

where e_prec and q_prec are input parameters that determine the precision of the solution.

6.5 Density mixing

In cases where convergence of the self-consistency cycle is problematic, the code offers the possibility to slow down the update of the density and anomalous density matrix by using a simple linear mixing procedure. Instead of using directly the calculated \(\rho _q\) and \(\kappa _q\) at any given iteration, the code constructs a mixed density and anomalous density at iteration i

$$\begin{aligned} \rho ^{(i)}_q = \alpha _{\mathrm{mix}} \rho ^{(i)}_q[\psi ] + (1- \alpha _{\mathrm{mix}})\rho ^{(i-1)}_q \, , \end{aligned}$$
(78a)
$$\begin{aligned} \kappa ^{(i)}_q = \alpha _{\mathrm{mix}} \kappa ^{(i)}_q[\psi ] + (1- \alpha _{\mathrm{mix}})\kappa ^{(i-1)}_q \, , \end{aligned}$$
(78b)

where \(\alpha ^{\mathrm{mix}}\) is a numerical parameter between 0 and 1. Here we denote by \(\rho ^{(i)}[\psi ], \kappa ^{(i)}[\psi ]\) the density and anomalous density constructed directly from the single-particle wavefunctions and the Bogoliubov or HF transformation currently in storage. Due to the limited size of both the model space and the heavy-ball steps, we found that density mixing is needed only in exceptional cases.

7 Examples

7.1 \(^{24}\)Mg in the sd shell

As a first example, we study a light nucleus using the well-known USDB effective interaction [51] for sd-shell nuclei. As reported in Ref. [8], almost all of the even–even sd-shell nuclei exhibit axially deformed mean-field minima. \(^{24}\)Mg is an exception, with a mean-field deformation characterized by \(\gamma = 12^{\circ }\). In Fig. 1 we show the free energy \(F = E - TS\) as a function of the quadrupole deformation Q (measured in units of \(b^2\) with b being the oscillator’s radius) and the angle \(\gamma \) for four different values of the temperature. We observe two shape transitions: at low temperatures the minimum is triaxial with \(\gamma = 12^{\circ }\), but around \(T \sim 1.25\) MeV there is a shape transition to an axial prolate configuration. At even higher temperatures, the prolate deformation gets washed out by thermal fluctuations and the free energy surface becomes flatter with a spherical mean-field minimum. We note that the HF, HF+BCS, and HFB surfaces for this nucleus are all similar since pairing correlations are weak and vanish for almost all configurations at all temperatures.

Fig. 1
figure 1

Free energy surfaces of \(^{24}\)Mg with the USDB interaction as a function of Q (in units of the square of the oscillator length b) and \(\gamma \) for four different values of the temperature (in units of MeV). The free energy is measured with respect to its global minimum (indicated by a black diamond) at the given temperature

7.2 Lanthanide nuclei: \(^{144}\)Nd and \(^{162}\)Dy

As an example of a larger model space, we study pairing and shape transitions in two lanthanide nuclei, \(^{144}\)Nd and \(^{162}\)Dy, which are to date among the heaviest studied with the shell model Monte Carlo (SMMC) method [26, 52]. Particle-number projected mean-field state densities in this mass region were benchmarked against SMMC level densities in Ref. [9].

For these lanthanide nuclei, the single-particle model space consists of 40 proton orbitals (\(0g_{7/2}\), \(1d_{5/2}\), \(1d_{3/2}\), \(2s_{1/2}\), \(0h_{11/2}\), and \(1f_{7/2}\)) and 66 neutron orbitals (\(0h_{11/2}\), \(0h_{9/2}\), \(1f_{7/2}\), \(1f_{5/2}\), \(2p_{3/2}\), \(2p_{1/2}\), \(0i_{13/2}\), and \(1g_{9/2}\)). These orbitals form the valence space for protons and neutrons outside an inert \(^{120}\)Sn core. The single-particle energies and quadrupole matrix elements are obtained from a Wood–Saxon potential with spin-orbit interaction using the parameters of Ref. [53]. We use the effective interactions of Refs. [26, 52].

\(^{144}\)Nd is an example of a spherical nucleus with a strong pairing condensate. Fig. 2 shows the average pairing gap \(\langle uv\varDelta \rangle _q\) of Eq. (63b) as a function of the inverse temperature \(\beta \) for neutrons (blue circles) and protons (red squares). Pairing correlations vanish above a critical temperature of about 0.50 MeV for protons and 0.31 MeV for neutrons.

Fig. 2
figure 2

Average pairing gap \(\langle u v \varDelta \rangle _q\) of \(^{144}\)Nd as a function of the inverse temperature \(\beta \) for protons (red squares) and neutrons (blue circles)

\(^{162}\)Dy is a well-deformed nucleus with relatively weak pairing correlations. In Table 1 we list various physical quantities calculated at the zero-temperature mean-field minimum. While the difference in total binding energy between HF and HFB solutions is less than 150 keV and the difference in total quadrupole moment is very small, pairing correlations contribute in HFB more than 1.5 MeV of binding energy (all due to the neutrons). Pairing correlations also have a significant effect on the Belyaev moment of inertia, whose HFB value is about 60% of its HF value.

Table 1 Comparison of zero-temperature quantities (energies, quadrupole moment \(\langle Q_{20}\rangle \) and Belyaev moment of inertia \({\mathcal {I}}_{xx}\) around an axis perpendicular to the symmetry axis) in \(^{162}\)Dy for the HF and HFB solutions. All energies are in units of MeV, \({\mathcal {I}}_{xx}\) is in units of \(\hbar ^{2}\)MeV\(^{-1}\) and the quadrupole moment is in units of fm\(^2\)

In Fig. 3, we show the quadrupole moment \(\langle Q_{20}\rangle {_T}\) of \(^{162}\)Dy as a function of the inverse temperature \(\beta \), in the vicinity of the shape transition temperature of \(T = 1.2\) MeV. In this regime the HF, BCS and HFB results are identical, as the temperatures shown are above the critical temperature of the pairing transition. In Fig. 3 we have used the same scales as in Fig. 1 of Ref. [25] to demonstrate the agreement between both codes.

Fig. 3
figure 3

The quadrupole moment \(\langle \hat{Q}_{20}\rangle _T\) of \(^{162}\)Dy as a function of inverse temperature \(\beta \) in the vicinity of the shape transition

7.3 Nuclear state density of \(^{162}\)Dy

Here we demonstrate the mean-field calculation of state densities. In the top panel of Fig. 4 we compare the HFB state density of \(^{162}\)Dy obtained with HF-SHELL (black line) with the SMMC state density (blue circles) [9]. In the bottom panel we show the ratio of the SMMC density to the HF-SHELL density. Similar results for this nucleus were discussed in Refs. [1, 9], in which the HF mean-field approximation was used.

Fig. 4
figure 4

Top panel: the state density \(\rho \) of \(^{162}\)Dy as a function of excitation energy \(E_x\), as calculated from HF-SHELL (solid black lines) and SMMC (blue circles). Bottom panel: the ratio of the SMMC state density to the HFB state density. The light gray line describes a ratio of 1. Discontinuities associated with the neutron pairing phase transition and the shape phase transition are visible in both panels, and are shown in the top panel by dashed lines. The SMMC results were taken from [9]

The deficiencies of the mean-field approach as discussed in these references are visible in both panels of Fig. 4: (i) the mean-field results exhibit two discontinuities associated with the neutron pairing phase transition around an excitation energy of 0.7 MeV and the shape phase transition around 25 MeV (shown by dashed lines). These transitions are absent in the exact results; (ii) the mean-field results underestimate significantly the SMMC state density below the pairing phase transition, which can be traced to an unphysical negative entropy (not shown) and is an artifact of performing projection after variation calculations [1]; and (iii) the mean-field density underestimates the exact SMMC density by roughly a constant factor of 12 between \(\sim 2\) MeV and the shape transition excitation energy. This can be explained by the effects of rotational collectivity: the exact state density includes all rotational bands, while the mean-field results count only the deformed intrinsic band-heads [9]. The feature that the rotational enhancement is constant across a wide range of excitation energies is in line with more phenomenological models [14], and was also observed in other rare-earth nuclei [26]. This rotational enhancement eventually disappears above the shape transition energy when the mean-field solutions conserve rotational symmetry.

8 Using the code

8.1 Compilation and execution

The code is written in Fortran 2003. Most of the code is backward compatible with Fortran 95 compilers, but we have employed procedure pointers in several places, which were introduced in the 2003 standard. To the best of our knowledge, all modern compilers implement this feature.

We provide a Makefile with the source code. To compile the code execute the command

figure a

in the source code directory. The flag CXX determines the compiler used, and defaults to gfortran when left unspecified. The code relies on the availability of a LAPACK distribution, which should be linked properly.

User input is read from STDIN. To run the code, execute

figure b

where input.data contains all run options for the code. It consists of two Fortran namelists, /modelspace/ and /config/. We will describe the contents of these namelists in more detail in Sect. 7.3. The second of these namelists can be repeated by the user any number of times by setting the logical variable moreconfigs=.true.. A schematic diagram of the logic and structure of the code is shown in Fig. 5.

The user should also provide a file describing the single-particle CI shell model space, as well as a file with the single-particle energies and the TBMEs of the effective interaction. Finally, the user has the option of providing a file that contains the reduced matrix elements of the quadrupole operator.

Fig. 5
figure 5

A schematic diagram demonstrating the general logic and structure of the code

8.2 Input of CI shell-model space and Hamiltonian

The code requires the user to provide two files, one that defines the single-particle orbitals and a second that provides the single-particle energies and TBMEs. The format follows the conventions of the proton-neutron formalism of the SMMC [52] and BigStick [54, 55] codes. This convention also matches that of the mean-field code of Ref. [25]. For more information on the formatting of these files, see the examples which are included with the code distribution.

Many shell-model interactions in the literature employ a scaling with mass number. If requested by the user, the code scales the TBMEs as follows

$$\begin{aligned} {\bar{v}}_{ijkl}^{qq} \rightarrow \left( \frac{A_{\mathrm{ref}}}{A} \right) ^x {\bar{v}}_{ijkl}^{qq} \, , \end{aligned}$$
(79)

where A is the mass number, \(A_{\mathrm{ref}}\) is a reference mass and x is a real number. Both \(A_{\mathrm{ref}}\) and x are parameters of the interaction. A similar scaling is applied to the pn matrix elements.

8.3 Run options

A valid input file for the code consists of a namelist /modelspace/ and one or more instances of the namelist /config/. The first determines the single-particle model space and effective interaction, as well as some other general aspects of the calculation. The /config/ namelist, contains more specific options that the user might vary in a systematic fashion, such as the inverse temperature \(\beta \) or the value of the quadrupole constraints. For this reason, this namelist can be repeated as often as needed so the code can explore varied parameters in a single run.

7.3.1 Options of the /modelspace/ namelist

Parameter

Type

Default value

Model space and interaction

spsfile

Character

‘pn.sps’

interfile

Character

‘test.int’

qfile

Character

‘r2.red’

outfile

Character

‘run.out’

TBME_A

Integer

\( -1\)

TBME_Aref

Integer

\( -1\)

TBME_x

Real

\(-1.0\)

Evolution and convergence

ptype

Character

‘HF’

maxiter

Integer

200

printiter

Integer

10

e_prec

Real

\(10^{-9}\)

q_prec

Real

\(10^{-3}\)

Model space and interaction

  • spsfile: filename containing information on the single-particle model space.

  • interfile: filename containing the single-particle energies and TBMEs of the CI shell-model Hamiltonian.

  • qfile: filename containing the reduced matrix elements of the quadrupole operator. If blank, the code constructs matrix elements using harmonic oscillator wavefunctions, see, e.g., Ch. 6 in Ref. [44].

  • outfile: filename for the tabulated output.

  • TBME_A, TBME_Aref, TBME_x: parameters of the mass scaling of the TBMEs, Eq. (79). The scaling is disabled when TBME_A takes negative values.

Evolution and convergence

  • ptype: Type of mean-field approximation. The options are ‘HF’, ‘BCS’ or ‘HFB’.

  • maxiter: Maximal number of heavy-ball iterations.

  • printiter: Number of iterations between two consecutive full printouts.

  • e_prec: Convergence parameter for the total energy.

  • q_prec: Convergence parameter for the quadrupole moments in units of fm\(^2\).

7.3.2 Options of the /config/ namelist

Parameter

Type

Default value

General information

  stepsize

Real

0.0

  momentum

Real

0.0

  inversetemp

Real

32.0

  protons

Integer

6

  neutrons

Integer

4

  denmix

Real

1.0

  moreconfigs

Logical

.false.

Quadrupole constraints

  Q20target

Real

0.0

  Q22target

Real

0.0

  q1target

Real

0.0

  q2target

Real

0.0

  Q20c

Real

0.0

  Q22c

Real

0.0

  lambda20

Real

0.0

  lambda22

Real

0.0

  constrainttype

Integer

0

  constraintiter

Integer

0

General information

  • stepsize, momentum: parameters \(\alpha \) and \(\mu \) of the heavy-ball update, Eq. (70). When not read from input, the code uses the values of Eq. (72b).

  • inversetemp: Inverse temperature \(\beta \) in units of MeV\(^{-1}\). A negative value will result in a zero-temperature calculation.

  • protons/neutrons: Number of protons/neutrons.

  • denmix : mixing parameter \(\alpha _{\mathrm{mix}}\) for the density, see Eqs. (78a) and (78b).

  • more_configs: Logical variable indicating whether there will be more occurrences of the /config/ namelist after the current one.

Quadrupole constraints

  • Q20/22target: target values for quadratic quadrupole constraints, in units of fm\(^2\).

  • q1/2target: alternative way of specifying target values, using the \(q_1, q_2\) convention, in units of fm\(^2\).

  • Q20/22c: values of \(C_{m}\) in Eq. (76) for the quadrupole constraints in units of fm\(^{-4}\) MeV. When set to zero, the code will use an estimate.

  • lambda20/22: Lagrange multipliers for linear

    quadrupole constraints in units of MeV fm\(^{-2}\).

  • constrainttype: Specifies the type of quadrupole constraints: (0) no constraints, (1) linear constraints, (2) quadratic constraints.

  • constraintiter: If non-zero, the quadrupole constraints are only active for this number of iterations.

8.4 Output

HF-SHELL prints to STDOUT a large amount of information, such as the evolution of the iterative process as well as the complete HF basis and the properties of the quasi-particles in the HF+BCS or HFB approximations. The code also produces a tabulated output file that contains the final values of various observables. The filename of this output is determined by the input parameter outfile. Every row of this file corresponds to one calculation, i.e., one occurrence of the namelist /config/. This file is particularly practical for further processing of a large number of sequential calculations, e.g., for constructing an energy surface or for calculating the state density. Table 2 contains the quantities that are tabulated in this file and their respective column numbers.

Table 2 Content of the tabulated output file

8.5 Choice of initial configuration and sequential calculations

When performing HF+BCS or HFB calculations, the code initializes at the first iteration with an educated, non-zero guess for the pairing gaps. Furthermore, the code uses the shell-model single-particle states as the initial Hartree–Fock basis so the initial mean-field configuration is spherically symmetric. For a Hartree-Fock calculation (or when the pairing gap vanishes), the code constructs the initial state by filling up the orbitals with the available number of nucleons. Unless both nucleon numbers correspond to closed-shell configurations, the resulting confguration will not be spherically symmetric.

In the majority of cases, the initial mean-field configuration is spherically symmetric. Without further input by the user, this symmetry will be conserved throughout the iterations. For a nucleus with a deformed global minimum this spherical solution describes a saddle-point in the deformation surface. In order to break the spherical symmetry of the initial configuration, we recommend the use of the keyword constraintiter. By setting some initial constraints for a small number of iterations, the code evolves towards a deformed solution at the start of the calculation. When these iterations are completed, the constraint is turned off and the code is free to find the mean-field minimum, unconstrained by spherical symmetry. We recommend the user to set such initial constraints for both \(\langle \hat{Q}_{20}\rangle _T\) and \(\langle \hat{Q}_{22}\rangle _T\) (to also break axial symmetry).

When several mean-field calculations are carried out sequentially (as signaled by occurrences of the namelist /config/), the code uses the final mean-field configuration of the previous calculation as the starting point of the new calculation. This choice is particularly useful when calculating various observables as a function of temperature.

8.6 Auxiliary script: level_densities.py

For convenience, we also provide a Python script for the calculation of projected mean-field densities as described in Sect. 3. The python script level_densities.py assumes a working installation of Numpy [56]. It includes a Python function

figure c

which employs a first-order finite-difference formula to evaluate the derivative in Eq. (54). The first argument of the function is the filename of an HF-SHELL tabulated output file produced by a run with different values of the inverse temperature. It returns a tuple of Numpy arrays, indexed by the inverse temperatures found in the HF-SHELL output

figure d

where E_c is the canonical energy, S_c is the canonical entropy and rho_state is the nuclear state density. rho_level is the nuclear level density, obtained from the state density using Eq. (56) within the spin-cutoff model. The second (optional) argument s2 is \(\sigma ^2\), the square of the spin-cutoff parameter \(\sigma \) used to obtain the level density. When this argument is not specified, the spin-cutoff parameter is taken from the mean-field calculation using [48].

$$\begin{aligned} \sigma ^2&= \langle J_z^2 \rangle \, . \end{aligned}$$
(80)

9 Conclusion and outlook

We presented the code HF-SHELL, which can be used to explore a variety of mean-field approximations for CI shell-model Hamiltonians, both at zero and finite temperature. It is particularly suitable for calculating nuclear state densities in a mean-field approximation.

The code requires little memory and its execution is typically very fast, making it a useful tool to supplement calculations that use other many-body methods. Possible future applications of this code include (i) the benchmarking of more computationally intensive many-body methods; (ii) the construction of effective CI shell-model interactions through fits of certain observables to experimental data, which are often very costly to undertake with more advanced many-body methods; and (iii) the construction of reference states as a starting point for, e.g., the generator coordinate method, symmetry restoration methods, and Bogoliubov perturbation theory.