Line data Source code
1 : MODULE m_convn
2 : use m_juDFT
3 : implicit none
4 : CONTAINS
5 160 : SUBROUTINE convn(l_write,atoms,stars)
6 : !
7 : ! ***********************************************************
8 : ! determines the optimum values for the convergence parameter
9 : ! for each atom type using the criterion discussed in
10 : ! m. weinert, j. math. phys. 22, 2433 (1981). each sphere
11 : ! and l component may have different values. (psqpw changed
12 : ! to allow this option).
13 : ! m. weinert july 1982
14 : ! ***********************************************************
15 : USE m_types
16 : USE m_constants
17 : IMPLICIT NONE
18 : ! ..
19 : LOGICAL,INTENT(IN) :: l_write
20 : TYPE(t_atoms),INTENT(INOUT) :: atoms
21 : TYPE(t_stars),INTENT(IN) :: stars
22 : ! .. Local Scalars ..
23 : REAL sck,z0
24 : INTEGER i,l,n,n1,nc
25 : ! ..
26 : ! .. Local Arrays ..
27 : REAL z(17)
28 : ! ..
29 : ! .. Intrinsic Functions ..
30 : INTRINSIC min0
31 : ! ..
32 : ! .. Data statements ..
33 : DATA z/6.9e0,8.1e0,9.3e0,10.5e0,11.6e0,12.7e0,13.9e0,15.0e0,&
34 : & 16.1e0,17.2e0,18.3e0,19.4e0,20.5e0,21.6e0,22.7e0,23.7e0,&
35 : & 24.8e0/,z0/5.7e0/
36 : ! ..
37 : !---> read in values of ncv (if ncv(1).le.0, calculate best values)
38 : ! read(5,1000) (ncv(n),n=1,ntype)
39 : ! if(ncv(1).le.0) go to 2
40 : ! n1=ncv(1)
41 : ! do 1 n=2,ntype
42 : ! 1 if(ncv(n).le.0) ncv(n)=n1
43 : ! go to 5
44 : !---> calculate values
45 : ! 2 continue
46 : !
47 434 : DO 20 n = 1,atoms%ntype
48 274 : sck = stars%gmax*atoms%rmt(n)
49 274 : IF (sck.LT.z0) GO TO 60
50 4264 : DO 10 i = 1,17
51 4206 : IF (sck.GT.z(i)) GO TO 10
52 216 : atoms%ncv(n) = i
53 4206 : GO TO 20
54 58 : 10 CONTINUE
55 58 : n1 = 0.9e0* (sck-z(17))
56 58 : atoms%ncv(n) = 18 + n1
57 160 : 20 CONTINUE
58 : !---> output and make sure ncv(n).le.ncvd
59 : 30 CONTINUE
60 240 : IF (.not.l_write) return
61 80 : WRITE (oUnit,FMT=8010)
62 217 : DO 40 n = 1,atoms%ntype
63 137 : nc = atoms%ncv(n)
64 137 : l = nc - 1
65 137 : WRITE (oUnit,FMT=8020) n,nc,l
66 80 : 40 CONTINUE
67 0 : RETURN
68 0 : 60 WRITE (oUnit,FMT=8040) n,sck
69 0 : CALL juDFT_error("ncv",calledby="convn")
70 : 8000 FORMAT (10i5)
71 : 8010 FORMAT (/,/,10x,'convergence parameters for the pseudocharge',&
72 : & ' density expansion',/,10x,'atom',5x,'parameter',5x,&
73 : & 'max. l to include',/)
74 : 8020 FORMAT (10x,i3,9x,i3,13x,i3)
75 : 8030 FORMAT (10x,'max values allowed: ncvd=',i3,', l=',i3,/)
76 : 8040 FORMAT (/,/,10x,'atom type',i3,' has rkmax=',f6.4,/,10x,&
77 : & '$$$ stop ncv error')
78 : END SUBROUTINE convn
79 : END MODULE m_convn
|