Introduction

The theory of open quantum system has been an important subfield of quantum physics during the past decades with a rich collection of well-established methods1,2,3. Since perfect isolation of quantum systems is impossible, any quantum mechanical system must be treated as an open system in practice. The theory of open quantum system thus plays a major role in various applications of quantum physics, e.g., quantum optics4,5, quantum control6, and quantum computing (QC)7. It becomes even more relevant in the context of Hamiltonian quantum computing (HQC), broadly defined as analog QC performed via continuously and smoothly driven Hamiltonians, as opposed to discrete gate-model QC, where Hamiltonians are driven discontinuously. Well-known example of HQC include adiabatic quantum computing (AQC)8,9 and quantum annealing (QA)10,11, as well as holonomic QC12,13. For example, in QA the Hamiltonian needs to move continuously from the initial driver Hamiltonian to the final problem Hamiltonian, and therefore, unlike idealized gate-model quantum computers whose description often involves effective noise channels (completely positive maps), practical quantum annealers are better described by noise models derived directly from the first principles14,15,16,17,18. As the entire field of QC is now in the noisy intermediate-scale quantum (NISQ) era19, an efficient and evolving framework of open quantum system simulation is essential for advancing our understanding of noise in quantum devices, as well for helping in the search for more effective error suppression and correction techniques20. Moreover, the distinction between analog and discrete models of QC is to some degree arbitrary, since in reality, even gate-model QC involves continuous driving due to the finite bandwidth of signal generators and controllers. We thus view the gate-model of QC as part of HQC for the purposes of this work.

At present, there is an increasing number of software tools being developed for open system simulations. An important example of open-source software in this area is “Quantum Toolbox in Python" (QuTiP)21. It is one of the first packages in the field to adopt the modern software engineering paradigm and is actively maintained on Github since its release, with new features and enhancements being continuously added. However, since QuTiP is designed to be as general as possible, it lacks several tools and the computational performance required to address the new challenges we are now facing in the field of HQC.

Inspired by this challenge, and by the success of QuTiP, we present here a complementary and alternative open system simulation framework, which we call “Hamiltonian Open Quantum System Toolkit" (HOQST). As the name suggests, the goal of HOQST is not to cover the entire field of open quantum system simulation but to focus on Hamiltonian QC, while retaining the flexibility to simulate systems subject to arbitrary time-dependent Hamiltonians. This focus gives us the ability to adopt domain-specific design choices and optimizations. The resulting implementation distinguishes itself from other available software by offering the following advantages:

  • HOQST is written in the Julia programming language22, which is designed for high-performance computing.

  • HOQST is built upon the ordinary differential equations (ODE) package DifferentialEquations.jl23; thus HOQST also benefits from progress in the field of ODE solvers.

  • Focusing solely on Hamiltonian QC, HOQST features several recently published master equations.

  • HOQST includes tools that work beyond the weak coupling limit.

  • HOQST provides a native interface for HPC clusters.

HOQST is developed following the Julia design philosophy: we intend it to be as user-friendly as possible without compromising performance. Although there is room for optimization, the first release of HOQST features reliable and efficient implementations of several key master equations (MEs) adopted in the HQC field, together with a highly modularized framework suitable for future development. Since the HOQST project started as an attempt to build a tool to simulate quantum annealing, it displays a certain bias towards QA. However, we reemphasize that it is broadly applicable to open quantum systems evolving subject to any time-dependent Hamiltonian. Besides the HOQST package itself, we provide error bounds on the MEs included. We also present examples to illustrate the typical workflows of HOQST. In particular, we focus on a three-qubit entanglement witness experiment performed using a quantum annealer24. Previous studies of open system models were unable to reproduce some of the key experimental features; we demonstrate that HOQST does now offer this capability.

Results

Throughout this work we consider a quantum mechanical system S coupled to a bath B. The total Hamiltonian is assumed to have the following form

$$H={H}_{{{{{{{{\rm{S}}}}}}}}}+{H}_{{{{{{{{\rm{I}}}}}}}}}+{H}_{{{{{{{{\rm{B}}}}}}}}},$$
(1)

where HS and HB denote, respectively, the free system and bath Hamiltonians. HI is the system-bath interaction, which is often written as

$${H}_{{{{{{{{\rm{I}}}}}}}}}=\mathop{\sum}\limits_{\alpha }{g}_{\alpha }{A}_{\alpha }\otimes {B}_{\alpha },$$
(2)

where Aα and Bα are dimensionless Hermitian operators acting on the system and the bath, respectively, and exclude both IS and IB (the identity operators on the system and the bath, respectively). The parameters gα are sometimes absorbed into Bα but are kept explicit in HOQST, are have units of energy. In addition, we assume for simplicity the factorized initial condition ρ(0) = ρS(0) ρB for the joint system-bath state at the initial time t = 0, where ρB is a Gibbs state at inverse temperature β

$${\rho }_{{{{{{{{\rm{B}}}}}}}}}=\frac{{e}^{-\beta {H}_{{{{{{{{\rm{B}}}}}}}}}}}{{{{{{{{\rm{Tr}}}}}}}}[{e}^{-\beta {H}_{{{{{{{{\rm{B}}}}}}}}}}]},$$
(3)

though we note that factorization is not necessary for a valid description of open system dynamics25,26. We work in units of  = 1 and kB = 1 so that β has units of inverse energy, or time.

Before proceeding, we transform the original Hamiltonian Eq. (1) into a rotating frame defined by U(t), i.e.

$$\tilde{H}(t)={U}^{{{{\dagger}}} }(t)\ HU(t).$$
(4)

The specific form of the unitary operator U(t) will lead to different master equations and will be discussed in detail in subsequent sections. The goals of the rotation are to remove the pure-bath Hamiltonian HB and to identify terms that remains small in different system bath coupling regimes. As long as U(t) acts non-trivially on the bath, we may assume without loss of generality we that the rotating frame Hamiltonian \(\tilde{H}\) has the following form:

$$\tilde{H}={\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}+{\tilde{H}}_{{{{{{{{\rm{I}}}}}}}}},$$
(5)

where \({\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}\) acts only the system and \({\tilde{H}}_{{{{{{{{\rm{I}}}}}}}}}\) acts jointly on the system and the bath. The Liouville von Neumann equation in this rotating frame is

$$\frac{\partial }{\partial t}\tilde{\rho }(t)=-i[\tilde{H}(t),\rho (t)]\equiv \tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\rho (t),$$
(6)

where \(\tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\) denotes the Liouvillian superoperator. Once again we can always write

$${\tilde{H}}_{{{{{{{{\rm{I}}}}}}}}}=\mathop{\sum}\limits_{\alpha }{g}_{\alpha }{\tilde{A}}_{\alpha }\otimes {\tilde{B}}_{\alpha }$$
(7)

where \({\tilde{A}}_{\alpha }\) and \({\tilde{B}}_{\alpha }\) are, respectively, system and bath operators (excluding identity). However, it is important to note that \({\tilde{A}}_{\alpha }\) and \({\tilde{B}}_{\alpha }\) do not necessarily correspond to U(t)AαU(t) and U(t)BαU(t) in Eq. (2) because U(t) may not preserve the tensor product structure (i.e., we allow for UABU ≠ UAUUBU).

Let

$$\left\langle \tilde{X}\right\rangle ={{{{{{{\rm{Tr}}}}}}}}\left(\tilde{X}{\tilde{\rho }}_{B}\right)$$
(8)

denote the expectation value of any rotating frame bath operator \(\tilde{X}\) with respect to \({\tilde{\rho }}_{B}\). Then the two-point correlation function is

$${C}_{\alpha \beta }({t}_{1},{t}_{2})={g}_{\alpha }{g}_{\beta }\left\langle {\tilde{B}}_{\alpha }({t}_{1}){\tilde{B}}_{\beta }({t}_{2})\right\rangle .$$
(9)

If the correlation function is time-translation-invariant

$${C}_{\alpha \beta }({t}_{1},{t}_{2})={C}_{\alpha \beta }({t}_{1}-{t}_{2},0)\equiv {C}_{\alpha \beta }(\tau )\,\quad \tau \equiv {t}_{1}-{t}_{2},$$
(10)

then the noise spectrum of the bath can be properly defined by taking the Fourier transform

$${\gamma }_{\alpha \beta }(\omega )=\int\nolimits_{-\infty }^{\infty }{C}_{\alpha \beta }(\tau ){e}^{i\omega \tau }{{{{{{{\rm{d}}}}}}}}\omega .$$
(11)

The widely used Ohmic bath case is

$${\gamma }_{\alpha \beta }^{\,{{\mbox{Ohmic}}}}(\omega )=2\pi \eta {g}_{\alpha }{g}_{\beta }\frac{\omega {e}^{-| \omega | /{\omega }_{c}}}{1-{e}^{-\beta \omega }}.$$
(12)

Timescales

We define the two timescales to measure the range of applicability27

$$\frac{1}{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}=\int\nolimits_{0}^{\infty }| C(\tau )| d\tau ,\quad {\tau }_{{{{{{{{\rm{B}}}}}}}}}=\frac{\int\nolimits_{0}^{{t}_{f}}\tau | C(\tau )| d\tau }{\int\nolimits_{0}^{\infty }| C(\tau )| d\tau }.$$
(13)

Here tf is the total evolution time, used as a cutoff which can often be taken as . The quantity τSB is the fastest system decoherence timescale, or timescale over which the system density matrix ρS changes due to the coupling to the bath, in the interaction picture. The quantity τB is the characteristic timescale of the decay of C(τ). Note that the expression for τB becomes an identity if we choose \(| C(\tau )| \propto {e}^{-\tau /{\tau }_{{{{{{{{\rm{B}}}}}}}}}}\) and take the limit tf → .

τSB and τB are the only two parameters relevant for determining the range of applicability of the various master equations discussed here27, with the Universal Lindblad Equation (ULE; see Methods) case being no exception28. For convenience we collect the corresponding error bounds here, before discussing the various MEs. Namely, the error bound of the Redfield master equation is

$$\parallel {\rho }_{{{\mbox{true}}}}(t)-{\rho }_{{{{{{{{\rm{R}}}}}}}}}(t){\parallel }_{1}\le O\left(\frac{{\tau }_{{{{{{{{\rm{B}}}}}}}}}}{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}{e}^{12t/{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}\right)\,{{\mbox{ln}}}\,\left(\frac{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}{{\tau }_{{{{{{{{\rm{B}}}}}}}}}}\right),\,$$
(14)

where ρtrue(t) denotes the true (approximation-free) state.

The error bound of the Davies-Lindblad master equation is

$$\parallel {\rho }_{{{{{{{{\rm{true}}}}}}}}}(t)-{\rho }_{{{{{{{{\rm{D}}}}}}}}}(t){\parallel }_{1}\le O\left(\left(\frac{{\tau }_{{{{{{{{\rm{B}}}}}}}}}}{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}+\frac{1}{\sqrt{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}\delta E}}\right){e}^{12t/{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}\right),$$
(15)

where δE = minijEi − Ej is the level spacing, with Ei the eigenenergies of the system Hamiltonian HS. This original version of this ME29 does not directly allow for time-dependent driving, and we shall consider an adiabatic variant that does, the adiabatic master equation (AME)30 (see Methods). The same error bound should apply in this case, since the difference is only in that the Lindblad operators are rotated in the AME case with the (adiabatically) changing eigenstates of HS, and the norms used to arrive at Eq. (15) are invariant under this unitary transformation.

The error bound of the coarse-grained master equation (GCME; see Methods) is

$$\parallel {\rho }_{{{{{{{{\rm{true}}}}}}}}}(t)-{\rho }_{{{{{{{{\rm{C}}}}}}}}}(t){\parallel }_{1}\le O\left(\sqrt{\frac{{\tau }_{{{{{{{{\rm{B}}}}}}}}}}{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}}{e}^{6t/{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}\right).$$
(16)

The error of the polaron transform master equation (PTRE; see Methods) can be separated into two parts. The first part comes from truncating the expansion to 2nd order. It can be bounded using the same expression as in Eq. (14), with timescales defined by the polaron frame correlation K(τ):

$$\frac{1}{{\tau }_{{{{{{{{\rm{SB}}}}}}}}}}={{{\Delta }}}_{m}^{2}\int\nolimits_{0}^{\infty }| K(\tau )| d\tau ,\quad {\tau }_{{{{{{{{\rm{B}}}}}}}}}=\frac{\int\nolimits_{0}^{{t}_{f}}\tau | K(\tau )| d\tau }{\int\nolimits_{0}^{\infty }| K(\tau )| d\tau }.$$
(17)

A detailed discussion of the above quantities is presented in Supplementary Note 2 and 3 (the explicit form of K(τ) is also described in the Polaron Transform subsection in the Methods), and as far as we know the error bounds we derive here for the PTRE are new. We mention here that if the system-bath coupling strength gα in Eq. (2) is sent to infinity, both 1/τSB and τB/τSB go to 0. Thus the PTRE works in the strong coupling regime. The second part of the error is caused by ignoring the 1st and 2nd order inhomogeneous terms, which themselves are due to the polaron transformation breaking the factorized initial condition. We do not have a bound on this error yet, but numerical studies suggest it is small when ρS(0) is diagonal31.

These bounds assume a Gaussian bath. For a non-Gaussian bath extra timescales relating to higher-order correlation functions generally appear, and the error bounds will contain additional terms.

Capabilities of HOQST and comparison with other quantum simulators

Recent developments in the field of QC have led to an explosion of quantum software platforms32, such as Qiskit33,34, pyQuil35 and ProjectQ36. Because some of these platforms include the capability to simulate noisy quantum circuits, we briefly compare their respective noise models and solver types in Table 1. Furthermore, for packages that support arbitrary time-dependent Hamiltonian and rely on MEs as solvers, we list their compatible MEs in Table 2.

Table 1 Comparison chart for noise models and solver types adopted by different software packages.
Table 2 Comparison chart for master equation (ME) support. The table lists the supported ME types for HOQST, QuTiP and Qiskit Pulse.

In this section, we benchmark the performance of HOQST against QuTiP. We consider only QuTiP because it is the single package in Table 1 that provides a capability similar to HOQST, i.e., to simulate time-dependent open-system dynamics. The other packages all focus on the quantum-circuit model; thus, the comparison with HOQST is not meaningful. As a useful example, we choose the alternating-sectors-chain (ASC)37 as the benchmark problem. The Hamiltonian of the N-qubit experiment is

$${H}_{{{{{{{{\rm{S}}}}}}}}}(\tau )=-a(\tau )\mathop{\sum }\limits_{i=1}^{N}{\sigma }_{i}^{x}+b(\tau ){H}_{{{{{{{{\rm{ASC}}}}}}}}}$$
(18)

where τ = t/tf is the dimensionless time and a(s) and b(s) are the annealing schedules shown in Fig. 1(a). The alternating-sectors-chain Hamiltonian is

$${H}_{{{{{{{{\rm{ASC}}}}}}}}}=-\mathop{\sum }\limits_{i=1}^{N-1}{J}_{i}{\sigma }_{i}^{z}{\sigma }_{i+1}^{z},$$
(19)

where the coupling strength Ji alternates between sectors of size n

$${J}_{i}=\left\{\begin{array}{ll}{W}_{1}\quad &{{{{{{{\rm{if}}}}}}}}\ \lceil i/n\rceil \,{{\mbox{is odd}}}\,\\ {W}_{2}\quad &{{{{{{{\rm{otherwise}}}}}}}}\end{array}\right..$$
(20)

To keep the problem size manageable, we fix n = 1 and vary the system size N. The open-system model is given by

$$H(\tau )={H}_{{{{{{{{\rm{S}}}}}}}}}(\tau )+g\mathop{\sum }\limits_{i=1}^{N}{\sigma }_{i}^{z}\otimes {B}_{i}+{H}_{{{{{{{{\rm{B}}}}}}}}},$$
(21)

where each qubit couples to an independent bath via σz with equal coupling strength g, and HB is the bath Hamiltonian. The bath is chosen to be Ohmic [Eq. (12)] with coupling strength \(\eta {g}_{{{{{{{{\rm{S}}}}}}}}}^{2}/{\hslash }^{2}=1.2\times 1{0}^{-4}\), cutoff frequency fc = 4GHz, and temperature T = 12mK37. In the benchmark simulation, we solve the AME (frequency form Redfield equation) using both HOQST and QuTiP. Because of the large computational cost, the full AME simulation can hardly scale beyond a few qubits. HOQST provides interfaces to solve the AME in a low energy subspace. It can greatly speed up the computation if the evolution is confined within a small, low energy subspace. We also include this version of the AME solver in our benchmark (see Supplementary Note 6 for details). Finally, we ignore the Lamb shift in all the simulations since QuTiP does not include it (a significant drawback since in general the Lamb shift can have a strong effect30).

Fig. 1: Annealing schedules and annealing parameters.
figure 1

In (a), we show the typical annealing schedules for the D-Wave device. In (b), we show the annealing parameters s(τ) and sp(τ) (see Eq. (22)) used in the entanglement witness experiment. There are three stages in the experiment: i. first evolve s(τ) from 1 to s for τ [0, τ1] and then evolve sp(τ) from 1 to \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }\) for τ [τ1, 2τ1]; ii. pause for a time τ2; iii. reverse the first stage. In our simulation, we choose s = 0.339, τ1tf = 10μs38 and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.612\) such that \(2A({s}_{{{{{{{{\rm{p}}}}}}}}}^{* })\approx 1{{{{{{{\rm{MHz}}}}}}}}\)24. The value of τ2 is varied to obtain the tunneling rate.

The benchmark result is shown in Fig. 2, where a significant runtime improvement of HOQST over QuTiP is observed. In fact, the QuTiP runtime became excessive for N > 4, while HOQST remains nearly an order of magnitude faster even for N = 5. Using HOQST’s subspace truncation capability allowed us to continue simulations up to N = 10 without exceeding a runtime of 103s. However, we note that we deliberately chose a benchmark problem that would demonstrate HOQST’s advantage. There are areas of overlap between QuTiP and HOQST (e.g., the time-independent Lindblad equation) where the packages would perform similarly.

Fig. 2: Total runtime vs system size for the benchmark simulation of the alternating sectors chain problem.
figure 2

The x-axis (N) is the system size. Each data point corresponds to the average runtime of 7–10 runs. Error bars represent 5 standard deviations. The “QuTiP” and “HOQST (Full)” points represent the runtime of full adiabatic master equation (AME) simulations using the corresponding packages. The “HOQST (Subspace)” points represent the runtime of AME simulation in the lowest 20-level subspace. The benchmark was done on a desktop computer with an Intel(R) Core(TM) i7-6700 @3.40GHz CPU and 16 GB memory. The software versions were QuTiP 4.6.2, HOQST 0.6.3, python 3.9.7 and Julia 1.6.3. The operating system was Ubuntu 20.04.3.

As a final remark, we emphasize that HOQST simulates the full open-system dynamics in the sense that the solution of the master equation is obtained up to a precision allowed by the underlying ODE algorithm. The computational cost of such a simulation scales exponentially with respect to the system size, and, without further assumptions or approximations, no algorithm with better scaling has been discovered. On the other hand, quantum Monte Carlo or tensor-network based algorithms could achieve superior scaling under additional assumptions or approximations. For example, if we know that the state stays within the space of matrix product state during the evolution, and the Liouvillian superoperator of the master equation could be effectively expressed in terms of matrix product operators, a tensor-network version of the ODE algorithm can solve the open-system dynamics efficiently. However, generically such assumptions are hard to satisfy, even approximately. Thus, it is not meaningful to benchmark HOQST against tensor-network based algorithm since the latter involves much stronger assumptions.

Entanglement witness experiment modeling

HOQST has a large collection of tutorials located at a dedicated Github repo, which are summarized in Table 3. As an illustrative yet non-trivial example, we next discuss the simulation of a three-qubit quantum annealing entanglement witness experiment. The entanglement witness experiment was proposed to provide evidence of entanglement in a D-Wave quantum annealing device24. An open system analysis of these experiments was performed using the AME38, but failed to reproduce the observed width of the tunneling rate peaks. This is the impetus for us revisiting this experiment here. As we shall show, the new tools provided in HOQST allow us to much more closely match the experimental data than was possible before.

Table 3 List of tutorials for HOQST.

The crux of the experiment is actually a form of tunneling spectroscopy39, where the goal is to find the energy gaps of the Hamiltonian \(-a(s){\sum }_{i}{\sigma }_{x}^{i}+b(s){H}_{{{{{{{{\rm{Ising}}}}}}}}}\). This is done by observing the location of a peak in the tunneling rate as measured using a probe qubit. The Hamiltonian of the 3-qubit-version of the experiment is

$${H}_{{{{{{{{\rm{S}}}}}}}}}(\tau )=-a(s(\tau ))\mathop{\sum }\limits_{i=1}^{2}{\sigma }_{i}^{x}-a({s}_{{{{{{{{\rm{p}}}}}}}}}(\tau )){\sigma }_{{{{{{{{\rm{P}}}}}}}}}^{x}+b(s(\tau )){H}_{{{{{{{{\rm{Ising}}}}}}}}},$$
(22)

where a(s) and b(s) are the annealing schedules, and s(τ) and sp(τ) are functions of the dimensionless time τ = t/tf, known as annealing parameters. The Hamiltonian consists of two system qubits coupled to an ancilla system qubit, as shown in Fig. 3. The aforementioned location of the tunneling rate peak can be controlled by varying hP, and this information can be used to extract the energy gaps as a function of s.

The annealing schedules and annealing parameters are illustrated in Fig. 1. To extract the tunneling rate, we first perform the simulation with the initial all-one state \(\left|\psi (0)\right\rangle ={\left|1\right\rangle }^{\otimes 3}\) for different hP and t2 = τ2tf values. The population of the all-one state at the end of anneal is then obtained as a function of hP and τ2: \({P}_{\left|{{{{{{{\bf{1}}}}}}}}\right\rangle }({h}_{{{{{{{{\rm{P}}}}}}}}},{t}_{2})=| \langle \psi ({t}_{f})| \psi (0)\rangle {| }^{2}\). Lastly, we fit \({P}_{\left|{{{{{{{\bf{1}}}}}}}}\right\rangle }({h}_{{{{{{{{\rm{P}}}}}}}}},{t}_{2})\) to the function \(a{e}^{b{t}_{2}}+c{e}^{d{t}_{2}}\), from which the rate Γ can be estimated

$${{\Gamma }}({h}_{{{{{{{{\rm{P}}}}}}}}})={\left.-\frac{\partial {P}_{\left|{{{{{{{\bf{1}}}}}}}}\right\rangle }}{\partial {t}_{2}}\right|}_{{t}_{2} = 0}=-ab-cd.$$
(23)
Fig. 3: The Ising Hamiltonian of the 3-qubit entanglement witness experiment.
figure 3

The figure shows the graphical representation of HIsing in Eq. (22). Here each circle represents a qubit (qubit 1, 2 and an ancilla denoted as P). hi is the local field strength and Jij is the coupling strength between qubit i and j. The Hamiltonian can be written as \({\sum }_{i}\ {h}_{i}{\sigma }_{i}^{z}+{\sum }_{ij}\ {J}_{ij}{\sigma }_{i}^{z}{\sigma }_{j}^{z}\). The goal of the experiment is to demonstrate entanglement between qubits 1 and 2, by probing the ancilla qubit. In our simulations, h1, h2, J1P and JS are fixed at J1P = − h1 = − 1.8, JS = − 2.5, h2 = 0.

For the open system model, we assume the qubits are coupled to independent baths38

$$H(t)={H}_{{{{{{{{\rm{S}}}}}}}}}(t)+\mathop{\sum }\limits_{i=1}^{2}{g}_{i}{\sigma }_{i}^{z}\otimes {B}_{i}+{g}_{{{{{{{{\rm{P}}}}}}}}}{\sigma }_{{{{{{{{\rm{P}}}}}}}}}^{z}\otimes {B}_{{{{{{{{\rm{P}}}}}}}}}+{H}_{{{{{{{{\rm{B}}}}}}}}},$$
(24)

but the bath coupling to the probe qubit gP is much stronger than the coupling to the two system qubits g1 = g2 = gS. In addition, we assume the bath is Ohmic [Eq. (12)] with coupling strength \(\eta {g}_{{{{{{{{\rm{S}}}}}}}}}^{2}/{\hslash }^{2}=1.2732\times 1{0}^{-4}\), cutoff frequency fc = 4GHz, and temperature T = 12.5mK. We performed numerical simulations with different models of BP:

  1. 1.

    An Ohmic bath with interaction strength gP = 10gS, using different flavors of the AME (see Methods, Sec.).

  2. 2.

    Hybrid Ohmic bath whose coupling strength to the Ohmic component is gP = 10gS and varying macroscopic resonant tunneling (MRT) width, using the PTRE (see the Polaron Transform subsection in the Methods).

The tunneling rates obtained via these different ME simulations are compared with the experimental results24 in Fig. 4. The reported experimental parameters are T = 12.5mK and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.612\)24 [see Fig. 1(b)]. Simulations using these parameters and two different flavors of the AME, the one-sided AME [Eq. (42)] and the Lindblad form AME [Eq. (38)], are plotted. The results demonstrate that these two AME flavors only differ significantly near the small gap region, but neither one matches the experimental results. No further improvement is observed by varying the AME parameters: the linewidth remains too narrow to match the experiment.

Fig. 4: Tunneling rates obtained via different master equations compared with the experimental results.
figure 4

The bath coupled to the system qubits is Ohmic with parameters: \(\eta {g}_{{{{{{{{\rm{S}}}}}}}}}^{2}/{\hslash }^{2}=1.2732\times 1{0}^{-4}\), fc = 4GHz and T = 12.5mK. The corresponding models and parameters of the bath coupled to the probe qubit used for different simulations are i. adiabatic master equation (AME): Ohmic with gP = 10gS and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.612\). ii. polaron transformed Redfield equation (PTRE): hybrid-Ohmic with gP = 10gS and various W, T values. The cutoff frequency fc is the same across different models. Here too \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.612\). iii. PTRE with alternative parameters (black dashed line): hybrid-Ohmic with W = 9mK, T = 25mK, and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.59\), while the other parameters are the same as in case (2).

In contrast with the AME, the PTRE with T = 12.5mK and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.612\) exhibits a larger Gaussian linewidth broadening and closer agreement with the experimental data (solid curves in Fig. 4). We note that if we increase W while fixing T, the PTRE curve is stretched to the right. This is the result of the fluctuation-dissipation theorem, where εL scales quadratically with W. Such a shift can be compensated by increasing the temperature together with W [see the black dashed curve in Fig. 4].

Despite the closer agreement using the PTRE at the reported experimental temperature and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }\) values, there is still a mismatch between the theoretical and experimental amplitudes of the tunneling rate curves. A possible reason for this may be a discrepancy in the reported \(A({s}_{{{{{{{{\rm{p}}}}}}}}}^{* })\) and its true value, attributable to annealing schedule fluctuations and integrated control errors in the early model of D-Wave annealer used in the experiment. To account for this, we performed PTRE simulation with different T and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }\) values from those reported24: T = 25mK and \({s}_{{{{{{{{\rm{p}}}}}}}}}^{* }=0.59\) (we also set W = 9mK). The result is plotted as the black dashed line in Fig. 4 and shows significantly better agreement with the experimental results. This highlights the fact that the slow bath coupled to the probe qubit may have a different temperature than the Ohmic one. Moreover, this results illustrates the power of HOQST’s range of ME implementations.

Conclusion

In conclusion, we presented a software package called Hamiltonian Open Quantum System Toolkit (HOQST). It is user-friendly and written in Julia. It supports various master equations with a wide joint range of applicability, as well as stochastic Hamiltonians to model 1/f noise. We demonstrated that HOQST can achieve order of magnitude speedups over QuTiP for problems with a time-dependent Hamiltonian. We also illustrated the use of HOQST in simulating open quantum system dynamics in a 3-qubit entanglement witness experiment. Whereas previous modeling of this experiment was unable to capture the reported linewidth, HOQST’s implementation of the polaron-transformed Redfield equation (PTRE) was able to do so. We also derived new error bounds for the PTRE.

We expect HOQST to be useful for researchers working in the field of open quantum systems, dealing with systems governed by time-dependent Hamiltonians. HOQST provides both basic and advanced numerical simulation tools in this area, which can be applied to simulate superconducting qubits of all types, trapped ions, NV centers, silicon quantum dot qubits, etc. Future releases of HOQST will expand both the suite of open system models and range of quantum control and computation models it supports.

Methods

We present a brief review of the open system models and corresponding master equations supported by HOQST. We provide various additional technical details in the Supplementary Information.

Cumulant expansion

The cumulant expansion is a technique originally designed for the perturbation expansion of stochastic differential equations40. This technique can be generalized to the open quantum system setting and allows a systematic description of the reduced system dynamics1. By applying this technique in different rotating frames, master equations with different ranges of applicability can be derived1,18,41. Defining the projection operator \({{{{{{{\mathcal{P}}}}}}}}\)

$${{{{{{{\mathcal{P}}}}}}}}\rho ={{{{{{{{\rm{tr}}}}}}}}}_{{{{{{{{\rm{B}}}}}}}}}\{\rho \}\otimes {\rho }_{{{{{{{{\rm{B}}}}}}}}}\equiv {\rho }_{{{{{{{{\rm{S}}}}}}}}}\otimes {\rho }_{{{{{{{{\rm{B}}}}}}}}},$$
(25)

the formal cumulant expansion of the Liouville von Neumann equation is

$$\frac{\partial }{\partial t}{{{{{{{\mathcal{P}}}}}}}}\tilde{\rho }(t)=\mathop{\sum}\limits_{n}{{{{{{{{\mathcal{K}}}}}}}}}_{n}(t){{{{{{{\mathcal{P}}}}}}}}\tilde{\rho }(t),$$
(26)

where the nth order generator \({{{{{{{{\mathcal{K}}}}}}}}}_{n}(t)\) is

$${{{{{{{{\mathcal{K}}}}}}}}}_{n}(t)=\int\nolimits_{0}^{t}{{{{{{{\rm{d}}}}}}}}{t}_{1}\int\nolimits_{0}^{{t}_{1}}{{{{{{{\rm{d}}}}}}}}{t}_{2}\cdots \int\nolimits_{0}^{{t}_{n-2}}{{{{{{{\rm{d}}}}}}}}{t}_{n-1}{\left\langle \tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\tilde{{{{{{{{\mathcal{L}}}}}}}}}({t}_{1})\cdots \tilde{{{{{{{{\mathcal{L}}}}}}}}}({t}_{n-1})\right\rangle }_{{{{{{{{\rm{oc}}}}}}}}},$$
(27)

and the quantities \({\left\langle \tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\tilde{{{{{{{{\mathcal{L}}}}}}}}}({t}_{1})\cdots \tilde{{{{{{{{\mathcal{L}}}}}}}}}({t}_{n-1})\right\rangle }_{{{{{{{{\rm{oc}}}}}}}}}\) are known as ordered cumulants1. In HOQST, we consider only the first and second order generators, which are given by:

$${\left\langle \tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\right\rangle }_{oc}={{{{{{{\mathcal{P}}}}}}}}\tilde{{{{{{{{\mathcal{L}}}}}}}}}(t){{{{{{{\mathcal{P}}}}}}}},\quad {\left\langle \tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\tilde{{{{{{{{\mathcal{L}}}}}}}}}({t}_{1})\right\rangle }_{oc}={{{{{{{\mathcal{P}}}}}}}}\tilde{{{{{{{{\mathcal{L}}}}}}}}}(t)\tilde{{{{{{{{\mathcal{L}}}}}}}}}({t}_{1}){{{{{{{\mathcal{P}}}}}}}}.$$
(28)

Incorporating higher order cumulants generally leads to more accurate results1.

Redfield equation

The oldest and one of the most well-known MEs in this category is the Redfield equation42 (also known as TCL21, where TCLn stands for time-convolutionless at level n, arising from an expansion up to and including \({{{{{{{{\mathcal{K}}}}}}}}}_{n}(t)\)), which directly follows from Eq. (26) after choosing the rotation U(t) to be

$$U(t)={U}_{{{{{{{{\rm{S}}}}}}}}}(t)\otimes {U}_{{{{{{{{\rm{B}}}}}}}}}(t),\quad {U}_{{{{{{{{\rm{S}}}}}}}}}(t)={T}_{+}\exp \bigg\{-i\int\nolimits_{0}^{t}{H}_{{{{{{{{\rm{S}}}}}}}}}(\tau ){{{{{{{\rm{d}}}}}}}}\tau \bigg\}, \quad {U}_{{{{{{{{\rm{B}}}}}}}}}(t)=\exp \{-i{H}_{{{{{{{{\rm{B}}}}}}}}}t\},$$
(29)

where T+ denotes the forward time-ordering operator. After rotating back to the Schrödinger picture, one of the most common forms of the Redfield equation is

$${\dot{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)=-i\big[{H}_{{{{{{{{\rm{S}}}}}}}}}(t),\ {\rho }_{{{{{{{{\rm{S}}}}}}}}}(t)\big]-\mathop{\sum}\limits_{\alpha }\ \big[{A}_{\alpha }(t),{{{\Lambda }}}_{\alpha }(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}(t)\big]+h.c.$$
(30)

where

$${{{\Lambda }}}_{\alpha }(t)=\mathop{\sum}\limits_{\beta }\int\nolimits_{0}^{t}{C}_{\alpha \beta }(t-\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}(t,\tau ){A}_{\beta }(\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}^{{{{\dagger}}} }(t,\tau ){{{{{{{\rm{d}}}}}}}}\tau \,.$$
(31)

This is the form used in HOQST. The error bound for the Redfield ME is given in Eq. (14). We note that the current release of HOQST supports correlated baths for the Redfield and adiabatic master equation solvers. However, for simplicity, we henceforth focus on uncorrelated baths where Cαβ(t) = δαβCα(t).

The most significant drawback of the Redfield equation is the fact that it does not generate a completely-positive evolution, and in particular can result in unphysical negative states (density matrices with negative eigenvalues). Though formal fixes for this problem have been proposed43,44, to address the issue in HOQST an optional positivity check routine is implemented at the code level, which can stop the solver if the density matrix become negative. In addition, three variants of Redfield equation that guarantee positivity, namely the adiabatic master equation (AME)30, the coarse-grained master equation (CGME)27,45, and the universal Lindblad equation (ULE)28, are included in HOQST. We detail these MEs next.

Coarse-grained master equation (CGME)

The CGME can be obtained from Eq. (30) by first time-averaging the Redfield part, i.e., shifting tt + t1 and applying \(\frac{1}{{T}_{a}}\int\nolimits_{-{T}_{a}/2}^{{T}_{a}/2}{{{{{{{\rm{d}}}}}}}}{t}_{1}\). One then neglects a part of the integral to regain complete positivity. The result is27:

$$\dot{\rho }=-i[{H}_{{{{{{{{\rm{S}}}}}}}}}+{H}_{{{{{{{{\rm{LS}}}}}}}}},\rho ]+\mathop{\sum}\limits_{\alpha }\frac{1}{{T}_{a}}\int\nolimits_{-{T}_{a}/2}^{{T}_{a}/2}{{{{{{{\rm{d}}}}}}}}{t}_{1}\int\nolimits_{-{T}_{a}/2}^{{T}_{a}/2}{{{{{{{\rm{d}}}}}}}}{t}_{2}{C}_{\alpha }({t}_{2}-{t}_{1})\\ \left[{A}_{\alpha }(t+{t}_{1}){\rho }_{{{{{{{{\rm{S}}}}}}}}}{A}_{\alpha }^{{{{\dagger}}} }(t+{t}_{2})-\frac{1}{2}\{{A}_{\alpha }(t+{t}_{2}){A}_{\alpha }(t+{t}_{1}),{\rho }_{{{{{{{{\rm{S}}}}}}}}}\}\right],$$
(32)

where Aα(t + t1) = U(t + t1, t)Aα(t)U(t + t1, t) and the Lamb shift is given by

$${H}_{{{{{{{{\rm{LS}}}}}}}}}=\frac{i}{2{T}_{a}}\int\nolimits_{-{T}_{a}/2}^{{T}_{a}/2}{{{{{{{\rm{d}}}}}}}}{t}_{1}\int\nolimits_{-{T}_{a}/2}^{{T}_{a}/2}{{{{{{{\rm{d}}}}}}}}{t}_{2}{{{{{{{\rm{sgn}}}}}}}}({t}_{1}-{t}_{2}){C}_{\alpha }({t}_{2}-{t}_{1})A(t+{t}_{2})A(t+{t}_{1}).$$
(33)

The quantity Ta is the coarse-graining time, a phenomenological parameter that can be manually specified or automatically chosen based on the bath correlation function45. HOQST uses a multidimensional h-adaptive algorithm46 to perform the 2-dimensional integration. The error bound for the CGME is given in Eq. (16).

Universal Lindblad equation (ULE)

The ULE28 is a Lindblad-form master equation that shares the same error bound as the Redfield equation, i.e., Eq. (14). A similar master equation with better accuracy, known as the geometric-arithmetic master equation (GAME), can also be derived by using a different formula for the Lamb shift47. The formal form of the ULE is identical to the Lindblad equation:

$${\dot{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)=-i[{H}_{{{{{{{{\rm{S}}}}}}}}}(t)+{H}_{{{{{{{{\rm{LS}}}}}}}}}(t),\,{\rho }_{{{{{{{{\rm{S}}}}}}}}}(t)]+\mathop{\sum}\limits_{\alpha }\left[{L}_{\alpha }(t)\rho {L}_{\alpha }^{{{{\dagger}}} }(t)-\frac{1}{2}\{{L}_{\alpha }^{{{{\dagger}}} }(t){L}_{\alpha }(t),\rho \}\right],$$
(34)

where the time-dependent Lindblad operators are

$${L}_{\alpha }(t)=\int\nolimits_{-\infty }^{\infty }{g}_{\alpha }(t-\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}(t,\tau ){A}_{\alpha }(\tau ){U}^{{{{\dagger}}} }(t,\tau ){{{{{{{\rm{d}}}}}}}}\tau ,$$
(35)

and the Lamb shift is

$${H}_{{{{{{{{\rm{LS}}}}}}}}}(t)=\mathop{\sum}\limits_{\alpha }\frac{1}{2i}\int\nolimits_{-\infty }^{\infty }{{{{{{{\rm{d}}}}}}}}s{{{{{{{\rm{d}}}}}}}}s^{\prime} U(t,s){A}_{\alpha }(s){g}_{\alpha }(s-t)U(s,s^{\prime} ){g}_{\alpha }(t-s^{\prime} ){A}_{\alpha }(s^{\prime} ){U}^{{{{\dagger}}} }(t,s^{\prime} ){{{{{{{\rm{sgn}}}}}}}}(s-s^{\prime} )\,.$$
(36)

In the above expression, gα(t) is called the jump correlation and is the inverse Fourier transform of the square root of the noise spectrum

$${g}_{\alpha }(t)=\frac{1}{2\pi }\int\nolimits_{-\infty }^{\infty }\sqrt{{\gamma }_{\alpha }(\omega )}{e}^{-i\omega t}{{{{{{{\rm{d}}}}}}}}\omega .$$
(37)

The integration limits of Eqs. (35) and (36) are problematic in practice because the unitary US(t) does not go beyond [0, tf]. In numerical implementation, we replace the integral limit with \(\int\nolimits_{0}^{{t}_{f}}\). This is a good approximation when g(t) decays much faster than tf. This is the form of ULE used in HOQST.

Adiabatic master equation (AME)

To derive the AME, we replace US(t − τ) in Eq. (31) with the ideal adiabatic evolution and apply the standard Markov assumption and the rotating wave approximation (RWA). The resulting equation is

$${\dot{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)= -i[{H}_{{{{{{{{\rm{S}}}}}}}}}(t)+{H}_{{{{{{{{\rm{LS}}}}}}}}}(t),\ {\rho }_{{{{{{{{\rm{S}}}}}}}}}(t)]\\ +\mathop{\sum}\limits_{\alpha \beta }\mathop{\sum}\limits_{\omega }{\gamma }_{\alpha \beta }(\omega )\left[{L}_{\omega ,\beta }(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}(t){L}_{\omega ,\alpha }^{{{{\dagger}}} }(t)-\frac{1}{2}\{{L}_{\omega ,\alpha }^{{{{\dagger}}} }(t){L}_{\omega ,\beta }(t),{\rho }_{{{{{{{{\rm{S}}}}}}}}}(t)\}\right].$$
(38)

The AME is in Davies form29 and the Lindblad operators are defined by

$${L}_{\omega ,\alpha }(t)=\mathop{\sum}\limits_{{\varepsilon }_{b}-{\varepsilon }_{a}=\omega }\left\langle {\psi }_{a}\right|{A}_{\alpha }\left|{\psi }_{b}\right\rangle \left|{\psi }_{a}\right\rangle \left\langle {\psi }_{b}\right|,$$
(39)

where εa is the instantaneous energy of the a’th level of the system Hamiltonian, i.e., \({H}_{{{{{{{{\rm{S}}}}}}}}}(t)\left|{\psi }_{a}(t)\right\rangle ={\varepsilon }_{a}(t)\left|{\psi }_{a}(t)\right\rangle\). Finally, the Lamb shift term is

$${H}_{{{{{{{{\rm{LS}}}}}}}}}(t)=\mathop{\sum}\limits_{\alpha \beta }\mathop{\sum}\limits_{\omega }{L}_{\omega ,\alpha }^{{{{\dagger}}} }(t){L}_{\omega ,\beta }(t){S}_{\alpha \beta }(\omega ),$$
(40)

where

$${S}_{\alpha \beta }(\omega )=\frac{1}{2\pi }\int\nolimits_{-\infty }^{+\infty }{\gamma }_{\alpha \beta }(\omega ^{\prime} ){{{{{{{\mathcal{P}}}}}}}}\Big(\frac{1}{\omega -\omega ^{\prime} }\Big){{{{{{{\rm{d}}}}}}}}\omega ^{\prime} ,$$
(41)

with \({{{{{{{\mathcal{P}}}}}}}}\) denoting the Cauchy principal value. The error bound is given in Eq. (15).

If the RWA is not applied, the resulting equation is called the one-sided AME:

$${\dot{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)=-i[{H}_{{{{{{{{\rm{S}}}}}}}}}(t),\ {\rho }_{{{{{{{{\rm{S}}}}}}}}}(t)]+\mathop{\sum}\limits_{\alpha \beta }\mathop{\sum}\limits_{\omega }{{{\Gamma }}}_{\alpha \beta }(\omega )[{L}_{\omega ,\beta }(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}(t),{A}_{\alpha }]+h.c.,$$
(42)

where

$${{{\Gamma }}}_{\alpha \beta }(\omega )=\int\nolimits_{0}^{\infty }{C}_{\alpha \beta }(t){e}^{i\omega t}{{{{{{{\rm{d}}}}}}}}t=\frac{1}{2}{\gamma }_{\alpha \beta }(\omega )+{{{{{{{\rm{i}}}}}}}}{S}_{\alpha \beta }(\omega ).$$
(43)

These two forms of the AME behave differently when the energy gaps are small because the RWA breaks down in such regions27. More importantly, like the Redfield equation, the one-sided AME does not generate a completely-positive evolution. The code-level positivity check routine works with this version of the AME as well.

Classical 1/f noise

HOQST includes the ability to model 1/f noise, which is an important and dominant source of decoherence in most solid-state quantum NISQ platforms 48,49, in particular those based on superconducting qubits50,51,52. Fully quantum treatments of 1/f noise have been proposed53,54, including for quantum annealing18. In HOQST we adopt the simpler approach of modeling 1/f noise as classical stochastic noise generated by a summation of telegraph processes, which has proved to be a good approximation to the fully quantum version48. Specifically, we provide a quantum-trajectory simulation of the following stochastic Schrödinger equation

$$\left|\dot{{{\Phi }}}\right\rangle =-i\left({H}_{{{{{{{{\rm{S}}}}}}}}}+\mathop{\sum}\limits_{\alpha }{\delta }_{\alpha }(t){A}_{\alpha }\right)\left|{{\Phi }}\right\rangle ,$$
(44)

where each δα(t) is a sum of telegraph processes

$${\delta }_{\alpha }(t)=\mathop{\sum }\limits_{i=1}^{N}{T}_{i}(t),$$
(45)

where Ti(t) switches randomly between ± bi with rate γi. In the limit of N →  and \({b}_{i}\to \bar{b}\), if the γi’s are log-uniformly distributed in the interval \([{\gamma }_{\min },{\gamma }_{\max }]\) (with \({\gamma }_{\max }\gg {\gamma }_{\min }\)), the noise spectrum of δα(t) approaches a 1/f spectrum within the same interval48. Empirically, we find that a good approximation can be achieved with relatively small N.

Hybrid model

The most significant drawback of a purely classical noise model is that if its steady state is unique then it is the maximally mixed state. To see this, we first realize that each trajectory of Eq. (44) generates a unitary acting on the space \({{{{{{{\mathcal{S}}}}}}}}({{{{{{{{\mathcal{H}}}}}}}}}_{S})\) of density matrices

$${{{{{{{{\mathcal{U}}}}}}}}}_{k}(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}={U}_{k}(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}{U}_{k}^{{{{\dagger}}} }(t).$$
(46)

Averaging over the trajectories over a distribution p(k) creates a unital (identity preserving) map from \({{{{{{{\mathcal{S}}}}}}}}({{{{{{{{\mathcal{H}}}}}}}}}_{S})\) into itself

$$\bar{{{{{{{{\mathcal{U}}}}}}}}}(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}(0)=\int p(k){{{{{{{{\mathcal{U}}}}}}}}}_{k}(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}{{{{{{{\rm{d}}}}}}}}k.$$
(47)

If the steady state ρ is unique then we can define it as

$$\mathop{\lim }\limits_{t\to \infty }\bar{{{{{{{{\mathcal{U}}}}}}}}}(t){\rho }_{{{{{{{{\rm{S}}}}}}}}}(0)={\rho }_{\infty }\quad \forall {\rho }_{{{{{{{{\rm{S}}}}}}}}}(0)\,.$$
(48)

By unitality it would then follow that ρ = I, since we can choose ρS(0) = I.

However, this is not what is observed in real devices, e.g., in experiments with superconducting flux16 or transmon55 qubits. To account for this, HOQST includes a hybrid classical-quantum noise model:

$$\dot{\rho }=-i\left[{H}_{{{{{{{{\rm{S}}}}}}}}}+\mathop{\sum}\limits_{\alpha }{\delta }_{\alpha }(t){A}_{\alpha },\rho\right] +{{{{{{{\mathcal{L}}}}}}}}(\rho ),$$
(49)

where δα(t) is the same random process as in Eq. (45), and \({{{{{{{\mathcal{L}}}}}}}}\) is the superoperator generated by the cumulant expansion (27). At present, HOQST supports the combination of 1/f noise with both the Redfield and adiabatic master equations.

Polaron transform

If the bath operators in Eq. (2) are bosonic

$${B}_{\alpha }=\mathop{\sum}\limits_{k}{\lambda }_{\alpha ,k}({b}_{\alpha ,k}^{{{{\dagger}}} }+{b}_{\alpha ,k}),\qquad {H}_{{{{{{{{\rm{B}}}}}}}}}=\mathop{\sum}\limits_{\alpha ,k}{\omega }_{\alpha ,k}{b}_{\alpha ,k}^{{{{\dagger}}} }{b}_{\alpha ,k},$$
(50)

we can choose the joint system-bath unitary U(t) in Eq. (29) as41

$${U}_{{{{{{{{\rm{p}}}}}}}}}(t)=\exp \left\{-i\mathop{\sum}\limits_{\alpha ,k}{A}_{\alpha }^{d}\frac{{g}_{\alpha }{\lambda }_{\alpha ,k}}{i{\omega }_{\alpha ,k}}({b}_{\alpha ,k}^{{{{\dagger}}} }-{b}_{\alpha ,k})\right\}{U}_{{{{{{{{\rm{B}}}}}}}}}(t),$$
(51)

where \({A}_{\alpha }^{d}\) is the diagonal component of Aα in the interaction Hamiltonian (2) and UB(t) is given in Eq. (29) (we use λ instead of g in Bα to distinguish it from the expansion parameter in Eq. (7)). The corresponding second order ME (30) is known as the polaron-transformed Redfield equation (PTRE)41 or the noninteracting-blip approximation (NIBA)3. The PTRE has a different range of applicability than the previous MEs we have discussed. Whereas the latter apply under weak-coupling conditions, the transformation defined in Eq. (51) leads to a complementary range of applicability under strong-coupling. This particular form of Eq. (51) does not preserve the factored initial state, so that inhomogeneous terms are present after the transformation. However, if ρS(0) is diagonal then numerical studies of the effects of the inhomogeneous terms suggest that they can be ignored31.

In addition, the PTRE can be extended beyond the spin-boson model by choosing a different form of the joint system-bath unitary (51), as18,56

$${U}_{{{{{{{{\rm{p}}}}}}}}}(t)={U}_{{{{{{{{\rm{B}}}}}}}}}(t){T}_{+}\exp \left\{-i\mathop{\sum}\limits_{\alpha }{A}_{\alpha }^{d}{g}_{\alpha }\int\nolimits_{0}^{t}{B}_{\alpha }(\tau ){{{{{{{\rm{d}}}}}}}}\tau \right\}.$$
(52)

The two transformations in Eqs. (51) and (52) lead to MEs with identical structure but slightly different expressions (see Supplementary Note 1 for details). Whether those differences make any physical significance is an interesting topic for further study. In this paper we choose to work with Eq. (51).

Because the general form of the PTRE is unwieldy, we present its form for a standard quantum annealing model

$$H(t)={H}_{{{{{{{{\rm{S}}}}}}}}}(t)+{H}_{{{{{{{{\rm{I}}}}}}}}}+{H}_{{{{{{{{\rm{B}}}}}}}}}\,\quad {H}_{{{{{{{{\rm{I}}}}}}}}}=\mathop{\sum}\limits_{i}{g}_{i}{\sigma }_{i}^{z}\otimes {B}_{i}$$
(53a)
$${H}_{{{{{{{{\rm{S}}}}}}}}}(t)=a(t){H}_{{{{{{{{\rm{driver}}}}}}}}}+b(t){H}_{{{{{{{{\rm{prob}}}}}}}}},\,$$
(53b)

where a(t) and b(t) are the annealing schedules, and Hdriver and Hprob are the standard driver and problem Hamiltonians, respectively:

$${H}_{{{{{{{{\rm{driver}}}}}}}}}=-\mathop{\sum}\limits_{i}{\sigma }_{i}^{x},\,\quad {H}_{{{{{{{{\rm{prob}}}}}}}}}=\mathop{\sum}\limits_{i}{h}_{i}{\sigma }_{i}^{z}+\mathop{\sum}\limits_{i < j}{J}_{ij}{\sigma }_{i}^{z}{\sigma }_{j}^{z},\,$$
(54)

where the Pauli matrix σx acting on qubit i is denoted by \({\sigma }_{i}^{x}\), etc. The transformed Hamiltonian is

$$\tilde{H}(t)=a(t)\left[\mathop{\sum}\limits_{i}{\sigma }_{i}^{+}\otimes {\xi }_{i}^{+}(t)+{\sigma }_{i}^{-}\otimes {\xi }_{i}^{-}(t)\right]+b(t){H}_{{{{{{{{\rm{prob}}}}}}}}},$$
(55)

where

$${\xi }_{i}^{\pm }(t)={U}_{{{{{{{{\rm{B}}}}}}}}}^{{{{\dagger}}} }(t)\exp \left\{\pm \mathop{\sum}\limits_{k}\frac{2{g}_{i}{\lambda }_{i,k}}{{\omega }_{k}}({b}_{i,k}^{{{{\dagger}}} }-{b}_{i,k})\right\}{U}_{{{{{{{{\rm{B}}}}}}}}}(t).$$
(56)

The Redfield equation corresponding to Eq. (55) is

$$\frac{\partial }{\partial t}{\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)=-i\left[{\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}(t)+a(t)\mathop{\sum}\limits_{i}{\kappa }_{i}{\sigma }_{x},{\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)\right]-\mathop{\sum}\limits_{i,\alpha }\left[{\sigma }_{i}^{\alpha },{{{\Lambda }}}_{i}^{\alpha }(t){\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)\right]+h.c.,$$
(57)

where

$${{{\Lambda }}}_{i}^{\alpha }(t)=a(t)\mathop{\sum}\limits_{\beta }\int\nolimits_{0}^{t}a(\tau ){K}_{i}^{\alpha \beta }(t,\tau ){\tilde{U}}_{{{{{{{{\rm{S}}}}}}}}}(t,\tau ){\sigma }_{i}^{\beta }{\tilde{U}}_{{{{{{{{\rm{S}}}}}}}}}^{{{{\dagger}}} }(t,\tau ){{{{{{{\rm{d}}}}}}}}\tau$$
(58a)
$${K}_{i}^{\alpha \beta }(t,\tau )=\left\langle {\xi }_{i}^{\alpha }(t){\xi }_{i}^{\beta }(\tau )\right\rangle$$
(58b)
$${\kappa }_{i}=\left\langle {\xi }_{i}^{\pm }(t)\right\rangle$$
(58c)

and

$${\tilde{U}}_{{{{{{{{\rm{S}}}}}}}}}(t,\tau )={T}_{+}\exp \left\{-i\int\nolimits_{\tau }^{t}{\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}(\tau ^{\prime} ){{{{{{{\rm{d}}}}}}}}\tau ^{\prime}\right\} ,\quad {\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}(t)=b(t){H}_{{{{{{{{\rm{prob}}}}}}}}}.$$
(59)

Here \({K}_{i}^{\alpha \beta }(t,\tau )\) is the two-point correlation function in the polaron frame [akin to the correlation function defined in Eq. (9)], and κi corresponds to the first order cumulant generator in Eq. (27) and is also known as the reorganization energy; it contributes a Lamb-shift-like term in Eq. (57). It is also worth mentioning that the polaron transformation (51) can be done partially, which means that in Eqs. (51) and (52), α can be summed over a subset of system-bath coupling terms.

To solve this form of the PTRE in HOQST, the user can define a new correlation function \({C}_{i}^{\alpha \beta }(t,\tau )=a(t)a(\tau ){K}_{\alpha \beta }(t,\tau )\) and use the Redfield solver. An alternative approach is to make the Markov approximation in Eq. (58a)

$$\int\nolimits_{0}^{t}a(\tau )\cdots {{{{{{{\rm{d}}}}}}}}\tau \to a(t)\int\nolimits_{0}^{\infty }\cdots {{{{{{{\rm{d}}}}}}}}\tau$$
(60)

and write Eq. (57) in Davies form29 (see Supplementary Note 4 for more details). This leads to the same expression as the AME [Eq. (38)], but with different Lindblad operators:

$${L}_{i}^{\omega ,\alpha }(t)=a(t)\mathop{\sum}\limits_{{\varepsilon }_{b}-{\varepsilon }_{a}=\omega }\left\langle {\psi }_{a}\right|{\sigma }_{i}^{\alpha }\left|{\psi }_{b}\right\rangle \left|{\psi }_{a}\right\rangle \left\langle {\psi }_{b}\right|,$$
(61)

where now \(\left|{\psi }_{a}\right\rangle\) is the energy eigenstate of the Hamiltonian \({\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}(t)\), and the noise spectrum is

$${\gamma }_{i}^{\alpha \beta }(\omega )=\int\nolimits_{-\infty }^{\infty }{K}_{i}^{\alpha \beta }(t){e}^{i\omega t}{{{{{{{\rm{d}}}}}}}}t.$$
(62)

Then the AME solver can be used to solve this Lindblad-form PTRE.

For example, the following ME can be derived for the entanglement witness problem following the aforementioned procedure:

$$\frac{\partial }{\partial t}{\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)=-i\left[{\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}(t)+{\tilde{H}}_{{{{{{{{\rm{LS}}}}}}}}}(t),{\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)\right]+{{{{{{{{\mathcal{L}}}}}}}}}_{{{\rm{A}}}}\left[{\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)\right]+{{{{{{{{\mathcal{L}}}}}}}}}_{{{\rm{P}}}}\left[{\tilde{\rho }}_{{{{{{{{\rm{S}}}}}}}}}(t)\right],$$
(63)

where

$${\tilde{H}}_{{{{{{{{\rm{S}}}}}}}}}(t)=-a(t)\mathop{\sum }\limits_{i=1}^{2}{\sigma }_{i}^{x}+b(t){H}_{{{{{{{{\rm{Ising}}}}}}}}},$$
(64)

and the Liouville operators \({{{{{{{{\mathcal{L}}}}}}}}}_{{{\rm{A}}}}\) and \({{{{{{{{\mathcal{L}}}}}}}}}_{{{\rm{P}}}}\) corresponds to the AME part and PTRE part of this equation, respectively:

$${{{{{{{{\mathcal{L}}}}}}}}}_{{{\rm{A}}}}(\rho )=\mathop{\sum }\limits_{i=1}^{2}\mathop{\sum}\limits_{\omega }\gamma (\omega )\left[{L}_{\omega ,i}(t)\rho {L}_{\omega ,i}^{{{{\dagger}}} }(t)-\frac{1}{2}\{{L}_{\omega ,i}^{{{{\dagger}}} }(t){L}_{\omega ,i}(t),\rho \}\right]$$
(65a)
$${{{{{{{{\mathcal{L}}}}}}}}}_{{{\rm{P}}}}(\rho )=\mathop{\sum}\limits_{\alpha \in \{+,-\}}\mathop{\sum}\limits_{\omega }{\gamma }_{{{\rm{P}}}}(\omega )\left[{L}_{{{{{{{{\rm{P}}}}}}}}}^{\omega ,\alpha }(t)\rho {L}_{{{{{{{{\rm{P}}}}}}}}}^{\omega ,\alpha {{{\dagger}}} }(t)-\frac{1}{2}\{{L}_{{{{{{{{\rm{P}}}}}}}}}^{\omega ,\alpha {{{\dagger}}} }(t){L}_{{{{{{{{\rm{P}}}}}}}}}^{\omega ,\alpha }(t),\rho \}\right],$$
(65b)

where the Lindblad operators are defined in Eqs. (39) and (61) respectively. The function γ(ω) is the standard Ohmic spectrum and γP(ω) is the polaron frame spectrum with a hybrid Ohmic form18,56 discussed in Supplementary Note 5. We provide the explicit form of γP(ω) here

$${\gamma }_{{{\rm{P}}}}(\omega )=\int K(t){e}^{i\omega t}{{{{{{{\rm{d}}}}}}}}t=\int \frac{{{{{{{{\rm{d}}}}}}}}x}{2\pi }{G}_{{{\rm{L}}}}(\omega -x){G}_{{{\rm{H}}}}(x){{{{{{{\rm{d}}}}}}}}x,$$
(66)

where

$${G}_{{{\rm{L}}}}(\omega )=\sqrt{\frac{\pi }{2{W}^{2}}}\exp \left[-\frac{{(\omega -4{\varepsilon }_{{{\rm{L}}}})}^{2}}{8{W}^{2}}\right],$$
(67)

and

$${G}_{{{\rm{H}}}}(\omega )=\frac{4\gamma (\omega )}{{\omega }^{2}+4\gamma {(0)}^{2}}.$$
(68)

GL(ω) is the contribution of low frequency component, characterized by the MRT width W. Because W and εL are connected through the fluctuation-dissipation theorem we have W2 = 2εLT; thus, hybridizing low frequency noise with an Ohmic bath introduces one additional parameter.

Numerical techniques

Redfield backward integration

To solve the Redfield or Redfield-like master equation (31), one needs to integrate the unitary US backward in time at each ODE step. Such integrations are computationally expensive for long evolution times and become the bottleneck of the solver. To improve the efficiency of the solver, we introduce an additional parameter Ta as the lower integration limit:

$${{{\Lambda }}}_{\alpha }(t)=\mathop{\sum}\limits_{\beta }\int\nolimits_{{T}_{a}}^{t}{C}_{\alpha \beta }(t-\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}(t,\tau ){A}_{\beta }(\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}^{{{{\dagger}}} }(t,\tau ){{{{{{{\rm{d}}}}}}}}\tau .$$
(69)

To justify this, note first that

$$\left\Vert \int\nolimits_{0}^{{T}_{a}}{C}_{\alpha \beta }(t-\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}(t,\tau ){A}_{\beta }(\tau ){U}_{{{{{{{{\rm{S}}}}}}}}}^{{{{\dagger}}} }(t,\tau ){{{{{{{\rm{d}}}}}}}}\tau \right\Vert \le \int\nolimits_{t-{T}_{a}}^{t}| C(\tau ^{\prime} )| {{{{{{{\rm{d}}}}}}}}\tau ^{\prime} ,$$
(70)

where is any unitarily invariant norm. To obtain this inequality, we perform a change of variable \(t-\tau \to \tau ^{\prime}\) and make use of the fact that the operator Aβ(t) can always be normalized by absorbing a constant factor into the corresponding bath operator Bβ. Second, note that in most applications the bath correlation function \(C(\tau ^{\prime} )\) decays fast compared with the total evolution time. As a result, the r.h.s. of Eq. (70) is small for sufficiently large t. The neglected part, i.e., the integral over [0, Ta], can thus be safely ignored so long as the r.h.s. of Eq. (70) is below the error tolerance of the numerical integration algorithm.

The same technique can also be applied to the ULE. The integration limits in Eqs. (35) and (36) can be localized around t, i.e. replaced by \(\int\nolimits_{t-{T}_{a}}^{t+{T}_{a}}\). However, choosing an appropriate Ta is a process of trial and error. The user needs to determine its value in a case-by-case manner.

Precomputing the Lamb shift

Instead of evaluating the Lamb shift (41) at each ODE step, to speed up the computations all the ME solvers support precomputing the Lamb shift on a predefined grid and use interpolation to fill up the values between the grid points.

Adiabatic frame

For a typical annealing process, the total annealing time is usually much larger than the inverse energy scale of the problem

$${t}_{f}\gg \frac{1}{{\min }_{s\in 0,1}\left[\max (A(s),B(s))\right]}.$$
(71)

Informally, the frequency of the oscillation between the real and imaginary part of the off-diagonal elements of ρS in the neighborhood of s is positively proportional to both A(s) and B(s). As a consequence, directly solving the dynamics in the Schrödinger picture is challenging because the algorithm needs to deal with the fast oscillations induced by the Hamiltonian, thus impacting the step size. HOQST includes an optional pre-processing step to rotate the Hamiltonian into the adiabatic frame57. If the evolution is in the adiabatic limit, the off-diagonal elements of the density matrix in this frame should approximately vanish. The fast oscillation is absent and a large step size can be taken by the ODE solver. This technique provides advantages if the user wishes to repeatedly solve the same problem with different parameters. See Supplement Method 1: Adiabatic frame for a brief summary.

Quantum trajectories method

HOQST implements a quantum-trajectory solver for the AME17. Using the native distributed memory parallel computing interface of both Julia and DifferentialEquations.jl, the quantum-trajectory simulations can take advantage of HPC clusters with minimum changes in the code. In addition, classical 1/f noise can be infused into the AME trajectory solver to generate the hybrid dynamics described in Eq. (49).