计算化学公社

 找回密码 Forget password
 注册 Register
Views: 7798|回复 Reply: 1
打印 Print 上一主题 Last thread 下一主题 Next thread

[算法与编程] gdb debug问题 以及c++查错

[复制链接 Copy URL]

93

帖子

0

威望

415

eV
积分
508

Level 4 (黑子)

跳转到指定楼层 Go to specific reply
楼主
最近新接触gdb, 还用得不是很熟,请问大家:

我往现有的代码里添加了一小段我的代码,结果运行报错Segmentation fault (core dumped), 然后程序就call error-message 函数,最后就abort了。像是这样:

Segmentation fault (core dumped)

finished by error termination in CP-SCF
Calling Command: cpscf H2O.cpscf.tmp
[file tools/qcmsg.cpp, line 432]:
  .... aborting the run


然后用gdb的话也没看出什么有用的信息。请问该怎么解决这个问题?

公式为 sum_j {2*(ia|jj)-(ij|aj)}                                                         // i j are indices of occupied MO; a is the index of virtual MO
伪码如下:
1 f=fopen(PertInp,"wb");
2 Loop over batches of the Integral list (pq|rs)                                //pqrs are indices of artbitrary MO
        for (i=all occ MO; i++)                                                            //i is the index of occupied MO
                 for(a=all vir MO; a++)                                                    //a is the index of virtual MO
                        temp1=0.0, temp2=0.0, P(a,i)=0.0;                         // the data structure of P is self-defined.
                        for(j=all occ MO; j++ )                                           //j is the index of occupied MO
                              if[integral type == (ia|jj) && r==s==j]            
                                    temp1+=integral_value*2.0
                             if[integral type == (ij|aj) && q==s==j]
                                     temp2-=x
                              P(a,i)+=temp1+temp2;                                         
                              fwrite(&P(a,i),f);

418

帖子

4

威望

2912

eV
积分
3410

Level 5 (御坂)

2#
发表于 Post on 2017-7-24 09:44:21 | 只看该作者 Only view this author
gdb不是可以载入coredump么?从中可以看到在哪一步出错。

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2025-8-18 08:44 , Processed in 0.140823 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list