| 24小時(shí)熱門(mén)版塊排行榜 |
| 5 | 1/1 | 返回列表 |
| 查看: 2830 | 回復(fù): 6 | |||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | |||
astringent銅蟲(chóng) (著名寫(xiě)手)
|
[交流]
【求助】在編譯時(shí)出錯(cuò) 已有5人參與
|
||
|
when i execute the program, the following error appear: At line 111 of file readmd.f90 (unit = 20, file = 'TRAJ1') Fortran runtime error: I/O past end of record on unformatted file How can solve this, please help me, thanks. |
銅蟲(chóng) (著名寫(xiě)手)
|
這個(gè)是源文件 open(nin,file='TRAJ1',status='old',form & ='unformatted') open(nout,file='csbw.out') do istep=1, nstep call readmdinit (mdtype,nin) call readmd & (mdtype,nattot,nin,atomname,xxx,yyy,zzz,cell) ! loop over all waters do i=1, nattot if (('atomname'.eq.'O').and.('resname'.eq.'WAT')) then io = i ih1 = io+1 ih2 = io+2 call test & (io,ih1,ia1,xxx,yyy,zzz,nattot,cell,atomname,resname,ihbnum) if (ihbnum.eq.1) then acc(j)=ia1 call test & (io,ih2,ia2,xxx,yyy,zzz,nattot,cell, & atomname,resname,ihbnum) if (ihbnum.eq.1) then if (resindex(ia1).eq.resindex(ia2)+1 & .or. resindex(ia1).eq. resindex(ia2)-1) then write(*,*) 'not find a cswb' else write(*,*) 'find a cswb' nhb=nhb+1 endif endif endif endif enddo sum=sum+nhb do j=1,nattot write (nout,"('acceptor is',i2)" acc(j)enddo enddo avgnhb=sum/nstep write (nout,"('avergaed number is',i2)" avgnhbclose(nout) end |

銅蟲(chóng) (著名寫(xiě)手)
|
astringent 新蟲(chóng) (小有名氣) 程序強(qiáng)帖: 0 金幣: 72.5 帖子: 112 在線: 14.9小時(shí) 蟲(chóng)號(hào): 900839 注冊(cè): 2009-11-12 狀態(tài): 在線 下面是各個(gè)子程序 subroutine findhbond & (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum) implicit none include 'constants.h' integer io,ih,iat,nattot,ihbnum double precision xxx(nattot),yyy(nattot),zzz(nattot) double precision cell(3) double precision theta,thetamax,roamax,rhamax double precision dx0,dy0,dz0,r0 double precision dx1,dy1,dz1,r1 double precision dx2,dy2,dz2,r2 thetamax = 30.d0 roamax = 3.5d0 rhamax = 2.45d0 ihbnum = 0 call bondcalculation(io,ih,xxx,yyy,zzz,nattot,cell,dx0,dy0,dz0,r0) call bondcalculation(io,iat,xxx,yyy,zzz,nattot,cell,dx1,dy1,dz1,r1) if (r1.lt.roamax) then theta = dacos(dx0*dx1+dy0*dy1+dz0*dz1) if(theta.lt.thetamax) then call bondcalculation & (ih,iat,xxx,yyy,zzz,nattot,cell,dx2,dy2,dz2,r2) if (r2.lt.rhamax) then ihbnum = 1 endif endif endif return end subroutine test & (io,ih,ia,xxx,yyy,zzz,nattot,cell,atomname,resname,ihbnum) implicit none include 'constants.h' integer io,ih,ia,nattot,ihbnum double precision xxx(nattot),yyy(nattot),zzz(nattot) double precision cell(*) character*4 atomname(nattot),resname(nattot) integer iat ia = 0 ihbnum = 0 do iat=1, nattot if((('resname'.eq.'DC5').or.('resname'.eq.'DC')).and.& ('atomname'.eq.'N1'.or.'atomname'.eq.'N4'.or.'atomname'.eq.'N3'& &.or.'atomname'.eq.'O2')) then call findhbond & (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum) elseif (('resname'.eq.'DG3'.or.'resname'.eq.'DG').and.& &('atomname'.eq.'N9'.or.'atomname'.eq.'N7'.or.'atomname'.eq.& &'O6'.or.'atomname'.eq.'N1'.or.'atomname'.eq.'N2'& &.or.'atomname'.eq.'N3')) then call findhbond & (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum) elseif (('resname'.eq.'DA').and.('atomname'.eq.'N9'.or.& 'atomname'.eq.'N7'.or.'atomname'.eq. & 'N6'.or.'atomname'.eq.'N1'& &.or.'atomname'.eq.'N3')) then call findhbond & (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum) elseif (('resname'.eq.'DT').and.('atomname'.eq.'N1'.or. & 'atomname'.eq.'O4'.or.'atomname' & .eq.'N3'.or.'atomname'.eq.'O2')) then call findhbond & (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum) endif if (ihbnum.eq.1) then ia=iat endif enddo return end subroutine bondcalculation & (i1,i2,xxx,yyy,zzz,nattot,cell,dx,dy,dz,roh) implicit none integer i1,i2,nattot double precision xxx(nattot),yyy(nattot),zzz(nattot) double precision cell(3),dx,dy,dz double precision xo,yo,zo,xh,yh,zh,roh xo = xxx(i1) yo = yyy(i1) zo = zzz(i1) xh = xxx(i2) yh = yyy(i2) zh = zzz(i2) dx = xh - xo dy = yh - yo dz = zh - zo dx = dx - anint(dx/cell(1))*cell(1) dy = dy - anint(dy/cell(2))*cell(2) dz = dz - anint(dz/cell(3))*cell(3) roh = dsqrt(dx**2+dy**2+dz**2) dx = dx / roh dy = dy / roh dz = dz / roh return end subroutine readmd & (mdtype,nattot,nin,atomname,xxx,yyy,zzz,cell) implicit none integer mdtype,nattot,nin double precision :: xxx(nattot),yyy(nattot),zzz(nattot) real*4 :: x_dcd(nattot),y_dcd(nattot),z_dcd(nattot) double precision cell(3) character*4 atomname(nattot) integer iatm,i double precision xtable(6) integer ::npdb=70 if (mdtype.eq.0) then ! original TINKER read(nin,*) do iatm=1, nattot read(nin,'(i6,2x,a2,x,3f12.6)')i,atomname(iatm),xxx(iatm),& yyy(iatm),zzz(iatm) enddo elseif (mdtype.eq.1) then ! modified TINKER read(nin,*) read(nin,*) do iatm=1, nattot read(nin,'(a2,9x,6f12.4)')atomname(iatm),xxx(iatm), & yyy(iatm), zzz(iatm) enddo elseif ((mdtype.eq.2).or.(mdtype.eq.3)) then ! DLPOLY read(nin,*) read(nin,*) read(nin,*) read(nin,*) do iatm=1, nattot read(nin,'(a2,x,6f10.5)')atomname(iatm),xxx(iatm), & yyy(iatm), zzz(iatm) enddo elseif (mdtype.eq.4) then ! Orsay - FX COUDERT read(nin,*) read(nin,*) do iatm=1, nattot read(nin,'(2x,a2,6x,3f14.5)')atomname(iatm),xxx(iatm),& yyy(iatm),zzz(iatm) enddo elseif (mdtype.eq.5) then ! xyz read(nin,*) read(nin,*) do iatm=1, nattot read(nin,'(a2,8x,3f12.4)')atomname(iatm),xxx(iatm),& yyy(iatm),zzz(iatm) enddo elseif (mdtype.eq.6) then ! dcd binary read(nin) (xtable(i),i=1,6) read(nin) (x_dcd(i),i=1,nattot) read(nin) (y_dcd(i),i=1,nattot) read(nin) (z_dcd(i),i=1,nattot) cell(1)=xtable(1) cell(2)=xtable(3) cell(3)=xtable(6) OPEN(npdb,file='system.pdb',status='old') call read_pdb(atomname,npdb,nattot) CLOSE(npdb) ! send from single precision to double do i=1,nattot xxx(i)=x_dcd(i) yyy(i)=y_dcd(i) zzz(i)=z_dcd(i) enddo endif return end subroutine readmdinit(mdtype,nin) implicit none integer mdtype,nin ! local variables -------------- integer ntitle,nset,istart,icntrl(6),jcntrl(9) character*80 title(10) character*4 hdr double precision delta integer i,nfr,dfr,natms if (mdtype.eq.3) then read(nin,*) read(nin,*) elseif(mdtype.eq.6) then read(nin) hdr,nfr,istart,dfr,(icntrl(i),i=1,6),delta,(jcntrl(i) & ,i=1,9) read(nin) ntitle,(title(i),i=1,ntitle) read(nin) natms endif return end subroutine read_pdb(atomname,n,nattot) integer ::n,nattot character(len=4),dimension(nattot),intent(inout) ::atomname character(len=4),dimension(nattot) ::resname character(len=4),dimension(nattot) ::itmp integer,dimension(nattot) ::resindex,label !--- local variables ------------------- integer :: i do i=1,nattot read(n,1000,err=20,end=20) itmp,label(i),atomname(i),resname(i),& resindex(i) enddo 20 CONTINUE 1000 format(3x,a4,6x,i5,a4,x,a4,3x,i5) |
金蟲(chóng) (小有名氣)
|
LZ,今天Fortran的問(wèn)題小爆發(fā)哦。 從錯(cuò)誤信息來(lái)看,TRAJ1這個(gè)文件,格式錯(cuò)誤。 另,你讀取數(shù)據(jù)的程序,用F90的嗎? 那么,open(nin,file='TRAJ1',status='old' 里面的 old Fortran的標(biāo)準(zhǔn)這么多年可以是變化的, 你先了解一下 f90 和 f77 的不同把,格式方面。 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 梁成偉老師課題組歡迎你的加入 +9 | 一鴨鴨喲 2026-03-14 | 11/550 |
|
|---|---|---|---|---|
|
[考研] 本人考085602 化學(xué)工程 專碩 +17 | 不知道叫什么! 2026-03-15 | 19/950 |
|
|
[考研] 304求調(diào)劑 +3 | 曼殊2266 2026-03-18 | 3/150 |
|
|
[考研] 一志愿985,本科211,0817化學(xué)工程與技術(shù)319求調(diào)劑 +10 | Liwangman 2026-03-15 | 10/500 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +5 | hanamiko 2026-03-18 | 5/250 |
|
|
[考研] 344求調(diào)劑 +6 | knight344 2026-03-16 | 7/350 |
|
|
[考研] 【同濟(jì)軟件】軟件(085405)考研求調(diào)劑 +3 | 2026eternal 2026-03-18 | 3/150 |
|
|
[考研] 331求調(diào)劑(0703有機(jī)化學(xué) +7 | ZY-05 2026-03-13 | 8/400 |
|
|
[考研] 0703化學(xué)336分求調(diào)劑 +6 | zbzihdhd 2026-03-15 | 7/350 |
|
|
[考研] 268求調(diào)劑 +8 | 一定有學(xué)上- 2026-03-14 | 9/450 |
|
|
[考研] 東南大學(xué)364求調(diào)劑 +5 | JasonYuiui 2026-03-15 | 5/250 |
|
|
[考研] 333求調(diào)劑 +3 | 文思客 2026-03-16 | 7/350 |
|
|
[考研] 0854控制工程 359求調(diào)劑 可跨專業(yè) +3 | 626776879 2026-03-14 | 9/450 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 085600材料與化工 求調(diào)劑 +13 | enenenhui 2026-03-13 | 14/700 |
|
|
[考研] 0856專碩279求調(diào)劑 +5 | 加油加油!? 2026-03-15 | 5/250 |
|
|
[考研] 085601材料工程315分求調(diào)劑 +3 | yang_0104 2026-03-15 | 3/150 |
|
|
[考研] 330求調(diào)劑 +3 | ?醬給調(diào)劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 0856材料與化工301求調(diào)劑 +5 | 奕束光 2026-03-13 | 5/250 |
|
|
[考研] 295求調(diào)劑 +3 | 小匕仔汁 2026-03-12 | 3/150 |
|