计算化学公社

标题: 由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文件里面。

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

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





作者
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