The Elk Code
dmatulm.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2025 J. K. Dewhurst and S. Sharma.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: dmatulm
8 ! !INTERFACE:
9 subroutine dmatulm(ulm,dmat)
10 ! !USES:
11 use modmain
12 ! !INPUT/OUTPUT PARAMETERS:
13 ! ulm : unitary transformation in the (l,m) basis
14 ! (in,complex(lmmaxdb,lmmaxdb))
15 ! dmat : density matrix in the (l,m) and spin basis for each
16 ! second-variational state
17 ! (in,complex(lmmaxdb,nspinor,lmmaxdb,nspinor,nstsv))
18 ! !DESCRIPTION:
19 ! Applies a unitary transformation to a density matrix corresponding to a
20 ! particular angular momentum $l$, atom and second-variational state. This is
21 ! done to transform the density matrix to irreducible representation form. See
22 ! also {\tt genlmirep}.
23 !
24 ! !REVISION HISTORY:
25 ! Created October 2025 (JKD)
26 !EOP
27 !BOC
28 implicit none
29 ! arguments
30 complex(8), intent(in) :: ulm(lmmaxdb,lmmaxdb)
31 complex(8), intent(inout) :: dmat(lmmaxdb,nspinor,lmmaxdb,nspinor,nstsv)
32 ! local variables
33 integer ist,ispn,jspn,ld
34 ! automatic arrays
35 complex(8) a(lmmaxdb,lmmaxdb)
36 ld=lmmaxdb*nspinor
37 do ist=1,nstsv
38  do ispn=1,nspinor
39  do jspn=1,nspinor
40 ! apply the unitary matrix as U γ U†
41  call zgemm('N','N',lmmaxdb,lmmaxdb,lmmaxdb,zone,ulm,lmmaxdb, &
42  dmat(:,ispn,1,jspn,ist),ld,zzero,a,lmmaxdb)
43  call zgemm('N','C',lmmaxdb,lmmaxdb,lmmaxdb,zone,a,lmmaxdb,ulm,lmmaxdb, &
44  zzero,dmat(:,ispn,1,jspn,ist),ld)
45  end do
46  end do
47 end do
48 end subroutine
49 !EOC
50 
subroutine dmatulm(ulm, dmat)
Definition: dmatulm.f90:10
complex(8), parameter zone
Definition: modmain.f90:1240
complex(8), parameter zzero
Definition: modmain.f90:1240