diff --git a/scratchpad/qtensor_MPS/evolution.py b/scratchpad/qtensor_MPS/evolution.py deleted file mode 100644 index 1203d956..00000000 --- a/scratchpad/qtensor_MPS/evolution.py +++ /dev/null @@ -1,61 +0,0 @@ -import tensornetwork as tn -import numpy as np -from mps import MPS -from gates import * -import matplotlib.pyplot as plt - -cutoff = 1e-8 -N = 10 -mps = MPS("q", N + 1, 2) -evolution_range = np.linspace(0, 1, 10) -js = np.array(range(N)) - - -# converting |0000..0..00> to |1001001001> -mps.apply_single_qubit_gate(xgate(), 0) -mps.apply_single_qubit_gate(xgate(), 3) -mps.apply_single_qubit_gate(xgate(), 6) -mps.apply_single_qubit_gate(xgate(), 9) - -assert mps.get_norm() == 1 -print(mps.get_wavefunction()) - -# TODO: -# 1. Implement matrix exponentatiation -# 2. Initialise the magnestiziation and plot the in colormesh -# 3. Then run the second part of code. - -# # reset magnetization -magnetization = [] - -for t in evolution_range: - mag_j = [] - - for j in js: - mps.apply_two_qubit_gate(sigmaRzz(t), [j, j + 1]) - mps.apply_single_qubit_gate(sigmaRx(t), j) - - # for j in js: - # mps.apply_two_qubit_gate(sigmaRzz(t), [N-1-j, N-j]) - # mps.apply_single_qubit_gate(sigmaRx(t), N-1-j) - - # ZIIIII.. - # IZIIII... - # IIZIII... - for j in range(0, N): - mag_j += [mps.get_expectation(zgate(), j)] - - magnetization += [mag_j] - -plt.style.context("default") -plt.figure(figsize=(12, 7)) - -# plot final magnetization -plt.pcolormesh([str(i) for i in js], evolution_range, np.real(magnetization)) -plt.set_cmap("RdYlBu") -plt.colorbar() -plt.title("Total Z-Magnetization Evolution") -plt.xlabel("Site") -plt.ylabel("time [ $Jt$ ]") - -plt.savefig("final_magnetisation.png") diff --git a/scratchpad/qtensor_MPS/evolution_all_zero.py b/scratchpad/qtensor_MPS/evolution_all_zero.py deleted file mode 100644 index e55ac30b..00000000 --- a/scratchpad/qtensor_MPS/evolution_all_zero.py +++ /dev/null @@ -1,45 +0,0 @@ -import tensornetwork as tn -import numpy as np -from mps import MPS -from gates import * -import matplotlib.pyplot as plt - -cutoff = 1e-8 -N = 10 -mps = MPS("q", N + 1, 2) -evolution_range = np.linspace(0, 1, 20) -js = np.array(range(N)) - -magnetization = [] - -for t in evolution_range: - mag_j = [] - - for j in js: - mps.apply_two_qubit_gate(sigmaRzz(t), [j, j + 1]) - mps.apply_single_qubit_gate(sigmaRx(t), j) - - # for j in js: - # mps.apply_two_qubit_gate(sigmaRzz(-1*t), [N - 1 - j, N - j]) - # mps.apply_single_qubit_gate(sigmaRx(-1*t), N-1-j) - - # ZIIIII.. - # IZIIII... - # IIZIII... - for j in range(0, N): - mag_j += [mps.get_expectation(zgate(), j)] - - magnetization += [mag_j] - -plt.style.context("default") -plt.figure(figsize=(12, 7)) - -# plot final magnetization -plt.pcolormesh(js, evolution_range, np.real(magnetization)) -plt.set_cmap("RdYlBu") -plt.colorbar() -plt.title("Total Z-Magnetization Evolution") -plt.xlabel("Site") -plt.ylabel("time [ $Jt$ ]") - -plt.savefig("final_magnetisation_all0.png") diff --git a/scratchpad/qtensor_MPS/evolution_mpo.py b/scratchpad/qtensor_MPS/evolution_mpo.py deleted file mode 100644 index 8f2f689e..00000000 --- a/scratchpad/qtensor_MPS/evolution_mpo.py +++ /dev/null @@ -1,80 +0,0 @@ -import tensornetwork as tn -import numpy as np -from mps import MPS -from mpo import MPOLayer -from gates import * -import matplotlib.pyplot as plt - -## See the mpo prepared and at the end the zgate thing -## Compare resuts -cutoff = 1e-8 -N = 5 -mps = MPS("q", N + 1, 2) -mps.apply_single_qubit_gate(xgate(), 0) -# mps.apply_single_qubit_gate(xgate(), 4) -assert mps.get_norm() == 1 -# print(mps.get_wavefunction()) - -mpo = MPOLayer("q", N + 1, 2) -evolution_range = np.linspace(0, 5, 30) -js = np.array(range(N)) - -magnetization = [] - -mag_j = [] - -# for j in range(0, N): -# mpo.add_single_qubit_gate(zgate(), j) -# mag_j += [mpo.mpo_mps_inner_prod(mps)] -# mpo.add_single_qubit_gate(zgate(), j) - -# magnetization += [mag_j] - -dt = 25 / 20 - -for j in range(0, N): - mpo = MPOLayer("q", N + 1, 2) - mpo.add_single_qubit_gate(zgate(), j) - mag_j = [] - mag_j += [mpo.mpo_mps_inner_prod(mps)] - for t in evolution_range: - # for j in js: - # mpo.add_two_qubit_gate(sigmaRzz(dt), [j, j + 1]) - # mpo.add_two_qubit_gate(sigmaRzz(dt), [j, j + 1], True) - - for j in js: - mpo.add_single_qubit_gate(sigmaRx(dt), j) - mpo.add_single_qubit_gate(sigmaRx(dt), j, True) - - # for j in js: - # mpo.add_two_qubit_gate(sigmaRzz(-1 * t), [N - 1 - j, N - j]) - # mpo.add_two_qubit_gate(sigmaRzz(-1 * t), [N - 1 - j, N - j], True) - - # for j in js: - # mpo.add_single_qubit_gate(sigmaRx(-1 * t), N - 1 - j) - # mpo.add_single_qubit_gate(sigmaRx(-1 * t), N - 1 - j, True) - - # mps.apply_mpo_layer(mpo) - # ZIIIII.. - # IZIIII... - # IIZIII... - - mag_j += [mpo.mpo_mps_inner_prod(mps)] - - magnetization += [mag_j] - -plt.style.context("default") -plt.figure(figsize=(12, 7)) - -# plot final magnetization -plt.pcolormesh(js, np.linspace(0, 5, 31), np.real(magnetization).T) -plt.set_cmap("RdYlBu") -plt.colorbar() -plt.title("Total Z-Magnetization Evolution") -plt.xlabel("Site") -plt.ylabel("time [ $Jt$ ]") - -plt.savefig("mpo_final_magnetisation.png") - -# Single qubit evolving, compare with mps evolution -# Single qubit rabii evolution diff --git a/scratchpad/qtensor_MPS/final_magnetisation.png b/scratchpad/qtensor_MPS/final_magnetisation.png deleted file mode 100644 index 43a2d36a..00000000 Binary files a/scratchpad/qtensor_MPS/final_magnetisation.png and /dev/null differ diff --git a/scratchpad/qtensor_MPS/initial_magnetisation.png b/scratchpad/qtensor_MPS/initial_magnetisation.png deleted file mode 100644 index 953cc3fc..00000000 Binary files a/scratchpad/qtensor_MPS/initial_magnetisation.png and /dev/null differ