Line data Source code
1 : MODULE m_slabgeom
2 : USE m_juDFT
3 : CONTAINS
4 0 : SUBROUTINE slabgeom(atoms,cell,nsld,&
5 0 : nsl,zsl,nmtsl,nslat,volsl,volintsl)
6 : !***********************************************************************
7 : ! This subroutine calculates z-coordinates of film layers,
8 : ! a number of mt-pheres in each layer, and they typs.
9 : ! Yury Koroteev 2003-09-30
10 : !***********************************************************************
11 : ! ABBREVIATIONS
12 : !
13 : ! natd : in, the number of atoms in the film
14 : ! pos(3,natd) : in, the coordinates of atoms in the film
15 : ! ntypd,ntype : in, the number of mt-sphere types
16 : ! z1 : in, half the film thickness (0.5*D_tilde)
17 : ! neq(ntypd) : in, the number of mt-spheres of the same type
18 : ! area : in, the area of the surface unit cell
19 : ! volmts(ntypd) : in, the volume of mt-spheres
20 : ! nsld : in, the number of layers in the film
21 : !-----------------------------------------------------------------------
22 : ! nsl : in, the number of layers in the film
23 : ! zsl(2,nsld) : out, z-coordinates of the layers
24 : ! nmtsl(ntypd,nsld) : out, the number of mt-spheres of the ntypd-
25 : ! type in the nsl-layer of the film
26 : ! nslat(natd,nsld) : out,
27 : ! volsl(nsld) : out, the volume of film layers
28 : ! volintsl(nsld) : out, the volume of mt-spheres
29 : !
30 : !-----------------------------------------------------------------------
31 : ! znz(nsl) : work, the z-ordinate of mt-spheres in
32 : ! the nsl-layer
33 : !-----------------------------------------------------------------------
34 : !
35 : USE m_types_setup
36 : IMPLICIT NONE
37 : TYPE(t_cell),INTENT(IN) :: cell
38 : TYPE(t_atoms),INTENT(IN) :: atoms
39 : ! ..
40 : ! ..Scalar Argument
41 : INTEGER, INTENT (IN) :: nsld
42 : INTEGER, INTENT (OUT) :: nsl
43 : ! ..
44 : ! ..Array Arguments
45 : INTEGER, INTENT (OUT) :: nmtsl(atoms%ntype,nsld),nslat(atoms%nat,nsld)
46 : REAL, INTENT (OUT) :: zsl(2,nsld),volsl(nsld)
47 : REAL, INTENT (OUT) :: volintsl(nsld)
48 : ! ..
49 : ! ..Local Scalars
50 : INTEGER iz,i,j,na,isum,mt,n,nz
51 : REAL epsz,half,zs,w,del,vmt
52 : ! ..
53 : ! ..Local Arrays
54 0 : REAL znz(nsld)
55 : ! ..
56 : ! ------------------------------------------------------------------
57 : DATA epsz/1.e-3/ half/0.5/
58 : ! ----------------------------------------------
59 : !
60 : ! ---> Calculate the number of the film layers (nsl)
61 : !
62 :
63 0 : znz(1) = atoms%pos(3,1)
64 0 : nz = 1
65 0 : na = 0
66 0 : DO i=1,atoms%ntype
67 0 : DO j=1,atoms%neq(i)
68 0 : na = na + 1
69 0 : zs = atoms%pos(3,na)
70 :
71 0 : IF(any(ABS(zs-znz(:nz)).LT.epsz)) CYCLE
72 0 : nz = nz+1
73 0 : znz(nz) = zs
74 : ENDDO
75 : ENDDO
76 :
77 0 : nsl = nz
78 0 : IF (nsl.GT.nsld) THEN
79 0 : WRITE(*,*) 'nsl =',nsl,' > nsld =',nsld
80 0 : CALL juDFT_error("nsl>nsld ",calledby ="slabgeom")
81 : ENDIF
82 : !
83 : ! ---> Order the film layers
84 : !
85 0 : DO i=1,nsl
86 0 : DO j=i,nsl
87 0 : IF(znz(j).LT.znz(i)) THEN
88 0 : w = znz(i)
89 0 : znz(i) = znz(j)
90 0 : znz(j) = w
91 : ENDIF
92 : ENDDO
93 : ENDDO
94 : !
95 : ! ---> Construct the z-coordinates of the film layers ( zsl(2,nsl) )
96 : !
97 0 : zsl(1,1) = -cell%z1
98 0 : DO i=1,nsl-1
99 0 : zsl(2,i) = (znz(i) + znz(i+1)) * half
100 0 : zsl(1,i+1) = zsl(2,i)
101 : ENDDO
102 0 : zsl(2,nsl) = cell%z1
103 : !
104 : ! ---> Calculate a number of mt-spheres of the same type
105 : ! ---> (nmtsl) in each layer of the film
106 : !
107 0 : DO i=1,nsl
108 0 : del = ABS( zsl(2,i) - zsl(1,i) )
109 0 : volsl(i) = del*cell%area
110 0 : n = 0
111 0 : vmt = 0.0
112 0 : DO j=1,atoms%ntype
113 0 : isum = 0
114 0 : DO mt=1,atoms%neq(j)
115 0 : n = n + 1
116 0 : zs = atoms%pos(3,n)
117 0 : IF((zsl(1,i).LT.zs).AND.(zs.LT.zsl(2,i))) THEN
118 0 : isum=isum+1
119 0 : nslat(n,i)=1
120 : ELSE
121 0 : nslat(n,i)=0
122 : ENDIF
123 : ENDDO
124 0 : nmtsl(j,i) = isum
125 0 : vmt = vmt + isum*atoms%volmts(j)
126 : ENDDO
127 0 : volintsl(i) = volsl(i) - vmt
128 : ENDDO
129 : !
130 0 : END SUBROUTINE slabgeom
131 : END MODULE m_slabgeom
132 :
|