%clear
%pylab inline
%run 'utils.ipynb'
import scipy
import scipy.signal
from scipy import optimize
from IPython.core.display import HTML
class power_law:
def __init__(self, p, exponent):
self.exponent = float(exponent)
self.factor = p[1] * p[0]**(-self.exponent)
def __call__(self, x):
return self.factor * x**self.exponent
import re
fit_pattern = re.compile(r'# (\w+)\s+= (.*)')
def load_info_data(fname):
res = {}
for line in open(fname):
match = fit_pattern.search(line)
if match:
name = match.group(1)
val = match.group(2)
res[name] = val
return res
import json
def get_krho(t_perp, filling, M):
fname = '../data_new/krho_chi={}.txt'.format(M)
info = load_info_data(fname)
all_tperp = json.loads(info['tperp'])
all_fillings = json.loads(info['filling'])
# all_tperp = [1.0, 1.2, 1.3, 1.4, 1.5]
# all_fillings = [0.625, 0.75, 0.875, 0.9375, 0.96875]
all_krho = np.atleast_2d(np.loadtxt(fname))
fill_idx = all_fillings.index(filling)
tper_idx = all_tperp.index(t_perp)
return all_krho[tper_idx, fill_idx]
def load_densdens(li):
extraps_raw = []
for mi in ['extrap_variance', 'extrap_bonddim']:
fname = '../data_new/dens_dens_avg_L={L:.0f}_n={fill}_tperp={tperp}_chi={M}_deg2_num6.txt'.format(type=t_perp, L=li, M=mi, fill=filling, tperp=t_perp)
extraps_raw.append(np.loadtxt(fname))
extraps = np.column_stack([extraps_raw[0][:,0], extraps_raw[0][:,1], extraps_raw[1][:,1]])
d = np.empty((extraps.shape[0], 2))
d[:,0] = extraps[:,0]
d[:,1] = np.mean(extraps[:,1:], axis=1)
return d
def plot_krho_decay(p):
y = []
for mi in ['extrap_variance_d2_n6', 'extrap_bonddim_d2_n6']:
K_rho = get_krho(t_perp, filling, mi)
y.append( power_law(p, -K_rho)(x) )
y = np.transpose(y)
plt.fill_between(x, np.min(y, axis=1), np.max(y, axis=1), edgecolor='none', facecolor=(.5,.5,.5, .4))
plt.plot(x, np.mean(y, axis=1), ':k', lw=.6)
L = 128
filling = 0.875
t_perp = 1.0
d = load_densdens(L)
figure(figsize=(12,6))
plot(d[:,0], d[:,1], 'o')
spl = InterpolatedUnivariateSpline(d[:,0], d[:,1])
x = np.linspace(1,L, 1000)
y = spl(x)
plot(x, y)
allmin = scipy.signal.argrelmin(y)[0]
allmax = scipy.signal.argrelmax(y)[0]
plot(x[allmin], y[allmin], 'rx')
plot(x[allmax], y[allmax], 'r+')
for i, ii in enumerate(allmin):
annotate(str(i), (x[ii], y[ii]), textcoords='offset points', xytext=(0,-15), ha='center')
for i, ii in enumerate(allmax):
annotate(str(i), (x[ii], y[ii]), textcoords='offset points', xytext=(0,+5), ha='center')
ylim(-0.002,0.001)
grid()
Suppose a correlation function like: $$ \langle n(x) n(0) \rangle \propto A_0 x^{-2} + A_1 e^{-\alpha x} \cos(2k_F x) + A_2 r^{-K_\rho} \cos(4k_F x) $$ from http://dx.doi.org/10.1103/PhysRevB.76.195105.
Then we can build the following table relating the minima and maxima of the $\cos()$ terms:
$x=$ | $\frac{\pi}{4 k_F}$ | $\frac{2\pi}{4 k_F}$ | $\frac{3\pi}{4 k_F}$ | $\frac{4\pi}{4 k_F}$ | $\frac{5\pi}{4 k_F}$ | $\frac{6\pi}{4 k_F}$ | $\frac{7\pi}{4 k_F}$ |
---|---|---|---|---|---|---|---|
$\cos(4k_F x)$ | -1 | +1 | -1 | +1 | -1 | +1 | -1 |
$\cos(2k_F x)$ | 0 | -1 | 0 | +1 | 0 | -1 | 0 |
Looking at the data above it seems that:
We consider now
figure(figsize=(12,6))
x1 = np.mean((x[allmax],x[allmin]), axis=0)
y1 = y[allmax] - y[allmin]
plot(x1, y1, 'o-', label='max-min')
x2 = np.mean((x[allmax],x[allmin]), axis=0)
y2 = y[allmax] + y[allmin]
plot(x2, abs(y2), '^-', label='abs(max+min)')
x3 = np.mean((x[allmax[:-1]],x[allmax[1:]]), axis=0)
y3 = y[allmax[:-1]] + y[allmax[1:]]
plot(x3, abs(y3), '>-', label='abs(max+max)')
x4 = np.mean((x[allmin[:-1]],x[allmin[1:]]), axis=0)
y4 = y[allmin[:-1]] + y[allmin[1:]]
plot(x4, abs(y4), 's-', label='abs(min+min)')
legend(loc='best')
figure(figsize=(12,6))
x1 = np.mean((x[allmax],x[allmin]), axis=0)
y1 = y[allmax] - y[allmin]
plot(x1, y1, 'o-', label='max-min')
x2 = np.mean((x[allmax],x[allmin]), axis=0)
y2 = y[allmax] + y[allmin]
plot(x2, abs(y2), '^-', label='abs(max+min)')
x3 = np.mean((x[allmax[:-1]],x[allmax[1:]]), axis=0)
y3 = y[allmax[:-1]] + y[allmax[1:]]
plot(x3, abs(y3), '>-', label='abs(max+max)')
x4 = np.mean((x[allmin[:-1]],x[allmin[1:]]), axis=0)
y4 = y[allmin[:-1]] + y[allmin[1:]]
plot(x4, abs(y4), 's-', label='abs(min+min)')
plot_krho_decay(p=(30, 0.001))
xscale('log')
yscale('log')
legend(loc='best')
figure(figsize=(12,6))
plot(x[allmax], abs(y[allmax]), 'o')
plot_krho_decay(p=(26, 0.0003))
xscale('log')
yscale('log')
xlim(10,L)
ylim(ymax=1e-2)
figure(figsize=(12,6))
plot(x[allmin], abs(y[allmin]), 'o')
plot_krho_decay(p=(18, 0.001))
xscale('log')
yscale('log')
xlim(10,L)
ylim(ymax=1e-2)
print x[allmin]
print x[allmax]
arange(8.)*(128-2) / 16 / 2.