[Fortran] 纯文本查看 复制代码
Program removezero
Implicit none
Integer::i,j
Character(len=20)::name,name1,name2,name3(2),name4(1)
Real(kind=kind(0.0d0))::a,b,c
Integer::d,e,f,g,h,k,ierr
write(*,*) 'Input the name of xyz:'
Read(*,*) name
name1=trim(adjustl(name))//'.xyz'
name2=trim(adjustl(name))//'1.xyz'
Open(12,file=name1)
Open(13,file=name2)
Do i=1,1
read(12,*) name3(1),name3(2)
write(13,"(2x,a,2x,a)") trim(name3(1)),trim(name3(2))
End Do
Do
read(12,*,iostat=ierr) k,name4(1),a,b,c,d,e,f,g,h
If(ierr==0) then
If (f==0 .or. g==0 .or. h==0 ) cycle
write(13,"(2x,I4,2x,a2,2x,F12.6,f12.6,f12.6,2x,I4,2x,I4,2x,I4,2x,I4,2x,I4)")k,&
trim(name4(1)),a,b,c,d,e,f,g,h
End if
If(ierr/=0) exit
End Do
Read(*,*)
Close(12)
Close(13)
End