-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCentralRegionEdgeContact.cpp
302 lines (266 loc) · 11.7 KB
/
CentralRegionEdgeContact.cpp
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
// @author Wushi Dong
// CentralRegionEdgeContact.cpp
#include "CentralRegionEdgeContact.h"
CentralRegionEdgeContact::~CentralRegionEdgeContact(){}
cx_mat CentralRegionEdgeContact::GetInteractionGrapheneS2(const double phase)
const
{
// Width of one supercell (same for graphene and MoS2)
const double width = mLatticeConstantMoS2 * mNumUnitCellYMoS2;
cx_mat interaction_Gr_S2(mNumWannierGraphene * mNumUnitCellXGraphene
* mNumUnitCellYGraphene, mNumUnitCellYMoS2 * mNumWannierS2);
interaction_Gr_S2.zeros();
double distance;
// position profile for Gr edge carbon atoms
double pos_Gr[mNumWannierGraphene * mNumUnitCellXGraphene
* mNumUnitCellYGraphene][2];
// position profile for interfacial sulfur atoms
double pos_s[mNumUnitCellYMoS2][2];
// Sets carbon atom positions
for(int i = 0; i < mNumWannierGraphene * mNumUnitCellXGraphene; ++i)
{
pos_Gr[2 * i + 3][0] = 0.0;
pos_Gr[2 * i + 3][1] = i * mLatticeConstantGraphene;
pos_Gr[2 * i + 2][0] = -mLatticeConstantGraphene / sqrt(3.0) * 0.5;
pos_Gr[2 * i + 2][1] = i * mLatticeConstantGraphene + 0.5
* mLatticeConstantGraphene;
pos_Gr[2 * i + 1][0] = -mLatticeConstantGraphene / sqrt(3.0) * 1.5;
pos_Gr[2 * i + 1][1] = i * mLatticeConstantGraphene + 0.5
* mLatticeConstantGraphene;
pos_Gr[2 * i + 0][0] = -mLatticeConstantGraphene / sqrt(3.0) * 2.0;
pos_Gr[2 * i + 0][1] = i * mLatticeConstantGraphene;
}
// Sets sulfur atom positions
for(int i = 0; i < mNumUnitCellYMoS2; ++i)
{
pos_s[i][0] = mDistanceGrS2;
pos_s[i][1] = (double) i * mLatticeConstantMoS2 + mYShift;
}
// Assigns interaction parameters that exponential decays with distance
for(int i = 0; i < mNumWannierGraphene * mNumUnitCellXGraphene
* mNumUnitCellYGraphene; ++i)
{
for(int j = 0; j < mNumUnitCellYMoS2; ++j)
{
distance = sqrt(pow((pos_Gr[i][0] - pos_s[j][0]), 2) + pow(pos_Gr[i][1]
- pos_s[j][1], 2));
interaction_Gr_S2(i, j * mNumWannierS2 + mNumWannierGraphene
* mNumUnitCellXGraphene) = mHoppingCS * exp(-distance
/ mDistanceGrS2);
}
}
// With supercell above
for(int i = 0; i < mNumWannierGraphene * mNumUnitCellXGraphene
* mNumUnitCellYGraphene; ++i)
{
for(int j = 0; j < mNumUnitCellYMoS2; ++j)
{
distance = sqrt(pow((pos_Gr[i][0] - pos_s[j][0]), 2) + pow(pos_Gr[i][1]
- (pos_s[j][1] + width), 2));
interaction_Gr_S2(i, j * mNumWannierS2 + mNumWannierGraphene
* mNumUnitCellXGraphene) += mHoppingCS * exp(-distance
/ mDistanceGrS2) * exp(constants::I * phase);
}
}
// With supercell below
for(int i = 0; i < mNumWannierGraphene * mNumUnitCellXGraphene
* mNumUnitCellYGraphene; ++i)
{
for(int j = 0; j < mNumUnitCellYMoS2; ++j)
{
distance = sqrt(pow((pos_Gr[i][0] - pos_s[j][0]), 2) + pow(pos_Gr[i][1]
- (pos_s[j][1] - width), 2));
interaction_Gr_S2(i, j * mNumWannierS2 + mNumWannierGraphene
* mNumUnitCellXGraphene) += mHoppingCS * exp(-distance
/ mDistanceGrS2) * exp(-constants::I * phase);
}
}
return interaction_Gr_S2;
}
// TODO([email protected]): Remove data and directly access hopping parameters
// through mpHoppingData[]
cx_mat CentralRegionEdgeContact::GetHamiltonianS2(double phase) const
{
// Array for storing MoS2 hopping parameters
double data[(2 * mNumNearestNeighborsMoS2 + 1)][(2 * mNumNearestNeighborsMoS2 + 1)][mNumWannierMoS2][mNumWannierMoS2];
// Gets hopping parameters from mpHoppingData[]
for(int i = 0; i < 2 * mNumNearestNeighborsMoS2 + 1; ++i)
for(int j = 0; j < 2 * mNumNearestNeighborsMoS2 + 1; ++j)
for(int l = 0; l < mNumWannierMoS2; ++l)
for(int m = 0; m < mNumWannierMoS2; ++m)
data[i][j][l][m] = mpHoppingData[i * (2 * mNumNearestNeighborsMoS2
+ 1) * mNumWannierMoS2 * mNumWannierMoS2 + j * mNumWannierMoS2
* mNumWannierMoS2 + l * mNumWannierMoS2 + m];
// S2 layer in the middle
cx_mat h_s2(mNumWannierS2, mNumWannierS2);
cx_mat int_scat_1(mNumWannierS2, mNumWannierS2);
cx_mat int_scat_2(mNumWannierS2, mNumWannierS2);
cx_mat PL_s2(mNumWannierS2 * mNumUnitCellYMoS2, mNumWannierS2
* mNumUnitCellYMoS2);
// hamiltonian for a single unit cell (phase-dependent supercell coupling
// included)
for(int i_wan = 0; i_wan < mNumWannierS2; ++i_wan)
{
for(int j_wan = 0; j_wan < mNumWannierS2; ++j_wan)
h_s2(i_wan, j_wan) = data[0 + mNumNearestNeighborsMoS2][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
+ mNumWannierMo] + data[0 + mNumNearestNeighborsMoS2
- mNumUnitCellYMoS2][0 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan + mNumWannierMo] * exp(constants::I * phase) + data[0
+ mNumNearestNeighborsMoS2 + mNumUnitCellYMoS2][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
+ mNumWannierMo] * exp(-constants::I * phase);
}
// hamiltonian between two neighboring unit Cell in y direction
// (phase-dependent supercell coupling included)
for(int i_wan = 0; i_wan < mNumWannierS2; ++i_wan)
{
for(int j_wan = 0; j_wan < mNumWannierS2; ++j_wan)
{
int_scat_1(i_wan, j_wan) = data[0 + mNumNearestNeighborsMoS2 - 1][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
+ mNumWannierMo] + data[0 + mNumNearestNeighborsMoS2
- 1 - mNumUnitCellYMoS2][0 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan + mNumWannierMo] * exp(constants::I * phase) + data[0
+ mNumNearestNeighborsMoS2 - 1 + mNumUnitCellYMoS2][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
+ mNumWannierMo] * exp(-constants::I * phase);
int_scat_2(i_wan, j_wan) = data[0 + mNumNearestNeighborsMoS2 - 2][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
+ mNumWannierMo] + data[0 + mNumNearestNeighborsMoS2
- 2 - mNumUnitCellYMoS2][0 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan + mNumWannierMo] * exp(constants::I * phase) + data[0
+ mNumNearestNeighborsMoS2 - 2 + mNumUnitCellYMoS2][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
+ mNumWannierMo] * exp(-constants::I * phase);
}
}
// Hamiltonian for a supercell
mat f_scat(mNumUnitCellYMoS2, mNumUnitCellYMoS2);
f_scat.zeros();
f_scat.diag(1) += 1;
PL_s2 = kron(f_scat, int_scat_1);
f_scat.zeros();
f_scat.diag(2) += 1;
PL_s2 = PL_s2 + kron(f_scat, int_scat_2);
PL_s2 = PL_s2 + PL_s2.t();
f_scat.zeros();
f_scat.diag(0) += 1;
PL_s2 = PL_s2 + kron(f_scat,h_s2);
return PL_s2;
}
cx_mat CentralRegionEdgeContact::GetInteractionS2MoS2(const double phase) const
{
cx_mat INT_s2_MoS2(mNumWannierS2 * mNumUnitCellYMoS2, mNumWannierMoS2
* mNumUnitCellXMoS2 * mNumUnitCellYMoS2);
for(int i_rep = 0; i_rep < mNumUnitCellYMoS2; ++i_rep)
{
for(int j_rep = 0; j_rep < mNumUnitCellYMoS2; ++j_rep)
INT_s2_MoS2.submat(i_rep * mNumWannierS2, j_rep * mNumWannierMoS2
* mNumUnitCellXMoS2, (i_rep + 1) * mNumWannierS2 - 1, (j_rep + 1)
* mNumWannierMoS2 * mNumUnitCellXMoS2 - 1)
= GetS2MoS2Interaction(j_rep - i_rep, phase);
}
return INT_s2_MoS2;
}
// TODO([email protected]): Remove data and directly access hopping parameters
// through mpHoppingData[]
cx_mat CentralRegionEdgeContact::GetS2MoS2Interaction(const int y, const double
phase) const
{
cx_mat hamiltonian(mNumWannierS2, mNumWannierMoS2 * mNumUnitCellXMoS2);
// Array for storing MoS2 hopping parameters
double data[(2 * mNumNearestNeighborsMoS2 + 1)][(2 * mNumNearestNeighborsMoS2
+ 1)][mNumWannierMoS2][mNumWannierMoS2];
// Gets hopping parameters from mpHoppingData[]
for(int i = 0; i < 2 * mNumNearestNeighborsMoS2 + 1; ++i)
for(int j = 0; j < 2 * mNumNearestNeighborsMoS2 + 1; ++j)
for(int l = 0; l < mNumWannierMoS2; ++l)
for(int m = 0; m < mNumWannierMoS2; ++m)
data[i][j][l][m] = mpHoppingData[i * (2 * mNumNearestNeighborsMoS2
+ 1) * mNumWannierMoS2 * mNumWannierMoS2 + j * mNumWannierMoS2
* mNumWannierMoS2 + l * mNumWannierMoS2 + m];
// Assign Hamiltonian between all atom pairs
// S
for(int i_wan = 0; i_wan < mNumWannierS2; ++i_wan)
{
// - Mo1
for(int j_wan = 0; j_wan < mNumWannierMo; ++j_wan)
hamiltonian(i_wan, j_wan) = data[0 + mNumNearestNeighborsMoS2 + (- y)][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan] + data[0
+ mNumNearestNeighborsMoS2 + (-(y + mNumUnitCellYMoS2))][0
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan] * exp(constants::I
* phase) + data[0 + mNumNearestNeighborsMoS2 + (-(y
- mNumUnitCellYMoS2))][0 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan] * exp(-constants::I * phase);
// - S1
for(int j_wan = mNumWannierMo; j_wan < mNumWannierMoS2; ++j_wan)
hamiltonian(i_wan, j_wan) = data[0 + mNumNearestNeighborsMoS2 + (- y)][1
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan] + data[0
+ mNumNearestNeighborsMoS2 + (-(y + mNumUnitCellYMoS2))][1
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan] * exp(constants::I
* phase) + data[0 + mNumNearestNeighborsMoS2 + (-(y
- mNumUnitCellYMoS2))][1 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan] * exp(-constants::I * phase);
// - Mo2
for(int j_wan = 0 + mNumWannierMoS2; j_wan < mNumWannierMo
+ mNumWannierMoS2; ++j_wan)
hamiltonian(i_wan, j_wan) = data[0 + mNumNearestNeighborsMoS2 + (- y)][1
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
- mNumWannierMoS2] + data[0 + mNumNearestNeighborsMoS2 + (-(y
+ mNumUnitCellYMoS2))][1 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan - mNumWannierMoS2] * exp(constants::I * phase) + data[0
+ mNumNearestNeighborsMoS2 + (-(y - mNumUnitCellYMoS2))][1
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
- mNumWannierMoS2] * exp(-constants::I * phase);
// - S2
for(int j_wan = mNumWannierMo + mNumWannierMoS2; j_wan < mNumWannierMoS2
+ mNumWannierMoS2; ++j_wan)
hamiltonian(i_wan, j_wan) = data[1 + mNumNearestNeighborsMoS2 + (- y)][2
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
- mNumWannierMoS2] + data[1 + mNumNearestNeighborsMoS2 + (-(y
+ mNumUnitCellYMoS2))][2 + mNumNearestNeighborsMoS2][i_wan
+ mNumWannierMo][j_wan - mNumWannierMoS2] * exp(constants::I * phase) + data[1
+ mNumNearestNeighborsMoS2 + (-(y - mNumUnitCellYMoS2))][2
+ mNumNearestNeighborsMoS2][i_wan + mNumWannierMo][j_wan
- mNumWannierMoS2] * exp(-constants::I * phase);
}
return hamiltonian;
}
//// Testing
//int main()
//{
// // Input parameters
// Parameters parameters;
// parameters.ParseInputFile();
// parameters.Print();
//
// cout << endl << "Setting up materials ..." << endl;
//
// // Graphene
// const Graphene *pGraphene = new Graphene(parameters);
// cout << pGraphene->GetPrefix() << " ..." << endl;
//
// // MoS2
// const MoS2 *pMoS2 = new MoS2(parameters, pGraphene);
// cout << pMoS2->GetPrefix() << " ..." << endl;
//
// // Set up edge contact device central region
// CentralRegionEdgeContact central_region_edge_contact(parameters, pGraphene,
// pMoS2);
//
//// cout << "GetInteractionGrapheneS2" << endl;
//// cout << central_region_edge_contact.GetInteractionGrapheneS2(0.) << endl;
//// cout << endl;
//// cout << "GetHamiltonianS2" << endl;
//// cout << central_region_edge_contact.GetHamiltonianS2(0.) << endl;
//// cout << endl;
// cout << "GetInteractionS2MoS2" << endl;
// cout << central_region_edge_contact.GetInteractionS2MoS2(0.) << endl;
// cout << endl;
//
// delete pGraphene;
// delete pMoS2;
//
// return 0;
//}