修改 MrBayes 3.2 源码解决不能恢复断点的问题

  当数据量较大时,用MrBayes进行计算通常是旷日持久的事情,几天甚至几个月。中间如果断电死机什么的发生就很令人发狂了。于是 MrBayes 3.2 svn 版增加了一个断点保存的功能,死机后可以从保存的断点处继续计算。只要在mcmc命令中加入checkfreq=n (n为保存断点间隔的代数)参数即可保存断点;下次从断点继续运算时,在mcmc  命令中加入append=yes参数即可. 

  碰巧的是,前些天不知道谁把我用来计算的那台服务器的电源碰掉了,我那已经算了20多天的任务啊.....!  想砍人之余又庆幸事前曾经设置了断点保存。可是当我在mcmc  命令中加入append=yes参数以恢复运算时,不幸的事还是发生了,MrBayes报错并停止:A maximum of 2000 characters is allowed on a single line, The longest line of the file  xxx contains at least one line with 58000 characters.   当时就有欲哭无泪的感觉啊。稍稍平复一下心情,决定还是从程序的源代码查起吧,希望不是一个与算法有关的大bug(小修小改能搞定,跟算法有关的话短时间就没办法搞了)!拿出错消息grep一下所有的源文件,发现问题在这里: 

trunk / src / command.c - 3211 -      /*  find length of longest line  */
trunk
/ src / command.c - 3212 -     longestLineLength  =  LongestLine (fp);
trunk
/ src / command.c - 3213 -     MrBayesPrint ( " %s   Longest line length = %d\n " , spacer, longestLineLength);
trunk
/ src / command.c - 3214 -     longestLineLength  +=   50 ;
trunk
/ src / command.c - 3215 -     
trunk
/ src / command.c: 3216 :     /*  check that longest line is not longer than CMD_STRING_LENGTH  */
trunk
/ src / command.c: 3217 :     if  (longestLineLength  >=  CMD_STRING_LENGTH  -   100 )
trunk
/ src / command.c - 3218 -         {
trunk
/ src / command.c: 3219 :         MrBayesPrint ( " %s   A maximum of %d characters is allowed on a single line\n " , spacer, CMD_STRING_LENGTH  -   100 );
trunk
/ src / command.c - 3220 -          MrBayesPrint ( " %s   in a file. The longest line of the file %s\n " , spacer, inputFileName);
trunk
/ src / command.c - 3221 -          MrBayesPrint ( " %s   contains at least one line with %d characters.\n " , spacer, longestLineLength);
trunk
/ src / command.c - 3222 -         nErrors ++ ;
trunk
/ src / command.c - 3223 -         }
trunk
/ src / command.c - 3224 - #     if  defined (MPI_ENABLED)

 

  原来最长行的字符数被 CMD_STRING_LENGTH 所限制。grep搜CMD_STRING_LENGTH,在mb.h中找到:

trunk / src / mb.h - 250 - #define  OMEGA_MAX 1000000.0f
trunk
/ src / mb.h - 251 -
trunk
/ src / mb.h - 252 - #define  POS_INFINITY 1E25f;
trunk
/ src / mb.h - 253 - #define  NEG_INFINITY -1000000.0f
trunk
/ src / mb.h - 254 -
trunk
/ src / mb.h: 255 : #define  CMD_STRING_LENGTH 200000
trunk / src / mb.h - 256 -

 

  原来 CMD_STRING_LENGTH 被限制到了20000,该值已经大大不能符合我的数据要求了。于是操刀将其放大10倍,改为200000。重新编译MrBayes, 再次从断点处回复执行, OK,熟悉的计算过程又回来了。20多天的计算总算没白费。

 

转载于:https://www.cnblogs.com/agateriver/archive/2010/05/31/1748373.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值