计算化学公社

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

[辅助/分析程序] 可自动处理虚频的Gaussian结构优化脚本

[复制链接 Copy URL]

683

帖子

12

威望

2818

eV
积分
3741

Level 5 (御坂)

鸩羽

跳转到指定楼层 Go to specific reply
楼主
本帖最后由 wal 于 2025-12-4 17:42 编辑

此脚本是g16的套壳,运行时执行g16 xx.gjf > xx.log,所以需要照常设置g16环境变量。运行方式g16loop xx.gjf
g16loop.7z (990.7 KB, 下载次数 Times of downloads: 69)
只支持笛卡尔坐标输入。大概率不支持link1,笔者的gjf解析库写的时候没考虑过link1的事。别的像冻结,额外输入,oniom层这种信息理论上是会保持的,如果发现信息丢失请反馈。

运行时脚本会先判断任务类型。如果是opt freq且不是opt=TS,则g16计算完成后检查虚频。发现虚频时,按照第一个虚频振动矢量对结构做个微调,重新进行计算,默认最大尝试3轮。

经笔者长期实践,掰2轮都处理不掉的多数是格点精度不够引起的虚频,所以如果发现用了M062X或者wb97xd,第3轮会加int=superfine再跑。要注意的是若你优化一批结构,而只有个别的改int设置,将破坏横向对比性。所以不想脚本给你加int的话可以用--notryint

一般来讲优化完成后的结构很接近极小点,步长可以放小,如果想启用的话可以用--loopstep 5指定第二轮后给opt加上maxstep=5。但有增加优化轮数的风险

脚本对个别报错有自动处理:
类型I - 笨蛋错误,默认开启处理,用--crash-handle false关闭
galloc:  could not allocate memory.
笔者常遇到slurm系统暂时分配不了内存导致这个报错。会先等5秒重算看看能不能给够内存,若尝试10次后还报这个,后续每次尝试把%mem指定的内存减1GB,上限99次
End of file in ZSymb. || End of file reading basis center. || EOF while reading ECP pointer card.
末尾少空行导致的。帮你加两行空行然后尝试重算
Internal input file was deleted
一般是瞎搞临时文件引起的。会尝试续算,要是还瞎搞就不给你算了
QPErr --- A syntax error was detected in the input line.
处理几个笔者经常在Gaussian-ORCA之间捯饬而写错的关键词
M06-2X → M06 2X
wb97x-d、wb97x-d3 → wb97xd
def2-tzvp → def2tzvp
def2-svp → def2svp
def-tzvp、deftzvp → tzvp

类型II - 可能导致意外操作的行为,需要--crash-handle all开启
CPHF failed to converge in LinEq2.
帮你加CPHF不收敛一般首先会尝试的CPHF=grid=fine重算
Convergence failure -- run terminated.
尝试加SCF=XQC,如果还不收敛就拉倒,自己想办法
R6DS8: Unable to choose the S8 parameter
对某些方法用了不合适的D3校正引起的。如果有em=gd3bj,首先降级到em=gd3再跑,此时M062X应该就能跑了。如果有em=gd3,直接删掉再跑,此时wb97xd应该就能跑了。如果删了还报这个错,那属于闹鬼了
FormBX had a problem.
三点一线问题,大型体系优化到一半经常报这个错,但是常常可以用Gaussian启动的时候那个处理逻辑躲过去,所以会试着用末次结构重新交一次

类型III - 其他错误,默认开启处理,用--crash-handle false关闭
其他报错通常不好自动处理,只截取输出文件末尾100行到tail.txt文件


25.12.4 update
  • 修复了分行写关键词会引起报错的问题
  • 当检查到geom=check/allchk/allcheck时跳过该跳过的块,使非opt任务可以正常运行,opt暂时没测试
  • 添加'Cannot combine IRC and frequency calculations'到类型I,处理方式为移除不应该添加在这里的freq关键词
  • FormBX的处理次数提升至3
  • 类型III始终是无害的,思考了下不再用--crash-handle false关掉

其他无关紧要的参数都在帮助里有 这里也贴一份吧

  1. Usage: g16loop <input.gjf> [OPTIONS]

  2. Automatically eliminate imaginary frequencies based on vibrational vectors in g16 runs.
  3. Author: Bane Dysta

  4. Options:
  5.   --scale <factor>    Scaling factor for vibrational displacement vectors (default: 0.5)
  6.                       New coordinates = optimized + scale * displacement_vector.
  7.                       When clash is detected, the scale factor will be halved.

  8.   --iters <N>         Maximum number of iterations to run (default: 3)
  9.                       Must be >= 1.

  10.   --loopstep <N>      Add MaxStep=N to Opt keyword from iteration 2 onwards (default: disabled)
  11.                       Helps control step size in optimization. Must be >= 1.

  12.   --tryint            Force enable int=superfine from iteration 3 onwards
  13.                       Overrides auto-detection.

  14.   --notryint          Force disable int keyword addition
  15.                       Prevents automatic addition of int=superfine even for M062X/wB97XD.

  16.   --crash-handle <mode>  Crash handling mode (default: default)
  17.                       Options: default(enable category I), all(enable I+II), false(disable I/II auto-fix)
  18.                       Note: Category III (write tail.txt for unknown errors) is always enabled.

  19.   -h, --help          Show this help message

  20. Notes:
  21.   - If neither --tryint nor --notryint is specified, auto-detection is used:
  22.       if method is M062X or wB97XD, add int=superfine from iteration 3.
  23.       Be careful, this would change the shape of the potential energy surface,
  24.       thus may destroy the comparability of this run with previous ones.
  25.   - Loop mode will be enabled only when Opt+Freq and no TS in Opt is detected.
  26.   - Crash handling category:
  27.       I - galloc(99): try declining mem request
  28.       I - EOF(3): add 2 empty lines to the end of the gjf file
  29.       I - Internal input deleted(1): retry
  30.       I - QPErr(1): fix normal syntax errors (M06-2X->M062X, etc.)
  31.       I - Cannot combine IRC and frequency calculations(1): remove Freq keyword and retry
  32.      II - CPHF convergence(1): try adding CPHF=grid=fine
  33.      II - SCF convergence(1): try adding SCF=XQC
  34.      II - R6DS8(2): try reducing D3 type
  35.      II - FormBX(3): try to calculate again
  36.     III - others(1): write last 100 lines to tail.txt
复制代码




评分 Rate

参与人数
Participants 11
威望 +1 eV +42 收起 理由
Reason
xiaoqi1111 + 3
呆瓜 + 5
Stardust0831 + 5
hebrewsnabla + 3
wcy鱼饵 + 5
sarphuart + 3 GJ!
sobereva + 1
student0618 + 5 好物!
mizu-bai + 5 好物!
SharkYYX2025 + 3 233333
Voidmio + 5 GJ!

查看全部评分 View all ratings

某不知名实验组从苞米地里长出来的计算选手

66

帖子

1

威望

1635

eV
积分
1721

Level 5 (御坂)

2#
发表于 Post on 2025-11-12 16:39:21 | 只看该作者 Only view this author
这太好了,可以给组里的小白用户里加一个

91

帖子

7

威望

2609

eV
积分
2840

Level 5 (御坂)

3#
发表于 Post on 2025-11-12 18:13:54 | 只看该作者 Only view this author
非常好脚本,已发给组里小东西,严肃学习

683

帖子

12

威望

2818

eV
积分
3741

Level 5 (御坂)

鸩羽

4#
 楼主 Author| 发表于 Post on 2025-11-12 20:53:05 | 只看该作者 Only view this author
mizu-bai 发表于 2025-11-12 18:13
非常好脚本,已发给组里小东西,严肃学习

还好发的预编译的 不然丢人丢到你们组里 XD
某不知名实验组从苞米地里长出来的计算选手

27

帖子

0

威望

1394

eV
积分
1421

Level 4 (黑子)

5#
发表于 Post on 2025-11-12 21:44:03 | 只看该作者 Only view this author
期待早日适配ORCA。

683

帖子

12

威望

2818

eV
积分
3741

Level 5 (御坂)

鸩羽

6#
 楼主 Author| 发表于 Post on 2025-11-12 21:48:35 | 只看该作者 Only view this author
kkwang 发表于 2025-11-12 21:44
期待早日适配ORCA。

ORCA其实有现成的消虚频的compound脚本
某不知名实验组从苞米地里长出来的计算选手

9

帖子

0

威望

434

eV
积分
443

Level 3 能力者

7#
发表于 Post on 2025-12-24 13:40:57 | 只看该作者 Only view this author
wal 发表于 2025-11-12 21:48
ORCA其实有现成的消虚频的compound脚本

请问ORCA消除虚频的compound脚本在哪里可以找到,方便分享一下嘛?

105

帖子

0

威望

1006

eV
积分
1111

Level 4 (黑子)

8#
发表于 Post on 2026-1-1 18:03:21 | 只看该作者 Only view this author
yuchuanxu 发表于 2025-12-24 13:40
请问ORCA消除虚频的compound脚本在哪里可以找到,方便分享一下嘛?

在orca的手册里找找看

本版积分规则 Credits rule

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

GMT+8, 2026-1-23 18:47 , Processed in 2.629428 second(s), 25 queries , Gzip On.

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