[Fortran] 纯文本查看 复制代码
rogram workfile
Implicit none
integer , parameter :: q = 1000
real , parameter :: t1 = 3.12 , t2 = 0.29 , t3 = -0.0103
complex , parameter :: i = (0, 1) , t0 = (0,0)
real , parameter :: PI = acos(-1.0) , a0 = 1.42e-10
real :: b1(2), b2(2) , a1(2) , a2(2) , m1 , m2
! complex H(6, 6)
real , allocatable :: k(:,:,:)
complex :: f1 , f2
integer :: x , y
! Output of the Hamiltonian matrix
! integer::i1
! Eigenvalue and Eigenvector of the Hamiltonian matrix
CHARACTER JOBZ , UPLO
integer :: INFO=0
integer , parameter :: N=6, LDA=N ! , LWORK=3*N
real*8 RWORK(3*N-2), W(N)
complex*16 H(LDA,N), WORK(3*N)
allocate(k(2,q-1,q-1))
b1 = [ 2*PI/a0*sqrt(3.0) , 2*PI/a0 ]
b2 = [ 2*PI/a0*sqrt(3.0) , -2*PI/a0 ]
a1 = [ a0*sqrt(3.0)/2 , a0/2 ]
a2 = [ a0*sqrt(3.0)/2 , -a0/2 ]
Forall(x=1:size(k,2), y=1:size(k,3))
k(:,x,y) = (b1*x+b2*y)/q
End Forall
m1 = dot_product(a1 , k(:,1,2))
m2 = dot_product(a2 , k(:,1,2))
f1 = 1+exp(i*m1)+exp(i*m2)
f2 = 1+exp(-i*m1)+exp(-i*m2)
H = reshape([complex::&
t0, t1*f1, t0, t0, t0, t0,&
t1*f2, t0, t0, t2, t0, t3,&
t0, t0, t0, t1*f2, t0 ,t0,&
t0, t2, t1*f1,t0, t0, t2, &
t0, t0, t0, t0, t0, t1*f1,&
t0, t3, t0, t0, t1*f2, t0],[6 , 6])
! Output of the Hamiltonian matrix
! do i1=1,6
! write(*,*)H(i1,:)
! end do
!print *, H(:,:)
! Eigenvalue and eigenvector of the Hamiltonian matrix
call myzheev(N,W,H)
call ZHEEV('V', 'U', N, H(6,6), N, W, WORK, 3*N, RWORK, INFO)
print *,W
contains
subroutine myzheev(N,W,H)
implicit none
integer::N, INFO=0
real*8::W(N),RWORK(3*N-2)
complex*16::H(N,N),WORK(3*N)
call ZHEEV('V', 'U', N, H, N, W, WORK, 3*N, RWORK, INFO)
endsubroutine
End Program workfile