我想p1.f 读tmp100.txt中的最后四列,并保存出来,但是执行时会报错,求各位指点。
[Fortran] 纯文本查看 复制代码 program mass centre
implicit real*8 (a-h,o-z)
c qa: coordinations of atom
dimension qa(10000,3)
c ns: number of atoms
dimension ns(10000)
c qcm: coordinations of mass centre
dimension qcm(3)
c wa: mass of atoms
dimension wa(10000)
c u1,u2 are useless
character::u1(10000)
character::u2(10000)
parameter(N=14.00672)
parameter(H=1.00795)
parameter(C=12.01078)
open(1,file='tmp100.txt')
open(2,file='mass_centre')
do i=1,10000
do j=1,3
read(1,*)u1(i),u2(2),ns(i),qa(i,j)
enddo
enddo
do i=1,10000
do j=1,3
write(2,*)ns(i),qa(i,1:10000)
enddo
enddo
close(2)
end
|