0%

RASPA教程

[TOC]

RASPA

  1. 介绍

    RASPA是一个多用途的计算软件,由西北大学Snurr组主持开发,可用于气体、液体、分子筛、硅铝酸盐、金属有机骨架材料等的分子动力学(MD)以及蒙特卡洛模拟(MC),本人主要用其进行气体吸附的高通量计算。

  1. 编译和安装
    • 需求

      • 编译RASPA需要安装C编译器,gccicc都可以,fftwblaslapack是可选的,不过建议一并安装。
    • 从git下载RASPA

      • 可以从GitHub等平台下载软件源代码的最新版本
      1
      git clone https://github.com/iRASPA/RASPA2.git
    • 安装RASPA

      • 在安装前应该设置RASPA_dir的环境变量,即RASPA的安装位置,,可通过以下方式配置环境变量
      1
      export RASPA_DIR=${HOME}/your/desired/directory
      • 也可以将这个语句加入至${HOME}/.bashrc文件中
    • 编译

      • 首先进入RASPA源代码文件夹
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
      100
      101
      102
      103
      104
      105
      106
      107
      108
      109
      110
      111
      112
      113
      114
      115
      116
      117
      118
      119
      120
      121
      122
      123
      124
      125
      126
      127
      128
      129
      130
      131
      132
      133
      134
      135
      136
      137
      138
      139
      140
      141
      142
      143
      144
      145
      146
      147
      148
      149
      150
      151
      152
      153
      154
      155
      156
      157
      158
      159
      160
      161
      162
      163
      164
      165
      166
      167
      168
      169
      170
      171
      172
      173
      174
      175
      176
      177
      178
      179
      180
      181
      182
      183
      184
      185
      186
      187
      188
      189
      190
      191
      192
      193
      194
      195
      196
      197
      198
      199
      200
      201
      202
      203
      204
      205
      206
      207
      208
      209
      210
      211
      212
      213
      214
      215
      216
      217
      218
      219
      220
      221
      222
      223
      224
      225
      226
      >>> cd raspa
      >>> ls
      acconfig.h conf31383.sh examples LICENSE molecules README.md src
      AUTHORS configure.ac forcefield ltconfig NEWS run structures
      BUGS COPYING framework Makefile.am python scripts work.pc
      ChangeLog Docs INSTALL MANIFEST.in README setup.py work.pcl
      >>> rm -rf autom4te.cache
      >>> mkdir m4
      >>> aclocal
      >>> autoreconf -i
      libtoolize: putting auxiliary files in `.'.
      libtoolize: copying file `./ltmain.sh'
      libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
      libtoolize: copying file `m4/libtool.m4'
      libtoolize: copying file `m4/ltoptions.m4'
      libtoolize: copying file `m4/ltsugar.m4'
      libtoolize: copying file `m4/ltversion.m4'
      libtoolize: copying file `m4/lt~obsolete.m4'
      configure.ac:28: installing './config.guess'
      configure.ac:28: installing './config.sub'
      configure.ac:3: installing './install-sh'
      configure.ac:3: installing './missing'
      src/Makefile.am: installing './depcomp'
      > automake --add-missing
      > autoconf
      > ./configure --prefix=${RASPA_DIR}
      checking for a BSD-compatible install... /usr/bin/install -c
      checking whether build environment is sane... yes
      checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
      checking for gawk... gawk
      checking whether make sets $(MAKE)... yes
      checking whether make supports nested variables... yes
      checking for style of include used by make... GNU
      checking for gcc... gcc
      checking whether the C compiler works... yes
      checking for C compiler default output file name... a.out
      checking for suffix of executables...
      checking whether we are cross compiling... no
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to accept ISO C89... none needed
      checking dependency style of gcc... gcc3
      checking for library containing ddot_... -lblas
      checking for library containing dsyevd_... -llapack
      checking for library containing fftw_plan_dft_r2c_1d... -lfftw3
      checking for gcc... (cached) gcc
      checking whether we are using the GNU C compiler... (cached) yes
      checking whether gcc accepts -g... (cached) yes
      checking for gcc option to accept ISO C89... (cached) none needed
      checking dependency style of gcc... (cached) gcc3
      checking for g++... g++
      checking whether we are using the GNU C++ compiler... yes
      checking whether g++ accepts -g... yes
      checking dependency style of g++... gcc3
      checking for g77... no
      checking for xlf... no
      checking for f77... no
      checking for frt... no
      checking for pgf77... no
      checking for cf77... no
      checking for fort77... no
      checking for fl32... no
      checking for af77... no
      checking for xlf90... no
      checking for f90... no
      checking for pgf90... no
      checking for pghpf... no
      checking for epcf90... no
      checking for gfortran... gfortran
      checking whether we are using the GNU Fortran 77 compiler... yes
      checking whether gfortran accepts -g... yes
      checking how to run the C preprocessor... gcc -E
      checking for grep that handles long lines and -e... /usr/bin/grep
      checking for egrep... /usr/bin/grep -E
      checking for ANSI C header files... yes
      checking for sys/types.h... yes
      checking for sys/stat.h... yes
      checking for stdlib.h... yes
      checking for string.h... yes
      checking for memory.h... yes
      checking for strings.h... yes
      checking for inttypes.h... yes
      checking for stdint.h... yes
      checking for unistd.h... yes
      checking math.h usability... yes
      checking math.h presence... yes
      checking for math.h... yes
      checking for string.h... (cached) yes
      checking fftw3.h usability... yes
      checking fftw3.h presence... yes
      checking for fftw3.h... yes
      checking build system type... x86_64-unknown-linux-gnu
      checking host system type... x86_64-unknown-linux-gnu
      checking how to print strings... printf
      checking for a sed that does not truncate output... /usr/bin/sed
      checking for fgrep... /usr/bin/grep -F
      checking for ld used by gcc... /usr/bin/ld
      checking if the linker (/usr/bin/ld) is GNU ld... yes
      checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
      checking the name lister (/usr/bin/nm -B) interface... BSD nm
      checking whether ln -s works... yes
      checking the maximum length of command line arguments... 3458764513820540925
      checking whether the shell understands some XSI constructs... yes
      checking whether the shell understands "+="... yes
      checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
      checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
      checking for /usr/bin/ld option to reload object files... -r
      checking for objdump... objdump
      checking how to recognize dependent libraries... pass_all
      checking for dlltool... no
      checking how to associate runtime and link libraries... printf %s\n
      checking for ar... ar
      checking for archiver @FILE support... @
      checking for strip... strip
      checking for ranlib... ranlib
      checking command to parse /usr/bin/nm -B output from gcc object... ok
      checking for sysroot... no
      checking for mt... no
      checking if : is a manifest tool... no
      checking for dlfcn.h... yes
      checking for objdir... .libs
      checking if gcc supports -fno-rtti -fno-exceptions... no
      checking for gcc option to produce PIC... -fPIC -DPIC
      checking if gcc PIC flag -fPIC -DPIC works... yes
      checking if gcc static flag -static works... no
      checking if gcc supports -c -o file.o... yes
      checking if gcc supports -c -o file.o... (cached) yes
      checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries...
      yes
      checking whether -lc should be explicitly linked in... no
      checking dynamic linker characteristics... GNU/Linux ld.so
      checking how to hardcode library paths into programs... immediate
      checking whether stripping libraries is possible... yes
      checking if libtool supports shared libraries... yes
      checking whether to build shared libraries... yes
      checking whether to build static libraries... yes
      checking how to run the C++ preprocessor... g++ -E
      checking for ld used by g++... /usr/bin/ld -m elf_x86_64
      checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
      checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
      checking for g++ option to produce PIC... -fPIC -DPIC
      checking if g++ PIC flag -fPIC -DPIC works... yes
      checking if g++ static flag -static works... no
      checking if g++ supports -c -o file.o... yes
      checking if g++ supports -c -o file.o... (cached) yes
      checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
      checking dynamic linker characteristics... (cached) GNU/Linux ld.so
      checking how to hardcode library paths into programs... immediate
      checking if libtool supports shared libraries... yes
      checking whether to build shared libraries... yes
      checking whether to build static libraries... yes
      checking for gfortran option to produce PIC... -fPIC
      checking if gfortran PIC flag -fPIC works... yes
      checking if gfortran static flag -static works... no
      checking if gfortran supports -c -o file.o... yes
      checking if gfortran supports -c -o file.o... (cached) yes
      checking whether the gfortran linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
      checking dynamic linker characteristics... (cached) GNU/Linux ld.so
      checking how to hardcode library paths into programs... immediate
      checking that generated files are newer than configure... done
      configure: creating ./config.status
      config.status: creating Makefile
      config.status: creating src/Makefile
      config.status: creating forcefield/Makefile
      config.status: creating forcefield/GenericMOFs/Makefile
      config.status: creating forcefield/GenericZeolites/Makefile
      config.status: creating forcefield/CrystalGenerator/Makefile
      config.status: creating forcefield/GarciaPerez2006/Makefile
      config.status: creating forcefield/Dubbeldam2007FlexibleIRMOF-1/Makefile
      config.status: creating forcefield/Dubbeldam2007FlexibleIRMOF-10/Makefile
      config.status: creating forcefield/Dubbeldam2007FlexibleIRMOF-16/Makefile
      config.status: creating forcefield/CoreShellCatlow/Makefile
      config.status: creating forcefield/CoreShellSchroderSauer/Makefile
      config.status: creating forcefield/CoreShellSastreGale2005/Makefile
      config.status: creating forcefield/RigidIonKramer1991/Makefile
      config.status: creating forcefield/Pascual2004/Makefile
      config.status: creating forcefield/AmirjalayerSchmid/Makefile
      config.status: creating forcefield/Nicholas/Makefile
      config.status: creating forcefield/Dubbeldam2012MIL-100/Makefile
      config.status: creating forcefield/Dubbeldam2012MIL-101/Makefile
      config.status: creating forcefield/Dzubak2012-IRMOF-1/Makefile
      config.status: creating forcefield/Dzubak2012-MgMOF-74/Makefile
      config.status: creating forcefield/Dzubak2012-MgMOF-74-extended/Makefile
      config.status: creating forcefield/Dzubak2012-ZnMOF-74/Makefile
      config.status: creating forcefield/MgMOF-74-Yazaydin/Makefile
      config.status: creating forcefield/CastilloVlugtCalero2009/Makefile
      config.status: creating forcefield/TraPPE/Makefile
      config.status: creating molecules/Makefile
      config.status: creating molecules/Generic/Makefile
      config.status: creating molecules/TraPPE/Makefile
      config.status: creating molecules/TraPPE-UA/Makefile
      config.status: creating molecules/TraPPE-EH/Makefile
      config.status: creating molecules/EPM2/Makefile
      config.status: creating molecules/CastilloVlugtCalero2009/Makefile
      config.status: creating framework/Makefile
      config.status: creating framework/Dubbeldam2007FlexibleIRMOF-1/Makefile
      config.status: creating framework/Dubbeldam2007FlexibleIRMOF-10/Makefile
      config.status: creating framework/Dubbeldam2007FlexibleIRMOF-16/Makefile
      config.status: creating framework/CoreShellCatlow/Makefile
      config.status: creating framework/CoreShellSchroderSauer/Makefile
      config.status: creating framework/CoreShellSastreGale2005/Makefile
      config.status: creating framework/Demontis/Makefile
      config.status: creating framework/DemontisModified/Makefile
      config.status: creating framework/Nicholas/Makefile
      config.status: creating framework/NicholasModified/Makefile
      config.status: creating framework/AmirjalayerSchmid/Makefile
      config.status: creating structures/Makefile
      config.status: creating structures/zeolites/Makefile
      config.status: creating structures/mofs/Makefile
      config.status: creating structures/minerals/Makefile
      config.status: creating structures/ceramics/Makefile
      config.status: creating structures/zeolites/cif/Makefile
      config.status: creating structures/zeolites/block/Makefile
      config.status: creating structures/zeolites/ions/Makefile
      config.status: creating structures/mofs/cif/Makefile
      config.status: creating structures/mofs/block/Makefile
      config.status: creating structures/mofs/ions/Makefile
      config.status: creating structures/minerals/cif/Makefile
      config.status: creating structures/ceramics/cif/Makefile
      config.status: executing depfiles commands
      config.status: executing libtool commands
      >>> make -j4 //-j后的数字代表同时编译的线程数
      ...具体编译时间视机器性能而定
      >>> make install
      ...
      • 安装文件位于之前指定的RASPA_DIR文件夹
    • 运行RASPA

      • 需要两个文件来运行模拟程序,第一个是run文件,例如
      1
      2
      3
      4
      5
      6
      #! /bin/sh -f
      export RASPA_DIR=${HOME}/raspa/install
      export DYLD_LIBRARY_PATH=${RASPA_DIR}/lib
      export LD_LIBRARY_PATH=${RASPA_DIR}/lib

      $RASPA_DIR/bin/simulate $1
      • 第二个是input文件,名字必须为simulation.input, 其中包含有运行模拟必要的一些参数,与run文件在同一个文件夹内,例如
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      SimulationType MonteCarlo
      NumberOfCycles 10000
      NumberOfInitializationCycles 10000
      PrintEvery 1000
      Box 0
      BoxLengths 30 30 30
      ExternalTemperature 300.0
      Forcefield TraPPE

      component 0 MoleculeName ethane
      TranslationProbability 1.0
      CreateNumberOfMolecules 100
      • 在终端输入bash run,即可运行模拟
    • 数据处理

      • 模拟生成的输出文件保存在../Output/System_0/output_Box_1.1.1_300.000000_0.data中,用文本方式打开即可,在高通量计算中可使用编程工具批量读取数据。
  2. 输入文件编写
    • 需要的文件

      • simulation.input文件

        包含模拟类型,模拟步数,结构名称,晶胞大小,分子类型以及MC类型等信息

      • structure-name.cif 结构文件

        RASPA支持cif类型的晶体结构文件,文件名称需要和simulation.input文件给定的结构名称相同。例如,若使用IRMOF-1.cif文件,则在simulation.input文件中指定Frameworkname IRMOF-1

      • pseudo-atoms.def 赝原子定义文件

        pseudo-atoms.def文件中列出了所有赝原子的电荷、质量等信息。通常情况下赝原子是一个原子,但有时候表示原子集团(比如甲基)或者在Tip5p水分子模型中表示氧原子孤对的虚拟点位。由于CIF文件中对于结构可以提供原子的相关信息,因此当使用CIF文件时可以不用在此文件中指定结构原子。在读取CIF文件时,会将读取到的原子加入到赝原子列表中。若在pseudo-atoms.def中重复定义,则此文件中的更具有优先权。

      • force_field_mxing_rules.def, force_field.def 力场文件

        该文件提供了pseudo-atoms.def文件中赝原子的力场信息,包括范德华势类型、参数、是否使用尾部修正、是否在截断距离处平滑至0以及混合规则类型。在文献中公开的力场类型通常以两种形式呈现:对每个原子来说的力场参数和混合规则;或者原子对的参数。前一种方式对应于force_field_mxing_rules.def,后一种方式对应于force_field.def。两个文件可以同时使用,但force_field.defforce_field_mxing_rules.def可覆盖。

      • molecule-name.def 分子定义文件

        所模拟的分子的定义文件。需要和在simulation.input文件中提供的分子名称一致。

      • zframework.def

        定义柔性骨架的结构文件。

      • 赝原子文件、力场文件、分子定义文件通常可以在RASPA的安装文件夹中找到,可以创建属于自己的文件夹自由组合力场、分子等文件。

    • simulation.input

      使用两个例子了解输入文件的写法

      1. 甲烷二氧化碳在IRMOF-1中的双组份吸附
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      SimulationType                MonteCarlo    #蒙特卡洛模拟
      NumberOfCycles 50000 #50000次模拟步数
      NumberOfInitializationCycles 5000 #弛豫原子步数
      PrintEvery 1000 #每1000次打印一次输出

      Forcefield Dubbeldam2007FlexibleIRMOF-1
      # 使用IRMOF-1柔性MoFs专用力场
      Framework 0 #第0个结构
      FrameworkName IRMOF-1 #结构名称IRMOF-1
      UnitCells 1 1 1 # 1x1x1晶胞大小
      HeliumVoidFraction 0.81 #以氦气度量的孔隙率
      ExternalTemperature 300.0 #温度300 K
      ExternalPressure 10e5 #压力 1x10^5 Pa

      Component 0 MoleculeName CO2 #第0个组分 二氧化碳
      MoleculeDefinition TraPPE #使用TraPPE模型
      MolFraction 0.25 #摩尔分数
      TranslationProbability 0.5 #平移概率
      RegrowProbability 0.5 #重生概率
      IdentityChangeProbability 1.0 #改变身份概率
      NumberOfIdentityChanges 2 #身份改变次数
      IdentityChangesList 0 1 #身份互换组分列表
      SwapProbability 1.0 #交换概率
      CreateNumberOfMolecules 0 #创建分子的个数

      Component 1 MoleculeName methane
      MoleculeDefinition TraPPE
      MolFraction 0.75
      TranslationProbability 0.5
      RegrowProbability 0.5
      IdentityChangeProbability 1.0
      NumberOfIdentityChanges 2
      IdentityChangesList 0 1
      SwapProbability 1.0
      CreateNumberOfMolecules 0

 2. 二氧化碳和钠在5A分子筛中的扩散模拟

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
SimulationType                   MolecularDynamics   #分子动力学模拟
NumberOfCycles 250000 #运行总步数
NumberOfInitializationCycles 5000 #弛豫步数
NumberOfEquilibrationCycles 10000 #平衡步数
PrintEvery 5000 #每5000步统计一次结果
RestartFile no #是否输出重启文件

Ensemble NVT #使用NVT系综

Forcefield GarciaPerez2006 #使用GarciaPerez2006力场
ModifyOxgensConnectedToAluminium yes #将连接至铝原子的氧原子的原子类型更改为`Oa`
TimeStep 0.0005 #时间步长

Framework 0
FrameworkName LTA4A
RemoveAtomNumberCodeFromLabel yes #在读取cif文件时移除原子后的数字
UnitCells 1 1 1
ExternalTemperature 600.0
ComputeMSD yes #计算均方位移,可用于计算扩散系数
PrintMSDEvery 5000 #每5000次统计一次MSD

component 0 MoleculeName sodium
MoleculeDefinition TraPPE
TranslationProbability 1.0
ReinsertionProbability 1.0 #重新插入概率
ExtraFrameworkMolecule yes #是否是外部分子
CreateNumberOfMolecules 96

component 1 MoleculeName CO2
MoleculeDefinition TraPPE
BlockPockets yes #是否禁止组分进入封堵的袋中
BlockPocketsFilename LTA
TranslationProbability 1.0
RotationProbability 1.0
ReinsertionProbability 1.0
ExtraFrameworkMolecule no
CreateNumberOfMolecules 64