Eliminado el bucle para el numero de QD, puesto que la energia no es
[ptslat.git] / poten.f90
blob65861bf49adaf5aa4efc2f212dfe1c14fc07bf30
1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 ! Driver for stain0.f subroutine
3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5 PROGRAM POTDRV
7 Use Dot_Geometry
8 Use Auxiliar_Procedures
9 Use Input_Data
10 Use NCPACK_PZO
11 Use NCPACK_STR
12 Use NCPACK_POT
14 IMPLICIT NONE
16 !! GRID RESULTS OF STRAIN0
18 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: P_SPONT,P_PIEZO, &
19 EXX,EYY,EZZ,EXZ,EYZ,EXY, &
20 EEL,EHHUP,EHHDW,ELHUP, &
21 ELHDW,ESOUP,ESODW,ELAST
24 INTERFACE
25 SUBROUTINE PIEZO(P_SPONT,P_PIEZO)
26 REAL,DIMENSION(:,:,:) :: P_SPONT,P_PIEZO
27 END SUBROUTINE
28 SUBROUTINE STRAIN0(EXX,EYY,EZZ,EXY,EXZ,EYZ)
29 REAL,DIMENSION(:,:,:) :: EXX,EYY,EZZ,EXY,EXZ,EYZ
30 END SUBROUTINE
31 SUBROUTINE POTENTIAL_ZB(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
32 ESOUP,ESODW,ELAST,EXX,EYY,&
33 EZZ,EXY,EXZ,EYZ)
34 REAL,DIMENSION(:,:,:),OPTIONAL :: EXX,EYY,EZZ,EXY,EXZ,EYZ
36 REAL,DIMENSION(:,:,:) :: EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
37 ESOUP,ESODW,ELAST
38 END SUBROUTINE
39 SUBROUTINE POTENTIAL_WZ(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
40 ESOUP,ESODW,ELAST,EXX,EYY,&
41 EZZ,EXY,EXZ,EYZ,POT)
42 REAL,DIMENSION(:,:,:),OPTIONAL :: EXX,EYY,EZZ,EXY,EXZ,EYZ,POT
44 REAL,DIMENSION(:,:,:) :: EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
45 ESOUP,ESODW,ELAST
46 END SUBROUTINE
47 END INTERFACE
49 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51 CALL READ_INPUT()
53 RC=Rqd_Base+23.E0
54 ZC=Hqd+23.E0
57 RD = Rqd_Base/RC ! RD = Rqd_Base normalized to RC
58 HD = Hqd/ZC ! HD = HQD normalized to ZC
60 D=DWL/ZC ! Wetting layer thick. normalized to ZC
63 !!! ELECTROSTATIC POTENTIAL AND STRAIN DISTRIBUTION !!!!!!!!!!!!!!!!!!
65 IF(PZO_Action.EQ.1.AND.STR_Action.EQ.1) THEN
67 ALLOCATE (P_SPONT(1:XDim,1:YDim,1:ZDim),&
68 P_PIEZO(1:XDim,1:YDim,1:ZDim) )
69 ALLOCATE (EXX(1:XDim,1:YDim,1:ZDim),EYY(1:XDim,1:YDim,1:ZDim), &
70 EZZ(1:XDim,1:YDim,1:ZDim),EXZ(1:XDim,1:YDim,1:ZDim), &
71 EXY(1:XDim,1:YDim,1:ZDim),EYZ(1:XDim,1:YDim,1:ZDim) )
73 CALL CONSTANTS( )
75 WRITE(6,*)"Begins the calculation of the Electrostatic Potential"
76 CALL PIEZO(P_SPONT,P_PIEZO)
77 WRITE(6,*)"Calculation of the Electrostatic Potential Ended"
78 WRITE(6,*)"Begins the calculation of the Strain Field"
79 CALL STRAIN0(EXX,EYY,EZZ,EXY,EXZ,EYZ)
80 WRITE(6,*)"Calculation of the Strain Field Ended"
82 CALL NCPACK_PZ(P_SPONT,P_PIEZO)
83 IF (KCOOR.EQ.0) THEN
84 CALL NCPACK_CART(EXX,EYY,EZZ,EXY,EXZ,EYZ)
85 ELSE
86 CALL NCPACK_CYL(EXX,EYY,EZZ,EXZ)
87 END IF
89 ELSE
91 IF(PZO_Action.EQ.1) THEN
92 ALLOCATE (P_SPONT(1:XDim,1:YDim,1:ZDim),&
93 P_PIEZO(1:XDim,1:YDim,1:ZDim) )
95 CALL CONSTANTS_PZO( )
97 WRITE(6,*)"Begins the calculation of the Electrostatic Potential"
98 CALL PIEZO(P_SPONT,P_PIEZO)
99 WRITE(6,*)"Calculation of the Electrostatic Potential Ended"
101 CALL NCPACK_PZ(P_SPONT,P_PIEZO)
103 END IF
104 IF(STR_Action.EQ.1) THEN
105 ALLOCATE (EXX(1:XDim,1:YDim,1:ZDim),EYY(1:XDim,1:YDim,1:ZDim), &
106 EZZ(1:XDim,1:YDim,1:ZDim),EXZ(1:XDim,1:YDim,1:ZDim), &
107 EXY(1:XDim,1:YDim,1:ZDim),EYZ(1:XDim,1:YDim,1:ZDim) )
109 CALL CONSTANTS_STR( )
111 WRITE(6,*)"Begins the calculation of the Strain Field"
112 CALL STRAIN0(EXX,EYY,EZZ,EXY,EXZ,EYZ)
113 WRITE(6,*)"Calculation of the Strain Field Ended"
115 IF (KCOOR.EQ.0) THEN
116 CALL NCPACK_CART(EXX,EYY,EZZ,EXY,EXZ,EYZ)
117 ELSE
118 CALL NCPACK_CYL(EXX,EYY,EZZ,EXZ)
119 END IF
121 END IF
123 END IF
125 IF(STR_Action.EQ.2) THEN
126 ALLOCATE (EXX(1:XDim,1:YDim,1:ZDim),EYY(1:XDim,1:YDim,1:ZDim), &
127 EZZ(1:XDim,1:YDim,1:ZDim),EXZ(1:XDim,1:YDim,1:ZDim), &
128 EXY(1:XDim,1:YDim,1:ZDim),EYZ(1:XDim,1:YDim,1:ZDim) )
129 IF (KCOOR.EQ.0) THEN
130 CALL NCREAD_CART(EXX,EYY,EZZ,EXY,EXZ,EYZ)
131 ELSE
132 CALL NCREAD_CYL(EXX,EYY,EZZ,EXZ)
133 END IF
134 END IF
136 IF(PZO_Action.EQ.2) THEN
137 ALLOCATE (P_SPONT(1:XDim,1:YDim,1:ZDim),&
138 P_PIEZO(1:XDim,1:YDim,1:ZDim) )
140 CALL NCREAD_PZ(P_SPONT,P_PIEZO)
142 END IF
144 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
145 !!! CONFINEMENT POTENTIAL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
146 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
148 IF(POT_Action.NE.0) THEN
150 WRITE(6,*)"Begins the calculation of the Confinement Potential"
152 ALLOCATE (EEL(1:XDim,1:YDim,1:ZDim),EHHUP(1:XDim,1:YDim,1:ZDim), &
153 EHHDW(1:XDim,1:YDim,1:ZDim),ELHUP(1:XDim,1:YDim,1:ZDim), &
154 ELHDW(1:XDim,1:YDim,1:ZDim),ESOUP(1:XDim,1:YDim,1:ZDim), &
155 ESODW(1:XDim,1:YDim,1:ZDim),ELAST(1:XDim,1:YDim,1:ZDim))
157 SELECT CASE(MTYPE)
159 CASE(1)
160 IF(STR_Action.GT.0) THEN
161 CALL POTENTIAL_ZB(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
162 ESOUP,ESODW,ELAST,EXX,EYY,&
163 EZZ,EXY,EXZ,EYZ)
164 ELSE
165 CALL POTENTIAL_ZB(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
166 ESOUP,ESODW,ELAST)
167 END IF
168 CASE(2:)
169 IF(STR_Action.NE.0.AND.PZO_Action.NE.0) THEN
170 CALL POTENTIAL_WZ(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
171 ESOUP,ESODW,ELAST,EXX,EYY,&
172 EZZ,EXY,EXZ,EYZ,&
173 POT=P_SPONT+P_PIEZO)
174 ELSE
176 IF(STR_Action.NE.0) &
177 CALL POTENTIAL_WZ(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
178 ESOUP,ESODW,ELAST,EXX,EYY,&
179 EZZ,EXY,EXZ,EYZ)
181 IF(PZO_Action.NE.0) &
182 CALL POTENTIAL_WZ(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
183 ESOUP,ESODW,ELAST,&
184 POT=P_SPONT+P_PIEZO)
185 END IF
186 IF(STR_Action.EQ.0.AND.PZO_Action.EQ.0) THEN
187 CALL POTENTIAL_WZ(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
188 ESOUP,ESODW,ELAST)
189 END IF
191 END SELECT
193 WRITE(6,*)"Calculation of the Confinement Potential Ended"
195 CALL NCPACK_PT(EEL,EHHUP,EHHDW,ELHUP,ELHDW,&
196 ESOUP,ESODW,ELAST)
197 END IF
200 END PROGRAM POTDRV