24小时热门版块排行榜    

CyRhmU.jpeg
南方科技大学公共卫生及应急管理学院2025级博士研究生招生报考通知
查看: 995  |  回复: 5
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

astringent

铜虫 (著名写手)


[交流] 【求助】高手请进

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


      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) then
                                  acc(j)=iat
                              else
                                 exit loop3
                              endif
                            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
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

» 抢金币啦!回帖就可以得到:

查看全部散金贴

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

astringent

铜虫 (著名写手)


问题已解决,不过感谢各位参与,没人赠送10个金币,呵呵。
5楼2010-12-15 02:36:51
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 6 个回答

heyansheng12345

银虫 (小有名气)


astringent(金币+10): 2010-12-15 02:35:40
主程序和子程序之间的连接可能有问题,不很清楚,帮顶个
2楼2010-12-14 13:44:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zyj8119

木虫 (著名写手)


astringent(金币+10): 2010-12-15 02:35:31
引用回帖:
Originally posted by astringent at 2010-11-23 17:28:39:
调试正常,为什么运行的时候出现 segmentation fault,请大家帮忙看看,这个程序哪里有问题,我调试了很长时间,总是这个错误,请大家帮帮忙,不甚感激。
sum = 0


      open(nin,file='TRAJ1',status='ol ...

这个翻译过来,貌似叫做段错误。
3楼2010-12-14 13:47:15
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

cean

金虫 (职业作家)


astringent(金币+10): 2010-12-15 02:35:13
我前些天也遇到segmentation fault的问题,知道是肯定连接的不对.多变变连接的设置.

你的程序不全,没法试.光读不好调.
4楼2010-12-14 19:46:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复(可上传附件)
信息提示
请填处理意见