为什么intensity1输出会是无穷大?谢谢
[Fortran] 纯文本查看 复制代码 program pxrd
implicit none
real(4),parameter::natom=143,n=180,lambda=1.5406,frame=1000
integer::i,j,k,l
real(4),dimension(natom,n)::f
real(4),dimension(natom,natom)::r
character::u
real(4),parameter::pi=4.d0*datan(1.d0)
real(8)::intensity0,intensity1,intensity2,intensity,s
open(11,file='facter.txt')
open(12,file='pbc.txt')
open(13,file='pxrd.txt')
open(14,file='ceshi.txt')
do i=1,natom
read(11,*)f(i,1:n)
enddo
c do l=1,frame
do i=1,natom
read(12,*)r(i,1:natom)
enddo
do i=1,n
intensity1=0.d0
intensity2=0.d0
s=4*pi/lambda*(sin(n*pi/180))
do j=1,natom
do k=1,natom
if(j.ne.k) then
intensity1=intensity1+(f(j,i)*f(k,i)*
x (sin(s*r(j,k))/s/r(j,k)))
else
intensity2=intensity2+(f(j,i)*f(k,i))
endif
write(14,*)intensity1,intensity2
enddo
enddo
intensity=intensity1+intensity2
write(13,*)intensity
enddo
c enddo
close(11)
close(12)
close(13)
close(14)
end |