-5
program height_sand
implicit none
integer tmax, nmax
real zmax, maxx
parameter (nmax=200000)
real x1(nmax),y1(nmax),z1(nmax),teta
!real d, zmax, xmax
integer t,ntot
integer i, j, id, tip(nmax)
open(unit=1,file='vmdfile.xyz')
open(unit=3,file='height.dat')
ntot=3000
tmax=51
maxx=0
zmax=0
do t=1,tmax
read(1,*)
read(1,*)
do i=1,ntot
read(1,*)tip(id),x1(id),y1(id),z1(id)
if (z1(id).gt.zmax) then
zmax=z1(id)
end if
if (x1(id).gt.maxx) then
maxx=x1(id)
end if
end do
teta=zmax/maxx
write(3,*)t,zmax,teta
end do
!110 format(I8, f15.6)
END
編譯所有警告和調試信息('gfortran -g-Wall')。使用調試器('gdb')。如果可能的話,切換到最新版本的Fortran(至少Fortran 2003) – 2014-10-01 07:10:45
這不是一個簡單的例子,因爲沒有輸入文件,我們不能重現問題。 – Peter 2014-10-01 07:38:56
編譯運行時間下標檢查。用gfortran,'-fcheck = all'或'-fcheck = bounds'。這會導致編譯器查找由高性能標記標識的問題。 – 2014-10-01 15:57:34