-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcall_dos.m
More file actions
85 lines (72 loc) · 2.61 KB
/
call_dos.m
File metadata and controls
85 lines (72 loc) · 2.61 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
% author: ziyan (zoe) zhu
% email: zzhu1@g.harvard.edu
% example calculatiion of the DOS
clear all
q1_list = linspace(1,2,11); % list of \theta_{12} in deg.
q2_list = linspace(1,2,11); % list of \theta_{23} in deg.
k_cutoff = 5; % k space cutoff in the unit of reciprocal lattice constant
E_list = linspace(-1,1,1e3); % list of energies in eV
q_cut_type = 1; % type of Brillouin zone sampling.
% type 1: monolayer Brillouin zone
% type 2: L12 moire Brillouin zone
% type 3: L23 moire Brillouin zone
num_eigs = 540; % number of eigenvalues to keep in the diagonalization
nq = 21; % grid size
E_field = 0; % vertical displacement field
save_data = 1;
a0 = 1.43 * sqrt(3);
% parallelization; define the number of parallel processes
% if running on a cluster
% np = str2num(getenv('SLURM_CPUS_PER_TASK')); % number of workers
% if running locally
np = 16;
k = 1;
for i = 1:length(q1_list)
for j = 1:length(q2_list)
twist(:, k) = [q1_list(i), q2_list(j)];
k = k + 1;
end
end
% total number of twist angles to calculate
tot_pt = length(q1_list)*length(q2_list);
parpool('local',np)
%figure(234)
%set(gcf,'Position',[211 101 453 453])
% clf
for i = 1:tot_pt
%if exist('np','var')
% parpool('local',np)
%else
% parpool('local',1)
%end
param = 6e-3;
lg{i} = ['$\theta_{12} = ' num2str(twist(1,i)) '^\circ$' 10 '$\theta_{23} = ' ...
num2str(twist(2,i)) '^\circ$'];
fprintf("Running twist angle %d/%d \n", i, tot_pt)
tic
[dos_tot, dos_tot_mono, dos_fit, prefac] = dos_calc_tri(a0,twist(1,i),twist(2,i),E_field,k_cutoff,param,nq,num_eigs,E_list,q_cut_type,save_data);
toc
% check monolayer fit
%subplot(1,2,1)
%box on
%hold all;
%plot(dos_tot_mono, E_list, 'LineWidth', 2)
%plot(prefac*polyval(dos_fit,E_list),E_list,'k--','LineWidth',2)
%ylim([-0.8 0.8])
%xlim([0 max(dos_tot_mono(:))*1.1]);
%title('Monolayer')
%ylabel('Energy (eV)')
%xlabel('DoS $\mathrm{(eV^{-1}\cdot\AA^{-2})}$','Interpreter','latex');
%subplot(1,2,2)
%box on;
%hold all
%plot(dos_tot,E_list, 'LineWidth', 2)
%ylim([-0.8 0.8])
%yticklabels([])
%legend(lg,'Interpreter','latex')
%title('Full DOS')
%xlabel('DoS $\mathrm{(eV^{-1}\cdot\AA^{-2})}$','Interpreter','latex');
disp("=====================================")
%delete(gcp('nocreate'))
end
delete(gcp('nocreate'))