-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathn20m6uniform0p2paiJdisorderSeed8.m
77 lines (65 loc) · 2.17 KB
/
n20m6uniform0p2paiJdisorderSeed8.m
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
n=20; %system size
k=6; %occupation number
m = nchoosek(k+n-1,n-1); % this will be the dim of hilbert space
dividers = [zeros(m,1),nchoosek((1:(k+n-1))',n-1),ones(m,1)*(k+n)];
occs = diff(dividers,1,2)-1; % all paritions
sqrprimetag= sqrt(primes(n^2));
sqrprimetag = sqrprimetag(1:n);
tags= occs*sqrprimetag';
%%
phi=0.2*pi;
ens=100;
seed=8;
rng(seed);
filestrEig = append('canbosParisiN', num2str(n), 'K', num2str(k),'uniformPhi0p2PiJdisorderEigsSeed', num2str(seed),'.txt');
filestrEigSpacRatio = append('canbosParisiN', num2str(n), 'K', num2str(k),'uniformPhi0p2PiJdisorderSpacRaSeed', num2str(seed),'.txt');
fileEigID = fopen(filestrEig,'w');
fileSpacRatioID = fopen(filestrEigSpacRatio,'w');
%%
tagerr = 10^(-10);%tolerence must be small enough to find the correct tags
for w = 1:ens
flux= ranPhases(n, phi);
%flux= ranPhases(n, phi);
hami = sparse(m,m);
for i = 1:n-1
for l= i+1 : n
toper = sparse(m,m);%will become T^+_i * T^-_{l}
for j = 1: m
u=j;
if occs(u,l)> 0
tranformedOcc= occs(u,:);
tranformedOcc(l) = tranformedOcc(l)-1;
tranformedOcc(i) = tranformedOcc(i) +1;
magnitude = sqrt(occs(u,l)) * sqrt(occs(u,i) + 1);
phase = exp(1j/2 * flux(l,i)) * exp(1j/2 * flux(i,l) *(tranformedOcc(l)+ tranformedOcc(i)));
for kk=1:n
if (kk ~= i) && (kk ~= l)
phase = phase * exp(1j/2 * (flux(i,kk)-flux(l,kk))* tranformedOcc(kk));
end
end
vtag = tranformedOcc*sqrprimetag';
v= find(abs(tags - vtag)<tagerr);
toper(v,u) = magnitude * phase;
end
end
hami = hami + randn* toper;
end
end
hami = (hami +ctranspose(hami))/sqrt(n*(n-1));
%%
% ev = eig(full(hami));
% hist(ev)
%%
lowspec = eigs(hami,300);
lowspec = sort(lowspec);
lowspec = lowspec(1:100);
lowspacings = diff(lowspec);
lowspacRatio = [];
for i =1: length(lowspacings) - 1
lowspacRatio = [lowspacRatio min(lowspacings(i),lowspacings(i+1))/max(lowspacings(i),lowspacings(i+1))];
end
fprintf(fileEigID,'%.10f\n', lowspec);
fprintf(fileSpacRatioID,'%.10f\n', lowspacRatio);
end
fclose(fileEigID);
fclose(fileSpacRatioID);