计算化学公社

标题: 基于xtb的amberQM/MM模拟 [打印本页]

作者
Author:
wuzhiyi    时间: 2019-11-11 04:35
标题: 基于xtb的amberQM/MM模拟
本帖最后由 wuzhiyi 于 2019-11-11 04:43 编辑

我知道可能很多人觉得用amber来跑QM/MM效率不是很高。但有些人就是懒,不想用别的,而且很多时候并不是想做非常严谨的QM,而是用一些半经验的方法试试看。
除掉那些历史悠久的半经验方法的话,amber自带的半经验能用的只有PM6和dftb3。amber的PM6只有DFT-D矫正,氢键矫正的形式有点怪。amber的dftb3又是连DFT-D矫正都没有。
所以我就想可以用现在大热的xtb来描述QM部分,无奈amber的QM/MM部分八百年没更新了,虽然有Holger Kruse写了一个amber/xtb的interface,但我记得是争对amber14的,现在再用可能会被审稿人欺负。
但从orca4.2开始,orca就支持xtb了,而amber支持orca,所以就可以串起来,搞一个amber/orca/xtb来用xtb。
可惜如果用orca/xtb的interface来调用xtb的话,point charge gradient文件pcgrad是以xtb的形式而非orca的形式输出,具体来说就是少了第一行point charge的个数和具体的小数点的个数也有点区别。
导致用orca/xtb生成的pcgrad文件无法被amber的amber/orca/的interface读取。
这个问题9月13号就被人提出在orca论坛上(https://orcaforum.kofo.mpg.de/viewtopic.php?f=11&t=5181&p=22867&hilit=xtb#p22867),不过没人理。于是我就修改的xtb一下(https://github.com/xiki-tempula/xtb),使其生成的pcgrad可以被amber的amber/orca来读取。发现我提供修改过的xtb之后,christoph.riplinger光速表示,我们会在下个版本修正这个问题,所以let‘s see。

具体操作就是把我修改过的xtb(https://github.com/xiki-tempula/xtb)下载下来,然后编译用intel编译器,meson(>0.49)和ninja编译。

  1. export FC=ifort CC=icc CXX=icpc
复制代码


注意meson要新版的,直接git就行,meson不需要编译。

因为xtb强制静态编译,所以可能会遇到没有静态pthread库问题,我有一个修改版的xtb(https://github.com/xiki-tempula/xtb/tree/dendrite)用一种丑陋的方式解决了这个问题,不过据说xtb的人在改了。

然后把编译完成的xtb放到orca下面命名为otool_xtb
然后普通的用amber调用orca,提供名为orc_job.tpl的模版就行,注意修改内存和线程数。以及适当的定义qmcut,都用半经验了,就把整个蛋白都包进去吧,省的审稿人BB。
amber的输入文件 (, 下载次数 Times of downloads: 83) 和orc_job.tpl (, 下载次数 Times of downloads: 75) 作为附件提供。









作者
Author:
纪山    时间: 2019-11-16 20:49
赞一个!
作者
Author:
纪山    时间: 2019-11-16 20:52
具体操作就是把我修改过的xtb(https://github.com/xiki-tempula/xtb)下载下来,---------------- 请问,下回来是 xtb-master.zip 文件吗?
作者
Author:
wuzhiyi    时间: 2019-11-16 22:14
纪山 发表于 2019-11-16 20:52
具体操作就是把我修改过的xtb(https://github.com/xiki-tempula/xtb)下载下来,---------------- 请问, ...

应该是
我一般就git clone https://github.com/xiki-tempula/xtb.git
作者
Author:
纪山    时间: 2019-11-17 08:18
wuzhiyi 发表于 2019-11-16 22:14
应该是
我一般就git clone https://github.com/xiki-tempula/xtb.git

用git clone的话又要安装一堆软件,好麻烦的说。
作者
Author:
zsu007    时间: 2019-11-17 09:35
谢谢分享!
作者
Author:
ChaosChiao    时间: 2019-12-25 14:03
厉害,能否写一个相关教程,付费也可。
作者
Author:
wuzhiyi    时间: 2019-12-25 18:41
ChaosChiao 发表于 2019-12-25 14:03
厉害,能否写一个相关教程,付费也可。

我觉得该有的信息都有了啊 你还要什么的教程啊?
作者
Author:
霜晨月    时间: 2019-12-26 16:06
编译时出了以下错误,请教楼主

xtb编译命令是按照社长写的编译xtb的教程:http://sobereva.com/521

[root@localhost xtb-master]# export FC=ifort CC=icc CXX=icpc
[root@localhost xtb-master]# meson setup build_intel --optimization=2
The Meson build system
Version: 0.52.1
Source dir: /mnt/hgfs/xtb_for_orca/xtb-master
Build dir: /mnt/hgfs/xtb_for_orca/xtb-master/build_intel
Build type: native build
Project name: xtb
Project version: 6.2.1
Fortran compiler for the host machine: ifort (intel 12.1.0 "ifort (IFORT) 12.1.0 20110811")
Fortran linker for the host machine: xild 12.1.0
C compiler for the host machine: icc (intel 12.1.0 "icc (ICC) 12.1.0 20110811")
C linker for the host machine: xild 12.1.0
C++ compiler for the host machine: icpc (intel 12.1.0 "icpc (ICC) 12.1.0 20110811")
C++ linker for the host machine: xild 12.1.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program git found: YES (/usr/bin/git)
Program date found: YES (/usr/bin/date)
Program whoami found: YES (/usr/bin/whoami)
Program hostname found: YES (/usr/bin/hostname)
Configuring xtb_version.fh using configuration
WARNING: Consider using the builtin option for language standard version rather than adding flags by hand.
WARNING: Consider using the builtin option for language standard version rather than adding flags by hand.
Library pthread found: YES
Library m found: YES
Library dl found: YES
Library mkl_intel_lp64 found: YES
Library mkl_intel_thread found: YES
Library mkl_core found: YES
Library iomp5 found: YES
Library mkl_rt found: YES
Run-time dependency threads found: YES
Program a2x found: NO
Program pytest found: NO
Program mypy found: NO
Program pylint found: NO
Program flake8 found: NO
Build targets in project: 5
Found ninja-1.7.2 at /usr/bin/ninja-build


[root@localhost xtb-master]# ninja -C build_intel
bash: ninja: command not found...

因为前面ninja的安装没有报错,所以我尝试将ninja改为ninja-build:会不会是这步的问题?


[root@localhost xtb-master]# ninja-build -C build_intel
ninja: Entering directory `build_intel'
[1/279] Compiling Fortran object 'xtb@sta/xtb_tbdef_param.f90.o'.
FAILED: xtb@sta/xtb_tbdef_param.f90.o
ifort -Ixtb@sta -I. -I.. -I../include -warn general -warn truncated_source -O2 -g -axAVX2 -r8 -traceback -qopenmp -D_FILE_OFFSET_BITS=64 -fPIC -module xtb@sta '-gen-dep='xtb@sta/xtb_tbdef_param.f90.o'' -gen-depformat=make -o 'xtb@sta/xtb_tbdef_param.f90.o' -c ../xtb/tbdef_param.f90
ifort: command line warning #10130: unknown extension 'A' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'V' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'X' ignored in option '-ax'
ifort: command line warning #10130: unknown extension '2' ignored in option '-ax'
ifort: command line warning #10006: ignoring unknown option '-qopenmp'
../xtb/tbdef_param.f90(79): error #8040: Invalid type-name in a derived type definition.   [GFN_PARAMETER]
   type gfn_parameter(nelem,nshell)
--------^
../xtb/tbdef_param.f90(80): error #6659: Not an attribute-spec keyword   [LEN]
      integer, len :: nelem  = max_elem
---------------^
../xtb/tbdef_param.f90(81): error #6659: Not an attribute-spec keyword   [LEN]
      integer, len :: nshell = max_shell
---------------^
../xtb/tbdef_param.f90(83): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [EN]
      real(wp) :: en(nelem)
------------------^
../xtb/tbdef_param.f90(84): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [MC]
      real(wp) :: mc(nelem)
------------------^
../xtb/tbdef_param.f90(85): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [GAM]
      real(wp) :: gam(nelem)
------------------^
../xtb/tbdef_param.f90(86): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [GAM3]
      real(wp) :: gam3(nelem)
------------------^
../xtb/tbdef_param.f90(87): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [RAD]
      real(wp) :: rad(nelem)
------------------^
../xtb/tbdef_param.f90(88): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [WLL]
      real(wp) :: wll(nelem,nshell)
------------------^
../xtb/tbdef_param.f90(89): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [REP]
      real(wp) :: rep(2,nelem)
------------------^
../xtb/tbdef_param.f90(90): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [POLYR]
      real(wp) :: polyr(4,nelem)
------------------^
../xtb/tbdef_param.f90(91): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [CXB]
      real(wp) :: cxb(nelem)
------------------^
../xtb/tbdef_param.f90(92): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [AO_EXP]
      real(wp) :: ao_exp(nshell,nelem)
------------------^
../xtb/tbdef_param.f90(93): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [AO_LEV]
      real(wp) :: ao_lev(nshell,nelem)
------------------^
../xtb/tbdef_param.f90(94): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [LPAR]
      real(wp) :: lpar(0:2,nelem)
------------------^
../xtb/tbdef_param.f90(95): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [KPAIR]
      real(wp) :: kpair(nelem,nelem)
------------------^
../xtb/tbdef_param.f90(96): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [KCNAT]
      real(wp) :: kcnat(0:2,nelem)
------------------^
../xtb/tbdef_param.f90(97): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [RADAES]
      real(wp) :: radaes(nelem)
------------------^
../xtb/tbdef_param.f90(98): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [DPOLC]
      real(wp) :: dpolc(nelem)
------------------^
../xtb/tbdef_param.f90(99): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [QPOLC]
      real(wp) :: qpolc(nelem)
------------------^
../xtb/tbdef_param.f90(100): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [AO_PQN]
      integer  :: ao_pqn(nshell,nelem)
------------------^
../xtb/tbdef_param.f90(101): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [AO_L]
      integer  :: ao_l(nshell,nelem)
------------------^
../xtb/tbdef_param.f90(102): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [AO_N]
      integer  :: ao_n(nelem)
------------------^
../xtb/tbdef_param.f90(103): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [AO_TYP]
      integer  :: ao_typ(nshell,nelem)
------------------^
../xtb/tbdef_param.f90(104): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [METAL]
      integer  :: metal(nelem)
------------------^
../xtb/tbdef_param.f90(105): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [CNVAL]
      integer  :: cnval(nelem)
------------------^
../xtb/tbdef_param.f90(106): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [TIMESTP]
      character(len=30) :: timestp(nelem)
---------------------------^
../xtb/tbdef_param.f90(83): error #6279: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association   [NELEM]
      real(wp) :: en(nelem)
---------------------^
../xtb/tbdef_param.f90(88): error #6279: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association   [NSHELL]
      real(wp) :: wll(nelem,nshell)
----------------------------^
compilation aborted for ../xtb/tbdef_param.f90 (code 1)
[2/279] Compiling Fortran object 'xtb@sta/xtb_tbdef_setvar.f90.o'.
ifort: command line warning #10130: unknown extension 'A' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'V' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'X' ignored in option '-ax'
ifort: command line warning #10130: unknown extension '2' ignored in option '-ax'
ifort: command line warning #10006: ignoring unknown option '-qopenmp'
[3/279] Compiling Fortran object 'xtb@sta/xtb_tbdef_data.f90.o'.
ifort: command line warning #10130: unknown extension 'A' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'V' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'X' ignored in option '-ax'
ifort: command line warning #10130: unknown extension '2' ignored in option '-ax'
ifort: command line warning #10006: ignoring unknown option '-qopenmp'
[4/279] Compiling Fortran object 'xtb@sta/xtb_tbdef_wavefunction.f90.o'.
ifort: command line warning #10130: unknown extension 'A' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'V' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'X' ignored in option '-ax'
ifort: command line warning #10130: unknown extension '2' ignored in option '-ax'
ifort: command line warning #10006: ignoring unknown option '-qopenmp'
[5/279] Compiling Fortran object 'xtb@sta/xtb_tbdef_basisset.f90.o'.
ifort: command line warning #10130: unknown extension 'A' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'V' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'X' ignored in option '-ax'
ifort: command line warning #10130: unknown extension '2' ignored in option '-ax'
ifort: command line warning #10006: ignoring unknown option '-qopenmp'
[6/279] Compiling Fortran object 'xtb@sta/xtb_tbdef_solvent.f90.o'.
ifort: command line warning #10130: unknown extension 'A' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'V' ignored in option '-ax'
ifort: command line warning #10130: unknown extension 'X' ignored in option '-ax'
ifort: command line warning #10130: unknown extension '2' ignored in option '-ax'
ifort: command line warning #10006: ignoring unknown option '-qopenmp'
ninja: build stopped: subcommand failed.


另外请教一下,网站直接打包下载的xtb-master.zip解压之后6.9MB,git clone下来的目录为8.5MB,而Grimme提供的编译好的xtb有30多MB,是不是不对?是不是两种方式下载的source code都不完整?(按理说编译成二进制可执行文件之后体积会大大缩小)



作者
Author:
wuzhiyi    时间: 2019-12-28 02:30
霜晨月 发表于 2019-12-26 16:06
编译时出了以下错误,请教楼主

xtb编译命令是按照社长写的编译xtb的教程:http://sobereva.com/521

你把ninja加进path没有啊
xtb静态编译 体积变大不奇怪
作者
Author:
霜晨月    时间: 2019-12-28 22:32
wuzhiyi 发表于 2019-12-28 02:30
你把ninja加进path没有啊
xtb静态编译 体积变大不奇怪

正确设置了ninja的soft link,这次可以直接找到ninja了,但第三步的报错跟原来一样
怀疑可能是我的ifort的问题
申请了个2019的intel编译包,四五天了还没消息。。

作者
Author:
wuzhiyi    时间: 2019-12-30 04:49
霜晨月 发表于 2019-12-28 22:32
正确设置了ninja的soft link,这次可以直接找到ninja了,但第三步的报错跟原来一样
怀疑可能是我的ifort ...

ifort居然会有问题,我建议你去github上提个issue
作者
Author:
霜晨月    时间: 2020-1-6 14:26
折腾了N天,终于编译出来了,简单报告一下结果。

ifort和icc尝试了好几个版本,最后用的是Intel compilers_and_libraries_2019.1.144(就是2019 update 1)。
编译出来的xtb 18MB,比官方的版本小了不少,不知道怎么回事。
这个xtb运行时还要依赖Intel compilers_and_libraries_2019.1.144,看来这个6.7GB的toolkit只能一直留着了。

测速结果:
硬件Xeon E5-2699 v4 双路,主频 2.20GHz
Amber18,gfortran编译(之前我也用ifort编译过,但速度与gfortran版本无明显差别,且MM/PBSA工具无法使用,后来被我删了)
orca版本是 4.2.1
sander都用串行版单核运行。步长 1 fs。
QM region 102 atoms: 43 ps/day
QM region 144 atoms: 25.6 ps/day
感觉并行效率很差,单核和2核(%pal nprocs 2 end)速度看不出差别。其实,即便是单核运行时,sander和otool_xtb的CPU占用也达不到100%,连70%都很难达到。估计是三个程序来回调用,大部分时间花费在中间的折腾上了。

粗测结果仅供参考哈,如果我的设置有什么问题敬请达人指正^_^

作者
Author:
wuzhiyi    时间: 2020-1-7 01:46
霜晨月 发表于 2020-1-6 14:26
折腾了N天,终于编译出来了,简单报告一下结果。

ifort和icc尝试了好几个版本,最后用的是Intel compile ...

我也觉得效率差,主要时间都在读写文件上了,不过我感兴趣的东西一般20ps就好收敛,挂一晚上第二天就好。。。所有也没动力。


作者
Author:
纪山    时间: 2020-1-15 10:22
wuzhiyi 发表于 2019-11-16 22:14
应该是
我一般就git clone https://github.com/xiki-tempula/xtb.git

,虽然有Holger Kruse写了一个amber/xtb的interface,   ------------------  请问,Holger Kruse 的这篇关于amber/xtb的interface 文献 名字叫什么呀?  
作者
Author:
纪山    时间: 2020-1-15 10:24
wuzhiyi 发表于 2020-1-7 01:46
我也觉得效率差,主要时间都在读写文件上了,不过我感兴趣的东西一般20ps就好收敛,挂一晚上第二天就好。 ...

那如果使用固态硬盘会不会速度快一点?
作者
Author:
纪山    时间: 2020-1-15 10:25
霜晨月 发表于 2020-1-6 14:26
折腾了N天,终于编译出来了,简单报告一下结果。

ifort和icc尝试了好几个版本,最后用的是Intel compile ...

如此说来,没有实用价值咯?
作者
Author:
霜晨月    时间: 2020-1-15 15:18
纪山 发表于 2020-1-15 10:25
如此说来,没有实用价值咯?

当然有实用价值了啊,每天几十ps已经是飞快了
我说的是并行效率很低,但是可以不并行,单核跑单任务
作者
Author:
wuzhiyi    时间: 2020-1-15 22:24
本帖最后由 wuzhiyi 于 2020-1-15 22:30 编辑
纪山 发表于 2020-1-15 10:25
如此说来,没有实用价值咯?

做MD一般就Gromacs,amber和NAMD,Gromacs的QM/MM就是残废,NAMD的xtb插件有http://bbs.keinsci.com/forum.php ... ighlight=namd%2Bxtb
NAMD效率比amber快一倍,究竟值不值得就见仁见智了,不过我不喜欢NAMD,所有就剩amber咯。。。据我所知,对最新版的amber目前就这一个解决方案。
当然直接写一个amber插件会又快又好,写一个是不难,不过我个人对amber dev有点意见,对sander的QM/MM这块有很大的意见,个人觉得是个屎坑,所有不怎么想搞。。。
作者
Author:
wuzhiyi    时间: 2020-1-15 22:28
纪山 发表于 2020-1-15 10:22
,虽然有Holger Kruse写了一个amber/xtb的interface,   ------------------  请问,Holger Kruse 的这篇 ...

直接问他要kruse@ibp.cz
我是没搞成功
作者
Author:
纪山    时间: 2020-1-21 11:01
wuzhiyi 发表于 2020-1-15 22:28
直接问他要
我是没搞成功

向他要了,还未回信。估计凉了。
作者
Author:
纪山    时间: 2020-1-21 11:02
wuzhiyi 发表于 2020-1-15 22:24
做MD一般就Gromacs,amber和NAMD,Gromacs的QM/MM就是残废,NAMD的xtb插件有http://bbs.keinsci.com/foru ...

对sander的QM/MM这块有很大的意见,个人觉得是个屎坑,----- 您觉得有哪些BUG?
作者
Author:
wuzhiyi    时间: 2020-1-21 19:28
纪山 发表于 2020-1-21 11:02
对sander的QM/MM这块有很大的意见,个人觉得是个屎坑,----- 您觉得有哪些BUG?

sander本身就写的很糟心啊 不要说和别的比 就和pmemd比就看得出了
作者
Author:
纪山    时间: 2020-1-21 20:19
wuzhiyi 发表于 2020-1-21 19:28
sander本身就写的很糟心啊 不要说和别的比 就和pmemd比就看得出了

看来您是介意它的速度了
作者
Author:
wuzhiyi    时间: 2020-1-22 00:47
纪山 发表于 2020-1-21 20:19
看来您是介意它的速度了

主要问题是coding style和代码水平,速度只是结果了。
作者
Author:
纪山    时间: 2020-1-22 11:40
wuzhiyi 发表于 2020-1-22 00:47
主要问题是coding style和代码水平,速度只是结果了。

是的
作者
Author:
纪山    时间: 2020-3-16 21:15
wuzhiyi 发表于 2020-1-22 00:47
主要问题是coding style和代码水平,速度只是结果了。

请问您,您写的xtb-dendrite,xtb是哪个版本呀?6.2吗?
作者
Author:
wuzhiyi    时间: 2020-3-17 00:59
纪山 发表于 2020-3-16 21:15
请问您,您写的xtb-dendrite,xtb是哪个版本呀?6.2吗?

是的 不过我只改了xtb/single.f90这一个文件
https://github.com/xiki-tempula/ ... 541470d58508df4eeea
你可以自己把这一条改到最新的xtb上
作者
Author:
yjb    时间: 2022-10-25 10:57
老师,最新版的amber22/orca/xtb跑QM/MM MD是不是不存在这样的问题了?
作者
Author:
wuzhiyi    时间: 2022-12-4 18:19
yjb 发表于 2022-10-25 10:57
老师,最新版的amber22/orca/xtb跑QM/MM MD是不是不存在这样的问题了?

不晓得 我现在都转OpenMM了 不过听过amber现在有了新的QM/MM模块
作者
Author:
hangmint    时间: 2022-12-4 22:45
霜晨月 发表于 2020-1-6 14:26
折腾了N天,终于编译出来了,简单报告一下结果。

ifort和icc尝试了好几个版本,最后用的是Intel compile ...

速度这么快吗?我直接amber连用gaussian速度才1ps/day,我有点好奇amber连用gaussian速度提不上去是因为gaussian计算QM区域慢吗?
作者
Author:
Ye。    时间: 2025-9-12 16:24
请问可以给我一个提交作业的脚本吗
作者
Author:
Huschein    时间: 2025-9-13 02:45
amber自带的quick都一百年没大更新了 自然的QMMM也淡出视野了 不过GROMACS/CP2K现在倒是成了最方便省事的了




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