Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 :
7 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8 : ! This module generates the cmt coefficients and eigenvectors z !
9 : ! at all kpoints nkpt from the irreducible kpoints kpts%nkpt !
10 : ! and writes them out in cmt and z, respectively. !
11 : ! M.Betzinger(09/07) !
12 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13 :
14 : MODULE m_gen_wavf
15 :
16 : CONTAINS
17 :
18 16 : SUBROUTINE gen_wavf(kpts, sym, atoms, el_eig, ello_eig, cell, mpdata, vr0, &
19 : hybdat, noco,nococonv, fmpi, input, jsp)
20 :
21 : ! nkpt :: number of all k-points
22 : USE m_types
23 : USE m_constants
24 : USE m_radfun
25 : USE m_radflo
26 : USE m_abcof
27 : USE m_trafo!, ONLY: waveftrafo_genwavf
28 : USE m_olap
29 : USE m_hyb_abcrot
30 : USE m_io_hybrid
31 :
32 : IMPLICIT NONE
33 :
34 : TYPE(t_hybdat), INTENT(INOUT) :: hybdat
35 : TYPE(t_mpi), INTENT(IN) :: fmpi
36 : TYPE(t_mpdata), intent(in) :: mpdata
37 : TYPE(t_input), INTENT(IN) :: input
38 : TYPE(t_noco), INTENT(IN) :: noco
39 : TYPE(t_nococonv), INTENT(IN) :: nococonv
40 : TYPE(t_sym), INTENT(IN) :: sym
41 : TYPE(t_cell), INTENT(IN) :: cell
42 : TYPE(t_kpts), INTENT(IN) :: kpts
43 : TYPE(t_atoms), INTENT(IN) :: atoms
44 :
45 : INTEGER, INTENT(IN) :: jsp
46 :
47 : REAL, INTENT(IN) :: vr0(:, :, :)!(jmtd,ntype,jspd)
48 : REAL, INTENT(IN) :: el_eig(0:atoms%lmaxd, atoms%ntype)
49 : REAL, INTENT(IN) :: ello_eig(:,:)
50 :
51 : ! local scalars
52 : INTEGER :: ilo
53 : INTEGER :: ikpt, itype, iop
54 : INTEGER :: l, ng
55 :
56 : INTEGER :: nodem, noded
57 : REAL :: wronk
58 :
59 : ! local arrays
60 16 : INTEGER :: rrot(3, 3, sym%nsym)
61 16 : INTEGER :: iarr(0:atoms%lmaxd, atoms%ntype)
62 :
63 16 : REAL :: vr(atoms%jmtd, atoms%ntype, input%jspins)
64 32 : REAL, ALLOCATABLE :: u(:, :, :), du(:, :, :)
65 :
66 16 : REAL :: flo(atoms%jmtd, 2, atoms%nlod)
67 32 : REAL :: uuilon(atoms%nlod, atoms%ntype), duilon(atoms%nlod, atoms%ntype)
68 16 : REAL :: ulouilopn(atoms%nlod, atoms%nlod, atoms%ntype)
69 :
70 : ! local arrays for abcof1
71 : ! COMPLEX :: a(nvd,0:lmd,natd,kpts%nkpt),b(nvd,0:lmd,natd,kpts%nkpt)
72 :
73 1824 : TYPE(t_lapw) :: lapw(kpts%nkptf)
74 :
75 16 : call timestart("gen_wavf")
76 16 : CALL hybdat%usdus%init(atoms, input%jspins)
77 :
78 : ! setup rotations in reciprocal space
79 784 : DO iop = 1, sym%nsym
80 784 : IF (iop <= sym%nop) THEN
81 8736 : rrot(:, :, iop) = transpose(sym%mrot(:, :, sym%invtab(iop)))
82 : ELSE
83 1248 : rrot(:, :, iop) = -rrot(:, :, iop - sym%nop)
84 : END IF
85 : END DO
86 :
87 : ! generate G-vectors, which fulfill |k+G|<rkmax
88 : ! for all k-points
89 144 : DO ikpt = 1, kpts%nkptf
90 144 : CALL lapw(ikpt)%init(input, noco,nococonv, kpts, atoms, sym, ikpt, cell)
91 : END DO
92 :
93 : ! set spherical component of the potential from the previous iteration vr
94 25352 : vr = vr0
95 :
96 : ! calculate radial basis functions belonging to the
97 : ! potential vr stored in bas1 and bas2
98 : ! bas1 denotes the large component
99 : ! bas2 " " small component
100 :
101 : allocate(u(atoms%jmtd, 2, 0:atoms%lmaxd), &
102 : du(atoms%jmtd, 2, 0:atoms%lmaxd), &
103 485680 : source=0.0)
104 :
105 272 : iarr = 2
106 40 : DO itype = 1, atoms%ntype
107 24 : IF (fmpi%irank == 0) WRITE (oUnit, FMT=8000) itype
108 24 : ng = atoms%jri(itype)
109 256 : DO l = 0, atoms%lmax(itype)
110 : CALL radfun(l, itype, jsp, el_eig(l, itype), vr(:, itype, jsp), &
111 232 : atoms, u(:, :, l), du(:, :, l), hybdat%usdus, nodem, noded, wronk)
112 348 : IF (fmpi%irank == 0) WRITE (oUnit, FMT=8010) l, el_eig(l, itype), &
113 116 : hybdat%usdus%us(l, itype, jsp), hybdat%usdus%dus(l, itype, jsp),&
114 116 : nodem, hybdat%usdus%uds(l, itype, jsp), hybdat%usdus%duds(l, itype, jsp),&
115 232 : noded, hybdat%usdus%ddn(l, itype, jsp), wronk
116 :
117 185072 : hybdat%bas1(1:ng, 1, l, itype) = u(1:ng, 1, l)
118 185072 : hybdat%bas2(1:ng, 1, l, itype) = u(1:ng, 2, l)
119 185072 : hybdat%bas1(1:ng, 2, l, itype) = du(1:ng, 1, l)
120 185072 : hybdat%bas2(1:ng, 2, l, itype) = du(1:ng, 2, l)
121 :
122 232 : hybdat%bas1_MT(1, l, itype) = hybdat%usdus%us(l, itype, jsp)
123 232 : hybdat%drbas1_MT(1, l, itype) = hybdat%usdus%dus(l, itype, jsp)
124 232 : hybdat%bas1_MT(2, l, itype) = hybdat%usdus%uds(l, itype, jsp)
125 256 : hybdat%drbas1_MT(2, l, itype) = hybdat%usdus%duds(l, itype, jsp)
126 : END DO
127 :
128 40 : IF (atoms%nlo(itype) >= 1) THEN
129 20 : CALL radflo(atoms, itype, jsp, ello_eig, vr(:, itype, jsp), u, du, fmpi, hybdat%usdus, uuilon, duilon, ulouilopn, flo)
130 :
131 52 : DO ilo = 1, atoms%nlo(itype)
132 32 : iarr(atoms%llo(ilo, itype), itype) = iarr(atoms%llo(ilo, itype), itype) + 1
133 25312 : hybdat%bas1(1:ng, iarr(atoms%llo(ilo, itype), itype), atoms%llo(ilo, itype), itype) = flo(1:ng, 1, ilo)
134 25312 : hybdat%bas2(1:ng, iarr(atoms%llo(ilo, itype), itype), atoms%llo(ilo, itype), itype) = flo(1:ng, 2, ilo)
135 32 : hybdat%bas1_MT(iarr(atoms%llo(ilo, itype), itype), atoms%llo(ilo, itype), itype) = hybdat%usdus%ulos(ilo, itype, jsp)
136 52 : hybdat%drbas1_MT(iarr(atoms%llo(ilo, itype), itype), atoms%llo(ilo, itype), itype) = hybdat%usdus%dulos(ilo, itype, jsp)
137 : END DO
138 : END IF
139 : END DO
140 16 : deallocate(u, du)
141 :
142 : ! consistency check
143 272 : IF (.not. all(iarr == mpdata%num_radfun_per_l)) call judft_error('gen_wavf: counting error')
144 :
145 :
146 : 8000 FORMAT(1x, /, /, ' wavefunction parameters for atom type', i3, ':', /, t32, 'radial function', t79, &
147 : 'energy derivative', /, t3, 'l', t8, 'energy', t26, 'value', t39, 'derivative', t53, &
148 : 'nodes', t68, 'value', t81, 'derivative', t95, 'nodes', t107, 'norm', t119, 'wronskian')
149 : 8010 FORMAT(i3, f10.5, 2(5x, 1p, 2e16.7, i5), 1p, 2e16.7)
150 :
151 16 : call timestop("gen_wavf")
152 1536 : END SUBROUTINE gen_wavf
153 : END MODULE m_gen_wavf
|