I was trying to create an array using two 'do' loops. But, some how, the way I made the array shows an error as mentioned in the title. Please be kind enough to point out the bug. I am new to Fortran.
Here's the code:
program energy
integer::Nx=100,Ny=10
real::kx(101),Epos(101),Eneg(101),E0=0.12,ts=0.2,tsp=2.0,ky(11),Es,Ep
Es=-(E0-4.0*ts)
Ep=(Eo-4.0*ts)
kx(1)=-0.50
do i=1,Nx
kx(i+1)=kx(1)+i*(1.00/Nx)
end do
ky(1)=-0.50
do j=1,Ny
ky(j+1)=ky(1)+j*(1.00/Ny)
end do
do j=1,11
do i=1,101
"The error points the line below as its source."
Epos(i,j)=sqrt(-Es*(Ep+2*ts*(cos(kx(i))+cos(ky(j)))) &
-(2*ts*(cos(kx(i))+cos(ky(j)))*(Ep-2*ts*(cos(kx(i))+cos(ky(j))))) &
+(4*tsp**2)*((sin(kx(i)))**2 +(sin(ky(j)))**2))
end do
end do
open(unit=1, file='data.dat')
do i=1,101
write(1,*) kx(i), Epos(i,1)
end do
close(unit=1)
end program energy
Also, how do I plot Epos(i,j) Versus Kx(i) while keeping j or 'ky' as a parameter ?