-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_min_state.m
75 lines (69 loc) · 2.16 KB
/
plot_min_state.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
figure;
nb = 3;
ir = 0;
supercell = zeros(nsites*nb^2,2);
for ic = -(nb-1)/2 : (nb-1)/2
for jc = -(nb-1)/2 : (nb-1)/2
for is = 1 : nsites
ir = ir + 1;
supercell(ir,:) = mcell(is,:) + ic*ma1 + jc*ma2;
end
end
end
super_ics = zeros(nb^2*ncharges,1);
for in = 0 : nb^2-1
super_ics(in*ncharges+1:ncharges*(in+1)) = ics_best(:) + in*nsites;
end
%if(add_disorder)
disorder_colors = (disorder' - min(disorder))./max(disorder - min(disorder));
sup_disorder_colors = repmat(disorder_colors,[nb^2,1]);
% f = scatteredInterpolant(supercell(:,1),supercell(:,2),repmat(disorder_colors,[nb^2,1]),'natural');
% z = f(xt',yt');
% surf(xt',yt',z,'FaceAlpha',0.15);
% shading interp
% view(0,90)
% colormap('hot')
% grid off
% colorbar
voronoi(supercell(:,1),supercell(:,2))
hold on
[v,c] = voronoin(supercell,{'Qbb'});
for i = 1:length(c)
fill(v(c{i},1),v(c{i},2),sup_disorder_colors(i),'FaceAlpha',0.25) ;
end
grid off
colormap('hot')
colorbar
% hFills = h.FacePrims;
% for i = 1:length(hFills)
% % Have to set this. The default is 'truecolor' which ignores alpha.
% h(i).ColorType = 'truecoloralpha';
% % The 4th element is the 'alpha' value. First 3 are RGB. Note, the
% % values expected are in range 0-255.
% h(i).ColorData(4) = 0;
% end
%end
% [x,y] = meshgrid(-(nb-1)/2*L : (nb-1)/2*L,-(nb-1)/2*L : (nb-1)/2*L);
% xy = [x(:),y(:)];
% T = [a1;a2];
% xyt = xy*T;
% xt = reshape(xyt(:,1),size(x));
% yt = reshape(xyt(:,2),size(y));
% hold on
% plot(xt,yt,'k-')
% hold on
% plot(xt',yt','k-')
axis equal
hold on
scatter(supercell(:,1),supercell(:,2),100,zeros(nb^2*nsites,1),'filled','MarkerFaceColor','w','MarkerEdgeColor','k')
hold on
scatter(supercell(super_ics,1),supercell(super_ics,2),100,ones(nb^2*ncharges,1),'filled','MarkerFaceColor','k','MarkerEdgeColor','k')
axis([-3 3 -3 3]*alat)
%colormap(flipud(gray))
str_fill = num2str(filling);
caxis([0 1]);
set(gca,'FontSize',32)
xlabel(gca,'$x$ [\AA]','Interpreter','latex','FontSize',32)
ylabel(gca,'$y$ [\AA]','Interpreter','latex','FontSize',32)
title(gca,join(['$\nu=$',str_fill]),'Interpreter','latex')
saveas(gca,join([filename,'.fig']))