Corregido un error en la lectura de los array.
[ptslat.git] / input.f90
blob9bdfeea4450d23e7fc4ed2db9cd2da8f1e579257
1 MODULE Input_Data
2 IMPLICIT NONE
4 REAL, SAVE :: A_S,B_S,C_S ! -> Superlattice constants
5 REAL, DIMENSION(3), SAVE :: A1_S,A2_S,A3_S ! -> Superlattice vectors
6 INTEGER, SAVE :: NMin_X,NMax_X,NMin_Y,NMax_Y,NMin_Z,NMax_Z
7 REAL, SAVE :: X_Min,X_Max,Y_Min,Y_Max,Z_Min,Z_Max
8 REAL, SAVE :: X_Inc,Y_Inc,Z_Inc
9 INTEGER, SAVE :: XDim,YDim,ZDim
10 INTEGER, SAVE :: KCOOR
11 INTEGER,PRIVATE :: NDots_X,NDots_Y,NDots_Z
13 !!! Material Parameters
14 REAL, SAVE :: XLAMB,XMU,C13,C33,C11,EPSC,EPSA
15 REAL, PRIVATE :: PZE15,PZE31,PZE33,PSPB,PSPW,DIELEC
16 REAL, SAVE :: ACW,AVW,BW,DW
17 REAL, SAVE :: VWE,VWH,VWSO,DW1,DW2,DW3
18 REAL, SAVE :: VBE,VBH,VBSO,DB1,DB2,DB3
19 REAL, SAVE :: C1,C2,D1,D2
20 REAL, SAVE :: D3,D4,D5,D6
22 !!! Calculation Constants
23 REAL, SAVE :: ETA1,ETA2,ETA_DIF,CN02_1,CN02_2,CN42_1, &
24 CN42_2,CN31_1,CN31_2,CNP31_1,CNP31_2, &
25 CN1_2G,BISUM,BIZZ,BIAUX,CARAC_MAX
26 REAL, SAVE :: CI1,CI2,CI3
27 REAL, SAVE :: CNE2_1,CNE2_2,CNE_1,CNE_2,CSP,CPZ
28 REAL, SAVE :: CSPWL,CSPBR,CPZWL,CPZ_Q1,CPZ_Q2
30 !!! Normalized Dot Parameters
31 REAL, SAVE :: RC,ZC,D,RD,HD
33 INTEGER,SAVE :: STR_Action,PZO_Action,POT_Action, &
34 DIAG_Action
35 CHARACTER (LEN=120), SAVE :: STR_Filename,PZO_Filename,POT_Filename
37 CONTAINS
39 SUBROUTINE READ_INPUT()
41 Use Dot_Geometry
42 Use Auxiliar_Procedures, ONLY : AISO, MTYPE
44 IMPLICIT NONE
46 INTEGER :: G_Method
47 REAL :: D_Z
48 REAL,DIMENSION(3) :: V_AUX
52 !!!!! read data from data file !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
54 READ (*,*)
55 READ (*,*)
56 READ (*,*)
57 READ (*,*)
58 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
59 READ (*,*)
60 READ (*,*) DWL ! Wetting layer thickness (A)
61 READ (*,*) ISHAPE ! Shape of the dot
62 READ (*,*) HQD ! Height of the quantum dot (A)
63 READ (*,*) Rqd_Base ! Base Radius (A)
64 READ (*,*) Rqd_Top ! Top Radius (A)
65 !!! Superlattice Begins !!!!
66 READ (*,*)
67 READ (*,*) A_S,B_S,C_S
68 READ (*,*) A1_S(1),A1_S(2),A1_S(3)
69 READ (*,*) A2_S(1),A2_S(2),A2_S(3)
70 READ (*,*) A3_S(1),A3_S(2),A3_S(3)
71 READ (*,*) NDots_X,NDots_Y,NDots_Z
72 V_AUX=(/A_S,B_S,C_S/)
73 A1_S=A1_S*V_AUX
74 A2_S=A2_S*V_AUX
75 A3_S=A3_S*V_AUX
76 IF(MOD(NDots_X,2).EQ.0) THEN
77 NDots_X=NDots_X+1
78 WRITE(6,'(A,1X,I3)')"Warning: NDots_X Even -> NDots_X=",NDots_X
79 END IF
80 IF(MOD(NDots_Y,2).EQ.0) THEN
81 NDots_Y=NDots_Y+1
82 WRITE(6,'(A,1X,I3)')"Warning: NDots_Y Even -> NDots_Y=",NDots_Y
83 END IF
84 IF(MOD(NDots_Z,2).EQ.0) THEN
85 NDots_Z=NDots_Z+1
86 WRITE(6,'(A,1X,I3)')"Warning: NDots_Z Even -> NDots_Z=",NDots_Z
87 END IF
88 IF(NDots_X.EQ.1) THEN
89 NMin_X=0; NMax_X=0
90 ELSE
91 NMin_X=-(NDots_X-1)/2; NMax_X=-NMin_X
92 END IF
93 IF(NDots_Y.EQ.1) THEN
94 NMin_Y=0; NMax_Y=0
95 ELSE
96 NMin_Y=-(NDots_Y-1)/2; NMax_Y=-NMin_Y
97 END IF
98 IF(NDots_Z.EQ.1) THEN
99 NMin_Z=0; NMax_Z=0
100 ELSE
101 NMin_Z=-(NDots_Z-1)/2; NMax_Z=-NMin_Z
102 END IF
103 !!! Grid Begins !!!!
104 READ (*,*)
105 READ (*,*) G_Method
106 READ (*,*) X_Min,X_Max
107 READ (*,*) Y_Min,Y_Max
108 READ (*,*) Z_Min,Z_Max
109 READ (*,*) XDim,YDim,ZDim
111 IF(G_Method.EQ.1) THEN
112 IF(XDim.EQ.1) THEN
113 X_Max=X_Min
114 ELSE
115 X_Max=A1_S(1)/2.E0
116 X_Min=0.E0
117 END IF
118 IF(YDim.EQ.1) THEN
119 Y_Max=Y_Min
120 ELSE
121 Y_Max=A2_S(2)/2.E0
122 Y_Min=0.E0
123 END IF
124 IF(ZDim.EQ.1) THEN
125 Z_Max=Z_Min
126 ELSE
127 Z_Max=A3_S(3)/2.E0
128 D_Z=Z_Max-(Hqd+DWL)/2.E0
129 Z_Max=Hqd+D_Z
130 Z_Min=-DWL-D_Z
131 END IF
132 END IF
134 IF (XDim.EQ.1) THEN
135 X_Inc=0.E0
136 ELSE
137 X_Inc=(X_Max-X_Min)/REAL(XDim-1)
138 END IF
139 IF (YDim.EQ.1) THEN
140 Y_Inc=0.E0
141 ELSE
142 Y_Inc=(Y_Max-Y_Min)/REAL(YDim-1)
143 END IF
144 IF (ZDim.EQ.1) THEN
145 Z_Inc=0.E0
146 ELSE
147 Z_Inc=(Z_Max-Z_Min)/REAL(ZDim-1)
148 END IF
150 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
152 READ (*,*)
153 READ (*,*) MTYPE ! MTYPE: 1-> ZBI, 2-> WZI, 3-> WZA
154 SELECT CASE (MTYPE)
155 CASE(1)
156 READ(*,*)VWE,VWH,VWSO
157 READ(*,*)VBE,VBH,VBSO
158 READ(*,*)ACW,AVW,BW,DW
159 READ(*,*)XLAMB,XMU
160 READ(*,*)EPSA
161 READ(*,*)
162 CASE(2:)
163 READ(*,*)VWE,VWH,DW1,DW2,DW3
164 READ(*,*)VBE,VBH,DB1,DB2,DB3
165 READ(*,*)C1,C2,D1,D2
166 READ(*,*)D3,D4,D5,D6
167 READ(*,*)C11,C13,C33 ! Elastic modulus
168 READ(*,*)XLAMB,XMU ! Lame constants
169 READ(*,*)EPSA ! Misfit strain: EPS0
170 READ(*,*)EPSC ! Misfit strain: EPSC
171 READ(*,*)PZE15,PZE31,PZE33 !Piezoelectric Constants
172 READ(*,*)PSPB,PSPW ! Spontaneous Polarization
173 READ(*,*)DIELEC ! Barrier Dielectric Constant
174 READ(*,*)
175 END SELECT
177 READ(*,*)CARAC_MAX
178 READ(*,*)STR_Action ! 0-> Nothing 1-> Caculate 2-> Read
179 READ(*,*)PZO_Action ! 0-> Nothing 1-> Caculate 2-> Read
180 READ(*,*)POT_Action ! 0-> Nothing 1-> Caculate
181 READ(*,*)DIAG_Action ! 0-> Only Diagonal, 1->Full Hamiltonian
182 READ(*,*)
183 IF(PZO_Action.GT.0.AND.MTYPE.EQ.1) THEN
184 WRITE(6,*)"Error: Electrostatic Potential for ZB not implemented"
185 STOP
186 END IF
187 IF (MTYPE.LT.3) THEN
188 AISO=1 ! Isotropic Material
189 ELSE
190 AISO=0 ! Anisotropic Material
191 END IF
192 READ(*,*) STR_Filename
193 READ(*,*) PZO_Filename
194 READ(*,*) POT_Filename
195 READ(*,*) KCOOR ! KCOOR=0 Cartesian Coordinates
196 ! KCOOR=1 Cylindrical Coordinates
197 IF(KCOOR.EQ.1.AND.YDIM.GT.1) THEN
198 WRITE(6,*)"ERROR: Selected coordinates are cylindrical and YDIM.GT.1"
199 WRITE(6,*)" Exiting Program"
200 STOP
201 END IF
202 READ (*,*)
203 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
205 RETURN
207 END SUBROUTINE READ_INPUT
209 SUBROUTINE CONSTANTS( )
210 Use Dot_Geometry, ONLY: DWL
211 Use Auxiliar_Procedures, ONLY : AISO, MTYPE
212 IMPLICIT NONE
214 REAL :: ALPHA,BETA,GAMA
215 REAL :: R,S,A1,A2,B1,B2
216 REAL :: CN1_1,CN1_2,CN3_1,CN3_2,CN4_1,CN4_2
217 REAL :: P1,P2,P3
218 REAL :: ETA_AUX, PI
220 PI=4.E0*ATAN(1.E0)
222 !!!! Remember: XLAMB=C12, XMU=C44 !!!!!
224 !!! ISO CONSTANTS
225 BISUM = 2.*EPSA ! Biaxial strain components
226 BIAUX = EPSA-BIZZ
227 BIZZ = -2.*EPSA*XLAMB/(XLAMB+2.*XMU)
228 IF(MTYPE.EQ.3) THEN
229 IF(STR_Action.EQ.0) THEN
230 BIZZ = -2.E0*EPSA*C13/C33
231 ELSE
232 BIZZ=EPSC
233 END IF
234 END IF
236 IF(MTYPE.EQ.1) RETURN
238 R=(C11+XLAMB+C13)*EPSA+C13*(EPSC-EPSA)
239 S=(C33+C13-XLAMB-C11)*EPSA+(C33-C13)*(EPSC-EPSA)
241 ALPHA=-XMU*C33
243 R=R/ALPHA; S=S/ALPHA
245 A1=R*(C33-XMU-C13)-S*(C13+XMU)
246 A2=R*XMU
248 B1=S*(C13+2.E0*XMU)-R*(C33-C13-2.E0*XMU)
249 B2=S*C11-R*(C13+2.E0*XMU-C11)
251 BETA=( C13*(C13+2.E0*XMU)-C11*C33 )/(-XMU*C33)
252 GAMA=C11/C33
254 CN1_1=A1; CN1_2=A2
255 CN3_1=A1+B1; CN3_2=A2+B2
256 CN4_1=A1+B1/2.E0; CN4_2=A2+B2/2.E0
258 P1=2.E0*PZE15; P2=PZE31; P3=PZE33
260 CI1=2.E0*EPSA*P2+EPSC*P3
261 CI2=P3
262 CI3=1.E0
264 CNE_1=(P1+P2-P3)*A1+(P1/2-P3)*B1
265 CNE_2=(P1+P2-P3)*A2+(P1/2-P3)*B2
267 ETA_AUX=SQRT(BETA**2 - 4.E0*GAMA)
268 ETA1=(-BETA+ETA_AUX)/2.E0
269 ETA2=(-BETA-ETA_AUX)/2.E0
270 IF(ETA1.GT.0.E0.OR.ETA2.GT.0.E0) THEN
271 WRITE(6,*)"ERROR: ETA1 AND ETA2 ARE GREATHER THAN ZERO"
272 STOP
273 END IF
274 ETA1=ABS(ETA1)
275 ETA2=ABS(ETA2)
277 ETA_DIF=ETA1-ETA2
279 CN02_1=(CN1_2/ETA2-CN1_1)
280 CN02_2=(CN1_2/ETA1-CN1_1)
282 CN31_1=(CN4_1*SQRT(ETA2)-CN4_2/SQRT(ETA2))
283 CN31_2=(CN4_1*SQRT(ETA1)-CN4_2/SQRT(ETA1))
285 CNP31_1=(CN3_2/SQRT(ETA2)-CN3_1*SQRT(ETA2))
286 CNP31_2=(CN3_2/SQRT(ETA1)-CN3_1*SQRT(ETA1))
288 CN42_1=(CN3_1*ETA2-CN3_2)
289 CN42_2=(CN3_1*ETA1-CN3_2)
291 CN1_2G=CN1_2/GAMA
293 CNE2_1=(1.E0-ETA1)*(CNE_2/SQRT(ETA2)-CNE_1*SQRT(ETA2))
294 CNE2_2=(1.E0-ETA2)*(CNE_2/SQRT(ETA1)-CNE_1*SQRT(ETA1))
296 CSP=(PSPW-PSPB)
297 !!! V=q/(4*PI*E0)*PZ=0.9*PZ eV
298 CPZ=0.9*(4.E0*PI/DIELEC)
299 CPZ_Q1=(BISUM*PZE31+BIZZ*PZE33)
300 CPZ_Q2=(BIAUX*(PZE33-(PZE31+2.E0*PZE15)))
302 !!! Wetting Layer Parameters
304 IF(NDots_z.GT.1) THEN
305 CSPWL=CSP*(C_S-DWL)/C_S
306 CSPBR=-CSP*(DWL/C_S)
307 ELSE
308 CSPWL=CSP
309 CSPBR=0.E0
310 END IF
312 IF(AISO.EQ.0) THEN
313 CPZWL=(PZE31-PZE33*(C13/C33))*BISUM
314 ELSE
315 CPZWL=(BISUM*PZE31+BIZZ*PZE33)
316 END IF
318 RETURN
320 END SUBROUTINE CONSTANTS
322 SUBROUTINE CONSTANTS_PZO( )
323 Use Dot_Geometry, ONLY: DWL
324 Use Auxiliar_Procedures, ONLY : AISO
325 IMPLICIT NONE
327 REAL :: ALPHA,BETA,GAMA
328 REAL :: R,S,A1,A2,B1,B2
329 REAL :: CN3_1,CN3_2,P1,P2,P3
330 REAL :: ETA_AUX, PI
332 PI=4.E0*ATAN(1.E0)
334 !!!! Remember: XLAMB=C12, XMU=C44 !!!!!
336 !!! ISO CONSTANTS
337 BISUM = 2.*EPSA ! Biaxial strain components
338 BIZZ = -2.*EPSA*XLAMB/(XLAMB+2.*XMU)
339 BIAUX = EPSA-BIZZ
341 R=(C11+XLAMB+C13)*EPSA+C13*(EPSC-EPSA)
342 S=(C33+C13-XLAMB-C11)*EPSA+(C33-C13)*(EPSC-EPSA)
344 ALPHA=-XMU*C33
346 R=R/ALPHA; S=S/ALPHA
348 A1=R*(C33-XMU-C13)-S*(C13+XMU)
349 A2=R*XMU
351 B1=S*(C13+2.E0*XMU)-R*(C33-C13-2.E0*XMU)
352 B2=S*C11-R*(C13+2.E0*XMU-C11)
354 BETA=( C13*(C13+2.E0*XMU)-C11*C33 )/(-XMU*C33)
355 GAMA=C11/C33
357 CN3_1=A1+B1; CN3_2=A2+B2
359 P1=2.E0*PZE15; P2=PZE31; P3=PZE33
361 CI1=2.E0*EPSA*P2+EPSC*P3
362 CI2=P3
363 CI3=1.E0
365 CNE_1=(P1+P2-P3)*A1+(P1/2-P3)*B1
366 CNE_2=(P1+P2-P3)*A2+(P1/2-P3)*B2
368 ETA_AUX=SQRT(BETA**2 - 4.E0*GAMA)
369 ETA1=(-BETA+ETA_AUX)/2.E0
370 ETA2=(-BETA-ETA_AUX)/2.E0
371 IF(ETA1.GT.0.E0.OR.ETA2.GT.0.E0) THEN
372 WRITE(6,*)"ERROR: ETA1 AND ETA2 ARE GREATHER THAN ZERO"
373 STOP
374 END IF
375 ETA1=ABS(ETA1)
376 ETA2=ABS(ETA2)
378 ETA_DIF=ETA1-ETA2
380 CNP31_1=(CN3_2/SQRT(ETA2)-CN3_1*SQRT(ETA2))
381 CNP31_2=(CN3_2/SQRT(ETA1)-CN3_1*SQRT(ETA1))
383 CNE2_1=(1.E0-ETA1)*(CNE_2/SQRT(ETA2)-CNE_1*SQRT(ETA2))
384 CNE2_2=(1.E0-ETA2)*(CNE_2/SQRT(ETA1)-CNE_1*SQRT(ETA1))
386 CSP=(PSPW-PSPB)
387 !!! V=q/(4*PI*E0)*PZ=0.9*PZ eV
388 CPZ=0.9*(4.E0*PI/DIELEC)
389 CPZ_Q1=(BISUM*PZE31+BIZZ*PZE33)
390 CPZ_Q2=(BIAUX*(PZE33-(PZE31+2.E0*PZE15)))
392 !!! Wetting Layer Parameters
394 IF(NDots_z.GT.1) THEN
395 CSPWL=CSP*(C_S-DWL)/C_S
396 CSPBR=-CSP*(DWL/C_S)
397 ELSE
398 CSPWL=CSP
399 CSPBR=0.E0
400 END IF
402 IF(AISO.EQ.0) THEN
403 CPZWL=(PZE31-PZE33*(C13/C33))*BISUM
404 ELSE
405 CPZWL=(BISUM*PZE31+BIZZ*PZE33)
406 END IF
408 RETURN
410 END SUBROUTINE CONSTANTS_PZO
412 SUBROUTINE CONSTANTS_STR( )
414 Use Auxiliar_Procedures, ONLY : MTYPE
416 IMPLICIT NONE
418 REAL :: ALPHA,BETA,GAMA
419 REAL :: R,S,A1,A2,B1,B2
420 REAL :: CN1_1,CN1_2,CN3_1,CN3_2,CN4_1,CN4_2
421 REAL :: ETA_AUX
423 !!!! Remember: XLAMB=C12, XMU=C44 !!!!!
425 !!! ISO CONSTANTS
426 BISUM = 2.*EPSA ! Biaxial strain components
427 BIZZ = -2.*EPSA*XLAMB/(XLAMB+2.*XMU)
428 BIAUX = EPSA-BIZZ
429 IF(MTYPE.EQ.3) THEN
430 IF(STR_Action.EQ.0) THEN
431 BIZZ = -2.E0*EPSA*C13/C33
432 ELSE
433 BIZZ=EPSC
434 END IF
435 END IF
437 IF(MTYPE.EQ.1) RETURN
439 R=(C11+XLAMB+C13)*EPSA+C13*(EPSC-EPSA)
440 S=(C33+C13-XLAMB-C11)*EPSA+(C33-C13)*(EPSC-EPSA)
442 ALPHA=-XMU*C33
444 R=R/ALPHA; S=S/ALPHA
446 A1=R*(C33-XMU-C13)-S*(C13+XMU)
447 A2=R*XMU
449 B1=S*(C13+2.E0*XMU)-R*(C33-C13-2.E0*XMU)
450 B2=S*C11-R*(C13+2.E0*XMU-C11)
452 BETA=( C13*(C13+2.E0*XMU)-C11*C33 )/(-XMU*C33)
453 GAMA=C11/C33
455 CN1_1=A1; CN1_2=A2
456 CN3_1=A1+B1; CN3_2=A2+B2
457 CN4_1=A1+B1/2.E0; CN4_2=A2+B2/2.E0
459 ETA_AUX=SQRT(BETA**2 - 4.E0*GAMA)
460 ETA1=(-BETA+ETA_AUX)/2.E0
461 ETA2=(-BETA-ETA_AUX)/2.E0
462 IF(ETA1.GT.0.E0.OR.ETA2.GT.0.E0) THEN
463 WRITE(6,*)"ERROR: ETA1 AND ETA2 ARE GREATHER THAN ZERO"
464 STOP
465 END IF
466 ETA1=ABS(ETA1)
467 ETA2=ABS(ETA2)
469 ETA_DIF=ETA1-ETA2
471 CN02_1=(CN1_2/ETA2-CN1_1)
472 CN02_2=(CN1_2/ETA1-CN1_1)
474 CN31_1=(CN4_1*SQRT(ETA2)-CN4_2/SQRT(ETA2))
475 CN31_2=(CN4_1*SQRT(ETA1)-CN4_2/SQRT(ETA1))
477 CN42_1=(CN3_1*ETA2-CN3_2)
478 CN42_2=(CN3_1*ETA1-CN3_2)
480 CN1_2G=CN1_2/GAMA
482 RETURN
484 END SUBROUTINE CONSTANTS_STR
486 END MODULE INPUT_DATA