[Fortran] 纯文本查看 复制代码
Program workfile
Implicit none
integer , parameter :: n = 1000
real , parameter :: t1 = 3.12
complex , parameter :: i = (0, 1) , t0 = (0,0), t2 = 0.29 , t3 = -0.0103
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
allocate(k(2,n-1,n-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)/n
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([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],shape(H))
write(*,"(*(6('(',f8.5,',',f8.5,')',1x),/) )") H(:,:)
End Program workfile