24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 363  |  回复: 1

astringent

铜虫 (著名写手)

[交流] 【求助】segmentation fault 已有1人参与

when i execute the following program, segmentation fault always occur.
program main
--
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 ')).or.&
                           ((resname(iat).eq.'DG3'.or.resname(iat).eq.'DG ').and.&
                           (atomname(iat).eq.' N9 '.or.atomname(iat).eq.' N7 '.or.&
                           atomname(iat).eq.' O6 '.or.atomname(iat).eq.' N1 '.or.&
                           atomname(iat).eq.' N2 '.or.atomname(iat).eq.' N3 ')).or.&
                           ((resname(iat).eq.'DA ').and.(atomname(iat).eq.' N9 '.or.&
                           atomname(iat).eq.' N7 '.or.atomname(iat).eq.' N6 '.or.&
                           atomname(iat).eq.' N1 '.or.atomname(iat).eq.' N3 ')).or.&
                           ((resname(iat).eq.'DT ').and.(atomname(iat).eq.' N1 '.or.&
                           atomname(iat).eq.' O4 '.or.atomname(iat).eq.' N3 '.or.&
                           atomname(iat).eq.' O2 '))) then
                           call findhbond &
                              (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum)
                           if(ihbnum.eq.1) then
                           acc(j)=iat
                           else
                           goto 200
                           endif
                       endif
                    enddo
                 enddo
                 if (acc(1)*acc(2)/=0) then
                    if ((resindex(acc(1))/=resindex(acc(2))+1).or.  &
                       (resindex(acc(1))/=resindex(acc(2))-1)) then
                       nhb=nhb+1
                    endif
                 endif
200     continue
           endif
         enddo
         sum=sum+nhb
      enddo
      avgnhb=sum/nstep
      write (nout,*) 'average cswb number is', avgnhb

      close(nout)
     end
how to solve this problem? thanks
回复此楼

» 猜你喜欢

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

astringent

铜虫 (著名写手)

this is my program, the last is wrong.
program main

open(nin,file='TRAJ1',status='old',form &
                ='unformatted')
      open(nout,file='cswb.out',form='formatted')
      open(21,file='check')
      call readmdinit (mdtype,nin)
      nhb = 0
      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)
         sum=0

         do i=1, nattot
              if((atomname(i).eq.' O  ').and.(resname(i).eq.'WAT')) then
                 io = i
                 do j=1,2
                    acc(j)=0
                    ih=io+j
                    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 ')).or.&
                           ((resname(iat).eq.'DG3'.or.resname(iat).eq.'DG ').and.&
                           (atomname(iat).eq.' N9 '.or.atomname(iat).eq.' N7 '.or.&
                           atomname(iat).eq.' O6 '.or.atomname(iat).eq.' N1 '.or.&
                           atomname(iat).eq.' N2 '.or.atomname(iat).eq.' N3 ')).or.&
                           ((resname(iat).eq.'DA ').and.(atomname(iat).eq.' N9 '.or.&
                           atomname(iat).eq.' N7 '.or.atomname(iat).eq.' N6 '.or.&
                           atomname(iat).eq.' N1 '.or.atomname(iat).eq.' N3 ')).or.&
                           ((resname(iat).eq.'DT ').and.(atomname(iat).eq.' N1 '.or.&
                           atomname(iat).eq.' O4 '.or.atomname(iat).eq.' N3 '.or.&
                           atomname(iat).eq.' O2 '))) then
                           call findhbond &
                              (io,ih,iat,xxx,yyy,zzz,nattot,cell,ihbnum)
                           if(ihbnum.eq.1) then
                           acc(j)=iat
                           else
                           goto 200
                           endif
                       endif
                    enddo
                 enddo
                 if (acc(1)*acc(2)/=0) then
                    if ((resindex(acc(1))/=resindex(acc(2))+1).or.  &
                       (resindex(acc(1))/=resindex(acc(2))-1)) then
                       nhb=nhb+1
                    endif
                 endif
200     continue
           endif
         enddo
         sum=sum+nhb
      enddo
      avgnhb=sum/nstep
      write (nout,*) 'average cswb number is
2楼2010-11-22 18:36:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 astringent 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 301求调剂 +4 细胞相关蛋白 2026-04-02 8/400 2026-04-02 16:30 by 271179835
[考研] 一志愿北京科技大学085601材料工程英一数二初试总分335求调剂 +8 双马尾痞老板2 2026-04-02 9/450 2026-04-02 14:45 by 5896
[考研] 求调剂推荐 +3 南山南@ 2026-04-01 3/150 2026-04-02 12:09 by xiaoranmu
[考研] 311求调剂 +16 zchqwer 2026-04-01 18/900 2026-04-02 10:15 by 不吃魚的貓
[考研] 324分 085600材料与化工 +20 呆鹅oor 2026-03-27 20/1000 2026-04-02 10:13 by oooqiao
[考研] 0710生物学,325求调剂 +3 mkkkkkl 2026-04-01 3/150 2026-04-02 09:48 by Jaylen.
[考研] 08工科275分求调剂 +13 AaAa7420 2026-03-31 13/650 2026-04-02 06:19 by 286640313
[考研] 298求调剂 +4 什么是胖头鱼 2026-03-30 6/300 2026-04-01 22:06 by 客尔美德
[考研] 085601材料工程找调剂 +20 oatmealR 2026-03-29 21/1050 2026-04-01 21:00 by lijunpoly
[考研] 085600,320分求调剂 +5 大馋小子 2026-04-01 6/300 2026-04-01 19:40 by 唐沐儿
[考研] 311求调剂 +10 李芷新1 2026-03-31 10/500 2026-04-01 14:38 by chenqifeng666
[考研] 材料科学与工程求调剂 +13 深V宿舍吧 2026-03-29 13/650 2026-03-31 19:50 by Dyhoer
[考研] 材料与化工272求调剂 +25 阿斯蒂芬2004 2026-03-28 25/1250 2026-03-31 16:27 by hypershenger
[考研] 282求调剂 +3 呼吸都是减肥 2026-03-31 3/150 2026-03-31 10:00 by wangjy2002
[考研] 297 地理学070500 复试求调剂 +3 小圆圈圈ooo 2026-03-30 3/150 2026-03-30 21:05 by 余震yz
[考研] 抱歉 +3 田洪有 2026-03-30 3/150 2026-03-30 19:11 by 迷糊CCPs
[考研] 材料专硕 085600求调剂 +7 BBQ233 2026-03-30 7/350 2026-03-30 17:44 by oooqiao
[考研] 348求调剂 +6 小懒虫不懒了 2026-03-28 6/300 2026-03-30 10:29 by Evan_Liu
[考研] 316求调剂 +7 江辞666 2026-03-26 7/350 2026-03-28 21:28 by sanrepian
[考研] 一志愿南京航空航天大学材料学硕求调剂 +3 @taotao 2026-03-28 3/150 2026-03-28 10:26 by JourneyLucky
信息提示
请填处理意见