- #1
MahdiI84
- 22
- 1
- TL;DR Summary
- Hello everyone. I am new to Fortran. The following coding is for a 2x2 matrix whose original diameter is zero and its non-original diameter requires writing a loop. The code I wrote now has an error that I am unable to fix. Please help me solve it. Thanks
Fortran:
program testmatek
implicit none
integer :: Nc=1000 ,k
integer,parameter :: N=2
REAL :: kx ,a0=1.0 ,t0=0.25
DOUBLE PRECISION :: pi=4*ATAN(1.)
COMPLEX , PARAMETER :: i=(0,1)
complex :: ek1 ,ek2
complex :: MATRIX_ek(N,N)
open(1,file='matek.txt')
MATRIX_ek(N,N)=(0,0)
DO k=-Nc,+Nc
kx=(pi*k)/(1000*a0)
ek1=t0*(1+EXP(-2*i*kx*a0))
ek2=t0*(1+EXP(2*i*kx*a0))
MATRIX_ek=RESHAPE((/0.0,eK2,ek1,0.0/ ) , (/2,2/))
write(1,*) MATRIX_ek
end do
end program testmatek
1>C:\Users\mahdi\Documents\Visual Studio 2012\Projects\Console4\Console4\Source1.f90(21): error #5082: Syntax error, found ')' when expecting one of: ( <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> <INTEGER_CONSTANT> ...