计算化学公社

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

[程序/脚本开发] 由smiles字符串直接生成gromacs文件的脚本

[复制链接 Copy URL]

60

帖子

3

威望

1736

eV
积分
1856

Level 5 (御坂)

跳转到指定楼层 Go to specific reply
楼主
分享一个由smiles字符串直接生成跑分子动力学所有的文件的脚本。

需要电脑安装若干软件,分别是sobtop,xtb,gromacs,obabel,packmol和Multiwfn

obabel负责把字符串转为3d结构,然后交给xtb进行优化。优化完成的分子交给sobtop生成gaff力场结构,以及交给packmol来塞进模拟盒子。脚本同时也会生成gaussian的输入文件,计算完成后交给Multiwfn进行resp电荷计算。电荷仍然需要手动粘贴进itp文件里面。

目前脚本写的比较简单,只支持一种分子。可以根据脚本改进支持多种分子。

  1. ╰─$ ./smiles2box-bash.sh                                       
  2. please input the SMILES:
  3. cccccc
  4. please input the number of molecules:
  5. 50
  6. please input the cell length:
  7. 50
  8. Paths of packages:
  9. the path of obabel is /opt/openbabel/bin/obabel

  10. the path of packmol is /opt/packmol/packmol

  11. the path of xtb is /opt/xtb-6.6.1/bin/xtb

  12. the path of gmx is /opt/gmx2022/bin/gmx

  13. the path of sobtop is /opt/sobtop_1.0(dev3.1)/sobtop

  14. Please confirm that the paths are all right.
  15. ============= generating xyz file with obabel =============
  16. 1 molecule converted
  17. mol1.xyz generated
  18. ============= optimizing xyz file with xtb =============
  19. normal termination of xtb
  20. xtb optimization finished



  21. ===============gaussian gjf file generation================
  22. =================================================


  23. ================ Packmol part ======================
  24. 1 molecule converted
  25.                      :-) GROMACS - gmx editconf, 2022.5 (-:

  26. Executable:   /opt/gmx2022/bin/gmx
  27. Data prefix:  /opt/gmx2022
  28. Working dir:  /home/chenxi/Templates/smiles2box/pack_mol
  29. Command line:
  30.   gmx editconf -f ./mol1_multi.pdb -o mol1_multi.gro -box 5 5 5

  31. Note that major changes are planned in future for editconf, to improve usability and utility.
  32. WARNING: all CONECT records are ignored
  33. Read 700 atoms
  34. No velocities found
  35.     system size :  4.945  4.863  4.899 (nm)
  36.     center      :  2.836  2.467  2.505 (nm)
  37.     box vectors :  0.000  0.000  0.000 (nm)
  38.     box angles  :   0.00   0.00   0.00 (degrees)
  39.     box volume  :   0.00               (nm^3)
  40.     shift       : -0.336  0.033 -0.005 (nm)
  41. new center      :  2.500  2.500  2.500 (nm)
  42. new box vectors :  5.000  5.000  5.000 (nm)
  43. new box angles  :  90.00  90.00  90.00 (degrees)
  44. new box volume  : 125.00               (nm^3)

  45. GROMACS reminds you: "Is That a Real Poncho ?" (F. Zappa)

  46. =================packmol finished================


  47. ================top file generation=================
  48. 1 molecule converted
  49. mol2 file generated
  50. the path of sobtop is /opt/sobtop_1.0(dev3.1)/
  51. ===========================================
复制代码




smiles2box-bash.sh

5.43 KB, 下载次数 Times of downloads: 13

评分 Rate

参与人数
Participants 3
威望 +1 eV +10 收起 理由
Reason
红红的太阳 + 5
greatzdk + 5 GJ!
sobereva + 1

查看全部评分 View all ratings

389

帖子

1

威望

4826

eV
积分
5235

Level 6 (一方通行)

2#
发表于 Post on 2025-6-20 15:50:24 | 只看该作者 Only view this author
越来越多的脚本被开发出来了,越点越开心,感觉自己像一个废物。T_T

60

帖子

3

威望

1736

eV
积分
1856

Level 5 (御坂)

3#
 楼主 Author| 发表于 Post on 2025-6-20 18:57:38 | 只看该作者 Only view this author
加入了for循环,可以支持多种分子packing

smiles2box-multi.sh

7.32 KB, 下载次数 Times of downloads: 11

本版积分规则 Credits rule

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

GMT+8, 2025-8-14 06:49 , Processed in 0.174833 second(s), 25 queries , Gzip On.

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