-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRaman2D_2.m
More file actions
149 lines (103 loc) · 3.63 KB
/
Copy pathRaman2D_2.m
File metadata and controls
149 lines (103 loc) · 3.63 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
function out = Raman2D(N,bins,type,flag,nn,Jx,Jz)
%output form: out = [Ev,DEp,DEm,DE,Ipp,Imm,Ipm]
%tic
%input-parameter:
%2N is the number of points in a dimension
%flag is a boolean telling whether to estimate time on this run
%nn is the number of times that you plan to do a similar calculation (for error estimation)
%type is a string specifying which Raman operator
%bins...number of bins on the energy axis
%emax...the max energy for the energy axis
%lv...the brillioun zone will be cut out of a rectangle shaped grid with
% ~lv^3 points
%output-values:
%Evalues...energy values from the lowest to the highest energy occuring
%DE...how many times every energy value occurs
%additional output:
%plot of the densitiy of states
%The Hamiltonian used comes from EK Lee et al. arXiv:1308.6592v2
%bins = 2*N;
%input data
%Jx = .3;
Jy = Jx;
%Jz = 1;
%pick the right Raman operator
switch type
case 'xx'
hx = 3/4*Jx; hy = 3/4*Jy ; hz = 0;
case 'yy'
hx = 1/4*Jx; hy = 1/4*Jy; hz = Jz;
case 'xy'
hx = -sqrt(3)/4*Jx; hy = sqrt(3)/4*Jy; hz = 0;
end
%L=2*N;
%hhz = repmat(hz,L,L);
%The following can be used to ensure that H is diagonalized by the unitary
%matrix below by checking that the Raman spectra are zero.
%hx=Jx;hy=Jy;hz=Jz;
emin = 0;
emax = 6*max(1,Jx); er = emax-emin;
%initialization
%Evalues=linspace(0,emax,bins);
DE=zeros(bins,1);
I=zeros(bins,1);
Ev = (1:bins)'*emax/(bins*max(1,Jx));
r1 = rand; r2 = rand; %r3 = rand;
pts = (-N):(N-1); %pts=pts/N;
%treat x and y values as corresponding to column
%ans row values respectively
x=(pts+r1)*2*pi/(sqrt(3)*N);
%z=repmat((pts.' + r3)/N,1,L)*pi/(3*sqrt(2));
Z=0;
for ind = pts
y = (ind + r2)*2*pi/(3*N);
%I display an estimate of the end time
aleph = 1+round(200^2/N) ; %1 + iterations for ~1 second of computation
%Or an iteration, which ever is longer
if ind == -N+2 && flag %the first few may be slower due to initialization
cl1 = clock;
end
if ind == -N+2+aleph && flag
cl2 = clock;
time = (cl2-cl1)*(2*N)/aleph *3*nn;
%cl = cl1 + time*(2*N-2)/(2*N);
format shortg
disp('approximate time to take:')
disp( datestr(time(6)/24/3600, 'DD-HH:MM:SS') )
% disp(time(6))
% disp('approximate end datetime:')
% disp(cl)
format
end
% if minute ~= cl(5)
% disp( ind )
% minute = cl(5);
% end
% tic
%If this value is not positive I negate the energies out of the hist
sn = sign( 2*pi/3 - abs(y) - abs(x)/sqrt(3) );
%Now I do arithmetic as if x,y, and z were numbers but with x and a
%matrices and doing only elementwise operations with them.
%I only store values for a given y and then reduce the information into
%a histogram before looping back to keep from overloading the memory
%My computer handles about 2 to 5 * 10^8 doubles at once in memory so I
%expect this code to max out the memory around N~10^8
%The Eigenvalues
% toc
% tic
s = Jz + Jx*exp(1).^(1i*(y*3+x*sqrt(3))/2) + Jy*exp(1).^(1i*(y*3-x*sqrt(3))/2) ;
en = 2*abs(s);
h = hz + hx*exp(1).^(1i*(y*3+x*sqrt(3))/2) + hy*exp(1).^(1i*(y*3-x*sqrt(3))/2) ;
V = (imag(h.*conj(s))./abs(s));
%The Delta weight in the Raman term (turned into column vectors)
W = 4*pi*V.^2;
[histw, histv] = histwv(en(sn>=0).',W(sn>=0).',0,emax,bins);
I = I + histw;
DE = DE + histv;
% toc
[d1,d2] = size(sn(sn(:)>=0));
Z=Z+d1*d2;
end
DE = DE*bins/(Z*er );
I=I*bins/(Z*er );
out = [Ev,DE,I];