Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tutorials (TFI, time-evolution, and finite-temperature) #81

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/sphinx/en/tutorial/simple_tutorial-1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Ising model with transverse magnetic field
---------------------------------------------

This section presents a calculation of the transverse magnetic field Ising model as an example.
The Hamiltonian is

.. math::

\begin{aligned}
H = J^z \sum_{\langle i,j \rangle} {S}_i^{z} {S}_j^{z} - h^x \sum_i S_i^x.
\end{aligned}

Please note that the model is defined using spin operators of size 1/2, not Pauli operators.
By changing the variable ``hx`` in the input file,
the magnitude of the transverse magnetic field will be modified.
For example, when the transverse magnetic field is 0, the input file is
Expand Down
64 changes: 61 additions & 3 deletions docs/sphinx/en/tutorial/simple_tutorial-7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
Real-Time Evolution of the Transverse Field Ising Model
--------------------------------------------------------

Here, we introduce a calculation example for the real-time evolution of the Ising model on a square lattice when a transverse magnetic field, denoted by ``hx``, is applied. The input and script files used in this tutorial can be found in ``sample/07_timeevolution``.
Here, we introduce a calculation example for the real-time evolution of the Ising model on a square lattice when a transverse magnetic field, denoted by ``hx``, is applied.
The Hamiltonian is

.. math::

\begin{aligned}
H = J^z \sum_{\langle i,j \rangle} {S}_i^{z} {S}_j^{z} - h^x \sum_i S_i^x.
\end{aligned}

Please note that the model is defined using spin operators of size 1/2, not Pauli operators.
The input and script files used in this tutorial can be found in ``sample/07_timeevolution``.

Initially, we compute the ground state (refer to the ``simple.toml`` file) which serves as our starting state. Specifically, it's set as:

Expand All @@ -15,7 +25,45 @@ Next, we prepare the input file for the real-time evolution. This can be achieve

.. literalinclude:: ../../../../sample/07_timeevolution/simple_te_strong.toml

In this case, the transverse field is set to ``hx = 2.0``, and the time-step for evolution is ``tau = 0.01``. Moreover, since we are utilizing the ground state as our initial condition, we load the state tensor with ``tensor_load = "save_tensor"``. For observing the time evolution with different transverse magnetic fields, we've also prepared sample input files named ``simple_te_middle.toml`` and ``simple_te_weak.toml``. Additionally, there's a script named ``run.sh`` to execute these calculations in one go. Ensure that paths to tools like ``tenes`` are set correctly, and then execute the calculations with:
In this case, the transverse field is set to ``hx = 2.0``, and the time-step for evolution is ``tau = 0.01``.
Moreover, since we are utilizing the ground state as our initial condition, we load the state tensor with ``tensor_load = "save_tensor"``.

Once preparing the input file, we execute ``tenes_simple``, ``tenes_std``, and ``tenes`` in order. The results are saved in the ``output_te_strong`` directory.
Basically, the output is the same as the ground state, but with the addition of time in the first column.
For example, ``FT_density.dat`` records the expectation values of physical quantities over time::

# The meaning of each column is the following:
# $1: time
# $2: observable ID
# $3: real
# $4: imag
# The meaning of observable IDs are the following:
# 0: Energy
# 1: Sz
# 2: Sx
# 3: Sy
# 4: bond_hamiltonian
# 5: SzSz
# 6: SxSx
# 7: SySy

0.00000000000000000e+00 0 -5.00184764052080899e-01 0.00000000000000000e+00
0.00000000000000000e+00 1 4.99999945646528332e-01 0.00000000000000000e+00
0.00000000000000000e+00 2 9.24306486797199186e-05 0.00000000000000000e+00
0.00000000000000000e+00 3 2.34088935337348195e-06 0.00000000000000000e+00
0.00000000000000000e+00 4 -5.00184764052080899e-01 3.47535331983321418e-21
0.00000000000000000e+00 5 4.99999902788251294e-01 -8.46256269499545126e-22
0.00000000000000000e+00 6 1.12653588020163689e-05 6.35907290717320676e-22
0.00000000000000000e+00 7 -1.12840199341671039e-05 -2.06527532941704114e-21


The second column represents the type of physical quantity, and in this case, ``1`` represents the longitudinal magnetization :math:`m^z = \langle S^z \rangle`.
We can extract the time evolution of the magnetization by extracting rows with the second column equal to ``1``::

awk '$2 == 1 {print $1, $3, $4}' output_te_strong/TE_density.dat > magnetization_strong.dat

For observing the time evolution with different transverse magnetic fields, we've also prepared sample input files named ``simple_te_middle.toml`` (``hx = 0.8``) and ``simple_te_weak.toml`` (``hx = 0.5``).
Additionally, there's a script named ``run.sh`` to execute these calculations in one go. Ensure that paths to tools like ``tenes`` are set correctly, and then execute the calculations with:

::

Expand All @@ -35,10 +83,20 @@ This will plot the temporal evolution of magnetization, :math:`S_z`. The result

Graph illustrating the real-time evolution of the Ising model. The vertical axis represents magnetization, and the horizontal axis represents time.


When the strength of the transverse-field exceeds the quantum phase transition point, the magnetization oscillates beyond 0 :ref:`[DQPT] <Ref-DQPT>`.

As time evolution progresses, the entanglement increases. At a certain point, the tensor network's capacity may be insufficient to express the wave function. In our case, the jump at ``t=4.25`` for ``hx=2.0`` indicates this issue. When applying this in practice, ensure no such discontinuities exist. If jumps are observed, steps like increasing the ``virtual_dimension`` might be necessary. For instance, adjusting it to ``virtual_dimension = 10`` and redoing the calculation as described above will eliminate the discontinuity, as can be seen in :numref:`fig_tutorial7_te_D10`.

.. figure:: ../../img/tutorial_07_timeevolution_D10.*
:name: fig_tutorial7_te_D10
:width: 600px

Graph showcasing the real-time evolution of the Ising model. The vertical axis denotes magnetization, while the horizontal axis represents time. Results when ``virtual_dimension = 10`` are applied.
Graph showcasing the real-time evolution of the Ising model. The vertical axis denotes magnetization, while the horizontal axis represents time. Results when ``virtual_dimension = 10`` are applied.


.. rubric:: Reference

.. _Ref-DQPT:
[DQPT]
M. Heyl, A. polkovnikov, and S. Kehrein, *Dynamical Quantum Phase Transitions in the Transverse-Field Ising Model*, Phys. Rev. Lett. **110**, 135704 (2013). `link <https://doi.org/10.1103/PhysRevLett.110.135704>`__
68 changes: 63 additions & 5 deletions docs/sphinx/en/tutorial/simple_tutorial-8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,75 @@
Finite Temperature Calculations for the Transverse Field Ising Model
----------------------------------------------------------------------

In this section, we present a calculation example of the ferromagnetic Ising model on a square lattice subjected to a transverse magnetic field, denoted by ``hx``, at finite temperatures. The input and script files used in this tutorial are located in the ``sample/08_finitetemperature`` directory. Below is a sample input file (`simple_ft_strong.toml`):
In this section, we present a calculation example of the ferromagnetic Ising model on a square lattice subjected to a transverse magnetic field, denoted by ``hx``, at finite temperatures.
The Hamiltonian is

.. math::

\begin{aligned}
H = J^z \sum_{\langle i,j \rangle} {S}_i^{z} {S}_j^{z} - h^x \sum_i S_i^x.
\end{aligned}

Please note that the model is defined using spin operators of size 1/2, not Pauli operators.
The input and script files used in this tutorial are located in the ``sample/08_finitetemperature`` directory. Below is a sample input file (`simple_ft_strong.toml`):

.. literalinclude:: ../../../../sample/08_finitetemperature/simple_ft_strong.toml

To perform finite temperature calculations, set the ``mode`` to ``finite``. Here, the transverse magnetic field is set to ``hx = 2.0`` with ``tau = 0.01`` (the inverse temperature step size is 2 times ``tau``). To observe the behavior at different transverse magnetic fields, we've provided additional sample input files: ``simple_ft_middle.toml``, ``simple_te_weak.toml``, and ``simple_ft_zero.toml``. Moreover, a script named ``run.sh`` has been set up to execute all these calculations simultaneously. Ensure you've added tools like ``tenes`` to your PATH, then initiate the calculations with:
To perform finite temperature calculations, set the ``mode`` to ``finite``.
Here, the transverse magnetic field is set to ``hx = 2.0`` with ``tau = 0.01`` (the inverse temperature step size is 2 times ``tau``).
Once preparing an input file of the simple mode, execute ``tenes_simple``, ``tenes_std``, and ``tenes`` in the same way as for the ground state calculation.

The results of the finite temperature calculations are output to the ``output_ft_strong`` directory.
Basically, the output is the same as the ground state calculation, but the inverse temperature is added to the first column.
For example, ``FT_density.dat`` is as follows::

# The meaning of each column is the following:
# $1: inverse temperature
# $2: observable ID
# $3: real
# $4: imag
# The meaning of observable IDs are the following:
# 0: Energy
# 1: Sz
# 2: Sx
# 3: Sy
# 4: bond_hamiltonian
# 5: SzSz
# 6: SxSx
# 7: SySy

0.00000000000000000e+00 0 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 1 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 2 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 3 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 4 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 5 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 6 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 7 0.00000000000000000e+00 0.00000000000000000e+00

... continued ...

The second column indicates the type of physical quantity, and for example, 0 represents energy.
Thus, you can extract the temperature dependence by extracting only the energy with ``awk``::

awk '$2 == 0 {print $1, $3, $4}' output_ft_strong/FT_density.dat > energy_strong.dat

To observe the behavior at different transverse magnetic fields, we've provided additional sample input files: ``simple_ft_middle.toml`` (``hx = 0.8``), ``simple_te_weak.toml`` (``hx = 0.5``), and ``simple_ft_zero.toml`` (``hx = 0.0``).
Moreover, a script named ``run.sh`` has been set up to execute all these calculations simultaneously.
Ensure you've added tools like ``tenes`` to your PATH, then initiate the calculations with:

::

sh run.sh

The computation should complete in about a minute. To visualize the results, scripts have been prepared to plot energy, heat capacity, and magnetization (:math:`S_x`, :math:`S_z`): ``plot_e.plt``, ``plot_c.plt``, ``plot_mx.plt``, and ``plot_mz.plt``. Running the following:
The computation should complete in about a minute.
Since specific heat is difficult to calculate directly, it is calculated from the energy by numerical differentiation.
``calcspec.py`` is a script to calculate specific heat from the energy by using the spline interpolation::

python3 calcspec.py

To visualize the results, scripts have been prepared to plot energy, heat capacity, and magnetization (:math:`S_x`, :math:`S_z`): ``plot_e.plt``, ``plot_c.plt``, ``plot_mx.plt``, and ``plot_mz.plt``.
Running the following:

::

Expand All @@ -22,10 +80,10 @@ The computation should complete in about a minute. To visualize the results, scr
gnuplot -persist plot_mx.plt
gnuplot -persist plot_mz.plt

will display plots for energy, heat capacity, and magnetizations (:math:`S_x` and :math:`S_z`). The resulting plots are illustrated in :numref:`fig_tutorial8_finitetemperature`. For comparison, results obtained using Quantum Monte Carlo calculations are also shown (using ``ALPS/looper``).
will display plots for energy, heat capacity, and magnetizations (:math:`m_x` and :math:`m_z`). The resulting plots are illustrated in :numref:`fig_tutorial8_finitetemperature`. For comparison, results obtained using Quantum Monte Carlo calculations are also shown (using ``ALPS/looper``).

.. figure:: ../../img/tutorial_08_finitetemperature.*
:name: fig_tutorial8_finitetemperature
:width: 600px

Graphs for the finite temperature calculations of the Ising model: (a) energy, (b) heat capacity, (c) :math:`S_x`, and (d) :math:`S_z`. The vertical axis represents the physical quantity, and the horizontal axis denotes temperature.
Graphs for the finite temperature calculations of the Ising model: (a) energy, (b) heat capacity, (c) :math:`m_x`, and (d) :math:`m_z`. The vertical axis represents the physical quantity, and the horizontal axis denotes temperature.
14 changes: 12 additions & 2 deletions docs/sphinx/ja/tutorial/simple_tutorial-1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
横磁場イジング模型
----------------------------

ここでは横磁場イジング模型に対して、横磁場を変化させた場合の計算例について紹介します。
入力ファイルの変数 ``hx`` を用いることで横磁場の大きさを調整することが可能です。例えば、横磁場が0の場合には、
ここでは正方格子上の横磁場イジング模型に対して、横磁場を変化させた場合の計算例について紹介します。
ハミルトニアンは

.. math::

\begin{aligned}
H = J^z \sum_{\langle i,j \rangle} {S}_i^{z} {S}_j^{z} - h^x \sum_i S_i^x
\end{aligned}

です。
大きさ1/2のスピン演算子を用いて定義しており、パウリ演算子を直接用いたモデルと係数が異なることに注意してください。
入力ファイルの変数 ``hx`` を用いることで横磁場 :math:`h^x` の大きさを調整することが可能です。例えば、横磁場が0の場合には、

.. literalinclude:: ../../../../sample/01_transverse_field_ising/simple.toml

Expand Down
63 changes: 60 additions & 3 deletions docs/sphinx/ja/tutorial/simple_tutorial-7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
-----------------------------------------------

ここでは正方格子のイジングモデルに対して、横磁場 ``hx`` をかけた場合の実時間発展の計算例について紹介します。
ハミルトニアンは

.. math::

\begin{aligned}
H = J^z \sum_{\langle i,j \rangle} {S}_i^{z} {S}_j^{z} - h^x \sum_i S_i^x
\end{aligned}

です。
大きさ1/2のスピン演算子を用いて定義しており、パウリ演算子を直接用いたモデルと係数が異なることに注意してください。
このチュートリアルで使用する入力ファイルおよびスクリプトファイルは ``sample/07_timeevolution`` に格納されています。

最初に初期状態として、基底状態の計算を行います (``simple.toml`` ファイル)。ここでは、
Expand All @@ -21,7 +31,46 @@

ここでは、横磁場を ``hx = 2.0`` 、実時間発展の刻み幅を ``tau = 0.01`` として時間発展させています。
また、初期状態として先ほどの基底状態を用いるため、 ``tensor_load = "save_tensor"`` として、基底状態のテンソルを読み込みます。
時間発展の様子をいくつかの横磁場で見るために、 ``simple_te_middle.toml`` 、 ``simple_te_weak.toml`` という入力ファイルもサンプルとして用意しています。
シンプルモードの入力ファイルを準備したあとは、基底状態計算と同様に、 ``tenes_simple``, ``tenes_std``, ``tenes`` を順番に実行します。
計算結果は ``output_te_strong`` ディレクトリに保存されます。
基本的に基底状態の出力と同様ですが、1列目に時間が追加されています。
たとえば ``FT_density.dat`` には物理量の期待値が時間ごとに記録されており、

::

# The meaning of each column is the following:
# $1: time
# $2: observable ID
# $3: real
# $4: imag
# The meaning of observable IDs are the following:
# 0: Energy
# 1: Sz
# 2: Sx
# 3: Sy
# 4: bond_hamiltonian
# 5: SzSz
# 6: SxSx
# 7: SySy

0.00000000000000000e+00 0 -5.00184764052080899e-01 0.00000000000000000e+00
0.00000000000000000e+00 1 4.99999945646528332e-01 0.00000000000000000e+00
0.00000000000000000e+00 2 9.24306486797199186e-05 0.00000000000000000e+00
0.00000000000000000e+00 3 2.34088935337348195e-06 0.00000000000000000e+00
0.00000000000000000e+00 4 -5.00184764052080899e-01 3.47535331983321418e-21
0.00000000000000000e+00 5 4.99999902788251294e-01 -8.46256269499545126e-22
0.00000000000000000e+00 6 1.12653588020163689e-05 6.35907290717320676e-22
0.00000000000000000e+00 7 -1.12840199341671039e-05 -2.06527532941704114e-21

のようになっています。
2列目は物理量の種類を表しており、この計算では1番が縦磁化 :math:`m^z = \langle S^z \rangle` です。
``awk`` などでフィルタリングすることで、特定の物理量の時間発展を取り出せます。

::

awk '$2 == 1 {print $1, $3, $4}' output_te_strong/TE_density.dat > magnetization_strong.dat

時間発展の様子をいくつかの横磁場で見るために、 ``simple_te_middle.toml`` (``hx = 0.8``)、 ``simple_te_weak.toml`` (``hx = 0.5``) という入力ファイルもサンプルとして用意しています。
また、これらを一括して計算するためのスクリプト ``run.sh`` も準備しています。
あらかじめ ``tenes`` などにパスを通した上で

Expand All @@ -36,7 +85,7 @@

load 'plot.plt'

とすれば、 磁化 :math:`S_z` の時間発展の様子がプロットされます。
とすれば、 磁化 :math:`m^z` の時間発展の様子がプロットされます。
その結果を :numref:`fig_tutorial7_timeevolution` に示します。

.. figure:: ../../img/tutorial_07_timeevolution.*
Expand All @@ -45,9 +94,10 @@

イジング模型の実時間発展の図. 縦軸は磁化、横軸は時間を表す。

横磁場を強くしていくと磁化の振動が大きくなり、量子相転移点を超えると :math:`m^z = 0` を超えて振動するようになります :ref:`[DQPT] <Ref-DQPT>` 。

なお、時間発展が進むにつれてエンタングルメントが大きくなり、ある時点でテンソルネットワークの容量が波動関数を表現するのに足りなくなります。
今の場合、 ``t=4.25`` ``hx=2.0`` の場合のジャンプがこの問題を示しています
今の場合、 ``hx=2.0`` における ``t=4.25`` のジャンプがこの問題を示しています
実際に使用する場合には、このような不連続性が存在しないかを確認の上、ジャンプが存在する場合にはテンソルネットワークの容量が足りなくならないように、
``virtual_dimension`` を大きくするなどの対策を行う必要があります。
例えば、 ``virtual_dimension = 10`` に変更して上述の計算を行うと、
Expand All @@ -59,3 +109,10 @@

イジング模型の実時間発展の図. 縦軸は磁化、横軸は時間を表す。
``virtual_dimension = 10`` とした場合の結果。


.. rubric:: 参考文献

.. _Ref-DQPT:
[DQPT]
M. Heyl, A. polkovnikov, and S. Kehrein, *Dynamical Quantum Phase Transitions in the Transverse-Field Ising Model*, Phys. Rev. Lett. **110**, 135704 (2013). `link <https://doi.org/10.1103/PhysRevLett.110.135704>`__
Loading