Preprint
Article

Using Basic Quantum Circuits to Simulate 1D Ising Model

Altmetrics

Downloads

335

Views

105

Comments

0

This version is not peer-reviewed

Submitted:

10 January 2024

Posted:

10 January 2024

You are already at the latest version

Alerts
Abstract
The Ising model, a cornerstone in the understanding of critical points, phase transitions, and magnetic systems, has been pivotal in advancing our knowledge of statistical physics. Although analytical solutions exist for the 1D and 2D Ising models, complexities rise significantly with the inclusion of external magnetic fields and in higher dimensions. Here, we demonstrate a novel quantum computational approach to simulate the 1D Ising model with basic quantum gates in the QISKIT(Python) that is both accessible to beginners and executable on personal computers, bypassing the need for advanced computational infrastructure. By initializing the system in a comprehensive superposition state, we effectively utilize quantum gates to replicate the intricate interactions between spins and external fields. This method offers a more intuitive and direct observational means of the system's evolution, distinguishing it from previous methodologies. Our results not only repeat all the physics behavior in the 1D Ising model but also showcase the expanding capabilities of quantum computing to tackle complex physical systems, promising advancements in both theoretical and applied physics.
Keywords: 
Subject: Physical Sciences  -   Quantum Science and Technology
The Ising model, despite its deceptively simple formulation, encapsulates a wealth of complex physics, making it a fundamental problem in the field. It serves as a key model for understanding critical points, phase transitions, and the exchange coupling in magnetic systems [1]. The model's versatility has spurred the development of various spin models, such as the XY and Heisenberg models, significantly advancing statistical physics. To date, rigorous analytical solutions have been formulated for both the 1D and 2D Ising models, while the 3D model remains an unresolved challenge for physicists worldwide. Beyond theoretical approaches, numerical methods such as the classical Monte Carlo method have been employed to tackle this problem from 1D to 3D [2].
Considering the 1D version with periodic boundary conditions (i.e. S 1 = S N ), the spins S i can take values ± 1 . The Hamiltonian of this system is represented as:
H = J i = 1 N S i S i + 1 h i = 1 N S i                     ( 1 )
Here, J denotes the exchange interaction (uniform across all neighboring spins, with J > 0 representing a ferromagnetic system and J < 0 an antiferromagnetic system), h is the external magnetic field, and N is the total number of spins. In this model, z =2 when considering only the nearest-neighbor interaction. The thermal fluctuation in the system is denoted by β , where β = 1 k B T . Here, k B is the Boltzmann constant, and T represents the temperature. The value of β inversely correlates with the thermal energy, influencing the spins' behavior. Among various methods to solve the Ising model, the mean-field approximation is one of the simplest, albeit with limitations. It omits thermal fluctuations and correlations between spins, leading to inaccuracies, particularly in predicting phase transitions. These shortcomings are addressed in more sophisticated solutions, like the transfer matrix method for the 1D case, which is shown in the Supplementary Information. This method accurately captures the critical phenomena and phase transitions in the Ising model, providing insights into the system's behavior at different temperatures and field.
In this paper, we introduce an innovative method to simulate the 1D Ising model using simple quantum circuits within the open-source software development kit QISKIT in python. This marks the first instance of such a simulation in QISKIT. Our method utilizes fundamental gates [3], including control-not, and X gates, to represent the nearest-neighbor exchange interaction, spin alignment in an external magnetic field, and thermal effects due to thermal fluctuations. Diverging from previous studies that relied on established results [4], our approach starts from a state of complete superposition, capturing all possible mixed states and their random evolution. This methodology provides a more holistic view of the system's dynamics. Furthermore, our quantum circuit is designed for execution on personal computers, making it accessible beyond the confines of specialized IBM servers. This novel approach not only offers a new perspective for understanding the Ising model but also demonstrates the expanding potential of quantum computing in solving complex physical systems.

Quantum Circuits Designed for the Ising Model

As have discussed in the previous section, we know that the final magnetization of the 1D Ising model is determined by the three free parameters J ,   β and h . In order to use quantum computing to simulate the system, we need to encode this information into the quantum circuits. For the exchange interaction with the nearest neighbor, we considered all eight possibilities for three qubits. We used the middle qubit as a reference to observe how the exchange interaction evolves the state, as illustrated in Figure 1a. It is observed that the middle spin flips only when the two nearest neighbors are identical but opposite to the middle reference spin. This suggests the use of the CCX gate to ensure that both sides are the same while controlling the middle state.
However, relying solely on the CCX gate is insufficient, as it would incorrectly flip states where all three spins are identical, such as in the and cases. To circumvent this, we employ an ancillary qubit to determine whether all three spins are identical. If they are, the middle spin undergoes an additional flip to rectify the erroneous flip. This correction does not interfere with cases like and , where the flip occurs only if all bits are the same. The final step involves resetting the ancillary qubit for reuse with the next spin. By looping this process across the entire 1D spin chain, we can effectively simulate the exchange interaction. Subsequent to this calculation, a random number generator produces a number between 0 and 1. In a manner akin to the classical Monte Carlo method, if the random number is smaller than e β , the corresponding spin is flipped. This approach is chosen because we assumed the exchange interaction, J , to be 1.
The spin alignment caused by the external magnetic field is also a key part in the Ising model. To make the problem easy to solve, we assume that the direction of the magnetic field is the same as what the | 0 〉 directs. Consequently, our objective is to implement a quantum operation that flips the state from | 1 〉 to | 0 〉, emulating the alignment of a spin with the magnetic field. The quantum circuit representing this magnetic field alignment is depicted in Figure 2a. In this setup, the flip operation is selectively applied only when the qubit state is | 1 〉.
To achieve this selective flipping, we employ an ancillary qubit in conjunction with a combination of controlled-NOT (CNOT) and controlled rotation gates. This configuration ensures that only the | 1 〉 state is flipped to | 0 〉, while | 0 〉 remains unaffected. Additionally, the ancillary qubit is reset after each operation to be reused for subsequent spins. It's important to note that the thermal effects are also taken into account in this simulation. Similar to what we have discussed above, if the random number is smaller than e β h , the corresponding spin will be flipped due to the thermal effect.

Spin Dynamics without an External Magnetic Field

Our simulation begins by examining an 8-spin Ising system in the absence of an external magnetic field. We opted for an 8-spin system as a balance between computational feasibility and the need for a sufficiently large system to align with the approximations inherent in the rigorous solutions. We define the step or the time in this simulation as the loop number of every spin being exposed to the quantum gates. As long as all the spins are being executed by the quantum gates, we assume the step or the time will add one more. To ensure statistical significance in line with the law of large numbers, we executed 100,000 shots for each configuration. On average, each data point takes about several hours to get. Figure 3(a) shows how the system evolves under the temperature that is very close to zero. As we can see, the system starts with the mixed states of all the possible states with equal possibilities. And after several steps, some possibilities disappears and some possible states are enhanced. And after long enough steps, the stable states finally appear with all the spin direct in the same direction, which agrees well with the phase transition at zero temperature.
The temperature dependent results, as depicted in Figure 3(b), cover a range from near absolute zero to approximately 10 k ~ 10 J k . From our analysis, several key features emerged. The first is the zero-temperature ferromagnetism. Consistent with the rigorous solution, we observed that the system exhibits ferromagnetic behavior (where the static magnetization reaches 1) exclusively at zero temperature. This aligns with the theoretical understanding that, in the absence of a magnetic field, the Ising model does not exhibit ferromagnetic order at finite temperatures. The second feature is that as the temperature increases, the average magnetization approaches zero, reverting to the initial state of the system. As displayed in Figure 3(c), we statistically show the absolute value of the average magnetization and its variation based on the last 10 steps of simulation. This trend is in line with physical intuition: higher thermal fluctuations disrupt the ability of spins to maintain macroscopic magnetization. Thus, at elevated temperatures, the system tends toward a disordered state, characterized by reduced magnetization. These simulation results underscore the critical role of temperature in influencing the magnetic properties of the Ising model and agree well with the rigorous solution, further confirming our quantum circuits are correct.

Simulation with a Magnetic Field

Next, we take the external magnetic field into account. Based on the rigorous solutions [5], as illustrated in the Supplementary Information, the magnetization m R S is described by the following formula:
m R S   ~ sinh β h sin h 2 β h + e 4 β J                     ( 2 )
We apply this formula to the 8-spin Ising model previously discussed. The simulation evolves over 15 steps, with statistics—average and variation—computed from the last ten steps to represent the average magnetization of the system. The magnetization under different temperatures and magnetic fields are shown in Figure 4. A notable uncertainty in our results can be attributed to the limited number of spins in the simulation. Operating with only 8 spins, a single spin flip within the ferromagnetic phase can cause the average magnetization to drop from 1 to 0.75, significantly impacting the outcome. Furthermore, our simulation results are consistently lower than theoretical predictions, which may be due to insufficient simulation steps. Certain data points suggest the need for extended simulation durations to allow the system to reach equilibrium. This extended time would likely lead to more accurate simulation results that are closer to theoretical expectations.

Conclusions

In this work, we have successfully utilized QISKIT to construct a simulation of the 1D Ising model using basic quantum gates. This simulation is accessible to novices in the field due to its reliance on fundamental quantum gates, and it is designed to be operable on standard personal computers, bypassing the need for specialized computational resources. Our approach initializes the system in a superposition of all possible mixed states, employing quantum gates to emulate the interactions between spins and between spins and an external field. This method presents a more instinctive and straightforward way of observing the system's evolution compared to earlier techniques. Our findings confirm the absence of a phase transition at finite temperatures within the 1D Ising model, providing a quantum computational perspective to a well-established concept in statistical mechanics. Furthermore, we demonstrate the potential of our program to be extended beyond the Ising model. By substituting the X gates with rotation gates of a specified angle, we can adapt the simulation to handle the XY model, allowing for a continuous range of spin states between 1 and -1. This versatility highlights the promising applications of quantum computing in advancing the study of complex physics systems and enriching our understanding of critical phenomena in statistical physics.

Supplementary Materials

The following supporting information can be downloaded at the website of this paper posted on Preprints.org.

Data Availability Statement

All data needed to evaluate the conclusions are available in the main text and the coding is open to access if requested by email. You may only use it for personal and non-commercial use.

Acknowledgement

Special thanks for the very helpful discussions with Songtao Chen (Rice University) and the strong support from Hanyu Zhu (Rice University).

Conflicts of Interest

The author declares no competing interests.

References

  1. Ising, E. Beitrag zur Theorie des Ferromagnetismus. Z. Physik 1925, 31, 253–258. [Google Scholar] [CrossRef]
  2. Brush, S.G. History of the Lenz-Ising Model. Rev. Mod. Phys. 1967, 39, 883–893. [Google Scholar] [CrossRef]
  3. Kaye, P.; Laflamme, R.; Mosca, M. An introduction to quantum computing. (Oxford University Press, 2007).
  4. Cervera-Lierta, A. Exact Ising model simulation on a quantum computer. Quantum 2018, 2, 114. [Google Scholar] [CrossRef]
  5. Pathria, R.K.; et al. Statistical Mechanics. 2011. [Google Scholar]
Figure 1. Encoding exchange interaction in quantum circuits. (a) This panel illustrates all possible states of three qubits in a nearest-neighbor configuration. We utilize the central qubit (q1) as a reference point for our analysis. (b). The quantum circuits encoding the exchange interaction between the targeted spin (q1) and its neighboring spins (q0 and q2), facilitated by the use of an ancillary qubit (q3).
Figure 1. Encoding exchange interaction in quantum circuits. (a) This panel illustrates all possible states of three qubits in a nearest-neighbor configuration. We utilize the central qubit (q1) as a reference point for our analysis. (b). The quantum circuits encoding the exchange interaction between the targeted spin (q1) and its neighboring spins (q0 and q2), facilitated by the use of an ancillary qubit (q3).
Preprints 95993 g001
Figure 2. Encoding the external magnetic field into the quantum circuits. (a) This panel demonstrates the "flip effect," where any state orienting opposite to the external magnetic field is flipped to align with the field. States already aligned with the field direction remain unchanged. (b) The quantum circuit depicted here encodes the effect of the external magnetic field on the target spin q1, utilizing the ancillary qubit q3.
Figure 2. Encoding the external magnetic field into the quantum circuits. (a) This panel demonstrates the "flip effect," where any state orienting opposite to the external magnetic field is flipped to align with the field. States already aligned with the field direction remain unchanged. (b) The quantum circuit depicted here encodes the effect of the external magnetic field on the target spin q1, utilizing the ancillary qubit q3.
Preprints 95993 g002
Figure 3. Spin dynamics in 1D Ising model without external magnetization. (a). This panel illustrates the dynamic process of all spins at zero temperature, showing the spontaneous magnetization of the system in the absence of thermal fluctuations. (b). The evolution of the average magnetization amplitude under varying temperatures when no external magnetic field is present. (c). The relationship between the average magnetization after a certain evolution time and the temperature. It underscores the absence of a phase transition in the 1D Ising model at finite temperatures, showcasing the model's characteristic behavior in different thermal conditions.
Figure 3. Spin dynamics in 1D Ising model without external magnetization. (a). This panel illustrates the dynamic process of all spins at zero temperature, showing the spontaneous magnetization of the system in the absence of thermal fluctuations. (b). The evolution of the average magnetization amplitude under varying temperatures when no external magnetic field is present. (c). The relationship between the average magnetization after a certain evolution time and the temperature. It underscores the absence of a phase transition in the 1D Ising model at finite temperatures, showcasing the model's characteristic behavior in different thermal conditions.
Preprints 95993 g003
Figure 4. Field dependent final states at different temperatures. The red dots are the simulation results under the temperature where T ~ 0.43 J k ( e β = 0.1 ) in (a), T ~ 0.83 J k ( e β = 0.3 ) in (b), T ~ 1.43 J k ( e β = 0.5 ) in (c). Theoretical values are illustrated in the grey curve.
Figure 4. Field dependent final states at different temperatures. The red dots are the simulation results under the temperature where T ~ 0.43 J k ( e β = 0.1 ) in (a), T ~ 0.83 J k ( e β = 0.3 ) in (b), T ~ 1.43 J k ( e β = 0.5 ) in (c). Theoretical values are illustrated in the grey curve.
Preprints 95993 g004
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

© 2024 MDPI (Basel, Switzerland) unless otherwise stated