本帖最后由 sqs 于 2022-4-24 23:10 编辑
输出部分的代码如下:
[Fortran] 纯文本查看 复制代码 ! output data into a file
open(1, file = 'sigma1.txt', status = 'new')
! assign value to the w1 and w2
do i5 = 0,10
w2 = complex((0.02d0)*i5*eV/h_bar, 0.03d0*eV)
call integralk(w2,S1_xx,S1_xy,S1_yx,S1_yy)
write(1,'(4es32.16,1x)')real(w2),aimag(w2),real(S1_xx),aimag(S1_xx)
end do
close(1)
如果我将循环注释掉,对w2假设赋值为;
[Fortran] 纯文本查看 复制代码 w2 = complex((0.02d0)*eV/h_bar, 0.03d0*eV)
在文本文件当中是可以正常出现结果的
[Fortran] 纯文本查看 复制代码 9.1155973050289469E+13 4.8065298624000004E-21 6.2109774794887160E+00 -2.5054868617856510E+01
但是如果不注释循环,就会出现
[Fortran] 纯文本查看 复制代码 0.0000000000000000E+00 4.8065298624000004E-21 1.7634943123222451E+35 -1.1181774585575250E+29
3.0385324350096488E+13 4.8065298624000004E-21 NaN NaN
6.0770648700192977E+13 4.8065298624000004E-21 NaN NaN
9.1155973050289469E+13 4.8065298624000004E-21 NaN NaN
1.2154129740038595E+14 4.8065298624000004E-21 NaN NaN
1.5192662175048244E+14 4.8065298624000004E-21 NaN NaN
1.8231194610057894E+14 4.8065298624000004E-21 NaN NaN
2.1269727045067544E+14 4.8065298624000004E-21 NaN NaN
2.4308259480077191E+14 4.8065298624000004E-21 NaN NaN
2.7346791915086841E+14 4.8065298624000004E-21 NaN NaN
3.0385324350096488E+14 4.8065298624000004E-21 NaN NaN
这又是哪里出问题了呢
完整代码如下
Fcode Pastebin
|