Line data Source code
1 : MODULE m_intnv
2 : ! ************************************************
3 : ! calculates the integral of charge density
4 : ! and potential in the unit cell
5 : ! ************************************************
6 : CONTAINS
7 1343 : SUBROUTINE int_nv(ispin,stars,vacuum,atoms,sphhar,cell,sym,input ,vpot,den,RESULT)
8 :
9 : USE m_types
10 : USE m_constants
11 : USE m_intgr, ONLY : intgr3,intgz0
12 :
13 : IMPLICIT NONE
14 : ! ..
15 : ! .. Scalar Arguments ..
16 : REAL RESULT
17 : INTEGER,INTENT(IN) :: ispin
18 : TYPE(t_stars),INTENT(IN) :: stars
19 : TYPE(t_vacuum),INTENT(IN) :: vacuum
20 : TYPE(t_atoms),INTENT(IN) :: atoms
21 : TYPE(t_sphhar),INTENT(IN) :: sphhar
22 : TYPE(t_cell),INTENT(IN) :: cell
23 : TYPE(t_sym),INTENT(IN) :: sym
24 : TYPE(t_input),INTENT(IN) :: input
25 :
26 : TYPE(t_potden),INTENT(IN) :: vpot,den
27 :
28 :
29 : ! ..
30 : ! .. Local Scalars ..
31 : REAL dpdot,facv,tis,tmt,tvac,tvact
32 : INTEGER i,ip,ivac,j,k2,lh,n,npz,nat
33 : LOGICAL tail
34 : ! ..
35 : ! .. Local Arrays ..
36 1343 : REAL dpj(atoms%jmtd),dpz(vacuum%nmzd)
37 : ! ..
38 : ! ..
39 : ! -----> CALCULATE DENSITY-POTENTIAL INTEGRALS
40 : !
41 : ! ******************* INTERSTITIAL REGION**********************
42 : !
43 : ! -> warping has been moved to vgen and visxc resp. ...gustav
44 : !
45 2825743 : tis = cell%omtil * REAL( DOT_PRODUCT(vpot%pw_w(:stars%ng3,ispin),den%pw(:stars%ng3,ispin)))
46 :
47 1343 : WRITE (oUnit,FMT=8020) tis
48 : 8020 FORMAT (/,10x,'interstitial :',t40,ES20.10)
49 :
50 1343 : RESULT = RESULT + tis
51 : !
52 : ! ******************M.T. SPHERES*******************
53 : !
54 1343 : tmt = 0.
55 3680 : DO n = 1,atoms%ntype
56 2337 : nat = atoms%firstAtom(n)
57 71442 : DO lh = 0,sphhar%nlh(sym%ntypsy(nat))
58 47934678 : DO j = 1,atoms%jri(n)
59 47934678 : dpj(j) = den%mt(j,lh,n,ispin)*vpot%mt(j,lh,n,ispin)
60 : ENDDO
61 67762 : CALL intgr3(dpj,atoms%rmsh(1,n),atoms%dx(n),atoms%jri(n),dpdot)
62 70099 : tmt = tmt + dpdot*atoms%neq(n)
63 : ENDDO
64 : ENDDO
65 1343 : WRITE (oUnit,FMT=8030) tmt
66 : 8030 FORMAT (/,10x,'muffin tin spheres :',t40,ES20.10)
67 1343 : RESULT = RESULT + tmt
68 : !
69 : ! *********** VACUUM REGION**************
70 : !
71 1343 : IF (input%film ) THEN
72 193 : npz = vacuum%nmz + 1
73 193 : tail = .TRUE.
74 193 : facv=2.0/vacuum%nvac
75 193 : tvac = 0.
76 193 : tvact = 0.
77 : ! set array dpz to zero
78 48443 : dpz=0.0
79 450 : DO ivac = 1,vacuum%nvac
80 64507 : DO ip = 1,vacuum%nmz
81 64507 : dpz(npz-ip) = REAL(den%vac(ip,1,ivac,ispin))*REAL(vpot%vac(ip,1,ivac,ispin))
82 : ! ---> WARPING REGION
83 : ENDDO
84 72928 : DO k2 = 2,stars%ng2
85 7340028 : DO ip = 1,vacuum%nmzxy
86 : dpz(npz-ip) = dpz(npz-ip) + stars%nstr2(k2)*den%vac(ip,k2,ivac,ispin)*&
87 7339771 : & CONJG(vpot%vac(ip,k2,ivac,ispin))
88 : ENDDO
89 : ENDDO
90 257 : CALL intgz0(dpz,vacuum%delz,vacuum%nmz,tvac,tail)
91 450 : tvact = tvact + cell%area*tvac*facv
92 : ENDDO
93 193 : WRITE (oUnit,FMT=8040) tvact
94 : 8040 FORMAT (/,10x,'vacuum :',t40,f20.10)
95 193 : RESULT = RESULT + tvact
96 :
97 : END IF
98 :
99 1343 : END SUBROUTINE int_nv
100 : END MODULE m_intnv
|