-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimulate_bilayer_spinactive_sc.m
106 lines (85 loc) · 3.54 KB
/
simulate_bilayer_spinactive_sc.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
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
% This script simulates the proximity effect in a metal with a spin-active interface.
% [This version of the script performs the calculation self-consistently.]
%
% Written by Jabir Ali Ouassou <[email protected]>
% Created 2015-05-06
% Updated 2015-05-07
function simulate_bilayer_spinactive_sc(interface_polarization, interface_phase)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE PARAMETERS FOR THE SIMULATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Vectors of positions and energies that will be used in the simulation
positions = linspace(0, 1, 151);
energies = [linspace(0.001,1.500,501) linspace(1.501,cosh(1/0.2),101)];
% Filename where results will be stored
output = 'simulate_bilayer_spinactive_sc.dat';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PREPARATIONS FOR THE SIMULATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make sure that all required classes and methods are in the current path
initialize;
% Create a superconductor [d=3.5ξ]
s = Superconductor(positions, energies, 1/3.5^2, 0.2);
s.spinactive = 1;
s.interface_right = 3;
s.magnetization_right = [0,0,1];
s.polarization_right = interface_polarization;
s.phaseshift_right = interface_phase;
%s.locked = true;
% Create a normal metal [d=ξ]
m = Metal(positions, energies, 1/1^2);
m.spinactive = 1;
m.interface_left = 3;
m.magnetization_left = [0,0,1];
m.polarization_left = interface_polarization;
m.phaseshift_left = interface_phase;
% Set the metal state
for N=1:length(positions)
for M=1:length(energies)
m.states(N,M) = State;
end
end
% This enables or disables various debugging options
s.delay = 0;
s.debug = 1;
s.plot = 0;
m.delay = 0;
m.debug = 1;
m.plot = 0;
% These variables keep track of the density of states
dosM = zeros(1,length(energies));
dosS = zeros(1,length(energies));
dosM0 = ones(1,length(energies));
dosS0 = ones(1,length(energies));
residue = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PERFORM THE SIMULATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic;
while residue > 1e-3
% Status information
fprintf('[ Time: %2d min ] [ Gap: %.4f ] [ Residue: %.4f ]\n', floor(toc/60), s.gap_max, residue);
% Update the internal state of the normal metal
m.update_boundary_left(s);
m.update;
% Calculate the density of states in the normal metal [left end]
dosM0 = dosM;
for n=1:length(energies)
dosM(n) = m.states(1,n).eval_ldos;
end
fprintf('[ ZEP in metal: %.6f ]\n\n', dosM(1));
% Update the internal state of the superconductor
s.update_boundary_right(m);
s.update;
% Calculate the density of states in the superconductor [right end]
dosS0 = dosS;
for n=1:length(energies)
dosS(n) = s.states(end,n).eval_ldos;
end
fprintf('[ ZEP in superconductor: %.6f ]\n\n', dosS(1));
% Update the residue
residue = max(max(abs(dosM-dosM0)),max(abs(dosS-dosS0)));
% Save the results of the simulation
save(output);
end
end