【Plumed教程(一)】增强采样Plumed入门
1. 在阿里云ECS的Centos7.9和8.2系統中進行Plumed簡單安裝測試
2. 在騰訊云ECS的Centos7.9系統中進行Plumed簡單安裝測試
3. 簡單的入門案例
4. 集合變量(CV)
5. 命令行工具
1. 在阿里云ECS的Centos7.9和8.2系統中進行Plumed的簡單安裝測試
Plumed的官方安裝教程是以以2.4.1為例進行的,installation教程地址在此:PLUMED: Installation
最新版本2.8.1下載地址再次:Release Release v2.8.1 · plumed/plumed2 · GitHub
在網上看到大家的安裝過程都很順利和簡單,然而我在安裝過程中卻遇到了各種麻煩,在此分享給大家,希望大家能夠少走彎路!
首先以阿里云ECS的7.9Centos系統(2核2GB,Open MPI?4.1.1,gcc/g++/gfortran 9.3.1)作為plumed的安裝測試環境,root賬戶下進行。
(1)下載并解壓安裝包。
以2.8.1的安裝為例,首先下載安裝包,上傳到服務器中,執行以下命令解壓縮
tar -xf plumed-2.8.1.tgz(2)進入解壓縮的文件夾中,執行以下命令進行簡單的編譯安裝。
cd plumed-2.8.1 # 進入解壓縮文件夾 ./configure --prefix=/usr/local # 編譯安裝到/usr/local目錄下 make -j 2 # 以2核進行編譯安裝,-j參數可選 make doc # this is optional and requires proper doxygen version installed make check make install使用阿里云ECS的centos系統進行configure之后出現了如下很多WARNING,包括提示“Bash completion for plumed will not be installed, please add the following two lines to your bashrc”等等。最重要的是提示:plumed可執行文件將不會在這臺機器上執行除非以 plumed --no-mpi 形式的命令行運行,即不能夠進行并行計算!
configure: WARNING: **** Bash completion for plumed will not be installed, please add the following two lines to your bashrc configure: WARNING: **** _plumed() { eval "$(plumed --no-mpi completion 2>/dev/null)";} configure: WARNING: **** complete -F _plumed -o default plumed configure: **** PLUMED will be compiled using MPI configure: WARNING: plumed executable will not run on this machine configure: WARNING: unless you invoke it as 'plumed --no-mpi' configure: WARNING: all command line tools are thus available as 'plumed --no-mpi name-of-the-tool' configure: WARNING: e.g. 'plumed --no-mpi driver' configure: WARNING: to patch an MD code use 'plumed --no-mpi patch' configure: WARNING: (notice that MPI will be available anyway in the patched code)暫時先不管上面的WARNING,?繼續進行make安裝,之后進行make check,出現以下結果:
+++++++++++++++++++++++++++++++++++++++++++++++++++++ + Final report: + 249 tests performed, 339 tests not applicable + 0 errors found + Well done!! +++++++++++++++++++++++++++++++++++++++++++++++++++++?再接著進行make install之后,顯示已經安裝了,同時提示要配置若干環境變量,還有一些WARNING,提示內容如下。
*** PLUMED has been installed ***Install prefix : /usr/local Full name : plumedSetup your environment - Ensure this is in your execution path : /usr/local/bin - Ensure this is in your include path : /usr/local/include - Ensure this is in your library path : /usr/local/lib - Ensure this is in your PKG_CONFIG_PATH path : /usr/local/lib/pkgconfig For runtime binding: - Set this environment variable : PLUMED_KERNEL=/usr/local/lib/libplumedKernel.soTo create a tcl module that sets all the variables above, use this one as a starting point: /usr/local/lib/plumed/modulefileTo uninstall, remove the following files and directories: /usr/local/lib/plumed /usr/local/share/doc/plumed /usr/local/include/plumed /usr/local/bin/plumed /usr/local/bin/plumed-patch /usr/local/bin/plumed-config /usr/local/lib/pkgconfig/plumed.pc /usr/local/lib/libplumed.so /usr/local/lib/libplumedKernel.so A vim plugin can be found here: /usr/local/lib/plumed/vim/ Copy it to /root/.vim/ directory Alternatively: - Set this environment variable : PLUMED_VIMPATH=/usr/local/lib/plumed/vim - Add the command 'let &runtimepath.=','.$PLUMED_VIMPATH' to your .vimrc file From vim, you can use :set syntax=plumed to enable it WARNING: plumed executable will not run on this machine WARNING: unless you invoke it as 'plumed --no-mpi' WARNING: This is normal if this is the login node of a cluster. WARNING: - to patch an MD code now use 'plumed --no-mpi patch' WARNING: (notice that MPI will be available anyway in the patched code) WARNING: - all command line tools are available as 'plumed --no-mpi name-of-the-tool' WARNING: e.g. 'plumed --no-mpi driver' WARNING: (MPI will be disabled in this case) make[2]: Leaving directory '/root/sun789/software/08_plumed/plumed-2.8.1/src/lib' make[1]: Leaving directory '/root/sun789/software/08_plumed/plumed-2.8.1/src'于是,vi ~/.bashrc文件,添加相關提示的環境變量,如下所示 # this is for plumed 部分,然后source ~/.bashrc。這一部分參考了PLUMED系列-安裝教程?的安裝教程。/.bashrc中結尾環境變量配置部分對應新添加的plumed部分,兩行##之前的對應bashrc中已有的環境變量配置。
# .bashrc# User specific aliases and functionsalias rm='rm -i' alias cp='cp -i' alias mv='mv -i'# Source global definitions if [ -f /etc/bashrc ]; then. /etc/bashrc fi# This is for anaconda # 在.bashrc文件底部添加 # 為了避免與其他服務器用戶產生命令沖突, 使用自己自定義的python8替代python # alias python8='/root/anaconda3/bin/python' # 這里寫anaconda的安裝路徑 # export PATH="/root/anaconda3/bin:$PATH"# This is for vaspkit # export PATH=/root/sun789/software/vaspkit.1.3.5/bin:${PATH}# This is for Gaussian09 export g09root=/root/sun789/software/03_gaussian/softwarepackage # g16所在目錄 export GAUSS_SCRDIR=/root/sun789/software/03_gaussian/tmp # 臨時文件夾tmp所在目錄 source /root/sun789/software/03_gaussian/softwarepackage/g09/bsd/g09.profile # 解壓縮的到的g16.profile所在目錄# this is for openmpi export PATH=$PATH:/usr/local/lib/openmpi/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/openmpi/lib# this is for intel MKL source /opt/intel/oneapi/setvars.sh > /dev/null# this is for gcc and gfortran upgrade source /opt/rh/devtoolset-9/enable # this is for quantum esrpresso # 避免root賬戶下每次調用openmmpi必須執行-allow-run-as-root命令 export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 # 寫入QE編譯后執行文件所在目錄,即QE編譯后bin文件夾所在目錄 export PATH=$PATH:/root/sun789/software/06_quantum_espresso/02_qe_configuration/bin # 寫入intel MKL的intel64_lin文件夾所在目錄,在默認安裝目錄/opt/intel/oneapi/目錄下面找 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/oneapi/compiler/2022.2.0/linux/compiler/lib/intel64_lin######################################################################################### ######################################################################################### # this is for plumed _plumed() { eval "$(plumed --no-mpi completion 2>/dev/null)";} complete -F _plumed -o default plumed # this is for plumed enviroment variable export PATH=/usr/local/bin:$PATH export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH export PLUMED_KERNEL=/usr/local/lib/libplumedKernel.so:$PLUMED_KERNEL export PLUMED_VIMPATH=/usr/local/lib/plumed/vim:$PLUMED_VIMPATH export INCLUDE=/usr/local/include:$INCLUDE # 若開啟了時間計算,需要增加 export PLUMED_USE_LEPTON=yes然后在終端輸入 plumed help 之后,再次顯示報錯,報錯內容如下!!!
[root@CentosDesktopSunYW plumed-2.8.1]# plumed help [CentosDesktopSunYW:02658] [[INVALID],INVALID] ORTE_ERROR_LOG: Unable to start a daemon on the local node in file ess_singleton_module.c at line 716 [CentosDesktopSunYW:02658] [[INVALID],INVALID] ORTE_ERROR_LOG: Unable to start a daemon on the local node in file ess_singleton_module.c at line 172 -------------------------------------------------------------------------- It looks like orte_init failed for some reason; your parallel process is likely to abort. There are many reasons that a parallel process can fail during orte_init; some of which are due to configuration or environment problems. This failure appears to be an internal failure; here's some additional information (which may only be relevant to an Open MPI developer):orte_ess_init failed--> Returned value Unable to start a daemon on the local node (-127) instead of ORTE_SUCCESS -------------------------------------------------------------------------- -------------------------------------------------------------------------- It looks like MPI_INIT failed for some reason; your parallel process is likely to abort. There are many reasons that a parallel process can fail during MPI_INIT; some of which are due to configuration or environment problems. This failure appears to be an internal failure; here's some additional information (which may only be relevant to an Open MPI developer):ompi_mpi_init: ompi_rte_init failed--> Returned "Unable to start a daemon on the local node" (-127) instead of "Success" (0) -------------------------------------------------------------------------- *** An error occurred in MPI_Init *** on a NULL communicator *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort, *** and potentially your MPI job)聯想到我之前在阿里ECS的centos7.9系統中編譯安裝科學計算軟件總是出問題,而在騰訊ECS的centos7.9版本中編譯安裝基本都是一次成功。猜想可能是ECS的centos7.9系統存在問題,或者是當前系統進行了太多軟件的編譯測試產生了環境沖突。
一番折騰調整還是沒能成功運行之后,我果斷將阿里云的ECS系統升級至8.2版本的centos系統。然后先配置了gcc, g++, gfortran編譯器(8.5版本),接著按照上述步驟重新進行編譯。
先進行configure,發現WARNING相比之前由9個減少至4個。由于還沒有安裝openmpi,所以提示還不能并行編譯,但是此處已經沒有僅能使用?plumed --no-mpi ?命令進行任務運行的warning了。
configure: **** As of PLUMED 2.5, you cannot change paths anymore during "make install" configure: **** Please configure and make clean to change the prefix configure: WARNING: **** Bash completion for plumed will not be installed, please add the following two lines to your bashrc configure: WARNING: **** _plumed() { eval "$(plumed --no-mpi completion 2>/dev/null)";} configure: WARNING: **** complete -F _plumed -o default plumed configure: WARNING: **** PLUMED will NOT be compiled using MPI because MPI have not been found! configure: creating ./config.status config.status: creating Makefile.conf config.status: creating sourceme.sh config.status: creating stamp-h接著進行make安裝,然后make check,結果如下:
+++++++++++++++++++++++++++++++++++++++++++++++++++++ + Final report: + 247 tests performed, 341 tests not applicable + 0 errors found + Well done!! +++++++++++++++++++++++++++++++++++++++++++++++++++++然后繼續make install,顯示已經安裝了,結果如下:
*** PLUMED has been installed ***Install prefix : /usr/local Full name : plumedSetup your environment - Ensure this is in your execution path : /usr/local/bin - Ensure this is in your include path : /usr/local/include - Ensure this is in your library path : /usr/local/lib - Ensure this is in your PKG_CONFIG_PATH path : /usr/local/lib/pkgconfig For runtime binding: - Set this environment variable : PLUMED_KERNEL=/usr/local/lib/libplumedKernel.soTo create a tcl module that sets all the variables above, use this one as a starting point: /usr/local/lib/plumed/modulefileTo uninstall, remove the following files and directories: /usr/local/lib/plumed /usr/local/share/doc/plumed /usr/local/include/plumed /usr/local/bin/plumed /usr/local/bin/plumed-patch /usr/local/bin/plumed-config /usr/local/lib/pkgconfig/plumed.pc /usr/local/lib/libplumed.so /usr/local/lib/libplumedKernel.so A vim plugin can be found here: /usr/local/lib/plumed/vim/ Copy it to /root/.vim/ directory Alternatively: - Set this environment variable : PLUMED_VIMPATH=/usr/local/lib/plumed/vim - Add the command 'let &runtimepath.=','.$PLUMED_VIMPATH' to your .vimrc file From vim, you can use :set syntax=plumed to enable it make[2]: Leaving directory '/root/sun789/01_software/01_plumed/plumed-2.8.1/src/lib' make[1]: Leaving directory '/root/sun789/01_software/01_plumed/plumed-2.8.1/src'注意:相比之前,已經沒有WARNING提示了。我輸入plumed help之后,然而還是報錯,結果如下:
[root@CentosDesktopSunYW plumed-2.8.1]# plumed help plumed: error while loading shared libraries: libplumedKernel.so: cannot open shared object file: No such file or directory提示不能夠加載libplumedKernel.so共享庫,其實上述make install中已經提到配置的這個庫環境變量的問題了。將相應環境變量進行配置,即加入上述環境變量配置的內容,再次運行plumed help,結果如下,終于成功了!
[root@CentosDesktopSunYW plumed-2.8.1]# plumed help Usage: plumed [options] [command] [command options]plumed [command] -h|--help: to print help for a specific command Options:[help|-h|--help] : to print this help[--is-installed] : fails if plumed is not installed[--has-mpi] : fails if plumed is running without MPI[--has-dlopen] : fails if plumed is compiled without dlopen[--load LIB] : loads a shared object (typically a plugin library)[--standalone-executable] : tells plumed not to look for commands implemented as scripts Commands:plumed completion : dump a function usable for programmable completionplumed driver : analyze trajectories with plumedplumed driver-float : analyze trajectories with plumed (single precision version)plumed gen_example : construct an example for the manual that users can interact withplumed gentemplate : print out a template input for a particular actionplumed info : provide informations about plumedplumed kt : print out the value of kT at a particular temperatureplumed manual : print out a description of the keywords for an action in htmlplumed pathtools : print out a description of the keywords for an action in htmlplumed pdbrenumber : Modify atom numbers in a PDB, possibly using hybrid-36 codingplumed pesmd : Langevin dynamics on PLUMED energy landscapeplumed simplemd : run lj codeplumed sum_hills : sum the hills with plumedplumed config : inquire plumed about how it was configureplumed mklib : compile a .cpp file into a shared libraryplumed newcv : create a new collective variable from a templateplumed partial_tempering : scale parameters in a gromacs topology to implement solute or partial temperingplumed patch : patch an MD engine /usr/local/lib/plumed/scripts/selector.sh: line 219: python: command not foundplumed selector : plumed vim2html : convert plumed input file to colored html using vim syntax除此之外,后續還在阿里云centos8.5系統上進行了測試。發現與8.2版本centos系統測試還是有差異的,但是不用設置環境變量就可以成功運行plumed help命令。
make check之后
+++++++++++++++++++++++++++++++++++++++++++++++++++++ + Final report: + 312 tests performed, 276 tests not applicable + 65 errors found + Find the bug! + To replace references, go to the test directory and + type 'make reset' make[1]: *** [Makefile:14: checkfail] Error 1 make[1]: Leaving directory '/root/01_sun789/02_plumed/plumed-2.8.1/regtest' make: *** [Makefile:66: check] Error 2make install之后
*** PLUMED has been installed ***Install prefix : /usr/local Full name : plumedSetup your environment - Ensure this is in your execution path : /usr/local/bin - Ensure this is in your include path : /usr/local/include - Ensure this is in your library path : /usr/local/lib - Ensure this is in your PKG_CONFIG_PATH path : /usr/local/lib/pkgconfig For runtime binding: - Set this environment variable : PLUMED_KERNEL=/usr/local/lib/libplumedKernel.soTo create a tcl module that sets all the variables above, use this one as a starting point: /usr/local/lib/plumed/modulefileTo uninstall, remove the following files and directories: /usr/local/lib/plumed /usr/local/share/doc/plumed /usr/local/include/plumed /usr/local/bin/plumed /usr/local/bin/plumed-patch /usr/local/bin/plumed-config /usr/local/lib/pkgconfig/plumed.pc /usr/local/lib/libplumed.so /usr/local/lib/libplumedKernel.so A vim plugin can be found here: /usr/local/lib/plumed/vim/ Copy it to /root/.vim/ directory Alternatively: - Set this environment variable : PLUMED_VIMPATH=/usr/local/lib/plumed/vim - Add the command 'let &runtimepath.=','.$PLUMED_VIMPATH' to your .vimrc file From vim, you can use :set syntax=plumed to enable it make[2]: Leaving directory '/root/01_sun789/02_plumed/plumed-2.8.1/src/lib' make[1]: Leaving directory '/root/01_sun789/02_plumed/plumed-2.8.1/src'為了測試騰訊云ECS上是否存在上述類似問題,進行了接下來的測試。
2. 在騰訊云ECS的Centos7.9系統中進行Plumed的簡單安裝測試
在騰訊云ECS的centos7.9系統(4核8GB,Open MPI?4.1.1,gcc/g++/gfortran 9.3.1)進行測試,
在configure之后,warning明顯減少,沒有只能夠進行非并行計算的WARNING:
configure: **** Please configure and make clean to change the prefix configure: WARNING: **** Bash completion for plumed will not be installed, please add the following two lines to your bashrc configure: WARNING: **** _plumed() { eval "$(plumed --no-mpi completion 2>/dev/null)";} configure: WARNING: **** complete -F _plumed -o default plumed configure: **** PLUMED will be compiled using MPI configure: creating ./config.status config.status: creating Makefile.conf config.status: creating sourceme.sh config.status: creating stamp-h?在騰訊云ECS的centos系統進行了make check之后,雖然出現了errors,但暫時可以忽略,因為可能涉及到一些庫沒有安裝。
+++++++++++++++++++++++++++++++++++++++++++++++++++++ + Final report: + 316 tests performed, 272 tests not applicable + 13 errors found + Find the bug! + To replace references, go to the test directory and + type 'make reset' make[1]: *** [Makefile:14: checkfail] Error 1 make[1]: Leaving directory '/home/lighthouse/06_plumed/plumed-2.8.1/regtest' make: *** [Makefile:66: check] Error 2接著進行 make install,顯示已經安裝,并且也沒有WARNING。
*** PLUMED has been installed ***Install prefix : /usr/local Full name : plumedSetup your environment - Ensure this is in your execution path : /usr/local/bin - Ensure this is in your include path : /usr/local/include - Ensure this is in your library path : /usr/local/lib - Ensure this is in your PKG_CONFIG_PATH path : /usr/local/lib/pkgconfig For runtime binding: - Set this environment variable : PLUMED_KERNEL=/usr/local/lib/libplumedKernel.soTo create a tcl module that sets all the variables above, use this one as a starting point: /usr/local/lib/plumed/modulefileTo uninstall, remove the following files and directories: /usr/local/lib/plumed /usr/local/share/doc/plumed /usr/local/include/plumed /usr/local/bin/plumed /usr/local/bin/plumed-patch /usr/local/bin/plumed-config /usr/local/lib/pkgconfig/plumed.pc /usr/local/lib/libplumed.so /usr/local/lib/libplumedKernel.so A vim plugin can be found here: /usr/local/lib/plumed/vim/ Copy it to /root/.vim/ directory Alternatively: - Set this environment variable : PLUMED_VIMPATH=/usr/local/lib/plumed/vim - Add the command 'let &runtimepath.=','.$PLUMED_VIMPATH' to your .vimrc file From vim, you can use :set syntax=plumed to enable it make[2]: Leaving directory '/home/lighthouse/06_plumed/plumed-2.8.1/src/lib' make[1]: Leaving directory '/home/lighthouse/06_plumed/plumed-2.8.1/src'輸入plumed help命令,結果表明成功運行,注意此處是在沒有配置一些環境變量的情況下成功運行的!
[root@VM-4-6-centos plumed-2.8.1]# plumed help Usage: plumed [options] [command] [command options]plumed [command] -h|--help: to print help for a specific command Options:[help|-h|--help] : to print this help[--is-installed] : fails if plumed is not installed[--has-mpi] : fails if plumed is running without MPI[--has-dlopen] : fails if plumed is compiled without dlopen[--load LIB] : loads a shared object (typically a plugin library)[--standalone-executable] : tells plumed not to look for commands implemented as scripts Commands:plumed completion : dump a function usable for programmable completionplumed driver : analyze trajectories with plumedplumed driver-float : analyze trajectories with plumed (single precision version)plumed gen_example : construct an example for the manual that users can interact withplumed gentemplate : print out a template input for a particular actionplumed info : provide informations about plumedplumed kt : print out the value of kT at a particular temperatureplumed manual : print out a description of the keywords for an action in htmlplumed pathtools : print out a description of the keywords for an action in htmlplumed pdbrenumber : Modify atom numbers in a PDB, possibly using hybrid-36 codingplumed pesmd : Langevin dynamics on PLUMED energy landscapeplumed simplemd : run lj codeplumed sum_hills : sum the hills with plumedplumed selector : create lists of serial atom numbersplumed patch : patch an MD engineplumed partial_tempering : scale parameters in a gromacs topology to implement solute or partial temperingplumed vim2html : convert plumed input file to colored html using vim syntaxplumed config : inquire plumed about how it was configureplumed newcv : create a new collective variable from a templateplumed mklib : compile a .cpp file into a shared library騰訊云ECS的Centos系統再一次不負眾望。之前在ORCA、Gaussian16的安裝上就已經出現過阿里云ECS無法成功安裝或運行而騰訊ECS成功編譯的經歷。這也告訴大家,有時候軟件編譯或安裝不成功,在排除掉自己的問題之后,可能就是系統兼容性問題或者軟件環境變量沖突了。
本小節參考資料:增強采樣軟件PLUMED的安裝與使用 - 騰訊云開發者社區-騰訊云
PLUMED系列-安裝教程 | 小康學習 | 計算化學與分子模擬愛好者
完成上述操作后,plumed可執行文件應該在執行路徑中,您將能夠使用 PLUMED 分析現有軌跡或使用包含的 Lennard-Jones 代碼。但是,由于 PLUMED 主要用于偏向使用分子動力學軟件包執行的動態模擬,您可以在下面找到有關如何修補您喜歡的 MD 代碼以便它可以與 PLUMED 結合。
3. 簡單的入門案例(Collective Variables)
安裝成功之后,建議從官網的Getting Started開始學習(對應手冊93頁)。
要運行 PLUMED,您需要提供一個輸入文件。在此文件中,您可以指定 PLUMED 在運行過程中應該做什么。通常這將涉及計算一個或多個集體變量,也許是計算這些 集合變量 的函數,然后對集體變量/函數的值進行一些分析或運行一些自由能計算的方法。如下所示:
DISTANCE ATOMS=1,2 LABEL=d1 PRINT ARG=d1 FILE=colvar STRIDE=10在這個輸入文件中,每一行都是 P??LUMED 執行某些特定操作的指令(每隔10步將軌跡文件中原子1和原子2之間的距離打印到colvar文件中)。可能是計算一個colvar,分析一個軌跡(trajectory)或者偏置(bias)系統的動力學。
這些行中的第一個詞指定要執行的特定操作。然后是一些關鍵字,這些關鍵字為 PLUMED 提供了有關如何執行操作的更多詳細信息。下面是對關鍵詞及集合變量的一些理解:
(1)集合變量通常分為兩類:一類是定義(原子)組和虛擬原子的變量,一般為虛擬原子坐標或一組原子序號,用于后續的第二類集合變量的計算使用,如center,com,ghost等,這一類的集合變量一共有11個,見手冊5.1小節;
(2)另外一類是鍵角、原子間距等集合變(CV)如DISTANCE, COORDINATION, 等等,可以將第二類集合變量理解為一種用于描述體系性質的函數變量 。這類變量大概有34個。
(3)可以將每一個集合變量和Analysis關鍵詞理解為一個多變量的函數,類似于python中定義的函數,有若干限定輸入參數關鍵字,如上所說,這些關鍵字為 PLUMED 提供了有關如何執行操作的更多詳細信息。比如GROUP集合變量關鍵詞后面可以跟的參數關鍵詞(包括ATOMS, REMOVE, SORT, UNIQUE, NDX_FILE, NDX_GROUP等)及默認值如下:
(4)每一行的開始要么是用于表示集合變量的小寫字母(或與數字組合)加上冒號,要么就是Analysis Keyword,如PRINT,等。后面跟的就是該函數可以調用的一些關鍵詞,手冊中在每個關鍵詞的說明中都明確指出了。
(5)每一行格式: FirstWord ? KeyWords? LabelKeyword? 。注:Firstword一般來源于CV, Analysis, Bias中的關鍵詞,LabelKeyword一般是要傳遞的變量值(如計算得到的距離、鍵角),通常與Firstword含義相同,比如鍵角,距離,原子序號(原子坐標)等,常放在一行的開頭,用小寫字母數字組合自定義組合進行標記,后接冒號“:”。
CV(1):GROUP,? COM, CENTER, FIXEDATOM, ...
CV(2): ? DISTANCE, COORDINATION, ANGLE, ...
Analysis: PRINT, DUMPATOMS, ...
這些關鍵字要么是單個詞(它們告訴 PLUMED 以特定方式進行計算 - 例如 NOPBC 告訴 PLUMED 在計算特定 colvar 時不要使用周期性邊界條件),或者它們可以是后跟等號的詞和沒有空格的逗號分隔列表數字或字符(例如 ATOMS=1,2,3,4 告訴 PLUMED 在計算特定 colvar 時使用原子編號 1,2,3 和 4)。不允許空格的原因是 PLUMED 應該能夠理解原子列表何時結束,并且應該期望一個新的關鍵字。如果整個列表包含在花括號中(例如 ATOMS={1 2 3 4}),則可以使用空格分隔列表而不是逗號分隔列表。請注意,您可以使用Continuation lines將命令拆分為多行。
這些關鍵字中最重要的是標簽關鍵字(label keyword),因為只有使用這些標簽,我們才能將數據從一個動作傳遞到另一個動作。如
d1: DISTANCE ATOMS=1,2 PRINT ARG=d1 FILE=colvar STRIDE=10然后 PLUMED 將每 10 步將原子 1 和 2 之間的距離值打印到文件 colvar 中,正如您告訴 PLUMED 采用由操作 d1 計算的值并打印它一樣。您可以使用任何字符串來標記您的操作,只要它不以符號 @ 開頭。在 PLUMED 中,以 @ 開頭的字符串用于引用特殊的、代碼生成的原子組,并為用戶在輸入中未提供標簽的任何操作提供標簽。
請注意,如果在行首添加了一個單詞后跟一列(例如 pippo:),PLUMED 會自動刪除它并添加一個等效標簽(LABEL=pippo)。因此,可以使用以下快捷方式獲得完全等效的結果。
DISTANCE ATOMS=1,2 LABEL=d1 PRINT ARG=d1 FILE=colvar STRIDE=10# 下面和上面是等效的 # d1: DISTANCE ATOMS=1,2 # PRINT ARG=d1 FILE=colvar STRIDE=10還要注意,所有動作都可以被標記,除了普通的集體變量之外,許多動作可以定義一個或多個值,然后可以使用相應的標簽來引用。
如果您的系統上有正則表達式庫并在配置時檢測到,則也可以使用 POSIX 正則表達式(請參閱正則表達式)引用操作。您還可以在輸入中添加注釋或在多個文件中設置輸入,然后通過包含其他文件創建復合輸入。
- 集體變量告訴你計算原子位置函數的方法。
- 分析告訴您可以使用 PLUMED 在軌跡上運行的各種形式的分析。
- Bias告訴您可以使用 PLUMED 偏置分子動力學模擬的方法。
可以通過指定plumed默認單位的轉換因子或使用與下面給出的定義單位之一相對應的字符串來設置新單位。該指令必須出現在 plumed.dat 文件的開頭。必須在整個 plumed.dat 文件中使用相同的單位。
# this is using Angstrom - kj/mol - fs UNITS LENGTH=A TIME=fs # compute distance between atoms 1 and 4 d: DISTANCE ATOMS=1,4 # print time and distance on a COLVAR file PRINT ARG=d FILE=COLVAR # dump atoms 1 to 100 on a 'out.gro' file DUMPATOMS FILE=out.gro STRIDE=10 ATOMS=1-100 # dump atoms 1 to 100 on a 'out.xyz' file DUMPATOMS FILE=out.xyz STRIDE=10 ATOMS=1-100在COLVAR文件中,時間和距離將分別出現在 fs 和 A 中,無論您在主機 MD 代碼中使用的單位是什么。文件中的坐標out.gro將以 nm 表示,因為gro按照慣例,文件是用 nm 編寫的。由于我們使用 UNITS 命令設置 Angstrom 單位,因此文件中的坐標out.xyz將以 Angstrom 寫入。事實上,在 PLUMED xyz 文件中使用的是內部 PLUMED 單位,不一定是埃!
LENGTH: nm (default), A (for Angstrom), um (for micrometer), Bohr (0.052917721067 nm)ENERGY: kj/mol (default), j/mol, kcal/mol (4.184 kj/mol), eV (96.48530749925792 kj/mol), Ha (for Hartree,2625.499638 kj/mol)TIME: ps (default), fs, ns, atomic (2.418884326509e-5 ps)MASS: amu (default)CHARGE: e (default)4. 集合變量
化學系統包含大量原子,在大多數情況下,這使我們無法通過直接監測原子位置來理解任何事情。因此,我們引入了描述我們感興趣的化學過程的集體變量 (CV),并改為監控這些更簡單的數量。這些 CV 用于 PLUMED 中實現的許多方法中 - 可以使用PRINT監控值,可以計算它們的函數,或者可以使用PLUMED 中實現的分析和偏置方法對它們進行分析或偏置。然而,在做任何這些事情之前,我們首先必須告訴 PLUMED 如何計算它們。
在 PLUMED 中實現的最簡單的集合變量采用一組原子位置并輸出一個或多個標量 CV 值。有關這些變量的信息在標題為CV 文檔的頁面上提供,而有關如何選擇原子集的信息可以在Groups 和 Virtual Atoms頁面中找到。請注意,PLUMED 包含許多其他集體變量的實現,但這些變量的輸入在第一次遇到時可能不太透明。特別是關于與參考配置的距離的頁面描述了計算與特定參考配置的距離的各種方法。因此,您將在此處找到有關如何計算蛋白質折疊狀態的 RMSD 距離的說明。同時,Functions頁面描述了可以在代碼中使用的集合變量的各種功能。這是 PLUMED 的一個非常強大的功能,因為您可以使用函數命令來計算任何函數或CV 文檔頁面上列出的簡單集合變量的組合。最后,MultiColvar 上的頁面描述了 MultiColvars。
MultiColvars 允許您使用許多不同的 colvars,并允許我們在沒有大量代碼的情況下實現所有這些集體變量。對于某些事情(例如DISTANCES?GROUPA=1 GROUPB=2-100 LESS_THAN={RATIONAL R_0=3}),plumed 中有更多計算效率更高的選項(例如COORDINATION)。然而,MultiColvars 值得研究,因為它們為許多相當復雜的 CV 提供了靈活的語法。
(1)指定原子
在 PLUMED 中實現的絕大多數 CV 都是從原子位置列表中計算出來的。在 PLUMED 中,原子使用分子動力學輸入文件中的數字索引指定。
在 PLUMED 中,原子列表可以直接在每個集合變量的定義中提供,也可以預定義為可以多次重用的GROUP 。原子列表可以寫成:
- 逗號分隔的數字列表 (?GROUP ATOMS=10,11,15,20 LABEL=g1)
- 數值范圍。所以GROUP ATOMS=10-20 LABEL=g2相當于GROUP ATOMS=10,11,12,13,14,15,16,17,18,19,20 LABEL=g2
- 具有步幅的數值范圍。所以GROUP ATOMS=10-100:10 LABEL=g3 is equivalent toGROUP ATOMS=10,20,30,40,50,60,70,80,90,100 LABEL=g3
- atoms ranges with a negative stride. SoGROUP ATOMS=100-10:-10 LABEL=g4 相當于GROUP ATOMS=100,90,80,70,60,50,40,30,20,10 LABEL=g4
此外,還有一些快捷方式可以使用:
- @mdatoms表示 MD 引擎中存在的所有物理原子(例如DUMPATOMS ATOMS=@mdatoms)。
- @allatoms表示所有原子,包括那些僅在 PLUMED 中定義的原子(例如DUMPATOMS ATOMS=@allatoms)。
PLUMED 中定義的虛擬原子列表可以通過命令獲取GROUP ATOMS=@allatoms REMOVE=@mdatoms。
如果您使用MOLINFO命令加載分子的結構,則可以使用其他快捷方式。
以上所有方法都可以組合在一起,只需將一個名稱放在另一個名稱之后,用逗號分隔:
g5: DUMPATOMS ATOMS=1,2,10-20,40-60:5,100-70:-2 FILE=test.xyz一些集體變量必須接受固定數量的原子,例如,DISTANCE僅使用兩個原子計算,ANGLE使用 3 或 4 個原子計算,TORSION使用 4 個原子計算。
plumed的獨立運行通常包含3類文件:軌跡文件、運行控制文件input file、運行得到的輸出文件。需要重點學習plumed的關鍵詞語法。同時plumed也包含了若干命令行工具,如下所示(對應手冊717頁),接下來的測試中會用到其中的一部分。
5. 命令行工具
plumed的命令行工具主要包含以下這些,調用格式如下
plumed <toolname> <list of input flags for that tool>
?以config的使用為例,config用于判斷編譯plumed時是否安裝了某些包。
plumed config makefile_conf??? #
plumed config show??? # 展示plumed所有的configuration
?info 命令行工具 ,查詢plumed的版本,調用格式如下
?driver 命令行工具??
driver 是一種工具,它允許人們使用 plumed 對現有軌跡進行后處理。 使用下面描述的命令行參數指定驅動程序的輸入。 此外,您可以在plumed輸入中使用特殊的 READ?命令來讀取在 MD 模擬期間生成的 colvar 文件。 然后可以將讀入的值視為計算的 colvars。
下面是一些典型的driver調用命令
# 后處理trajectory.xyz軌跡文件 plumed driver --plumed plumed.dat --ixyz trajectory.xyz# 后處理trajectory.xyz軌跡文件 # 請注意 xyz文件應采用內部 PLUMED 單位,默認情況下為 nm。 您可以使用 --length-units選項 # 在這種情況下,驅動程序讀取 xyz文件假設它包含以埃為單位的坐標。 然而,由此產生的 colvar文件包含以 nm 表示的距離。 plumed driver --plumed plumed.dat --ixyz trajectory.xyz --length-units A # plumed.dat輸入文件內容如下 BEGIN_PLUMED_FILE working DATADIR=example-check/driver.tmp # no explicit UNITS action here d: DISTANCE ATOMS=1,2 PRINT ARG=d FILE=colvarplumed driver --plumed plumed.dat --ixyz trajectory.xyz --trajectory-stride 100 --timestep 0.001plumed driver --plumed plumed.dat --pdb diala.pdb --mf_xtc traj.xtc --trajectory-stride 100 --timestep 0.001plumed driver --plumed plumed.dat --imf_crd trajectory.crd --natoms 128?
參考資料:
增強采樣軟件PLUMED的安裝與使用 - DECHIN - 博客園
增強采樣軟件PLUMED的安裝與使用 - 騰訊云開發者社區-騰訊云
淺談PCA與g_covar+g_anaeig+ddtdp+sigmaplot做自由能面圖的方法 - 思想家公社的門口:量子化學·分子模擬·二次元
高斯核函數_擺爛辦不到的博客-CSDN博客_gaussian kernel
高斯函數(Gaussian function)的詳細分析_青龍戰的博客-CSDN博客_高斯函數
Metadynamic論文1 - 知乎
Umbrella Sampling
【分子模擬】Metadynamics - 知乎
總結
以上是生活随笔為你收集整理的【Plumed教程(一)】增强采样Plumed入门的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RENIX软件RTSM基本操作_Linu
- 下一篇: 液晶面板GOA技术