回 帖 发 新 帖 刷新版面

主题:帮忙看下哪错了???

调试正常,为什么运行的时候出现 segmentation fault,请大家帮忙看看,这个程序哪里有问 
题,我调试了很长时间,总是这个错误,请大家帮帮忙,不甚感激。  read dynamical trajectory


      open(nin,file='TRAJ1',status='old',form &
                ='unformatted')
      open(nout,file='cswb.out',form='formatted')
      open(21,file='check')
        call readmdinit (mdtype,nin)
      loop1:  do istep=1, nstep
               call readmd  &
                   (mdtype,nattot,nin,atomname,xxx,yyy,zzz,&
                   cell,resname,resindex)
               open(npdb,file='newsystem.pdb',status='old')
               call readpdb (atomname,npdb,nattot,resname,resindex)
               close(npdb)
! loop over all waters
               nhb=0

            loop2:   do i=1, nattot
                  if ((atomname(i).eq.' O  ').and.(resname(i).eq.'WAT')) then
                     io = i
                  loop3:   do j=1,2
                                ih=io+j
                      loop4:  do iat=1,nattot
                          if ((resname(iat).eq.'DC5'.or.resname(iat).eq.'DC ').and.&
                              (atomname(iat).eq.' N1 '.or.atomname(iat).eq.' N4 '.or.&
                              atomname(iat).eq.' N3 '.or.atomname(iat).eq.' O2 '))  then
                              call findhbond &
                                   (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum)
                              if (ihbnum/=1) exit loop3
                             acc(j)=iat
                            endif
                        enddo loop4
                     enddo loop3
                    if (acc(1)*acc(2)/=0) then
                       if (resindex(acc(1)).ne.resindex(acc(2))+1 &
                         .or. resindex(acc(1)).ne. resindex(acc(2))-1) then
                            nhb=nhb+1
                        endif
                     endif
                endif
          enddo loop2
          sum=sum+nhb
        enddo loop1
        avgnhb=sum/nstep
        write (nout,*) ihbnum


          close(nout)
          end

回复列表 (共1个回复)

沙发

segmentation fault 的可能比较多, 常见于数组越界. 或者打开一些调试开关看有什么报错信息吧.

我来回复

您尚未登录,请登录后再回复。点此登录或注册