计算化学公社
标题:
由smiles字符串直接生成gromacs文件的脚本
[打印本页]
作者Author:
Puying
时间:
2025-6-19 16:39
标题:
由smiles字符串直接生成gromacs文件的脚本
分享一个由smiles字符串直接生成跑分子动力学所有的文件的脚本。
需要电脑安装若干软件,分别是sobtop,xtb,gromacs,obabel,packmol和Multiwfn
obabel负责把字符串转为3d结构,然后交给xtb进行优化。优化完成的分子交给sobtop生成gaff力场结构,以及交给packmol来塞进模拟盒子。脚本同时也会生成gaussian的输入文件,计算完成后交给Multiwfn进行resp电荷计算。电荷仍然需要手动粘贴进itp文件里面。
目前脚本写的比较简单,只支持一种分子。可以根据脚本改进支持多种分子。
╰─$ ./smiles2box-bash.sh
please input the SMILES:
cccccc
please input the number of molecules:
50
please input the cell length:
50
Paths of packages:
the path of obabel is /opt/openbabel/bin/obabel
the path of packmol is /opt/packmol/packmol
the path of xtb is /opt/xtb-6.6.1/bin/xtb
the path of gmx is /opt/gmx2022/bin/gmx
the path of sobtop is /opt/sobtop_1.0(dev3.1)/sobtop
Please confirm that the paths are all right.
============= generating xyz file with obabel =============
1 molecule converted
mol1.xyz generated
============= optimizing xyz file with xtb =============
normal termination of xtb
xtb optimization finished
===============gaussian gjf file generation================
=================================================
================ Packmol part ======================
1 molecule converted
:-) GROMACS - gmx editconf, 2022.5 (-:
Executable: /opt/gmx2022/bin/gmx
Data prefix: /opt/gmx2022
Working dir: /home/chenxi/Templates/smiles2box/pack_mol
Command line:
gmx editconf -f ./mol1_multi.pdb -o mol1_multi.gro -box 5 5 5
Note that major changes are planned in future for editconf, to improve usability and utility.
WARNING: all CONECT records are ignored
Read 700 atoms
No velocities found
system size : 4.945 4.863 4.899 (nm)
center : 2.836 2.467 2.505 (nm)
box vectors : 0.000 0.000 0.000 (nm)
box angles : 0.00 0.00 0.00 (degrees)
box volume : 0.00 (nm^3)
shift : -0.336 0.033 -0.005 (nm)
new center : 2.500 2.500 2.500 (nm)
new box vectors : 5.000 5.000 5.000 (nm)
new box angles : 90.00 90.00 90.00 (degrees)
new box volume : 125.00 (nm^3)
GROMACS reminds you: "Is That a Real Poncho ?" (F. Zappa)
=================packmol finished================
================top file generation=================
1 molecule converted
mol2 file generated
the path of sobtop is /opt/sobtop_1.0(dev3.1)/
===========================================
复制代码
作者Author:
exity
时间:
2025-6-20 15:50
越来越多的脚本被开发出来了,越点越开心,感觉自己像一个废物。T_T
作者Author:
Puying
时间:
2025-6-20 18:57
加入了for循环,可以支持多种分子packing
欢迎光临 计算化学公社 (http://bbs.keinsci.com/)
Powered by Discuz! X3.3