1
我試圖寫代碼來獲得以下格式計數句子
FILEIN(I)= 'box_01_step_000000000000j.pdb'
輸出應該是這樣的:
filein(1)='box_01_step_00000000000000.pdb'
filein(2)='box_01_step_00000000000020.pdb'
filein(3)='box_01_step_00000000000040.pdb'
filein(4)='box_01_step_00000000000060.pdb'
filein(5)='box_01_step_00000000000080.pdb'
filein(6)='box_01_step_00000000000100.pdb'
filein(7)='box_01_step_00000000000120.pdb'
filein(8)='box_01_step_00000000000140.pdb'
filein(9)='box_01_step_00000000000160.pdb'
filein(10)='box_01_step_00000000000180.pdb'
filein(11)='box_01_step_00000000000200.pdb'
我的代碼是
program main
implicit none
integer :: i,n,j
character(4):: filein,box,step,pdb
do i = 0, 501
open (300,file='in')
end do
j=0
do i = 0, 501
j=j+20
WRITE(300,*) "'filein'",'"("',(i),'")"',"'='","'box_01_step_'","'000000000000'",j,"'.pdb'"
enddo
close (300)
end program
我
'filein'"(" 0 ")"'=''box_01_step_''000000000000' 20 '.pdb'
'filein'"(" 1 ")"'=''box_01_step_''000000000000' 40 '.pdb'
'filein'"(" 2 ")"'=''box_01_step_''000000000000' 60 '.pdb'
'filein'"(" 3 ")"'=''box_01_step_''000000000000' 80 '.pdb'
我怎樣才能使它
filein(1)='box_01_step_00000000000000.pdb'
filein(2)='box_01_step_00000000000020.pdb'
filein(3)='box_01_step_00000000000040.pdb'
非常感謝dave_thompson_085 – Chung