In [129]:
!ipython locate profile
In [130]:
%install_ext https://raw.githubusercontent.com/rasbt/python_reference/master/ipython_magic/watermark.py
%load_ext watermark
In [131]:
from IPython import parallel
c = parallel.Client()
view = c.load_balanced_view()
In [132]:
%%px --local
import numpy as np
from numpy import linalg as LA
from numpy import array
from numpy import pi
import matplotlib.pyplot as plt
In [133]:
%matplotlib inline
In [134]:
from scipy.interpolate import griddata
dpi_out = 400
fig_width = 3.39
golden_mean = (np.sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_height = fig_width*golden_mean # height in inches
MAX_HEIGHT_INCHES = 8.0
if fig_height > MAX_HEIGHT_INCHES:
print("WARNING: fig_height too large:" + fig_height +
"so will reduce to" + MAX_HEIGHT_INCHES + "inches.")
fig_height = MAX_HEIGHT_INCHES
fig, ax = plt.subplots(figsize = (fig_width, fig_height), dpi=400, frameon=True)
small_tick_size = 8
small_label_size = 8
In [135]:
%%px --local
import matplotlib.pyplot as plt
import sys
import math
from scipy.optimize import curve_fit
import pickle
if "/home/dominique/Code/PG/Source" not in sys.path:
sys.path.append("/home/dominique/Code/PG/Source")
import phase_fluctuations as PF
from phase_fluctuations import TbModel, TbParams, SWaveModel, DWaveModel
from MCMC import MCMCDriver
import scipy.constants as cst
def K_to_meV(in_temp):
return cst.physical_constants["Boltzmann constant in eV/K"][0] * in_temp * 1000.0
def meV_to_K(in_temp):
return in_temp / 1000.0 / cst.physical_constants["Boltzmann constant in eV/K"][0]
def func(x, a, b, c):
return a * np.exp(-b * x) + c
def func_short(x, a, b):
return a * np.exp(-b * x)
def func_combined(x, a, b, d):
return a * np.exp(-b * x) / np.power(x, d)
def func_power(x, a, b):
return a * np.power(x, b)
def func_exponent(x, a, b):
#return a * np.power(x - 290.112982064, b)
return a * np.exp(-np.power(x - 290.112982064, b))
def func_full(x, a, b, c):
return a * np.exp(-np.abs(b) * x) / np.power(x, c)
In [136]:
%load_ext autoreload
%autoreload 2
In [137]:
%who
In [138]:
%watermark -a "Dominique" -d -t -u -v -h -m -g
We pick the following parameters:
This means that we have the following physical properties
In [139]:
Tc_mf = meV_to_K(0.5*250)
print meV_to_K(pi/2.0)
print 1.0/0.89
print cst.physical_constants["Boltzmann constant"]
In [140]:
print r"$T_c^{MF} = $", Tc_mf, "K"
T_KT = meV_to_K(0.1*250)
print r"$T_{KT} = $", T_KT, "K"
In [22]:
%%px --local
T_CST = 0.25
MY_PARAMS = {"width":10, "chem_potential": 0.0,
"hopping_constant": T_CST, "J_constant": 0.1 * T_CST / 0.89,
"delta": 1.0 * T_CST,
"use_assaad": False, "broadening_delta": 0.01 * T_CST}
MY_MODEL = TbModel(MY_PARAMS)
In [23]:
%%px --local
TB_PARAMS = {"width":14, "use_assaad": True}
MY_MODEL.set_params(TB_PARAMS)
print MY_MODEL
In [24]:
all_test_vectors = []
nb_samples = MY_MODEL.lattice.width
for elem in np.arange(nb_samples):
print "handling", elem
k_in = elem * 1.0 * np.pi * np.array([1.0, 1.0]) / nb_samples
test2_vector = MY_MODEL.get_vector_spectral_function_point(k_in,
MY_MODEL.lattice.omega_mesh)
all_test_vectors.append(test2_vector)
In [27]:
%%px --local
import numpy as np
import os
In [28]:
%%px --local
def get_spectral_function(x):
nb_samples = MY_MODEL.lattice.width
k_in = x * np.pi * np.array([1.0, 1.0]) / nb_samples
return MY_MODEL.get_vector_spectral_function_point(k_in, MY_MODEL.lattice.omega_mesh)
In [29]:
nb_samples = MY_MODEL.lattice.width
x = np.arange(nb_samples)
all_test_vectors = view.map_sync(get_spectral_function, x)
In [ ]:
import multiprocessing
nb_samples = MY_MODEL.lattice.width
multiprocessing.cpu_count()
pool = multiprocessing.Pool(processes=3)
all_test_vectors = pool.map(get_spectral_function, np.arange(nb_samples))
In [30]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
to_add = [[k_in[0], energy/T_CST] for energy in MY_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
In [31]:
from scipy.interpolate import griddata
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width*visu_factor, fig_height*visu_factor), dpi=400, frameon=False)
xmin = 0.0
xmax = np.pi
ymin = -5.0
ymax = 5.0
#grid_x = np.linspace(xmin, xmax, num = 200)
#grid_y = np.linspace(ymin, ymax, num = 2000)
grid_x, grid_y = np.mgrid[xmin:xmax:100j, ymin:ymax:200j]
grid_z1 = griddata(array_coords, z_values, (grid_x, grid_y), method='nearest', fill_value=0.0)
p = ax.pcolormesh(grid_x, grid_y, grid_z1, cmap=plt.get_cmap('Greys'),rasterized=True)
#for index, theta in np.ndenumerate(thetas):
# ax.plot(theta, resonance_omega_values[index], marker='o', color='k')
cb = fig.colorbar(p, ax=ax)
ax.plot(grid_x, -2.0 * 2.0 * T_CST * np.cos(grid_x) / T_CST)
ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])
plt.savefig("spectral_function.pdf")
In [32]:
import contextlib
@contextlib.contextmanager
def printoptions(*args, **kwargs):
"""Define some temporary pretty print options
"""
original = np.get_printoptions()
np.set_printoptions(*args, **kwargs)
yield
np.set_printoptions(**original)
In [34]:
with printoptions(precision=4, suppress=True, threshold=np.nan):
print MY_MODEL._eigen_values
for i in np.arange(MY_MODEL.lattice.width):
print MY_MODEL._unitary_matrix[i]
In [36]:
k_in = 1.0 * np.pi * np.array([1.0, 1.0])
test = MY_MODEL.get_vector_spectral_function_point(k_in,
MY_MODEL.lattice.omega_mesh)
In [37]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)
x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl
ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f' %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f' %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])
ax.plot(MY_MODEL.lattice.omega_mesh/T_CST, test)
#ax.plot(MY_MODEL.lattice.omega_mesh/T_CST, test_elem)
Out[37]:
In [116]:
%%px --local
T_CST = 0.25
BCS_PARAMS = {"width":4, "chem_potential": 0.0,
"hopping_constant": T_CST, "J_constant": 0.1 * T_CST / 0.89,
"g_constant": 0.25, "delta": 1.0 * T_CST, "use_assaad": True,
"uniform_phase": True, "temperature": 100}
MY_DWAVE_MODEL = DWaveModel(BCS_PARAMS)
In [117]:
print MY_DWAVE_MODEL
In [118]:
%%px --local
BCS_PARAMS = {"width":5, "use_assaad": True,
"uniform_phase": True, "temperature": 1.75*145.0,
"delta": 1.0 * T_CST}
MY_DWAVE_MODEL.set_params(BCS_PARAMS)
In [119]:
print MY_DWAVE_MODEL
print "temp: ", K_to_meV(MY_DWAVE_MODEL.temperature), "meV"
In [126]:
%%px --local
def get_spectral_function(x):
local_model = MY_DWAVE_MODEL
nb_samples = local_model.lattice.width
k_in = x * np.pi * np.array([1.0, 1.0]) / nb_samples
return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)
In [127]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples)
all_test_vectors_nodal = view.map_sync(get_spectral_function, x)
In [21]:
all_test_vectors = []
nb_samples = MY_DWAVE_MODEL.lattice.width
for elem in np.arange(nb_samples):
print "handling", elem
k_in = elem * np.pi * np.array([1.0, 1.0]) / nb_samples
test2_vector = MY_DWAVE_MODEL.get_vector_spectral_function_point(k_in,
MY_DWAVE_MODEL.lattice.omega_mesh)
all_test_vectors.append(test2_vector)
In [58]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
In [59]:
from scipy.interpolate import griddata
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width*visu_factor, fig_height*visu_factor), dpi=400, frameon=False)
xmin = 0.0
xmax = np.pi
ymin = -5.0
ymax = 5.0
#grid_x = np.linspace(xmin, xmax, num = 200)
#grid_y = np.linspace(ymin, ymax, num = 2000)
grid_x, grid_y = np.mgrid[xmin:xmax:100j, ymin:ymax:200j]
grid_z1 = griddata(array_coords, z_values, (grid_x, grid_y), method='nearest', fill_value=0.0)
p = ax.pcolormesh(grid_x, grid_y, grid_z1, cmap=plt.get_cmap('Greys'),rasterized=True)
#for index, theta in np.ndenumerate(thetas):
# ax.plot(theta, resonance_omega_values[index], marker='o', color='k')
cb = fig.colorbar(p, ax=ax)
ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])
Out[59]:
In [60]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)
x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl
ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f' %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f' %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])
ax.plot(MY_DWAVE_MODEL.lattice.omega_mesh/T_CST,
MY_DWAVE_MODEL.get_vector_spectral_function_point(np.array([0.6, 0.6]),
MY_DWAVE_MODEL.lattice.omega_mesh))
Out[60]:
In [114]:
%%px --local
def get_spectral_function(x):
local_model = MY_DWAVE_MODEL
nb_samples = local_model.lattice.width
k_in = x * np.pi * np.array([1.0, 0.0]) / nb_samples
return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)
In [115]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples+1)
all_test_vectors = view.map_sync(get_spectral_function, x)
In [116]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples+1):
k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
In [117]:
visu_factor = 1
fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
fig_height * visu_factor),
dpi=800,
frameon=False)
color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]
x_size = 200
y_size = 200
xmax = np.pi
xmin = 0.0
ymax = 5.0
ymin = -5.0
def x_convert(in_x):
out = (in_x - xmin) * x_size / (xmax - xmin)
return out
def y_convert(in_y):
out = (in_y - ymin) * y_size / (ymax - ymin)
return out
############ IMSHOW ##############################################
xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)
min_cbar = 0.0
max_cbar = np.max(zi)
low_cutoff = 0.005
im = plt.imshow(zi.T,aspect='auto',
origin = 'lower',
extent=[0,x_size,0,y_size],
vmin=min_cbar, vmax=max_cbar,
#norm=LogNorm())#,
cmap=plt.get_cmap(color_map))
##### Colorbar ###############################################
max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)
cbar4.set_ticklabels(['%1.0f' % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor)
cbar4.set_label(r"$A((k_x, 0), E)$",
fontsize=small_label_size * visu_factor,
labelpad=-37.5 * visu_factor)
#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)
##### Figure properties ###############################################
ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])
ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1
x_tick_list = np.pi * np.array([1.0 / 6.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0,
2.0 / 3.0, 3.0 / 4.0, 5.0 / 6.0, 1.0])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$\frac{\pi}{6}$", r"$\frac{\pi}{4}$",
r"$\frac{\pi }{3}$", r'$\frac{\pi}{2}$',
r'$\frac{2 \pi}{3}$', r'$\frac{3 \pi}{4}$',
r'$\frac{5 \pi}{6}$', r'$\pi$'])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f' % i for i in x_tick_list])
y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f' % (i) for i in y_tick_list])
ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)
for item in (ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
line.set_color('k')
line.set_markeredgewidth(1)
plt.savefig("./Figures/spectral_gap_dwave_" + color_map + ".pdf",
bbox_extra_artists=(cbar4.ax,),
bbox_inches='tight',
dpi=dpi_out)
In [118]:
%%px --local
def get_spectral_function(x):
local_model = MY_DWAVE_MODEL
nb_samples = local_model.lattice.width
k_in = np.array([np.pi, x * np.pi / nb_samples])
return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)
In [119]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples+1)
spectral_func_second_segment = view.map_sync(get_spectral_function, x)
In [120]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples+1):
k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(spectral_func_second_segment[elem])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
In [121]:
visu_factor = 1
fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
fig_height * visu_factor),
dpi=800,
frameon=False)
color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]
x_size = 200
y_size = 200
xmax = np.pi
xmin = 0.0
ymax = 5.0
ymin = -5.0
def x_convert(in_x):
out = (in_x - xmin) * x_size / (xmax - xmin)
return out
def y_convert(in_y):
out = (in_y - ymin) * y_size / (ymax - ymin)
return out
############ IMSHOW ##############################################
xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)
min_cbar = 0.0
max_cbar = np.max(zi)
low_cutoff = 0.005
im = plt.imshow(zi.T,aspect='auto',
origin = 'lower',
extent=[0,x_size,0,y_size],
vmin=min_cbar, vmax=max_cbar,
#norm=LogNorm())#,
cmap=plt.get_cmap(color_map))
##### Colorbar ###############################################
max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)
cbar4.set_ticklabels(['%1.0f' % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor)
cbar4.set_label(r"$A((k_x, 0), E)$",
fontsize=small_label_size * visu_factor,
labelpad=-37.5 * visu_factor)
#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)
##### Figure properties ###############################################
ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])
ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1
x_tick_list = np.pi * np.array([1.0 / 6.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0,
2.0 / 3.0, 3.0 / 4.0, 5.0 / 6.0, 1.0])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$\frac{\pi}{6}$", r"$\frac{\pi}{4}$",
r"$\frac{\pi }{3}$", r'$\frac{\pi}{2}$',
r'$\frac{2 \pi}{3}$', r'$\frac{3 \pi}{4}$',
r'$\frac{5 \pi}{6}$', r'$\pi$'])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f' % i for i in x_tick_list])
y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f' % (i) for i in y_tick_list])
ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)
for item in (ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
line.set_color('k')
line.set_markeredgewidth(1)
plt.savefig("./Figures/spectral_gap_dwave_2segment_" + color_map + ".pdf",
bbox_extra_artists=(cbar4.ax,),
bbox_inches='tight',
dpi=dpi_out)
In [156]:
%%px --local
def get_spectral_function(x):
local_model = MY_DWAVE_MODEL
nb_samples = local_model.lattice.width
k_in = (float(x) / nb_samples) * np.array([np.pi, np.pi])
return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)
In [157]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples+1)
spectral_func_third_segment = view.map_sync(get_spectral_function, x)
In [158]:
#spectral_func_third_segment = all_test_vectors_nodal[::-1]
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
k_in = (float(elem) / nb_samples) * np.array([np.pi, np.pi])
print k_in
to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(spectral_func_third_segment[nb_samples - elem -1])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
In [159]:
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
fig_height * visu_factor),
dpi=800,
frameon=False)
color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]
x_size = 200
y_size = 200
xmax = np.pi
xmin = 0.0
ymax = 5.0
ymin = -5.0
def x_convert(in_x):
out = (in_x - xmin) * x_size / (xmax - xmin)
return out
def y_convert(in_y):
out = (in_y - ymin) * y_size / (ymax - ymin)
return out
############ IMSHOW ##############################################
xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)
min_cbar = 0.0
max_cbar = np.max(zi)
low_cutoff = 0.005
im = plt.imshow(zi.T,aspect='auto',
origin = 'lower',
extent=[0,x_size,0,y_size],
vmin=min_cbar, vmax=max_cbar,
#norm=LogNorm())#,
cmap=plt.get_cmap(color_map))
##### Colorbar ###############################################
max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)
cbar4.set_ticklabels(['%1.0f' % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor)
cbar4.set_label(r"$A((k_x, 0), E)$",
fontsize=small_label_size * visu_factor,
labelpad=-37.5 * visu_factor)
#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)
##### Figure properties ###############################################
ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])
ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1
x_tick_list = np.pi * np.array([1.0 / 6.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0,
2.0 / 3.0, 3.0 / 4.0, 5.0 / 6.0, 1.0])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$\frac{\pi}{6}$", r"$\frac{\pi}{4}$",
r"$\frac{\pi }{3}$", r'$\frac{\pi}{2}$',
r'$\frac{2 \pi}{3}$', r'$\frac{3 \pi}{4}$',
r'$\frac{5 \pi}{6}$', r'$\pi$'])
ax.set_xticklabels(xtick_labels)
y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f' % (i) for i in y_tick_list])
ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)
for item in (ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
line.set_color('k')
line.set_markeredgewidth(1)
plt.savefig("./Figures/spectral_gap_dwave_3segment_" + color_map + ".pdf",
bbox_extra_artists=(cbar4.ax,),
bbox_inches='tight',
dpi=dpi_out)
In [162]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
to_add = [[elem, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
for elem in np.arange(nb_samples)[1:]:
to_add = [[nb_samples + elem -1, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(spectral_func_second_segment[elem])# / np.amax(all_test_vectors[elem]))
for elem in np.arange(nb_samples)[1:]:
to_add = [[2.0 * nb_samples + elem -1, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(spectral_func_third_segment[nb_samples - elem -1])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
print array_coords.shape
In [165]:
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
fig_height * visu_factor),
dpi=800,
frameon=False)
color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]
x_size = 200
y_size = 200
xmax = 3 * nb_samples
xmin = 0.0
ymax = 5.0
ymin = -5.0
def x_convert(in_x):
out = (in_x - xmin) * x_size / (xmax - xmin)
return out
def y_convert(in_y):
out = (in_y - ymin) * y_size / (ymax - ymin)
return out
############ IMSHOW ##############################################
xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)
min_cbar = 0.0
max_cbar = np.max(zi)
im = plt.imshow(zi.T,aspect='auto',
origin = 'lower',
extent=[0,x_size,0,y_size],
vmin=min_cbar, vmax=max_cbar,
#norm=LogNorm())#,
cmap=plt.get_cmap(color_map))
##### Colorbar ###############################################
max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)
cbar4.set_ticklabels(['%1.0f' % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor)
cbar4.set_label(r"$A((k_x, 0), E)$",
fontsize=small_label_size * visu_factor,
labelpad=-37.5 * visu_factor)
#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)
##### Figure properties ###############################################
ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])
ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1
x_tick_list = np.array([0, nb_samples, 2 * nb_samples])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$(0, 0)$", r"$(\pi, 0)$", r"$(\pi, \pi)$"])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f' % i for i in x_tick_list])
y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f' % (i) for i in y_tick_list])
ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)
for item in (ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
line.set_color('k')
line.set_markeredgewidth(1)
plt.savefig("./Figures/spectral_gap_dwave_complete_" + color_map + ".pdf",
bbox_extra_artists=(cbar4.ax,),
bbox_inches='tight',
dpi=dpi_out)
In [74]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)
x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl
ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f' %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f' %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])
for i in range(6)[1:4]:
ax.plot(MY_DWAVE_MODEL.lattice.omega_mesh/T_CST + 0.5 * i,
spectral_func_second_segment[i], label=str(i))
plt.legend()
Out[74]:
In [76]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)
x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl
ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f' %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f' %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])
for i in range(6)[1:4]:
ax.plot(MY_DWAVE_MODEL.lattice.omega_mesh/T_CST + 0.5 * i,
all_test_vectors[-i], label=str(-i))
plt.legend()
Out[76]:
In [120]:
MC_Params = {"seed": 222315, "intervals": 100,
"target_snapshots": 15, "observable_list":["dispersion"]}
MY_DRIVER = MCMCDriver(MY_DWAVE_MODEL, MC_Params)
In [121]:
MC_PARAMS_MP = {"intervals": BCS_PARAMS["width"]**2 / 2,
"target_snapshots": 25,
"algorithm":"metropolis"}
MC_PARAMS_CLUSTER = {"intervals": 5,
"target_snapshots": 25,
"algorithm":"cluster"}
MY_DRIVER.set_params(MC_PARAMS_CLUSTER)
print MY_DWAVE_MODEL._uniform_phase
In [122]:
MY_DRIVER.mc_object.set_params({"temperature": 2.0 * 145.0, "uniform_phase": False})
MY_DRIVER.mc_object.set_params({"width":8, "temperature": 0.4 * 145.0, "uniform_phase": False})
In [123]:
print MY_DRIVER
print MY_DRIVER.params
In [124]:
MY_DRIVER.thermalize(20000)
#MY_DRIVER.mc_object.set_params({"temperature": 1.1 * 145.0})
#MY_DRIVER.thermalize(50)
In [125]:
MY_DRIVER.execute()
In [126]:
result = MY_DRIVER.result
data = result.observable_results["dispersion"]
print data["momentum_coordinates"].shape
print data["momentum_coordinates"]
print data["spectral_functions"]
print result
x_data = data["momentum_coordinates"]
y_data = data["spectral_functions"]
In [127]:
array_coords = []
z_values = []
for elem in np.arange(data["momentum_coordinates"].shape[0]):
to_add = [[elem, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
array_coords.extend(to_add)
z_values.extend(data["spectral_functions"][elem])# / np.amax(all_test_vectors[elem]))
array_coords = np.array(array_coords)
z_values = np.array(z_values)
print array_coords.shape
In [128]:
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
fig_height * visu_factor),
dpi=800,
frameon=False)
color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]
nb_samples = MY_DWAVE_MODEL.lattice.width
x_size = 200
y_size = 200
xmax = 3 * nb_samples
xmin = 0.0
ymax = 5.0
ymin = -5.0
def x_convert(in_x):
out = (in_x - xmin) * x_size / (xmax - xmin)
return out
def y_convert(in_y):
out = (in_y - ymin) * y_size / (ymax - ymin)
return out
############ IMSHOW ##############################################
xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)
min_cbar = 0.0
max_cbar = np.max(zi)
im = plt.imshow(zi.T,aspect='auto',
origin = 'lower',
extent=[0,x_size,0,y_size],
vmin=min_cbar, vmax=max_cbar,
#norm=LogNorm())#,
cmap=plt.get_cmap(color_map))
##### Colorbar ###############################################
max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)
cbar4.set_ticklabels(['%1.0f' % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor)
cbar4.set_label(r"$A((k_x, 0), E)$",
fontsize=small_label_size * visu_factor,
labelpad=-37.5 * visu_factor)
#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)
##### Figure properties ###############################################
ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])
ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1
x_tick_list = np.array([0, nb_samples, 2 * nb_samples])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$(0, 0)$", r"$(\pi, 0)$", r"$(\pi, \pi)$"])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f' % i for i in x_tick_list])
y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f' % (i) for i in y_tick_list])
ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)
for item in (ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
line.set_color('k')
line.set_markeredgewidth(1)
plt.savefig("./Figures/spectral_gap_dwave_direct_" + color_map + ".pdf",
bbox_extra_artists=(cbar4.ax,),
bbox_inches='tight',
dpi=dpi_out)
In [ ]: