2
SUBROUTINE READPLA( IOPTION, XMIN, XMAX, YMIN, YMAX,
3
. NPX, NPY, COORPO, NORMAL, DIRVER1, DIRVER2,
4
. ARMUNI, MAXA, XA, VOLUME, IUNITCD )
5
C **********************************************************************
6
C Read the data file to prepare the plane in which we are going to
7
C calculate the charge density
8
C Coded by J. Junquera, November 98
9
C **********************************************************************
19
. XMIN, XMAX, YMIN, YMAX,
20
. COORPO(3,3), NORMAL(3), DIRVER1(3), DIRVER2(3),
29
C **********************************************************************
30
C INTEGER IOPTION : Option to generate the plane
32
C 2 = Two vectors belonging to the plane
33
C 3 = Three points of the plane
34
C 4 = Three atomic indices
35
C INTEGER NPX, NPY : Number of points generated along x and y
36
C directions ina a system of reference in which
37
C the third component of the points of the plane
38
C is zero (Plane Reference Frame; PRF)
39
C REAL*8 XMIN, XMAX : Limits of the plane in the PRF for x-direction
40
C REAL*8 YMIN, YMAX : Limits of the plane in the PRF for y-direction
41
C REAL*8 NORMAL(3) : Components of the normal vector used to define
43
C REAL*8 DIRVER(3) : Components of the two vectors contained in the plane
44
C REAL*8 COORPO(3,3) : Coordinates of the three points used to define
45
C the plane. COORPO(POINT,IX)
46
C INTEGER MAXA : Maximum number of atoms
47
C REAL*8 XA(3,MAXA) : Atomic coordinates
48
C REAL*8 VOLUME : Volumen of unit cell (in bohr**3)
49
C **********************************************************************
52
. OGP*22, OGP_DEFECT*22,
53
. CPF*22, CPF_DEFECT*22,
54
. UCD*22, UCD_DEFECT*22
57
. IUNIT, IX, JX, NPX_DEFECT, NPY_DEFECT, IND1, IND2, IND3,
69
DATA ORIGIN /0.D0,0.D0,0.D0/
70
DATA XDIR /1.D0,0.D0,0.D0/
77
CPF = FDF_STRING('2D.CoorUnits',CPF_DEFECT)
78
IF (LEQI(CPF,'bohr')) then
80
ELSEIF (LEQI(CPF,'ang')) then
84
UCD_DEFECT = 'Ele/bohr**3'
85
UCD = FDF_STRING('2D.DensityUnits',UCD_DEFECT)
86
IF (LEQI(UCD,'ele/bohr**3')) then
88
ELSEIF (LEQI(UCD,'ele/ang**3')) then
90
ELSEIF (LEQI(UCD,'ele/unitcell')) then
93
WRITE(6,'(A)')' readpla: Wrong Option in Units of '
94
WRITE(6,'(A)')' readpla: Charge Density '
95
WRITE(6,'(A)')' readpla: You must choose one of the following:'
97
WRITE(6,'(A)')' readpla: - Ele/bohr**3 '
98
WRITE(6,'(A)')' readpla: - Ele/ang**3 '
99
WRITE(6,'(A)')' readpla: - Ele/unitcell '
105
NPX = FDF_INTEGER('2D.NumberPointsX',NPX_DEFECT)
106
NPY = FDF_INTEGER('2D.NumberPointsY',NPY_DEFECT)
108
XMIN = FDF_PHYSICAL('2D.MinX',-3.D0,'Bohr')
109
XMAX = FDF_PHYSICAL('2D.MaxX', 3.D0,'Bohr')
110
YMIN = FDF_PHYSICAL('2D.MinY',-3.D0,'Bohr')
111
YMAX = FDF_PHYSICAL('2D.MaxY', 3.D0,'Bohr')
113
OGP_DEFECT = 'NormalVector'
114
OGP = FDF_STRING('2D.PlaneGeneration',OGP_DEFECT)
115
IF (LEQI(OGP,'normalvector')) then
117
ELSEIF (LEQI(OGP,'twolines')) then
119
ELSEIF (LEQI(OGP,'threepoints')) then
121
ELSEIF (LEQI(OGP,'threeatomicindices')) then
124
WRITE(6,'(A)')' readpla: Wrong Option to Generate The Plane '
125
WRITE(6,'(A)')' readpla: You must choose one of the following:'
127
WRITE(6,'(A)')' readpla: - NormalVector '
128
WRITE(6,'(A)')' readpla: - TwoLines '
129
WRITE(6,'(A)')' readpla: - ThreePoints '
130
WRITE(6,'(A)')' readpla: - ThreeAtomicIndices '
134
IF ( FDF_BLOCK('2D.CompNormalVector',IUNIT) ) THEN
135
READ(IUNIT,*)(NORMAL(IX),IX=1,3)
138
IF ( FDF_BLOCK('2D.Comp2Vectors',IUNIT) ) THEN
139
READ(IUNIT,*)(DIRVER1(IX),IX=1,3)
140
READ(IUNIT,*)(DIRVER2(IX),IX=1,3)
143
IF ( FDF_BLOCK('2D.Coor3Points',IUNIT) ) THEN
144
READ(IUNIT,*)(COORPO(1,IX),IX=1,3)
145
READ(IUNIT,*)(COORPO(2,IX),IX=1,3)
146
READ(IUNIT,*)(COORPO(3,IX),IX=1,3)
149
IF ( FDF_BLOCK('2D.Indices3Atoms',IUNIT) ) THEN
150
READ(IUNIT,*)IND1, IND2, IND3
153
IF ( IOPTION .EQ. 4 ) THEN
155
COORPO(1,IX) = XA(IX,IND1)
158
COORPO(2,IX) = XA(IX,IND2)
161
COORPO(3,IX) = XA(IX,IND3)
165
C Check if the three points are colinear -------------------------------
166
IF ((IOPTION .EQ. 3) .OR. (IOPTION .EQ. 4))THEN
167
CALL COLINEAR( COORPO, COLIN )
169
WRITE(6,*)'The coordinates of the three points are colinear'
170
WRITE(6,*)'and do not define a plane'
171
WRITE(6,*)'Please, check these coordinates in the input file'
176
IF ( FDF_BLOCK('2D.PlaneOrigin',IUNIT) ) THEN
177
READ(IUNIT,*)(ORIGIN(IX),IX=1,3)
180
IF ( FDF_BLOCK('2D.X_Axis',IUNIT) ) THEN
181
READ(IUNIT,*)(XDIR(IX),IX=1,3)
184
IF (IOPTION .LT. 3) THEN
186
COORPO(1,IX) = ORIGIN(IX)
188
IF(IOPTION .EQ. 1) THEN
190
COORPO(2,IX) = XDIR(IX)
195
C Scale points coordinates
196
C Iscale = 1 => Do nothing
197
C Iscale = 2 => Multiply by 1./0.529177 (Ang --> Bohr)
199
IF( (ISCALE .EQ. 2) .AND. (IOPTION .NE. 4) ) THEN
202
COORPO(JX,IX) = 1.D0 / 0.529177D0 * COORPO(JX,IX)
204
ORIGIN(IX) = 1.D0 / 0.529177D0 * ORIGIN(IX)
205
DIRVER1(IX) = 1.D0 / 0.529177D0 * DIRVER1(IX)
206
DIRVER2(IX) = 1.D0 / 0.529177D0 * DIRVER2(IX)
210
C Units of Charge Density
211
C Iunitcd = 1 => Do nothing
212
C Iunitcd = 2 => Multiply by (1.d0 / 0.529177d0) **3 (bohr**3 --> Ang**3)
213
C Iunitcd = 3 => Multiply by volume unit cell (in bohrs**3)
215
IF (IUNITCD .EQ. 1) THEN
217
ELSEIF( IUNITCD .EQ. 2 ) THEN
218
ARMUNI = (1.D0 / 0.529177D0)**3
219
ELSEIF( IUNITCD .EQ. 3 ) THEN