-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmobility100f.m
More file actions
384 lines (342 loc) · 8.66 KB
/
mobility100f.m
File metadata and controls
384 lines (342 loc) · 8.66 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
%% Common
clear classes;
Clib.type = 'perES';
Clib.nangles = 100;
Clib.Vgs = 1;
Clib.betaES = -20;
Clib.beta1 = 1;
Clib.tstep = 1;
Clib.temp = 298;
Clib.ESoverlap = true;
Clib.ESeps = 0.1;
nangles = [50 100];
Vgs = [0.3 1];
betaES = [-20];
beta1 = [1];
tstep = [1 10 0.2 0.05];
nsteps = [200000 20000 600000 1000000];
%ESeps = [0.1 0.2 0.3 0.4 0.5 0.7 0.9 1.0];
ESeps = [0.1 0.2 0.3 0.4 0.5];
C = TrajConfig;
C.ESoverlap = true;
C.ESforces = 1;
C.optWidth = 0;
C.periodic = true;
nsave = [0 1000 0 0 1];
lib = Library('data3\mobility100f','perES');
%% Generate data
for i1 = 1:size(nangles,2)
for i2 = 1:size(Vgs,2)
for i3 = 1:size(betaES,2)
for i4 = 1:size(beta1,2)
for i5 = 1:size(tstep,2)
for i6 = 1:size(ESeps,2)
Clib.nangles = nangles(i1);
Clib.Vgs = Vgs(i2);
Clib.betaES = betaES(i3);
Clib.beta1 = beta1(i4);
Clib.tstep = tstep(i5);
Clib.ESeps = ESeps(i6);
C.nangles = Clib.nangles;
C.Vgs = Clib.Vgs;
C.betaES = Clib.betaES;
C.beta1 = Clib.beta1;
C.tstep = Clib.tstep;
C.temp = Clib.temp;
C.ESeps = Clib.ESeps;
found = lib.find(Clib);
nfound = size(found,1);
if (nfound > 0)
disp(['angles ',num2str(C.nangles), ...
' Vgs ', num2str(C.Vgs), ...
' betaEs ', num2str(C.betaES), ...
' beta1 ', num2str(C.beta1), ...
' tstep ', num2str(C.tstep), ...
' found'
]);
else
disp(['angles ',num2str(C.nangles), ...
' Vgs ', num2str(C.Vgs), ...
' betaEs ', num2str(C.betaES), ...
' beta1 ', num2str(C.beta1), ...
' tstep ', num2str(C.tstep), ...
' not found'
]);
t1 = TrajSegment(C,nsave,0,0);
tic;
olaps = t1.runTraj( nsteps(i5) );
toc;
lib.store(Clib, t1);
end
end
end
end
end
end
end
%% load data
for i1 = 1:size(nangles,2)
for i2 = 1:size(Vgs,2)
for i3 = 1:size(betaES,2);
for i4 = 1:size(beta1,2);
for i5 = 1:size(tstep,2);
Clib.nangles = nangles(i1);
Clib.Vgs = Vgs(i2);
Clib.betaES = betaES(i3);
Clib.beta1 = beta1(i4);
Clib.tstep = tstep(i5);
disp(['angles ',num2str(Clib.nangles), ...
' Vgs ', num2str(Clib.Vgs), ...
' betaEs ', num2str(Clib.betaES), ...
' beta1 ', num2str(Clib.beta1), ...
' tstep ', num2str(Clib.tstep), ...
]);
ifound = lib.find(Clib,false);
t1 = lib.retrieve(ifound);
c1 = t1.data('cent');
d1 = diff(c1);
dtest = [d1+2*pi; d1; d1-2*pi];
d2 = min(abs(dtest),[],1);
hist(d2,200);
input junk;
end
end
end
end
end
%% analysis
for i1 = 1:size(nangles,2)
for i2 = 1:size(Vgs,2)
for i3 = 1:size(betaES,2)
for i4 = 1:size(beta1,2)
for i5 = 1:size(tstep,2)
for i6 = 1:size(ESeps,2)
Clib.nangles = nangles(i1);
Clib.Vgs = Vgs(i2);
Clib.betaES = betaES(i3);
Clib.beta1 = beta1(i4);
Clib.tstep = tstep(i5);
Clib.ESeps = ESeps(i6);
ifound = lib.find(Clib,false);
% disp(['angles ',num2str(Clib.nangles), ...
% ' Vgs ', num2str(Clib.Vgs), ...
% ' betaEs ', num2str(Clib.betaES), ...
% ' beta1 ', num2str(Clib.beta1), ...
% ' tstep ', num2str(Clib.tstep), ...
% ' ESeps ', num2str(Clib.ESeps), ...
% ' found ', num2str(ifound), ...
% ]);
if (~isempty(ifound))
t1 = lib.retrieve(ifound);
c1 = t1.data('cent');
c1 = c1(1,:);
d1 = diff(c1);
dtest = [d1+2*pi; d1; d1-2*pi];
d2 = min(abs(dtest),[],1);
% d2 is in radians, need to convert to unit cells
d2 = d2 .* t1.C.nangles/(2*pi);
if (Clib.tstep < 1)
disp('>');
nsteps = 1/Clib.tstep;
d3 = [];
currentPoint = 1;
while((currentPoint+nsteps) < length(d2))
d3(end+1) = sum(d2(currentPoint:(currentPoint+nsteps-1)));
currentPoint = currentPoint+nsteps;
end
avgx2 = sum(d3.^2)/size(d3,2);
mob = (1.6e-19 * (4e-8).^2 /2/1.38e-23/298/48.8e-15) * avgx2/...
(Clib.tstep * nsteps);
else
avgx2 = sum(d2.^2)/size(d2,2);
mob = (1.6e-19 * (4e-8).^2 /2/1.38e-23/298/48.8e-15) * avgx2/Clib.tstep;
end
%disp([' mobility = ',num2str(mob)]);
disp(['angles ',num2str(Clib.nangles), ...
' Vgs ', num2str(Clib.Vgs), ...
' betaEs ', num2str(Clib.betaES), ...
' beta1 ', num2str(Clib.beta1), ...
' tstep ', num2str(Clib.tstep), ...
' ESeps ', num2str(Clib.ESeps), ...
' found ', num2str(ifound), ...
' avgx2 ', num2str(avgx2), ...
' mobility ',num2str(mob), ...
]);
end
%hist(d2,200);
%input junk;
end
end
end
end
end
end
%% How does x2 change with summation of steps ?
%ESeps = [0.1 0.2 0.3 0.4 0.5];
col = {'r','y','g','b','k'};
%tstep = [1 10 0.2 0.05];
sym = {'x','.','^','o'};
for i1 = 1:size(ESeps,2)
for i2 = 1:size(tstep,2)
Clib.nangles = 100;
Clib.Vgs = 0.3;
Clib.betaES = -20;
Clib.beta1 = 1;
Clib.tstep = tstep(i2);
Clib.ESeps = ESeps(i1);
ifound = lib.find(Clib,false);
t1 = lib.retrieve(ifound);
angles = t1.data('cent');
%y1 = c1(2,:);
%state = floor(y1);
%olap = y1 - state;
%olap = olap(2:size(olap,2));
loc = perToLinear(t1.C.nangles, angles);
plotx = zeros(100,1);
ploty = zeros(100,1);
ic = 1;
for time = 1:100
bin = floor(time/t1.C.tstep);
plotx(ic,1) = Clib.tstep * bin; % * 48.8/1000;
ploty(ic,1) = getMobility(t1.C, loc, bin);
ic = ic+1;
end
figure(400 + i1);
hold on;
plot(plotx,ploty,[col{i1},sym{i2}]);
end
end
%% Since results are converged by limit of above plot (time = 100), look at
% this point only
nangles = [50 100];
Vgs = [0.3 1];
betaES = [-20];
beta1 = [1];
tstep = [0.05 0.2 1 10];
ESeps = [0.1 0.2 0.3 0.4 0.5];
mob = zeros(size(nangles,2), size(ESeps,2), size(tstep,2));
for i1 = 1:size(nangles,2)
lib = Library(['mobility',num2str(nangles(i1)),'f'],'perES');
for i2 = 1:size(ESeps,2)
for i3 = 1:size(tstep,2)
Clib.nangles = nangles(i1);
Clib.Vgs = 0.3;
Clib.betaES = -20;
Clib.beta1 = 1;
Clib.tstep = tstep(i3);
Clib.ESeps = ESeps(i2);
ifound = lib.find(Clib,false);
t1 = lib.retrieve(ifound);
angles = t1.data('cent');
loc = perToLinear(t1.C.nangles, angles);
time = 100;
bin = floor(time/t1.C.tstep);
mob(i1,i2,i3) = getMobility(t1.C, loc, bin);
end
end
end
%% plot mob
nangles = [50 100];
sym = {'x','o'};
tstep = [0.05 0.2 1 10];
col = {'r','k','b','g'};
ESeps = [0.1 0.2 0.3 0.4 0.5];
for i1 = 1:size(nangles,2)
for i2 = 1:size(ESeps,2)
for i3 = 1:size(tstep,2)
figure(10);
hold on;
plot(ESeps(i2), mob(i1,i2,i3),[col{i3},sym{i1}]);
end
end
end
%% What is happening with the cutoffs?
for nangles = 50 % 50:50:100
Clib.nangles = nangles;
Clib.Vgs = 1.0;
Clib.betaES = -20;
Clib.beta1 = 1;
Clib.tstep = 0.05;
lib = Library(['data3\mobility',num2str(Clib.nangles),'f'],'perES');
if Clib.nangles == 100
sym = '^';
ESeps = [0.1 0.2 0.3 0.4 0.5];
else
sym = '>';
ESeps = [0.1 0.2 0.3 0.4 0.5];
end
col = {'b','r','k','b','g','c'};
for i1 = 1 %:size(ESeps,2)
Clib.ESeps = ESeps(i1);
ifound = lib.find(Clib,false);
if (ifound == [])
disp('data not found');
end
t1 = lib.retrieve(ifound);
c1 = t1.data('cent');
angles = c1(1,:);
% flag is stored in center(2,:)
y1 = c1(2,:);
% integer component is the state selected
state = floor(y1);
% remaining portion is the overlap
olap = y1 - state;
% dist(n) holds loc(n+1) - loc(n)
% so state(n+1) and olap(n+1) are appropriate
olap = olap(2:size(olap,2));
state = state(2:size(state,2));
loc = perToLinear(t1.C.nangles, angles);
dist = loc(1,2:size(loc,2)) - loc(1,1:(size(loc,2)-1));
%[~,ist1] = find(state < 1.5);
%olap = olap(ist1);
%dist = dist(ist1);
% examine distances as a function of overlap
step = 0.025;
ols = Clib.ESeps:step:(1.0-step); % available data starts at ESeps
nplot = size(ols,2);
xplot = zeros(nplot,1);
yplot = zeros(nplot,1);
yplot2 = zeros(nplot,1);
mu = zeros(nplot,1);
i=0;
for ol = ols
i = i+1;
xplot(i) = ol+(step/2);
% select points within a range of overlap
[~,ind1] = find((ol<olap) & (olap<(ol+step)));
% find average x^2 for steps with this overlap
yplot(i) = mean(dist(ind1).^2);
yplot2(i) = size(ind1,2);
end
% get fraction of steps with this overlap
yplot2n = yplot2/sum(yplot2);
for i2 = 1:nplot
% fraction of steps, assuming we keep states with overlaps > ols(i2)
ytemp = yplot2(i2:nplot)/sum(yplot2(i2:nplot));
% average x2 for this cut off
avgx2 = sum(ytemp.*yplot(i2:nplot));
time1 = Clib.tstep;
mu(i2) = (1.6e-19 * (4e-8).^2 /2/1.38e-23/298/48.8e-15) * avgx2/time1;
end
figure(10);
hold on;
plot(xplot,yplot,[col{i1},sym,'-']);
figure(11);
hold on;
plot(xplot,log10(yplot2n),[col{i1},sym,'-']);
figure(12);
hold on;
plot(xplot,yplot.*yplot2n,[col{i1},sym,'-']);
figure(13);
hold on;
plot(xplot,mu,[col{i1},sym,'-']);
end
end
figure(10)
title('avg x2 versus overlap');
figure(11)
title('log(# steps) versus overlap');
figure(12);
title('contribution to x2 versus overlap');
figure(13);
title('mobility as function of overlap cutoff');