To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit ce9a0cb4 authored by mgassner's avatar mgassner
Browse files

minor changes

parent 5728c117
...@@ -21,7 +21,9 @@ def create_2spin_matrix(model_name, param): ...@@ -21,7 +21,9 @@ def create_2spin_matrix(model_name, param):
return (0.5 * (np.kron(sigma_p, sigma_m) + np.kron(sigma_m, sigma_p)) + return (0.5 * (np.kron(sigma_p, sigma_m) + np.kron(sigma_m, sigma_p)) +
param * np.kron(sigma_z, sigma_z) + 0*1e-6 *(np.kron(sigma_z, sigma_0) + np.kron(sigma_0, sigma_z))).astype('float64') param * np.kron(sigma_z, sigma_z) + 0*1e-6 *(np.kron(sigma_z, sigma_0) + np.kron(sigma_0, sigma_z))).astype('float64')
elif model_name == 'tfim': elif model_name == 'tfim':
return ( np.kron(sigma_z, sigma_z) - 0.5*param*(np.kron(sigma_x, sigma_0) + np.kron(sigma_0, sigma_x))).astype('float64').tolist() #return ( np.kron(sigma_z, sigma_z) - 0.5*param*(np.kron(sigma_x, sigma_0) + np.kron(sigma_0, sigma_x))).astype('float64').tolist()
#in the plus minus basis
return ( np.kron(sigma_x, sigma_x) - 0.5*param*(np.kron(sigma_z, sigma_0) + np.kron(sigma_0, sigma_z))).astype('float64').tolist()
else: else:
raise NameError raise NameError
......
...@@ -13,28 +13,34 @@ parser.add_argument("--set_param_range_and_steps", '-pr', dest='param_range', na ...@@ -13,28 +13,34 @@ parser.add_argument("--set_param_range_and_steps", '-pr', dest='param_range', na
parser.add_argument("--boundary_condition", "-b", dest='periodic' ,type=bool, required=False) parser.add_argument("--boundary_condition", "-b", dest='periodic' ,type=bool, required=False)
args = parser.parse_args() args = parser.parse_args()
def test_tfim(): def test_tfim(number_spins, param_range, periodic = False):
model_name = 'tfim' model_name = 'tfim'
number_spins = 8 hamming_weight = None #number_spins // 2
periodic = True
hamming_weight = number_spins // 2
param = 0.5
spin_inversion= None spin_inversion= None
model = spin_model(model_name=model_name, number_spins=number_spins, periodic=periodic, params = np.linspace(param_range[0], param_range[1], int(param_range[2]))
param=param, hamming_weight=None, spin_inversion=spin_inversion) entropies = []
model.compute_ew_and_ev() for param in params:
print('EIGENSTATE at h/J = ', param, 'is: ', model.eigenstates[:,0]) model = spin_model(model_name=model_name, number_spins=number_spins, periodic=periodic,
sub_dims = np.arange(1, number_spins) param=param, hamming_weight=hamming_weight)
bipartite_entropies = [] model.compute_ew_and_ev()
gs = model.eigenstates[:,0] # print('EIGENSTATE at h/J = ', param, 'is: ', model.eigenstates[:,0])
basis_states = model.basis.states gs = model.eigenstates[:,0]
for sub_dim in sub_dims: basis_states = model.basis.states
print('----------------------------------') sub_dim = number_spins // 2
print('Sub Dimension is ', sub_dim) first_trace_spin = None #number_spins // 4
rhos = reduced_dm(sub_dim, number_spins, hamming_weight, gs, basis_states, spin_inversion) rhos = reduced_dm(sub_dim, number_spins, hamming_weight, gs, basis_states, first_trace_spin=first_trace_spin)
bipartite_entropies.append(compute_entropy(rhos)) entropies.append(compute_entropy(rhos))
del model del model
print(sub_dims, bipartite_entropies)
plt.figure(figsize=(12, 12))
plt.plot(params, entropies, label="half chain entropy")
plt.legend()
plt.xlabel('h / J')
plt.ylabel('Bipartite Entanglement Entropy')
plt.title('Model:' + model_name + str(number_spins) + str(periodic))
plt.grid(True)
timestr = time.strftime("%Y%m%d-%H%M%S")
plt.savefig('output/' + timestr + 'entropytest.jpg')
def test_area_law(number_spins, periodic, param_range): def test_area_law(number_spins, periodic, param_range):
...@@ -110,4 +116,4 @@ if __name__ == "__main__": ...@@ -110,4 +116,4 @@ if __name__ == "__main__":
number_spins = args.number_spins number_spins = args.number_spins
periodic = args.periodic periodic = args.periodic
#test_area_law(number_spins, periodic, param_range) #test_area_law(number_spins, periodic, param_range)
test_tfim() test_tfim(number_spins, param_range)
...@@ -21,7 +21,7 @@ def test_xxz(number_spins, param_range, periodic=True): ...@@ -21,7 +21,7 @@ def test_xxz(number_spins, param_range, periodic=True):
entropies = [] entropies = []
hamming_weight = None #number_spins // 2 hamming_weight = None #number_spins // 2
for param in params: for param in params:
if param > -0.95: if param > -1.0:
hamming_weight = number_spins // 2 hamming_weight = number_spins // 2
model = spin_model(model_name=model_name, number_spins=number_spins, periodic=periodic, model = spin_model(model_name=model_name, number_spins=number_spins, periodic=periodic,
param=param, hamming_weight=hamming_weight) param=param, hamming_weight=hamming_weight)
...@@ -30,20 +30,13 @@ def test_xxz(number_spins, param_range, periodic=True): ...@@ -30,20 +30,13 @@ def test_xxz(number_spins, param_range, periodic=True):
basis_states = model.basis.states basis_states = model.basis.states
gs = model.eigenstates[:,0] gs = model.eigenstates[:,0]
# just for testing # just for testing
if number_spins == 16 and param <= -1.1 and param > -1.4: if number_spins == 8 and param >= -1.1 and param > -1.4:
print(gs[0]) print(gs[0])
printi = [] printi = []
for i, x in enumerate(gs): for i, x in enumerate(gs):
if abs(x) > 1e-1: if abs(x) > 1e-1:
printi.append([x, basis_states[i]]) printi.append([x, basis_states[i]])
print(printi) print(printi)
if number_spins == 10 and param < -2.0:
print(gs[0])
printi = []
for i, x in enumerate(gs):
if abs(x) > 1e-2:
printi.append([x, basis_states[i]])
print(printi)
#print('Number Spins: ', model.basis.number_spins) #print('Number Spins: ', model.basis.number_spins)
#print('States', model.basis.states) #print('States', model.basis.states)
sub_dim = number_spins // 2 sub_dim = number_spins // 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment