The Elk Code
Loading...
Searching...
No Matches
eveqnwxy.f90
Go to the documentation of this file.
1
2
! Copyright (C) 2019 Chung-Yu Wang, J. K. Dewhurst, S. Sharma and
3
! E. K. U. Gross. This file is distributed under the terms of the GNU General
4
! Public License. See the file COPYING for license details.
5
6
subroutine
eveqnwxy
(n,p,dw,ex,fy,w)
7
implicit none
8
! arguments
9
integer
,
intent(in)
:: n,p
10
complex(8)
,
intent(inout)
:: dw(n,n),ex(n,n),fy(n)
11
real
(8),
intent(out)
:: w(n)
12
! local variables
13
integer
n2,i,j
14
real
(8) t1,t2
15
! allocatable arrays
16
integer
,
allocatable
:: idx(:)
17
real
(8),
allocatable
:: r(:)
18
complex(8)
,
allocatable
:: w2(:),h(:,:)
19
complex(8)
,
allocatable
:: x(:),a(:,:)
20
! external functions
21
real
(8),
external
:: dznrm2
22
n2=2*n
23
! setup the bosonic Bogoliubov Hamiltonian
24
allocate
(w2(n2),h(n2,n2))
25
do
j=1,n
26
do
i=1,n
27
h(i,j)=dw(i,j)
28
h(n+i,n+j)=-dw(i,j)
29
h(i,n+j)=-ex(i,j)
30
h(n+i,j)=ex(i,j)
31
end do
32
end do
33
! find the eigenvalues and right eigenvectors
34
call
eveqnzg
(n2,n2,h,w2)
35
! select the eigenpairs corresponding to W†W - X†X = I
36
allocate
(idx(n2),r(n2))
37
do
j=1,n2
38
t1=dznrm2(n,h(1,j),1)**2
39
t2=dznrm2(n,h(n+1,j),1)**2
40
r(j)=t1-t2
41
end do
42
call
sortidx
(n2,r,idx)
43
! pseudo-normalise the eigenvectors and store in output arrays
44
do
i=1,n
45
j=idx(n+i)
46
t1=abs(r(j))+1.d-8
47
t1=(1.d0-(1.d0-t1)**p)/sqrt(t1)
48
w(i)=dble(w2(j))
49
dw(1:n,i)=t1*h(1:n,j)
50
ex(1:n,i)=t1*h(n+1:n2,j)
51
end do
52
deallocate
(idx,r,w2,h)
53
! solve for the vector y
54
allocate
(x(n),a(n,n))
55
a(:,:)=dw(:,:)-ex(:,:)
56
x(:)=fy(:)
57
call
zgemv(
'T'
,n,n,(1.d0,0.d0),a,n,x,1,(0.d0,0.d0),fy,1)
58
do
i=1,n
59
if
(w(i) > 1.d-6)
then
60
fy(i)=fy(i)/w(i)
61
else
62
fy(i)=0.d0
63
end if
64
end do
65
deallocate
(x,a)
66
end subroutine
67
eveqnwxy
subroutine eveqnwxy(n, p, dw, ex, fy, w)
Definition
eveqnwxy.f90:7
eveqnzg
subroutine eveqnzg(n, ld, a, w)
Definition
eveqnzg.f90:7
sortidx
pure subroutine sortidx(n, x, idx)
Definition
sortidx.f90:10
eveqnwxy.f90
Generated by
1.9.8