Skip to content

Commit

Permalink
almost done
Browse files Browse the repository at this point in the history
  • Loading branch information
aethrvmn committed Sep 26, 2020
1 parent c1b94b2 commit 02628c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@

start_time = time.time()

matrix1 = ZT_Random_Spin(20,1,0.5)
matrix1 = ZT_Random_Spin(30,1,0.1)
matrix2 = NZT_Random_Spin(99,1,0.5, 1)

cmap = colors.ListedColormap(['black','white','yellow'])
bounds=[-matrix1.ceiling, -0.0000000000001,0.0000000000001, matrix1.ceiling]
norm = colors.BoundaryNorm(bounds, cmap.N)

for i in range(10):
while (matrix1.max_bond > matrix1.floor):
matrix1.renormalization()
print(matrix1.left_index, matrix1.max_index, matrix1.right_index)
img = plt.imshow(matrix1.bond_matrix,interpolation='nearest', cmap=cmap, norm=norm)
plt.show()
print(matrix1.max_bond)
img = plt.imshow(matrix1.bond_matrix,interpolation='nearest', cmap=cmap, norm=norm)
plt.show()
duration = time.time() - start_time
print("---%s seconds---" %duration)

12 changes: 6 additions & 6 deletions random_singlets/ZT_RSS.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import numpy as np

"Ok, let's try again, but this time let's make it work using matrices."

class ZT_Random_Spin:

version="v0.9.7"
version="v0.9.9"

def __init__(self, number_of_bonds, ceiling, floor):
self.length = int(number_of_bonds) #the self.length of the chain (actually the total amount of bonds so chain-1)
Expand Down Expand Up @@ -40,14 +39,15 @@ def bonds(self):
self.max_bond = np.amax(self.bond_matrix)
self.max_index = np.argwhere(self.bond_matrix.max() == self.bond_matrix).ravel()
for i in range(self.max_index[0]):
if (self.bond_matrix[i][self.max_index[0]-1] != 0):
self.left_index = np.array([i, self.max_index[0]-1])
if (self.bond_matrix[self.max_index[0]-i][self.max_index[1]-1] > 0):
self.left_index = np.array([self.max_index[0]-i, self.max_index[0]-1])
break
else:
self.left_index = np.array([0,0])
continue
for j in range(self.length - self.max_index[1]):
if (self.bond_matrix[self.max_index[1]+1][self.max_index[1]+j] != 0):

for j in range(self.max_index[1]):
if (self.bond_matrix[self.max_index[1]+1][self.max_index[1]+j] > 0):
self.right_index = np.array([self.max_index[1]+1, self.max_index[1]+j])
break
else:
Expand Down

0 comments on commit 02628c4

Please sign in to comment.