Line data Source code
1 : MODULE m_slabdim 2 : USE m_juDFT 3 : CONTAINS 4 0 : SUBROUTINE slab_dim(atoms,nsld) 5 : !*********************************************************************** 6 : ! This subroutine calculates the number of layers in the slab 7 : ! 8 : ! Yury Koroteev 2003-09-30 9 : !*********************************************************************** 10 : ! ABBREVIATIONS 11 : ! 12 : ! natd : in, the number of atoms in the film 13 : ! pos(3,natd) : in, the coordinates of atoms in the film 14 : ! ntypd,ntype : in, the number of mt-sphere types 15 : ! neq(ntypd) : in, the number of mt-spheres of the same type 16 : !----------------------------------------------------------------------- 17 : ! nsld : out, the number of layers in the film 18 : !----------------------------------------------------------------------- 19 : ! znz(nsl) : work, the z-ordinate of mt-spheres in 20 : ! the nsl-layer 21 : !----------------------------------------------------------------------- 22 : ! 23 : USE m_types_setup 24 : IMPLICIT NONE 25 : 26 : TYPE(t_atoms),INTENT(IN) :: atoms 27 : ! .. 28 : ! ..Scalar Argument 29 : INTEGER, INTENT (OUT) :: nsld 30 : ! .. 31 : ! ..Array Arguments 32 : ! .. 33 : ! ..Local Scalars 34 : INTEGER iz,i,j,na,nz 35 : REAL zs 36 : ! .. 37 : ! ..Local Arrays 38 0 : REAL znz(atoms%nat) 39 : ! .. 40 : ! ---------------------------------------------- 41 : REAL,PARAMETER:: epsz=1.e-3 42 : ! ---------------------------------------------- 43 : ! 44 : ! ---> Calculate the number of the film layers (nsld) 45 : ! 46 0 : znz(1) = atoms%pos(3,1) 47 0 : nz = 1 48 0 : na = 0 49 0 : DO i=1,atoms%ntype 50 0 : equivAtomsLoop: DO j=1,atoms%neq(i) 51 0 : na = na + 1 52 0 : zs = atoms%pos(3,na) 53 0 : DO iz=1,nz 54 0 : IF(ABS(zs-znz(iz)).LT.epsz) CYCLE equivAtomsLoop 55 : END DO 56 0 : nz = nz+1 57 0 : znz(nz) = zs 58 : END DO equivAtomsLoop 59 : END DO 60 0 : nsld = nz 61 0 : IF(nsld>atoms%nat) CALL juDFT_error("nsld.GT.atoms%nat ",calledby="slab_dim") 62 : ! 63 0 : END SUBROUTINE slab_dim 64 : END MODULE m_slabdim 65 :