Simulating thermal qubits through thermofield dynamics

Quantum computing has attracted the attention of the scientific community in the past few decades. The development of quantum computers promises one path toward safer and faster ways to treat, extract, and transfer information. However, despite the significant advantages of quantum computing, the development of quantum devices operating at room temperature has been compromised by the thermal decoherence process. In addition, in most undergraduate and graduate quantum mechanics courses, the study of thermofield dynamics is usually neglected. In this scenario, this work explores a didactic approach to simulate thermal qubit systems through Thermofield Dynamics (TFD), applied in a quantum computing setup. The results show that the Bloch sphere representation for a qubit can be written in terms of the Bogoliubov transformation, which allows a practical construction for the thermal qubits in a quantum computing setup. Therefore, this work introduces thermofield dynamics through quantum computing to teachers and curious students interested in teaching and learning this important field of studying the temperature impacts on quantum protocols using the TFD technique.


I. INTRODUCTION
In the past few years, we have seen the emergence of several technologies based on quantum properties of advanced materials [1][2][3][4][5][6][7][8][9][10].However, the advantages of these quantum technologies are compromised since it is impossible to decouple the system from its surroundings and the decoherence phenomena are inevitable [11].Quantum features such as entanglement [12] and coherence [13], for instance, are extremely sensitive to thermal coupling, compromising their usability at room temperature and, consequently, the development of quantum technologies under room conditions [9,11,12].
As a consequence, the study of thermal effects on the dynamics of quantum systems has attracted the attention of the scientific community [14][15][16][17][18][19][20][21][22].In this scenario, the Thermofield Dynamics (TFD) appears as a useful approach since it allows the treatment of temporal and thermal contributions equally [14,[16][17][18][19][23][24][25][26].Therefore, TFD is a natural approach to studying quantum states at finite temperatures.In contrast to other finite-temperature quantum field theories, which employ imaginary-time based on path integrals, the TFD formalism differs by doubling the degrees of freedom in a Hilbert space and applying a temperaturedependent Bogoliubov transformation [27].The application of higher-dimensional Hilbert spaces has been used for simplifying quantum logic in the construction of quantum circuits [28].On the other hand, the TFD approach gives an advantage in studying gate-based quantum computers because it is a real-time operator-based approach, using Bogoliubov transformations of quantum field theory at finite temperature [23].
In this context, this theory has shown great potential for studying the thermal properties of qubit systems regarding the development of quantum protocols at finite temperatures [14,17,[23][24][25][26]29].In addition, applying higherdimensional Hilbert spaces have been used to simplify quantum logic in the construction of quantum circuits [28].Implementing qubits and logical gates at finite temperature using TFD formalism has long been a question of great interest in the past few years [14,17,23,24,26,29,30].As a result, the realization of simulation of thermal qubits using variational methods was developed [17,23,24,30], and recently it was demonstrated that the verification of TFD doubled state on a trapped-ion quantum computer [25].Furthermore, since quantum computers can model other quantum mechanical systems, the preparation of thermal equilibrium states in quantum computers can be used to study temperaturedependent quantum phenomena [14,19].
In this context, this paper investigates a teaching approach for simulating thermal qubit systems using Thermofield Dynamics (TFD) in a quantum computing environment.The primary objective is to present a proof-of-concept for implementing thermal qubits in a quantum computing configuration using the TFD theory, in a manner that is accessible to undergraduate students with an interest in this important and expansive field of quantum physics.We assume that the readers have knowledge of the well-known quantum mechanics and quantum computing fundamentals [31] Exploiting that the TFD formalism uses dual states to express temperature dependence [23], we show how to build a Bloch sphere representation for a two-level quantum system (qubit) in terms of the Bogoliubov transformations.The thermofield-double qubits were simulated using the quantum information software development kit -IBM Qiskit, available on the IBM Quantum Experience platform [32][33][34][35], available free of charge and easily accessible to students.
Using the TFD algebraic approach, we show the imple-mentation of the famous quantum teleport algorithm at finite temperatures.The results show that using Bloch sphere representation for a qubit, written in terms of the Bogoliubov transformation, allows the construction of thermal qubits in a quantum computing setup, making it more intuitive and approachable for quantum algorithm developers.Consequently, the algebraic method of TFD theory makes modeling quantum protocols at finite temperatures easier for quantum algorithm developers, lowering the number of quantum gates required.This decrease in gates simplifies quantum logic opening a large avenue for the teaching and learning of thermal effects on quantum protocols.Therefore, this work provides an enticing introduction to thermofield dynamics via quantum computing, aimed at undergraduate teachers, and inquisitive undergraduate and graduate students, interested in teaching and learning this significant and extensive field of researching the thermal effects on quantum protocols.The codes used in this article are accompanied by detailed protocols throughout the text 1 , enabling readers to replicate and apply them to their own quantum computing initiatives, even if they have limited experience in scientific computing.

II. THERMOFIELD DYNAMICS
Thermofield Dynamics (TFD) is an approach to quantum field theory at finite temperature [19,27,37,38].Different from other finite-temperature quantum field theories, based on fictitious imaginary times [37,38], the TFD formalism emerges as a natural way of describing the thermal phenomena in a real-time operator-based approach through the doubling of the Hilbert space and the applying of the Bogoliubov transformations [27,37,38].
In this scenario, the tilde (∼) conjugate rules give the doubling of Hilbert space, where the thermal space can be defined as S T = S ⊗ S, with S being the standard Hilbert space and S being the tilde (dual) space [27,38].This doubling is defined by the mapping (∼) : S → S, which connects each operator in S to each operators in S , such as Thus, the relationship between the tilde A i and non-tilde A i operators can be defined as: with ξ = −1 for bosons and ξ = +1 for fermions [27,37,38].
On the other hand, a Bogoliubov transformation, U(α), is used to introduce thermal effects by inducing a rotation between the tilde and non-tilde variables, and it is defined as 1 In addition, the codes used in this work are also available on GitHub [36].

A. Boson representation for the SU(2) algebra
In order to introduce the concept of a thermal qubit, one can use an alternative algebraic approach to studying twolevel systems as spin-1/2, for instance, through a boson representation of SU(2) algebra [27].In this context, the ladder operators can be defined as and Consequently, for each spin variable, we get Then one can define where a 1 and a 2 satisfying the double boson algebra with i, j = 1, 2, and all other commutations being zero.Thus, the connection to the original SU(2) algebra can be recovered assuming n 1 = s + m, n 2 = s − m,, where n i = a † i a i , with s and m are related to the usual results σ 2 |s, m⟩ = s(s + 1)|s, m⟩, σ z |s, m⟩ = m|s, m⟩ The rules for applying S ± operators to states are as follows: It is worth noting that, S − |0, 1⟩ = 0, i.e. |0, 1⟩ is the vacuum state for S − .Due to the fact that this represents a two-level system, one can represent a ground state and an excited state from an energetic point of view.In this context, the corresponding basis of this Hilbert space can be redefined as where |0⟩ is the ground state, and |1⟩ is the excited one.Thus, one can construct the doubled Hilbert space in order to build the thermal algebra and consequently simulate thermal qubits.

B. Thermo-SU(2) algebra
In order to double the SU(2) algebra, one needs to define the set of conjugation rules, which results in the following non-vanishing commutation rules Due to the fact that a unitary operator U(β) can be assumed as a canonical transformation, for the algebra which characterizes the physical system, the so-called TFD thermal operators can be defined by where U(β) corresponds to the Thermal Bogoliubov Transformation.As a consequence, the thermal operators fulfill the following requirement of destroying the so-called thermal vacuum states |0(β)⟩: where with Z(β) = 1 + e −βω being the canonical partition function, and The thermal vacuum states |0(β)⟩ can be defined as the vacuum of the field emerging in a thermal bath, being an alternative way to represent the temperature in quantum mechanics in an algebraic perspective without the need for quantum statistics [27].In this scenario, the Bogoliubov transformations can be seen as a rotation in the duplicated Hilbert space which leads to the creation of thermal effects [37,38].

III. THERMAL QUBITS
Let us consider the particular case of a two-level system (qubit).From Eq. ( 13) one can define the thermal vacuum qubit or thermal qubit [14] as It is worth noting that, since the double thermofield is always in the same state as the real fermion, the mixed states |1, 0⟩ and |0, 1⟩ cannot be seen [27,37,38].
In this regard, rewriting Eq. ( 15) as leads Eq. ( 16) to a form that resembles the geometrical representation for a pure state of a two-level quantum system, the so-called Bloch Sphere representation of a qubit [31]: where: Thus, as a remarkable result, the thermal vacuum can be represented in a quantum circuit setup as sketched in Fig. 1.The circuit is created in order to implement the Bogoliubov transformation using the geometrical ideas of the Bloch sphere representation.The operator represents a rotation of an angle θ around Y-direction on the non-tilde qubit |0⟩, while the CNOT gate [31], controlled by the non-tilde qubit, targets the tilde one, doubling the Hilbert space in this way.
. Sketch of the circuit that implements the Thermal Bogoliubov Transformation by applying the TFD approach for a single twolevel quantum system.The state |0⟩ is ground state in the S Hilbert space, while | 0⟩ is the ground state of the S one.
It is worth noting that this procedure is only possible due to the boson representation of SU(2) algebra reported previously in this section.This representation gives us a short circuit obtained through the analytical construction of the Bogoliubov transformation.Moreover, this result can be compared with the literature in the example reported in reference 23.In this reference, the authors use a function of IBM Qiskit [32] that decomposes a given unitary matrix into quantum gates.However, it currently only works for 2-qubit, while the circuit shown in Fig. 1 can be implemented as a subroutine limited only by the number of qubits present in a given quantum computer.In addition, using the Bogoliubov transformation approach also differs from other results reported recently in references 24, and 30, since it does not use a variational approach for simulating thermal qubits.Therefore, using the algebraic approach of TFD theory can make the simulation of quantum protocols at finite temperatures more intuitive for quantum algorithm developers, reducing the number of quantum gates needed for its implementation.This reduction of the number of gates can open a large avenue for the teaching of thermal effects on quantum protocols since it reduces the cost of implementing thermal qubits, simplifying the quantum logic in the circuits [28,39,40].
From Eq. ( 18), the angle θ in the Bloch sphere representation can be defined only by the reciprocal temperature β.Thus, one can conclude that where in Eq. ( 20) we have the non-physical (infinity temperature) maximally thermal vacuum and Eq. ( 21) the non-thermal qubit.Therefore, increasing the temperature (β → 0) will populate both ground and excited states equally, reaching the maximally thermal vacuum, Eq. ( 20).Consequently, decreasing it (β → ∞) leads the system to the non-thermal state [23].This result can be simulated by implementing the circuit sketched in Fig. 1 in a quantum computing setup using the IBM Qiskit framework [32].Qiskit consists of a platform that enables high-level programming, serving as both a software development platform and a Quantum Computing language2 .

A. Quantum algorithm
After installing a Python language compiler and Qiskit module 3 , the readers are ready to learn how to write code to simulate their thermal qubits through TFD by constructing circuits and executing them on their own personal computers.To initiate the program, it is necessary to import the following modules into the Python environment: qiskit: the main module, used for designing the quantum circuits and execute the quantum algorithms [42, 43, 45]; qiskit.circuit: to import the sequence of coherent quantum operations used in quantum computing.[42,43,45]; numpy: to create a mathematical workspace that involves multidimensional arrays and matrices, utilizing a vast range of mathematical functions available [46]; matplotlib: used for generating graphs or creating data visualizations in general [47]; The thermal vacuum state can be checked by measuring the corresponding qubits, the reader can measure the associated qubits and interpret the results using a classical computer.The outcomes of each qubit's measurement can be stored as classical bits (either 0 or 1) in the circuit's defined classical bits [33].Qiskit offers a powerful solution for running quantum simulations on quantum processors using the cloud access to the IBM Quantum Experience platform [48], through the IBM Q Provider element [32,[42][43][44].By specifying the number of circuit repetitions (or shots), the simulator obtain the counts for every measurement outcome in the final state.In order to utilize the IBM Q Experience through Qiskit and run projects on real quantum processors 4 , it is necessary to create a free account.This can be done by accessing the "My Account" settings in IBM Q Experience [48].Once the API token is obtained, IBM Q devices can be accessed from a home computer using Qiskit.To simulate the quantum circuit in the IBM quantum processor using a home-classical computer, use the following commands: Therefore, the thermal vacuum probabilities can be calculated by dividing the state counts by the number of shots.Fig. 2 shows the thermal vacuum probabilities as a function of the reciprocal temperature (β) and the angle θ.Dashed (red) and solid (blue) lines represent the theoretical probabilities for the ground |0, 0⟩ and excited |1, 1⟩, and are obtained from the square modulus of the probability amplitudes a and b in Eq. (18).The crosses and open circles represent the results obtained from the simulation of the thermal qubit in a real quantum processor, available in the backend ibmq lima.
As can be seen in Fig. 2 (a), according to Eq.( 21), thermal qubit at high temperature (low β) is a superposition of the states |0, 0⟩ and |1, 1⟩.This superposition decays exponentially until the qubit becomes the non-thermal state |0, 0⟩ when the temperature drops (β rises), Eq. ( 20).In Fig. 2 (b) we have the same prediction of Fig. 2 (a), but now in terms of θ.It should be noted that θ ∈ [0, π/2] when β ∈ [0, ∞], this result is in agreement with of quantum field theories at finite temperature that see β as a compactification of a time dimension [37,38].
Similar results were recently shown in reference 23 in terms of β.However, the authors used a function UnitaryGate available in IBM Qiskit, which creates a quantum gate from a numeric unitary matrix [32].On the other hand, the result showed in Fig. 2 is directly obtained from the Bloch sphere representation in terms of the Bogoliubov transformations, obtained from the circuit shown in Fig. 1, in which the angle of rotation in the R y (θ) gate defines the temperature.

IV. QUANTUM TELEPORTATION AT FINITE TEMPERATURE
In this regard, one can apply the formalism shown in this section in order to simulate a quantum algorithm involving thermofield states.As an example, we will simulate the quantum teleportation of thermofield states, a problem that has been previously discussed in reference 26.In this reference, the quantum teleportation of thermal qubits will consist of the transmission of a non-thermal qubit |0, 0⟩ into a thermal reservoir between two parties, conventionally known as Alice and Bob, spatially separated [26,31].Thus in the doubled Hilbert space representation, we have |0, 0⟩ → |0(β)⟩.
Initially, Alice has only a single copy of a non-thermal qubit, and she wants to send this qubit to Bob's thermal reser-voir.Thus, Alice prepares the qubit whose information will be sent and uses a second (auxiliary) thermal vacuum state which will be maximally entangled to a third thermal vacuum state (auxiliary) belonging to Bob, who will receive Alice's nonthermal qubit.In the following, Alice performs measurements on its two thermal qubits and informs her results through a classical channel to Bob.Finally, with this (classical) information, Bob properly performs a set of (quantum) operations in your thermal vacuum state to retrieve the non-thermal qubit sent by Alice in his thermal reservoir [26].Therefore, at the end of the teleportation, the initial non-thermal qubit |0, 0⟩ acquires the temperature information of Bob's thermal reservoir, becoming the thermal qubit |0(β)⟩ in the doubled Hilbert space representation of the TFD approach, Eq. ( 15).
From this protocol, one can build the circuit in IBM Qiskit that simulates this procedure, as shown in Fig. 3.The algorithm is divided into five main steps, described as follows.
(I) Preparing the thermal vacuum states.Since the usual teleport algorithm uses three qubits [31], the TFD's version needs six qubits in order to implement Bogoliubov's transformations.The first four qubits {q 1 , q1 , q 2 , q2 } belongs to Alice, while the last two {q 3 , q3 } belongs to Bob.Thus, the first step of the circuit (after calling the packages as presented in Box 1) is to create the circuit registers: Box 4: Creating the circuit register for the TFD teleportation algorithm # Creating registers qreg_q = QuantumRegister(6, 'q') creg_c = ClassicalRegister(2, 'c') circuit = QuantumCircuit(qreg_q, creg_c) In addition, Alice's first two qubits {q 0 , q0 } are prepared on a non-thermal state in the doubled Hilbert space using the general U-gate defined as applied in the tilde and non-tilde qubits: Box 5 displays the code used to initialize Alice's non-thermal state.: Box 5: Initialization of Alice's non-thermal state #Alice prepares her non-thermal state to be →teleported circuit.u(alpha,beta,gamma,qreg_q[0])circuit.u(alpha,beta,gamma,qreg_q[1]) The parameters alpha, beta and gamma on Box 5 can be selected by the user in order to initialize the state to be teleported.

#Alice decodes her non-termal state into his
→auxiliary thermal vacuum state circuit.cx(qreg_q[0],qreg_q [2]) circuit.h(qreg_q[0])circuit.cx(qreg_q[1], qreg_q [3]) circuit.h(qreg_q[1]) circuit.barrier()(IV) Conditioned operations.The following step would be for Alice to perform measurements on her qubits.Depending on the results, contact Bob through a classic channel to inform the corrections that Bob must apply in his state in order to finish the teleportation process, and he can retrieve the non-thermal qubit sent by Alice.This step can be performed through an operation conditioned to the result of Alice's measurements.However, IBM QE does not allow the implementation of this type of port conditioned to a classic channel [32].In this case, we can replace it with the CNOT and Z-Controlled gates.In this regard, Alice performs controlled gates on Bob's thermal vacuum state using her qubits as controls.Thus, we were able to modify the original circuit without changing its main objective.The following Box #Alice performs conditioned gates targeted →to Bob's thermal vacuum state circuit.cx(qreg_q[2], qreg_q [4]) circuit.cz(qreg_q[0],qreg_q [4]) circuit.cx(qreg_q[3], qreg_q [5]) circuit.cz(qreg_q[1], qreg_q [5]) circuit.barrier()(V) Measurement in Bob's vacuum state.Finally, Bob measures his thermal vacuum state, retrieving the non-thermal qubit sent by Alice into his thermal reservoir as the thermal qubit |0(β)⟩, Eq. (15).The following Box exhibits the code for this step: Box 10: Measuring Bob's thermal vacuum state.# Bob's measurements circuit.measure(qreg_q[4], creg_c[0]) circuit.measure(qreg_q[5], creg_c [1]) circuit.draw(output='mpl')Thus, one can simulate the teleport algorithm through TFD algebraic perspective (Fig. 3) using IBM Qiskit.For the sake of simplicity, we chose the angles {α = π, β = 0, γ = pi in Eq. ( 22), during step I (Box 4).Thus, Alice sends the non-thermal state |1, 1⟩.Moreover, considering the microwave frequency ℏω = 1.5x10 −22 J in Eq. ( 18), one can prepare the thermal vacuum states |0(β)⟩ A and |0(β)⟩ B at the finite temperature 72 K, by selecting the parameter θ = π/3 in the step I (Box 5).In this regard, one can simulate quantum teleportation at a finite temperature (Fig. 3) in both ideal and real quantum processors [33].Qiskit provides a Quantum Assembly Language (QASM) simulator for quantum simulation on personal computers [32,[42][43][44].This tool is an integral part of the module and is specifically designed to emulate the execution of quan-tum circuits on a local classical processor.This enables us to emulate an ideal quantum processor without any external environmental disturbances.On the other hand, in addition to being able to simulate our quantum circuit on a numerically emulated ideal processor on a home-classical computer, we can also run our projects on real quantum processors using the IBM Q Experience through the IBM Q Provider element (as shown in Box 3).In the following, Box 11 shows the code for running the quantum teleportation at a finite temperature (Fig. 3) in both ideal and real quantum processors: Fig. 4 shows the probability distributions for this teleport algorithm simulated in ideal quantum processor (QASM simulator [49]) and the 7-qubit real quantum processor ibm lagos 5 .As can be seen, the state measured in Bob's vacuum state |0(β)⟩ B was, in a good approximation, the thermal qubit state which is in agreement with the application of the Thermal Bogoliubov Transformation, Eq. ( 14), on Alice's non-thermal state |1, 1⟩, with corresponding temperature 72 K. Thus, the non-thermal state sent by Alice acquires the temperature information of the bath, becoming a thermal qubit in agreement with the presented Thermofield Dynamics model.The ideal processor numerically emulates the quantum circuit execution shown in Fig. 3 (a), without any influence from external perturbations due to the inevitable coupling between quantum information processing systems and the external environment.The simulation returns the counts of each mea-surement in the final thermal state for the given set of 20000 shots.However, even if no decoherence act and no additional errors affect the system statistics, due to the fact that the number of shots is not large enough, one can still notice a slight statistical discrepancy between the obtained result and the theoretically expected result observed in Fig. 2 (b).On the other hand, in the real quantum processor, noise and other decohering processes lead to imprecision in the fine control of the qubits, causing systematic errors in the implementation of logic gates, which explains the appearance of the states |0, 1⟩ and |1, 0⟩.Nevertheless, these results show a proof of concept regarding the implementation of thermal qubits through the TFD approach.Therefore, using the Bloch sphere representation in terms of the Bogoliubov transformation allows the construction of thermal qubits in a quantum computing setup, opening a large avenue for future research toward the study of thermal effects in the development of optimal quantum protocols.

V. CONCLUSION
In summary, this work shows how quantum computing can be a useful tool for teaching the Thermofield Dynamics and the Blogoliobov transformations in a practical way.We show a didactic implementation of thermal vacuum qubits in a quantum computing setup, using an algebraic approach accessible to most undergraduate physics students.The Bloch sphere representation for a qubit is built in terms of the Bogoliubov transformations, and the thermofield-double space is simulated through the IBM Qiskit.The approach reported in this work can be implemented as a practical algebraic framework in undergraduate and graduate classrooms to study the thermal effects of the TFD approach using quantum computing.The presented examples show that constructing thermal qubits using TFD in a quantum computing setup can be more intuitive and approachable for professors, students, and even quantum algorithm developers.The presented method appears as an alternative to the complicated variational approach methods used in the literature up to date [24,30], reducing the number of quantum gates and processes needed for the implementation of the thermal qubits.In addition, the use of TFD theory for quantum computing opens a large avenue for physics teaching on the thermal effects on quantum protocols, which can be a path toward the understanding of the cost of implementation of thermal quantum algorithms.Therefore, this work highlights the potential of TFD algebraic perspective in quantum computing to encourage the study of optimal quantum protocols.
those of the authors, and do not reflect the official policy or position of IBM or the IBM Quantum team.
qiskit.tools.monitor:used to monitor the realtime execution of our algorithms in a real quantum computer by utilizing the job monitor function [42, 43, 45]; qiskit.visualization:used to visualize the probability distributions through the function plot histogram.This modules can be imported in the Python environment using the code: Box 1: Importing the Packages from qiskit import * from qiskit.circuitimport * import numpy as np import matplotlib.pyplotas plt from qiskit.tools.monitorimport job_monitor from qiskit.visualizationimport →plot_histogram The next step is to define the rotation angle θ of the nontilde qubit performed by the operator R y (θ) in Eq. (19).Thus, we can represent the thermal vacuum in quantum circuit as Box 2: Creating the Thermal Vacuum State # Define a variable theta to be a parameter →with name 'theta' theta = Parameter('theta') # Set number of qubits and classical bits to →2 qubits_count = 2 bits_count = 2 # Initialize a quantum circuit with two →qubits qc = QuantumCircuit(qubits_count,bits_count) # Add a parametrized RX rotation on the qubit qc.ry(theta,0) qc.cx(0,1) qc.draw(output='mpl')

Figure 2 .
Figure 2. (a) Probabilities of the thermal vacuum state in terms of the reciprocal temperature β (dimensionless units).(b) Probability amplitude of the thermal vacuum in terms of θ (rad).Dashed (red) and solid (blue) lines represent the theoretical probabilities for the ground |0, 0⟩ and excited |1, 1⟩, respectively.They are obtained from the square modulus of the probability amplitudes a and b in Eq. (18).

Figure 4 .
Figure 4. Probability distribution for the teleportation algorithm at finite temperature simulated for 8000 shots in (a) an ideal quantum processor (QASM simulator [49]), and (b) a 7-qubit real quantum processor ibm oslo.The simulation is performed considering the frequency ω = 1.5 • 10 29 s −1 and 145 K for the temperature of the thermal vacuum states.