计算化学公社

标题: 可自动处理虚频的Gaussian结构优化脚本 [打印本页]

作者
Author:
wal    时间: 2025-11-12 16:21
标题: 可自动处理虚频的Gaussian结构优化脚本
本帖最后由 wal 于 2025-12-4 17:42 编辑

此脚本是g16的套壳,运行时执行g16 xx.gjf > xx.log,所以需要照常设置g16环境变量。运行方式g16loop xx.gjf
(, 下载次数 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

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

  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
复制代码





作者
Author:
Voidmio    时间: 2025-11-12 16:39
这太好了,可以给组里的小白用户里加一个
作者
Author:
mizu-bai    时间: 2025-11-12 18:13
非常好脚本,已发给组里小东西,严肃学习
作者
Author:
wal    时间: 2025-11-12 20:53
mizu-bai 发表于 2025-11-12 18:13
非常好脚本,已发给组里小东西,严肃学习

还好发的预编译的 不然丢人丢到你们组里 XD
作者
Author:
kkwang    时间: 2025-11-12 21:44
期待早日适配ORCA。
作者
Author:
wal    时间: 2025-11-12 21:48
kkwang 发表于 2025-11-12 21:44
期待早日适配ORCA。

ORCA其实有现成的消虚频的compound脚本
作者
Author:
yuchuanxu    时间: 2025-12-24 13:40
wal 发表于 2025-11-12 21:48
ORCA其实有现成的消虚频的compound脚本

请问ORCA消除虚频的compound脚本在哪里可以找到,方便分享一下嘛?
作者
Author:
ljc050512    时间: 2026-1-1 18:03
yuchuanxu 发表于 2025-12-24 13:40
请问ORCA消除虚频的compound脚本在哪里可以找到,方便分享一下嘛?

在orca的手册里找找看




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3