-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphase_diagram_triangular.py
executable file
·88 lines (67 loc) · 2.15 KB
/
phase_diagram_triangular.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
""" In this script we will read out the psi for each point from the .h5 fiels in /data folder
"""
# numpy
import numpy as np
from numpy import pi
# matplot
import matplotlib.pyplot as plt
# model and dmrg
from kitaev_ladder import KitaevLadderModel, save_after_run, load_data, run_atomic
# triangular coordinates
from triangular_coordinates import triangular_to_decarte, decimals
# path toolkits
from pathlib import Path
# region selection
# Here we use the step
a_step = 0.05
b_step = 0.05
point_list = []
for a in np.arange(0, 1+a_step, a_step):
for b in np.arange(0, 1-a+b_step, b_step):
point_list.append(triangular_to_decarte(1, a, b))
chi = 100
L = 3
max_E_err=1.e-6
max_S_err=1.e-4
N_sweeps_check=5
max_sweeps=100
verbose=1
# folder name
prefix = f'data_L_{L}/'
Path(prefix).mkdir(parents=True, exist_ok=True)
run_save = save_after_run(run_atomic, folder_prefix=prefix)
# # store those points reaching the max sweeps
unclear_points = []
# run the DMRG
for a in np.arange(0, 1+a_step, a_step):
psi = None
for b in np.arange(0, 1-a+b_step, b_step):
if psi is not None:
initial_psi = psi.copy()
else:
initial_psi = None
Jx, Jy, Jz = triangular_to_decarte(1, a, b)
J = (Jx, Jy, Jz)
print("\n\n\n Calculating the (Jx, Jy, Jz) = (%.3f, %.3f, %.3f) ground state" % (Jx, Jy, Jz))
result = run_save(
chi=chi,
Jx=Jx,
Jy=Jy,
Jz=Jz,
L=L,
initial_psi=initial_psi,
max_E_err=max_E_err,
max_S_err=max_S_err,
N_sweeps_check=N_sweeps_check,
max_sweeps=max_sweeps,
verbose=verbose,
)
if result != 0:
sweeps_stat = result['sweeps_stat']
last_sweep = len(sweeps_stat['sweep']) * N_sweeps_check
max_sweeps = result['parameters']['max_sweeps']
if max_sweeps == last_sweep:
unclear_points.append(J)
print("Maximum sweeps reached!")
initial_psi = result['psi']
print("Finished.\n", "Unclear points: ", unclear_points)