【学习笔记】Gaussian、ORCA、VASPKIT、Quantum ESPRESSO、CASTEP、CP2K+plumed等安装教程

1. vaspkit的linux安装

2. Gaussian的linux安装

3. ORCA的linux安装 (含OpenMPI安装)

4. Quantum ESPRESSO的linux安装(含Intel MKL数学库安装)

5. cp2k的linux+plumed安装

6. CASTEP的Linux 安装

7. 比较完整的INCAR模板

8. LINUX基础命令

1. vaspkit的安装(参考vaspkit的英文手册)

参考资料:anaconda的安装          vaspkit从零安装             vaspkit官网安装教程         vaspkit下载

vaspkit的最新linux版本是

vaspkit.1.3.5.linux.x64.tar.gz 2022-07-08 64.8 MB

vaspkit英文官网地址:Installation — VASPKIT 1.4 documentation 

VASPKIT is supported by Python 3.x. Please install the following dependencies prior to installing VASPKIT. I strongly suggest to use anaconda package to manage various python packages.

  • Python 3.5 or higher

  • Numpy 1.15.4 or higher

  • Scipy 1.1.0 or higher

  • matplotlib 3.0.1 or higher

注意:由于依赖python3的一些库,推荐安装anaconda来管理这些包,anaconda的安装教程如上

(1)下载vaspkit的Linux版本安装包,上传至服务中自定义文件夹中,然后在该文件夹下使用如下命令解压缩。

tar -zxvf vaspkit.1.3.5.linux.x64.tar.gz

(2)进入到解压缩的vaspkit的文件夹中,执行以下两条命令复制环境变量设置文件到vaspkit文件中

cd vaspkit.1.00
cp -f how_to_set_environment_variables ~/.vaspkit

(3)将PBE泛函文件夹上传到服务器中,使用如下命令编辑上述vaspkit文件,将PBE泛函路径添加到vaspkit文件中,

vi ~/.vaspkit

vaspkit的默认文件内容图下 ,需要修改PBE_PATH项

例如 PBE_PATH  =  /root/sun789/software/02_PBE (根据自身情况设定)

# cp how_to_set_environment_variables ~/.vaspkit and modify the ~/.vaspkit file based on the settings in your supercomputer!
# All environment variables are case sensitive.
VASP5                         =     .TRUE.                         # .TRUE. or .FALSE.; Set .FALSE. if you are using vasp.4.x
LDA_PATH                      =     ~/POTCAR/LDA                   #  Path of LDA potential
PBE_PATH                      =     ~/POTCAR/PBE                   #  Path of PBE potential
GGA_PATH                      =     ~/POTCAR/GGA                   #  Path of PW91 potential
VASPKIT_UTILITIES_PATH        =     ~/vaspkit/utilities            #  Path of VASPKIT
PYTHON_BIN                    =     ~/anaconda3/bin/python3        #  Python executable program with its installation path. Recommend Anaconda package 
POTCAR_TYPE                   =      PBE                           #  PBE, PW91 or LDA; Set PBE if you want to make PBE-POTCAR file
GW_POTCAR                     =     .FALSE.                        # .TRUE. or .FALSE.; For example, H_GW, O_GW will be chose when POTCAR_GW set to .TRUE.
RECOMMENDED_POTCAR            =     .TRUE.                         # .TRUE. or .FALSE.; The recommended PAW potential will be chose when RECOMMENDED_POTCAR set to .TRUE.
SET_FERMI_ENERGY_ZERO         =     .TRUE.                         # .TRUE. or .FALSE.; The Fermi Energy will be set to zero eV when SET_FERMI_ENERGY_ZERO set to .TRUE.
SET_MINI_INCAR                =     .FALSE.                        # .TRUE. or .FALSE.; A simplified INCAR will be written when MINI_INCAR set to .TRUE.
USER_DEFINED_INCAR            =     .FALSE.                        # .TRUE. or .FALSE.; whether to use embedded INCAR templates or user defined INCAR templates
WRITE_SELECTIVE_DYNAMICS      =     .FALSE.                        # .TRUE. or .FALSE.; the selective dymanics set will be forced to write when SET_SELECTIVE_DYNAMICS_MODE set to .TRUE.
GET_DOS_FROM_HYBRID_BAND      =     .FASLE.                        # .TRUE. or .FALSE.; whether to calculate DOS using optimized tetrahedron method in the hybrid band strucutre calculations
ADVANCED_USER                 =     .TRUE.                         # .TRUE. or .FALSE.; Please fill in your settings in the block 'USER_DEFINED' if you want vaspkit to integrate your own scripts in the 'UTILITIES' file.
SET_INCAR_WRITE_MODE          =      OVERRIDE                      #  OVERRIDE, APPEND, BACK-UP-OLD,BACK-UP-NEW;  "Customize INCAR File"  whether to override existing or appending existing INCAR/backup existing INCAR to INCAR.old && write into INCAR/write into INCAR.new
APPLY_SCISSOR_CORRECTION      =     .FALSE.                        # .TRUE. or .FALSE.; whether to rigidly shift of the conduction band with respect to the valence band of nonmagnetic semiconductors to matches with that of the experimental, HSE or GW value (default: .FALSE)
APPLY_PHS_CORRECTION          =     .FALSE.                        # .TRUE. or .FALSE.; whether to make PHS correction during linear optical calculations. More details are given in Comput. Mater. Sci. 172 (2020) 109315 
NORMALIZE_ORBITAL_WEIGHTS     =     .FALSE.                        # .TRUE. or .FALSE.; whether to normalize orbital-projected weights in each state (default: .FALSE.)
REORIENTATE_LATTICE_VECTORS   =     .FALSE.                        # .TRUE. or .FALSE.; reorientate lattice vectors when build supercell or heterojunction or not (default: .FALSE.) 
GET_IRREDUCIBLE_KPOINTS       =     .TRUE.                         # .TRUE. or .FALSE.; Control whether to generate k-points in the symmetry-irreducible wedge of the Brillouin Zone (default: .TRUE.)
FACTOR_ENCUT2NPWS             =      0.262465831d0                 # Adjust the final decimal place (or one beyond that) of this parameter if you encounter an error message saying that “Error: the calculated NPWS is not equal to the read NPWS”. 
SYMPREC                       =      1E-5                          # Tolerance in Cartesian coordinates to find crystal symmetry (default: 1E-5)
LATTICE_TOLERANCE             =      0.2                           # Float lattice tolerance for the lattice vectors (default: 0.2 angstrom) 
ANGLE_TOLERANCE               =      0.2                           # Float angle tolerance for the lattice vectors in degrees (default: 0.2 degree) 
EMIN                          =     -20.0                          # Minimum energy for evaluation of DOS (default: -20.0 eV)
EMAX                          =      20.0                          # Maximum energy for evaluation of DOS (default:  20.0 eV)
SIGMA                         =      0.2                           # The width of the smearing to calculate DOS from eigenvalue (default: 0.2 eV)
NEDOS                         =      2001                          # Number of grid points in DOS (default: 2001)
GAMMA_CENTERED                =     .TRUE.                         # .TRUE. or .FALSE. (default: .TRUE.).
VACUUM_THICKNESS              =      15.0                          # The thickness of vacuum to build slab or 2D materials (default: 10 angstrom)
CENTER_SLAB                   =     .TRUE.                         # Center the slab in the z direction; (default: .TRUE.)
                                 
# New added in Version 1.3.0       
MAX_ATOM_NUMBER               =      10000                         # The maximum number of atoms to screen heterostructures (default: 10000)
MIN_LATTICE_ANGLE             =      0.0                           # The minimum lattice angle to screen heterostructures (default: 0.0)
MAX_LATTICE_ANGLE             =      180.0                         # The maximum lattice angle to screen heterostructures (default: 180.0)
GET_INTERPOLATED_DATA         =     .FALSE.                        # .TRUE. or .FALSE.; Whether to interpolate the grid data of charge/spin density, potential, band structure, etc. (default: .FALSE.)
INTERPOLATION_SPACING         =      0.04                          # Determines the number of interpolation grids, in unit of A in real-space or 1/A in reciprocal space (default: 0.04)
INTERPOLATION_METHOD          =     'cubic'                        # 'linear', 'cubic' (3rd order-spline interpolation), quartic (4th order-spline interpolation), or FFT available only for 2D and 3D grids (default method: 'cubic')
AUTO_SUBMIT_JOB               =     .FALSE.                        # .TRUE. or .FALSE. (default: .FASLE.). Whether to auto-submit vaspkit or vasp job or not.   
SUBMIT_JOB_COMMAND            =     'qsub job.sh'                  # The command line to submit job
AUTO_PLOT                     =     .FALSE.                        # TRUE. or .FALSE. (default: .FASLE.). Whether to auto-plot data graphs in the post-processing.
                              
#USER_DEFINED                 
#Synopsis:The first parameter is the command-id,starting with 'u'; the second is the interpreter, like 'python/bash/perl'(Please left it blank if you are using an executive binary); the third is the name of a script or an executive binary; the fourth one is a switch, if any extra argv is needed, please set if .TRUE. ; the last on is the description, MUST use '_' as delimiter.
#           id      interpreter      script          argv       description
#Example1  'u1        python      get_entropy.py    .TRUE.      get_entropy'
#Example2  'u2                      hello.exe       .FALSE.     ls         '
                              
u1        python      get_entropy.py    .TRUE.      get_entropy_for_adsorbate
u2        python      bader2pqr.py      .FALSE.     bader2pqr
#END_USER_DEFINED             
                              
#+------------------------------------------------------------------------------------------------------------------+
#| Customize VASP job script                                                                                        |
#| Must copy the block from #BEGIN_CUSTOMIZE_JOB_SCRIPT to #END_CUSTOMIZE_JOB_SCRIPT                                |             
#+------------------------------------------------------------------------------------------------------------------+
#BEGIN_CUSTOMIZE_JOB_SCRIPT   
#PBS -N name                  
#PBS -o out                   
#PBS -e err                   
#PBS -l nodes=2:ppn=4         
#PBS -r y                     
cd $PBS_O_WORKDIR             
mpirun -np 8 vasp_std > vasp-out
#END_CUSTOMIZE_JOB_SCRIPT     
#+------------------------------------------------------------------------------------------------------------------+
                              
#BEGIN_CUSTOMIZE_PLOT         
#+------------------------------------------------------------------------------------------------------------------+
#| WARNNING! The character-type values of plot variables are case sensitive and must be enclosed in single quotes.  |
#+------------------------------------------------------------------------------------------------------------------+
# https://matplotlib.org/3.3.3/tutorials/introductory/customizing.html
# https://matplotlib.org/tutorials/text/text_props.html
# https://github.com/rougier/matplotlib-cheatsheet                             
# Advanced Features of VASPKIT Pro version
figure_format                 =     'pdf'                          # string type (default: 'jpg'). Options: 'png', 'pdf', 'eps', 'jpg', etc.
figure_height                 =      4.0                           # float type (default: 4.0). The height of the figure.
figure_width                  =      5.0                           # float type (default: 5.0). The width of the figure.
dpi                           =      400                           # integer type (default: 400). The resolution of the figure in dots-per-inch.
                                                                
# Global settings             =                                    
figure_style                  =     'default'                      # string type (default: 'default'). Options: 'default', 'classic', 'grayscale', 'seaborn', 'bmh', 'seaborn-notebook', etc.
font_family                   =     'arial'                        # string type (default: 'arial'). Options: 'fantasy','arial','sans-serif', 'monospace', 'cursive', 'serif', etc.
global_fontsize               =      12.0                          # float type (default: 15.0).
label_fontsize                =      12.0                          # float type (default: 15.0).
number_format                 =      '%.3f'                        # string type (default: 15.0).
                                                                 
# Legend-related settings     =                                    
show_legend                   =     .TRUE.                         # .TRUE. or .FALSE (default: .TRUE.).
legend_location               =     'best'                         # string type (default: 'best'). Options: 'best', 'upper right', 'upper left', 'lower left', 'lower right', 'right', 'center left', 'center right', 'lower center', 'upper center', 'center', etc.
legend_fontsize               =      12.0                          # float type (default: 14.0).
                              =                                    
# Line-related settings       =                                    
line_colors                   =     ['b', 'g', 'r', 'm']           # string type (default: 'blue'). Options: 'red', 'green', 'cyan', '#4c005c', etc.
line_styles                   =     ['-', '-', '-', '-']           # string type (default: '-'). Options: '-' or solid, '--' or 'dashed', '-.' or 'dashdot', etc.
line_widths                   =     [1.5, 1.5, 1.5]                # float type (default: 1.5).
line_alpha                    =     [1.0, 1.0, 1.0]                # float type (default: 1.0). 0.0< alpha <=1.0, adjust the transparency of each line (by default, alpha=1.0)
fill_areas                    =     .FALSE.                        # .TRUE. or .FALSE (default: .FLASE.). Fill the area between two horizontal curves.

# Marker-related settings     =     
#marker_colors                =     ['blue', 'cyan', 'red', 'magenta', 'orange', 'lawngreen', 'deeppink', 'brown', 'dodgerblue']
marker_symbols                =     ['o','o','o']                  # string type (default: 'o'). Options: 'o': Circle, 'x': Cross, '+': Plus sign, 'D': Filled diamond, 's': Square, '^': Triangle, etc.
marker_colors                 =     ['#0db14b', '#4c005c', '#d93b2b','#0075dc', '#740aff', '#993f00', '#4c005c', '#426600']
marker_sizes                  =     [60, 60.0, 60.0]               # float type (default: 10.0).
marker_scale                  =     1.0                            # float type (default: 1.0). marker_sizes = marker_sizes * marker_scale        
marker_alpha                  =     [0.8, 0.7, 0.6, 0.5, 0.4]      # float type (default: 1.0). 0.0< alpha <=1.0), adjust the transparency of markers (by default, alpha=1.0)
                                   
# Tick-related settings       =     
#x_label                      =     'Wave vector'                  # string type (No default value).
#y_label                      =     'Energy (eV)'                  # string type (No default value).
#z_label                      =     'k$_x$ ($\\mathrm{\\AA}$)'     # string type (No default value).
#x_limits                     =     [-8.0, 8.0]                    # float type [xmin, xmax] (No default value).
#y_limits                     =     [-8.0, 8.0]                    # float type [ymin, ymax] (No default value).
#z_limits                     =     [-8.0, 8.0]                    # float type [zmin, zmax] (No default value).
#x_major_locator              =      2.0                           # float type (No default value).
#y_major_locator              =      2.0                           # float type (No default value).
#z_major_locator              =      2.0                           # float type (No default value).
#x_minor_locator              =      1.0                           # float type (No default value).
#y_minor_locator              =      1.0                           # float type (No default value).
#z_minor_locator              =      1.0                           # float type (No default value).
                                                                   
# contour-related settings                                         
colormap                      =     'RdBu'                         # string typ (default: 'jet'). Options: 'jet', 'hsv', 'viridis', 'gray', etc.
contour_levels                =      5                             # integer type (default: 5).
contour_limits                =     [0.0, 0.5]                     # float type (No default value).
display_colorbar              =     .FLASE.                        # .TRUE. or .FALSE (default: .FLASE.).
display_level_value           =     .FLASE.                        # .TRUE. or .FALSE (default: .FLASE.).
colorbar_shrink               =      0.5                           # float type (default: 0.4).
colorbar_orientation          =     'vertical'                     # 'horizontal' or 'vertical' (default: 'horizontal')
                                                                   
# 3D-plot related settings                                         
elevation                     =     12.0                           # float type (default: 12).
azimuth                       =     24.0                           # float type (default: 23).
display_coordinate_axes       =    .TRUE.                          # .TRUE. or .FALSE (default: .TRUE.).
                                                                   
# XKCD sketch-style related settings                               
xkcd_style                    =    .FALSE.                         # .TRUE. or .FALSE (default: .FLASE.). Turn on xkcd sketch-style drawing mode or not. 
xkcd_scale                    =     1                              # float type (default: 1.0). The amplitude of the wiggle perpendicular to the source line (default: 1).  
xkcd_length                   =     100                            # float type (default: 100.0). The length of the wiggle along the line (default: 100). 
xkcd_randomness               =     2                              # float type (default: 2.0). The scale factor by which the length is shrunken or expanded (default: 2).
#END_CUSTOMIZE_PLOT

(4)将vaspkit的绝对路径添加到bashrc文件中。进入到vaspkit的解压缩文件夹中,执行以下两条命令即可

bash setup.sh
source ~/.bashrc

(5)编辑vaspkit文件,在自定义部分(以#BEGIN_CUSTOMIZE_PLOT开头,以#END_CUSTOMIZE_PLOT结束)添加以下两条参数

PYTHON_BIN        ~/anaconda3/bin/python3  # 注意换成自己的对应目录
AUTO_PLOT         .TRUE.

vaspkit文件中自定义部分的标识是,需要将上述两条参数添加至该部分

#BEGIN_CUSTOMIZE_PLOT
...
...
#END_CUSTOMIZE_PLOT

至此,vaspkit的初步安装已经完成!输入vaspkit命令会出现以下内容

[root@CentosDesktopSunYW 02_vaspkit+test]# vaspkit
 
 
            \\\///         
           / _  _ \         Hey, you must know what you are doing.
         (| (o)(o) |)       Otherwise you might get wrong results.
 +-----.OOOo--()--oOOO.------------------------------------------+
 |         VASPKIT Standard Edition 1.3.5 (03 Jul. 2022)         |
 |         Core Developer: Vei WANG ([email protected])         |
 |     Main Contributors: Nan XU, Jin-Cheng LIU & Gang TANG      |
 |  Online Tutorials Available on Website: https://vaspkit.com   |
 +-----.oooO-----------------------------------------------------+
        (   )   Oooo.                          VASPKIT Made Simple
         \ (    (   )     
          \_)    ) /      
                (_/       
 ===================== Structural Utilities ======================
 1)  VASP Input-Files Kit          2)  Mechanical Properties      
 3)  K-Path for Band-Structure     4)  Structure Editor           
 5)  Catalysis-ElectroChem Kit     6)  Symmetry Analysis          
 8)  Advanced Structure Models  
 ===================== Electronic Utilities ======================
 11) Density-of-States             21) Band-Structure             
 23) 3D Band-Structure             25) Hybrid-DFT Band-Structure  
 26) Fermi-Surface                 28) Band-Structure Unfolding   
 31) Charge-Density Analysis       42) Potential Analysis         
 51) Wave-Function Analysis        62) Magnetic Properties        
 65) Spin-Texture                  68) Transport Properties       
 ======================== Misc Utilities =========================
 71) Optical Properties            72) Molecular-Dynamics Kit     
 74) User Interface                78) VASP2other Interface       
 91) Semiconductor Kit             92) 2D-Material Kit            
 0)  Quit                                                         
 ------------>>

2. linux版本的Gaussian安装教程(以Centos系统安装为例)

(1)Centos系统安装zip解压工具,并对zip压缩文件进行解压,然后得到 G16-C01-AVX.tbJ 文件

yum install -y unzip zip
unzip Gaussian_16_C01_AVX_Linux_x64.zip

(2) 接着执行以下命令,对上述G16-C01-AVX.tbJ 文件进行解压缩得到g16文件夹。解压缩后的文件夹有将近12.8 GB,2933个文件。

tar xvf G16-C01-AVX.tbJ

(3)用下述命令编辑bashrc文件,在里面加入下面三行参数,三行参数的意义如下a, b, c所示。

vi ~/.bashrc

a. 设置g16root的环境变量,即写入解压缩得到的g16文件夹所在目录

b. 设置GAUSS_SCRDIR环境变量,可自定义文件夹,这里选的是tmp文件夹

c. 找到Gaussian自带的脚本文件g16.profile的所在目录,用source命令来执行

export g16root=/home/lighthouse/gaussian16      # 解压缩得到的g16文件夹所在目录
export GAUSS_SCRDIR=/home/lighthouse/gaussian16/tmp   # tmp为临时文件夹,可自定义
source /home/lighthouse/gaussian16/g16/bsd/g16.profile  # g16.profile是gaussian自带的脚本文件,需要source更新其目录

最后用下述命令更新bashrc文件,即可进行测试。

source ~/.bashrc

切换到解压缩得到的g16目录,运行如下命令设置权限

chmod 750 -R *

(4)gaussian提交脚本命令。

g16 < test01.gjf | tee test01.out   # 运行过程显示在屏幕上
g16 < test01.gjf > test01.out  &  (信息都输出到test.out里。末尾可以再加上&令任务在后台运行)
g16 test01.gjf  (输出文件将默认为当前目录下的test01.log)

如下命令可以将运行信息打印在屏幕上

tail -f test.out

注意当远程连接服务器时,用如下命令提交,否则断开连接任务会中断,并且退出时要用exit命令。

nohup g16 < test.gjf > test.out &    # 加上nohup可能会报错,报错时去掉nohup命令

nohup 英文全称 no hang up(不挂起),用于在系统后台不挂断地运行命令,退出终端不会影响程序的运行。

注意:会存在某些gaussian版本和某些linux系统不兼容的问题,若运行出现无报错中断,可尝试其他centos版本。如Gaussian_16_C01_AVX_Linux_x64和Centos7.8Version39.101.71.56就不兼容,换用G09_D01即可。

参考资料:Gaussian的安装方法及运行时的相关问题 - 思想家公社的门口:量子化学·分子模拟·二次元

使用Gaussian时的几个实用脚本和命令 - 思想家公社的门口:量子化学·分子模拟·二次元

3. linux版本的ORCA安装教程(以Centos系统为例)

其安装主要分为两部分:(1)Open_MPI的安装(2)ORCA的安装

(3.1.1)先安装gcc和gfortran编译器

yum install gcc
sudo yum install gcc-gfortran

注意:安装Centos安装 g++ 的命令为 yum install gcc-c++
查看相应版本命令分别为 gcc -v, g++ -v, gfortran -v

(3.1.2)下载ORCA软件包和安装OpenMPI库。注意二者版本要一致,如orca_5_0_1_linux_x86-64_shared_openmpi411.tar对应OpenMPI版本为4.1.1(openmpi-4.1.1.tar),下载地址:Open MPI: Version 4.1。

(3.1.3)输入以下命令对openmpi压缩包进行解压缩。

tar -xf openmpi-4.1.1.tar.bz2

上述解压缩如果报错,则yum安装bzip2。

yum -y install bzip2

参考资料:tar (child): lbzip2: Cannot exec: No such file or directory 解决方法_洛阳山的博客-CSDN博客_tar(child)

然后进入到解压缩的目录中,执行编译和安装命令

cd openmpi-4.1.1/     #进入解压缩的openmpi文件夹
./configure
make && make install

# make all install -j    #-j后面不写核数默认用所有核并行编译

# 注意也可以使用如下命令设置安装路径
# ./configure  --prefix=/home/username/softwares/openmpi
# --prefix设置安装路径,这里先创建一个openmpi文件夹

(3.1.4)接下来就是配置环境变量了

为了让命令行能找到MPI命令,需要将MPIbinlib加入到PATHLD_LIBRARY_PATH中去。首先,查找安装好的OpenMPI在什么位置:

$ whereis openmpi
openmpi: /usr/local/lib/openmpi

接着,修改PATH配置文件,修改后注意使用source命令使修改生效:

vi ~/.bashrc

将以下两句添加到.bashrc文件末尾位置,按Esc:wq保存修改

export PATH=$PATH:/usr/local/lib/openmpi/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/openmpi/lib

使用source命令激活修改:

source ~/.bashrc

编译并运行examples文件夹中的脚本,查看输出即可验证是否安装成功:

cd examples/
make
./hello_c
Hello, world, I am 0 of 1, (Open MPI v3.1.0, package: Open MPI root@CentosDesktopSunYW Distribution, ident: 3.1.0, repo rev: v3.1.0, May 07, 2018, 118)

使用如下命令可以查看openmpi版本

mpiexec -V

mpirun --version  # 可以查看一下mpirun有没有装上

如果运行openmpi出现以下报错信息

mpiexec: error while loading shared libraries: libopen-rte.so.40: cannot open shared object file: No such file or directory

输入 以下命令即可解决。

ldconfig

 参考资料:CentOS 7安装OpenMPI_DORIC.MA的博客-CSDN博客_centos7安装openmpi

OpenMPI error while loading shared libraries: libopen-rte.so.40解决方案_baidu_27167467的博客-CSDN博客

注意:gcc编译器相关套件缺少也有可能报错,如gcc-c++库等。

(3.2)ORCA的安装就比较简单了

首先对ORCA压缩包进行解压缩,获得解压缩的文件夹,将其命名为orca501

tar -xf orca_5_0_1_linux_x86-64_shared_openmpi411.tar.xz

接下来编辑~/.bashrc文件,编辑之后记得source更新。编辑内容如下所示,除了配置ORCA中PATHLD_LIBRARY_PATH两个环境变量外,建议设置aliasopenMP的运行选项

# 配置环境变量
export PATH=$PATH:/home/lighthouse/03_ORCA/orca501
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lighthouse/03_ORCA/orca501  

alias orca='/home/lighthouse/03_ORCA/orca501/orca'   # 避免每次提交任务要写绝对路径

# 避免OpenMPI每次执行的命令都带着-allow-run-as-root选项
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

其中将解压缩得到的orca文件夹重命名为orca501,alias添加了解压缩解文件夹中orca的绝对路径。orca的运行命令如下,添加了alias绝对路径之后可以使用第二个任务提交命令。

/home/lighthouse/03_ORCA/orca501/orca test.inp > test.out

orca test.inp > test.out

此处给出一个使用orca进行水分子计算的test.inp例子,使用4核并行计算。另外,使用multiwfn可以产生orca的输入文件,相关参考资料可以见下面链接。

! BLYP def2-SVP noautostart miniprint pal4
* xyz 0 1
 C                  0.00000000    0.00000000   -0.56221066
 H                  0.00000000   -0.92444767   -1.10110537
 H                 -0.00000000    0.92444767   -1.10110537
 O                  0.00000000    0.00000000    0.69618930
*

参考资料:

量子化学程序ORCA的安装方法 - 思想家公社的门口:量子化学·分子模拟·二次元

量子化学软件ORCA入门指南 - 组内活动 - 天然产物研究与开发课题组

ORCA 5.0安装及运行 - 腾讯云开发者社区-腾讯云

详谈Multiwfn产生ORCA量子化学程序的输入文件的功能 - 思想家公社的门口:量子化学·分子模拟·二次元

4. linux版本的Quantum ESPRESSO安装教程

QE的安装主要分为3步:(1)OpenMPI的安装;(2)MKL数学库的安装;(3)QE编译。OpenMPI的安装前文已经提到过了,这里主要是MKL数学库的安装和QE的编译。对于新手来说,可能需要在intel MKL数学库的安装上花一些时间,总体还是挺简单的。

(4.1)OpenMPI的安装若之前已经安装,此步骤可跳过

并行计算openmpi的安装

并行计算需要MPI,目前免费版本有openmpi,可在官网下载最新版本的openmpi,用tar 命令解压后进入文件目录。注意,openmpi安装时所用编译器必须和之后QE安装时作用编译器一致。

若采用gcc和gfortran编译器  ,则解压openmpi压缩包后直接进入目录内,然后终端输入:

./configure --prefix=”指定的安装目录”

如果不指定安装,则默认安装到/usr/local/openmpi

openmpi的后续安装步骤可参考第三小节ORCA安装过程

(4.2)关于MKL数学库安装

Intel MKL (Math Kernel Library)是Intel公司开发的数学函数库,其提供了一系列用于数值计算的Fortran和C语言接口,用户通过调用MKL可以高效并行地完成矩阵乘法,线性方程组求解,FFT快速傅里叶变换等工作。MKL库具有优秀的计算性能,在笔者常用的线性方程组的求解上,MKL库的计算效率甚至能够超过matlab,从计算效率上来说,和全世界范围内各种数值计算库相比,MKL基本上也处于第一梯队。

MKL的官网下载链接:Get Intel® oneAPI Math Kernel Library

截至目前2022年10月31日,MKL可以免费下载使用。

(4.2.1)首先下载并安装MKL的.sh安装包,进行离线安装,然后将安装包上传至服务器中,执行以下命令sh ./.sh进行安装(是安装包名称)。这里安装包名称是l_onemkl_p_2022.2.0.8748_offline.sh,大小为904MB。

sh ./l_onemkl_p_2022.2.0.8748_offline.sh  # l_onemkl_p_2022.2.0.8748_offline.sh是安装包

【学习笔记】Gaussian、ORCA、VASPKIT、Quantum ESPRESSO、CASTEP、CP2K+plumed等安装教程_第1张图片

【学习笔记】Gaussian、ORCA、VASPKIT、Quantum ESPRESSO、CASTEP、CP2K+plumed等安装教程_第2张图片

 默认安装目录为:/opt/intel/oneapi记住该目录,后续配置环境变量需要用到。

上述安装完成之后,Intel的oneapi环境并没有启动,因此需要初始化oneAPI-MKL环境,采用命令

. /opt/intel/oneapi/setvars.sh

此时终端弹出以下结果

[root@CentosDesktopSunYW oneapi]# . /opt/intel/oneapi/setvars.sh
 
:: initializing oneAPI environment ...
   -bash: BASH_VERSION = 4.2.46(2)-release
   args: Using "$@" for setvars.sh arguments: 
:: compiler -- latest
:: mkl -- latest
:: tbb -- latest
:: oneAPI environment initialized ::

也可以将初始化命令放到.bashrc文件中,这样每一次启动终端,就会自动初始化环境。写入方法如下:

(4.2.2)将MKL初始化命令写入环境变量

安装完后,个人用户需在~/.bashrc文件里写环境变量,而root用户可以在/etc/profile.d/目录下新建一个文件,例如intel_compiler.sh,在里面写环境变量:

# this is for intel MKL
source /opt/intel/oneapi/setvars.sh > /dev/null


"""
# source setvars.sh后每次命令行会出现很多反馈,如果像我一样强迫症不希望显示的话可以这样修改source语句
#source /opt/intel/oneapi/setvars.sh --config="/opt/intel/oneapi/config.txt" > /dev/null
# /dev/null 是类Unix系统中的一个特殊文件设备,他的作用是接受一切输入它的数据并丢弃这些数据。通常被当做垃圾桶来用。
"""

注意setvars.sh文件所在位置,随着版本的变化,该文件的相对位置可能会有变化,写入的时候注意做相应调整。

注意:oneapi中带有Intel python环境,每次初始化用,之前安装的anaconda环境会被自动取代,如果初始化之后输入conda init 则.bashrc文件中conda环境路径也会给成Intel环境的路径,注意备份好.bashrc文件,推荐在终端输入指令启动环境。

执行以下命令,可查看MKL路径

echo $MKLROOT

注意: 由于新版intel编译器不再是parallel_studio_xe_xxx_update4_cluster_edition,而改名为oneAPI,无需注册即可下载。oneAPI又可具体细分为oneAPI Base Toolkit和oneAPI HPC Toolkit等等。但Base Toolkit包里含icc、icpc编译器和MKL库,却不含ifort。而HPC Toolkit包里含icc、icpc、ifort,却不含MKL库。通过自定义安装BaseKit也可实现MKL数学库的安装(BaseKit安装时需要注意选择Customize),仅仅安装oneAPI中的MKL数学库就可以

(4.3)Quantum Espresso的编译安装

先下载QE,QE的下载链接如下,此处安装的是qe-7.0-ReleasePack.tgz版本,注意高版本的QE可能会对gcc和gfortran版本有要求,否则安装时会报错,应当对gcc和gfortran其进行升级。

https://github.com/QEF/q-e/releases/download/qe-7.0/qe-7.0-ReleasePack.tgz

 先对QE压缩包进行解压缩,解压缩命令如下

tar -xf qe-7.0-ReleasePack.tgz

然后进入解压缩的目录中,进行编译和安装,命令如下

./configure --prefix=/root/sun789/software/06_quantum_espresso/qe-7.0  -enable-openmp

# ./configure --prefix=/home/lighthouse/05_Quantum_Espresso/qe-7.0_configuration  -enable-openmp   # 注意此处configure之后不会出现qe-7.0_configuration指定目录,需要make之后才出现

make all install  # 此处不要加参数-j,否则bin目录是空的

# make all install -j
# 这里用-j是为了通过并行编译降低编译过程耗时。但如果编译中途出现诡异报错,去掉-j再试。

经过几分钟编译完毕,可执行文件都被装到了/home/lighthouse/05_Quantum_Espresso/qe-7.0_configuration/bin目录下,结果发现bin目录为空,原因在于此处安装的QE是7.0版本的,而服务器的gcc和gfortran的版本太低(gcc (GCC) 4.8.5),升级gcc和gfortran版本的方法如下,可将此步骤提前至QE的编译安装之前。

注意:Gfortran v.4.8.5, still found on CentOS machines, no longer compiles Quantum ESPRESSO v.6.6 or later, due to a gfortran bug. You need at least gfortran v.4.9.X.

CentOS7 安装高版本gcc, g++, gfortran等工具

yum -y install centos-release-scl     # 安装scl源
yum -y install devtoolset-9           # 安装devtoolset-x, 可以根据需要安装指定版本的devtoolset,这里以 devtooset-9 为例。

# 默认安装位置为 /opt/rh/devtoolset-9 目录下
# 编辑 ~/.bashrc,在文件尾部添加如下命令。
vi ~/.bashrc
source /opt/rh/devtoolset-9/enable    # 激活devtoolset
source ~/.bashrc                # 保存退出后重新加载配置文件。
gcc -v                                # 检查是否安装成功,以 gcc 为例

参考资料:CentOS7 安装高版本gcc, g++, gfortran等工具 - InaRwi - 博客园

按照上述步骤重新configure、make,可成功安装。安装成功后会有如下提示!

最终安装的目录如下:

/home/lighthouse/05_Quantum_Espresso/qe-7.0_configuration/bin

 此处设置quantum esrpresso的环境变量,主要分为三部分,其中主要包括$PATH和$LD_LIBRARY_PATH变量设置,分别对应QE的bin目录和MKL的intel64_lin目录。

# 避免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:/home/lighthouse/05_Quantum_Espresso/qe-7.0_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

(4.4)Quantum Espresso运行测试 

首先对QE的PWscf模块做简单测试,注意如果是用root账户安装的,那么测试也需要在root用户下执行,否则会报错。可以使用计算化学公社卢天提供的http://sobereva.com/attach/562/diamond.zip

测试文件,对金刚石做SCF计算。对diamond.zip进行解压(解压后得到pseudo文件夹和pwscf.in文件),进入diamond目录,分别执行以下两种命令进行测试:

# 使用4个MPI进程计算,每个MPI进程下属只有一个线程
export OMP_NUM_THREADS=1
mpirun -n 4 pw.x < pwscf.in |tee pwscf.out


# 测试纯OpenMP并行方式运行。运行以下命令,将使用一个MPI进程下属4个OpenMP线程进行计算
export OMP_NUM_THREADS=4
pw.x < pwscf.in |tee pwscf.out

运行结果显示如下,证明安装成功!

【学习笔记】Gaussian、ORCA、VASPKIT、Quantum ESPRESSO、CASTEP、CP2K+plumed等安装教程_第3张图片

 其中pwscf.in内容如下

&CONTROL
  calculation = 'scf'
  etot_conv_thr =   2.0000000000d-05
  forc_conv_thr =   1.0000000000d-04
  outdir = './out/'
  prefix = 'aiida'
  pseudo_dir = './pseudo/'
  tprnfor = .true.
  tstress = .true.
  verbosity = 'high'
/
&SYSTEM
  ecutrho =   3.6000000000d+02
  ecutwfc =   4.5000000000d+01
  ibrav = 0
  nat = 2
  ntyp = 1
  occupations = 'fixed'
/
&ELECTRONS
  conv_thr =   4.0000000000d-10
  electron_maxstep = 80
  mixing_beta =   4.0000000000d-01
/
ATOMIC_SPECIES
C      12.0107 C.pbe-n-kjpaw_psl.1.0.0.UPF
ATOMIC_POSITIONS crystal
C            0.0000000000       0.0000000000       0.0000000000 
C            0.7500000000       0.7500000000       0.7500000000 
K_POINTS automatic
16 16 16 0 0 0
CELL_PARAMETERS angstrom
     -1.7833950000      -1.7833950000       0.0000000000
     -1.7833950000       0.0000000000      -1.7833950000
     -0.0000000000      -1.7833950000      -1.7833950000

注意:以上述方式编译出来的QE没有包含EPW、PLUMED、Wannier90、WanT、YAMBO、GIPAW程序,如果需要编译的话,看官网上User's Guide for Quantum ESPRESSO文档的2.5节。 

参考资料

Quantum ESPRESSO在Linux下的安装方法 - 思想家公社的门口:量子化学·分子模拟·二次元

Linux下Intel编译器oneAPI安装和链接MKL库编译_XianJiaoMu的博客-CSDN博客_linux安装intel编译器

Linux下安装Intel oneAPI

如何安装oneAPI - 知乎

oneAPI使用手记 - 知乎

如何快过matlab?-MKL数值计算库的Fortran95接口使用及MKL文档下载

Linux下安装intel数学库Math Kernel Library(MKL)_千与千与千的博客-CSDN博客_mkl library

新版本Intel编译器安装策略(2022以上版)本)

Quantum Espresso 安装

Quantum ESPRESSO在Linux下的安装方法 - 第一性原理 (First Principle) - 计算化学公社

QE安装问题 - 第一性原理 (First Principle) - 计算化学公社

CP2K第一性原理程序在CentOS中的简易安装方法 - 思想家公社的门口:量子化学·分子模拟·二次元

5. cp2k+plumed的linux编译安装

CP2K是功能最强大的计算化学-计算物理学-计算生物学程序之一。它为不同的方法提供了一个通用框架:密度泛函理论(DFT) 使用混合高斯和平面波方法 (GPW) 通过LDA、GGA、MP2或RPA理论水平、经典对和多体势、半经验( AM1 , PM3 , MNDO , MNDOd, PM6) 和紧束缚哈密顿量,以及依赖静电势高斯展开 (GEEP) 的量子力学/分子力学(QM/MM) 混合方案。高斯和增强平面波方法 (GAPW) 作为 GPW 方法的扩展允许全电子计算。CP2K 进行分子动力学(MD)、元动力学(Metadynamics)、蒙特卡罗(MC)、埃伦费斯特动力学(Ehrenfest dynamics)、从头算动力学(AIMD)、振动分析核心能级光谱、能量最小化以及使用NEB或Dimer方法进行过渡态优化的模拟。 

CP2K有sopt、ssmp、popt、psmp四种版本。CP2K有三种安装方式:
(1)先依次手动编译CP2K所需要的各个库,然后再编译CP2K。
(2)使用CP2K自带的toolchain脚本自动下载CP2K依赖的各种库并且自动编译。
(3)直接用官方预编译的ssmp版,下载后直接就能用。

CP2K的编译需要Fortran和C/C++编译器,其中gcc必须>=5.5版。CentOS 7.x自带的gcc是4.8.5版,因此没法直接编译,需要升级gcc编译器,或者用CentOS >=8.0版。CentOS 8.0自带的gcc是8.3.1,可以非常顺利地结合toolchain编译CP2K。

sopt:只能单机单核计算,无法并行。s意为single
ssmp:OpenMP并行,可以单机多核运行。smp意为Symmetric multiprocessing
popt:MPI并行,可以单机并行也可以跨节点并行。p意为parallel
psmp:MPI+OpenMP混合并行,可以单机并行也可以跨节点并行

(5.1)下载cp2k8.1软件包

首先下载CP2K压缩包cp2k-8.1.tar.bz2,大小为75.6MB。将该压缩包上传至服务器中,运行下述命令解压缩。

tar -xf cp2k-8.1.tar.bz2   # 解压缩

(5.2)运行toolchain安装脚本

进入到解压缩的toolchain文件夹,运行./install_cp2k_toolchain.sh安装脚本进行安装。

cd /root/sun789/software/07_cp2k8.1/cp2k-8.1/tools/toolchain
./install_cp2k_toolchain.sh --with-sirius=no --with-openmpi=install --with-plumed=install

之后这个toolchain脚本就会依次下载各个库的压缩包到toolchain/build目录下并解压和自动编译,编译产生的可执行文件、库文件、头文件等都自动装到了toolchain/install目录下。 

--with-sirius=no选项代表不装本来自动会装的SIRIUS库。这个库使得CP2K可以像Quantum ESPRESSO那样完全基于平面波+赝势做计算,但一般这用不上。
• --with-openmpi=install代表安装OpenMPI库,这使得编译出来的CP2K可以通过MPI方式并行计算。CP2K也支持其它MPI库如Intel MPI和MPICH。
• --with-plumed=install代表安装默认不自动装的PLUMED库,这使得CP2K可以结合PLUMED做增强采样的从头算动力学。
• toolchain默认用所有CPU核心并行编译,可以自行加上-j [并行核数]来明确指定用多少核。
• toolchain默认自动下载和编译cmake。如果你通过yum或dnf已经装过cmake而且其版本较新,可以再加上--with-cmake=system用当前系统里的cmake,能节约编译时间。
• 注意硬盘的空余空间应当足够。上述命令执行完毕后,toolchain/build目录约占9GB,toolchain/install目录占约2GB。
• 如果toolchain运行过程中某个库编译失败,可以去toolchain/build目录下的那个库的目录中去找编译过程输出的log文件,在里面搜error根据报错试图分析原因。toolchain运行失败后可以重新运行,它会根据根据toolchain/build目录的内容做判断,之前已经下载和编译成功的库会自动跳过,而从失败的库继续编译。如果把build和install目录都删了,则toolchain会从头执行。

报错1cmake安装失败

失败原因:与系统中原有/root/anaconda3/lib/cmake路径产生环境变量冲突。

解决方法:离线独立安装cmake包。将anaconda想关环境变量注释掉,更新bashrc并重启终端,然后删除源码目录下的CMakeCache.txt文件后,重新bootstrap即可解决。安装相关命令如下:

# 解离线cmake压缩包
tar -xf cmake-3.18.5.tar.gz

# 进入解压后文件夹
cd cmake-3.18.5

# 运行当前目录下的bootstrap文件
./bootstrap

# 如果没有报错,可继续编译安装
make && make install

# 制作软链接,具体用法是:ln  -s   [源文件]   [软链接文件] ,源文件是源代码编译生成的bin路径
ln -s  /root/sun789/software/07_cp2k8.1/01_cmake_3.18.5/cmake-3.18.5/bin   /usr/bin/cmake

cmake独立安装成功之后,继续执行toolchain安装脚本。

结果又出现以下报错:

error: (./scripts/install_cmake.sh, line 45) non-zero exit code detected

参考资料:CentOS7安装cmake-3.18.0_绮梦寒宵的博客-CSDN博客_centos7安装cmake

Centos7 安装CMake_张志翔 ̮的博客-CSDN博客

Linux创建连接命令 ln -s创建软连接_jk英菲尼迪的博客-CSDN博客_建立软链接

toolchain中常见的库:

  --with-gcc              The GCC compiler to use to compile CP2K
                          Default = system
  --with-cmake            Cmake utilities
                          Default = no
  --with-openmpi          OpenMPI, important if you want parallel version
                          of CP2K.
                          Default = system
  --with-mpich            MPICH, MPI library like OpenMPI. one should
                          use only one of OpenMPI, MPICH or Intel MPI.
                          Default = system
  --with-libxc            libxc, exchange-correlation library. Needed for
                          QuickStep DFT and hybrid calculations.
                          Default = install
  --with-libint           libint, library for evaluation of two-body molecular
                          integrals, needed for hybrid functional calculations
                          Default = install
  --with-fftw             FFTW3, library for fast fourier transform
                          Default = install
  --with-mkl              Intel maths kernel library, which provides LAPACK and BLAS,
                          and depending on your system, may also provide ScaLAPACK.
                          If the MKL version of ScaLAPACK is found, then it will replace
                          the one specified by --with-scalapack option.
                          Default = system
  --with-openblas         OpenBLAS is a free high performance LAPACK and BLAS library,
                          the successor to GotoBLAS.
                          Default = install
  --with-libxsmm          Small matrix multiplication library for x86_64 systems. If
                          your system arch is x86_64, then you can use libxsmm
                          instead of libsmm.
                          Default = install
  --with-plumed           Enable interface to the PLUMED library.
                          Default = no
  --with-sirius           Enable interface to the plane wave SIRIUS library.
                          This package requires: gsl, libspg, elpa, scalapack, hdf5 and libxc.
                          Default = install

参考资料:

cp2k官方编译指南

从零开始安装CP2K 8.1 (patched with PLUMED)

最新版CP2K-9.1编译安装教程

CP2K/LAMMPS+PLUMED加速采样(安装)

CP2K第一性原理程序在CentOS中的简易安装方法 - 思想家公社的门口:量子化学·分子模拟·二次元

附录 cp2k8.1中的库选项

The --with-PKG options follow the rules:
  --with-PKG=install      Will download the package in \$PWD/build and
                          install the library package in \$PWD/install.
  --with-PKG=system       The script will then try to find the required
                          libraries of the package from the system path
                          variables such as PATH, LD_LIBRARY_PATH and
                          CPATH etc.
  --with-PKG=no           Do not use the package.
  --with-PKG=       The package will be assumed to be installed in
                          the given , and be linked accordingly.
  --with-PKG              The option keyword alone will be equivalent to
                          --with-PKG=install

  --with-gcc              The GCC compiler to use to compile CP2K
                          Default = system
  --with-cmake            Cmake utilities
                          Default = no
  --with-valgrind         Valgrind memory debugging tool, only used for
                          debugging purposes.
                          Default = no
  --with-openmpi          OpenMPI, important if you want parallel version
                          of CP2K.
                          Default = system
  --with-mpich            MPICH, MPI library like OpenMPI. one should
                          use only one of OpenMPI, MPICH or Intel MPI.
                          Default = system
  --with-intelmpi         Intel MPI, MPI library like OpenMPI. one should
                          use only one of OpenMPI, MPICH or Intel MPI.
                          Default = system
  --with-libxc            libxc, exchange-correlation library. Needed for
                          QuickStep DFT and hybrid calculations.
                          Default = install
  --with-libint           libint, library for evaluation of two-body molecular
                          integrals, needed for hybrid functional calculations
                          Default = install
  --with-fftw             FFTW3, library for fast fourier transform
                          Default = install
  --with-reflapack        Reference (vanilla) LAPACK and BLAS linear algebra libraries.
                          One should use only ONE linear algebra library. This
                          one is really mostly used for debugging purposes as it is
                          non-optimised.
                          Default = no
  --with-acml             AMD core maths library, which provides LAPACK and BLAS
                          Default = system
  --with-mkl              Intel maths kernel library, which provides LAPACK and BLAS,
                          and depending on your system, may also provide ScaLAPACK.
                          If the MKL version of ScaLAPACK is found, then it will replace
                          the one specified by --with-scalapack option.
                          Default = system
  --with-openblas         OpenBLAS is a free high performance LAPACK and BLAS library,
                          the successor to GotoBLAS.
                          Default = install
  --with-scalapack        Parallel linear algebra library, needed for parallel
                          calculations.
                          Default = install
  --with-libsmm           CP2K's own small matrix multiplication library. An optimised
                          libsmm should increase the code performance. If you set
                          --with-libsmm=install, then instead of actually compiling
                          the library (which may take a long time), the script will
                          try to download a preexisting version from the CP2K website
                          that is compatible with your system.
                          Default = no
  --with-libxsmm          Small matrix multiplication library for x86_64 systems. If
                          your system arch is x86_64, then you can use libxsmm
                          instead of libsmm.
                          Default = install
  --with-elpa             Eigenvalue SoLvers for Petaflop-Applications library.
                          Fast library for large parallel jobs.
                          Default = install
  --with-ptscotch         PT-SCOTCH, only used if PEXSI is used
                          Default = no
  --with-superlu          SuperLU DIST, used only if PEXSI is used
                          Default = no
  --with-pexsi            Enable interface to PEXSI library
                          Default = no
  --with-quip             Enable interface to QUIP library
                          Default = no
  --with-plumed           Enable interface to the PLUMED library.
                          Default = no
  --with-sirius           Enable interface to the plane wave SIRIUS library.
                          This package requires: gsl, libspg, elpa, scalapack, hdf5 and libxc.
                          Default = install
  --with-gsl              Enable the gnu scientific library
                          Default = install
  --with-libvdwxc         Enable support of Van der Waals interactions in SIRIUS. Support provided by libvdwxc
                          Default = install
  --with-spglib           Enable the spg library (search of symmetry groups)
                          This package depends on cmake.
                          Default = install
  --with-hdf5             Enable the hdf5 library (used by the sirius library)
                          Default = install
  --with-spfft            Enable the spare fft used in SIRIUS (hard dependency)
                          Default = install
  --with-cosma            Enable cosma as a replacement for scalapack matrix multiplication
                          Default = install
  --with-libvori          Enable libvori for the Voronoi integration (and the BQB compressed trajectory format)
                          Default = install

6. CASTEP的Linux 安装

参考资料: 

CASTEP的Linux 安装

7. 比较完整的INCAR模板

!! *** Note that some INCAR tags (ISMEAR, ISTART, ICHARG, etc.) are duplicated in the following example *** !!

!-- always necessary --!
 ENCUT = 550.0 ! eV, ENMAX*1.3 for structural opt.
 ISMEAR = -5 ! 0: Gaussian, 1: MP, -5: tetrahedron
! SIGMA = 0.1 ! eV, specify this for ISMEAR=0,1. 0.1--0.2 eV.

!-- calculation modes --!
!! structural opt.
! NSW = 50
! IBRION = 2
! ISIF = 3 ! 2: fixed lattice & relax ions, 3: all opt
! EDIFFG = 0 ! +:Energy diff, -:Force, 0:stop after NSW iterations
! PSTRESS = 10.0 ! pressure in kB

!! band calc.
! ISTART = 0 ! SCF orbitals are not used
! ICHARG = 11 ! SCF charge density is used (fixed)
! ISMEAR = 0 ! tetrahedron does not work for band calc.
! SIGMA = 0.1

!! input tags for LDOS calc. are shown later

!-- functionals --!
 GGA = PE
! VOSKOWN = 1 ! when using PW91

!! HSE06. initial GGA (PBE) run is recommended before HSE calc.
! LHFCALC = .TRUE.
! HFSCREEN = 0.2
! ICHARG = 0 ! restart from PBE orbitals
! ISTART = 1 ! restart from PBE orbitals
! PRECFOCK = Fast ! (optional) accuracy and speed control. For old versions, ENCUTFOCK = 0.
! NKRED = 2 ! (optional) lower accuracy but fast. Instead, NKREDX,NKREDY,NKREDZ can be used.

!! +U parameter
! LDAU = .TRUE.
! LDAUTYPE = 2
! LDAUL = -1 2 -1 ! l-quantum number (-1:noU, 2:d, 3:f)
! LDAUU = 0.0  5.0  0.0 ! U values (eV)
! LDAUJ = 0.0  0.0  0.0 ! J values (For LDAUTYPE=2, Ueff=U-J)
! LMAXMIX = 4 ! 4 for d-electrons, 6 for f-electrons.
! LDAUPRINT = 2

!-- spin (incl. spin-orbit coupling) --!
!! no spin pol. & no SOC
 ISPIN = 1

!! spin pol. & no SOC
! ISPIN = 2
! ISYM = -1 
! LSORBIT = .FALSE.
! LNONCOLLINEAR = .FALSE.
! ICHARG = 2 ! set ICHARG=2 to use MAGMOM
! MAGMOM = 5*0.0 ! scalar, 5 atoms

!! SOC calc (vasp_ncl)
! ISPIN = 2
! ISYM = -1
! LSORBIT = .TRUE.
! LNONCOLLINEAR = .TRUE.
! SAXIS = 0 0 1 ! quantization axis
! LORBMOM = .TRUE.
!! (case 1) SOC calc using vasp_ncl after non-SOC (but spin-polarized) calc using vasp_std (i.e. use non-SOC orbitals as initial guess)
! ISTART = 1
! NBANDS = 100 ! (NBANDS in non-SOC run) x 2. see OUTCAR in non-SOC run. (not INCAR because NBANDS can be changed by vasp run)
!! (case 2) SOC calc without initial orbitals
! ICHARG = 2 ! set ICHARG=2 to use MAGMOM
! MAGMOM = 15*0.0 ! spinor, 5 atoms.

!-- accuracy settings (usually no need to change) --!
 EDIFF = 1E-8 ! can be a larger value
 LREAL = .FALSE. ! LREAL = Auto is recommended for a large system (to reduce cost)
 ADDGRID = .TRUE. ! improves accuracy but can result in (small) negative density in real space. ADDGRID = .FALSE. is default
 GGA_COMPAT = .FALSE.
 PREC = Accurate
 LASPH = .TRUE.

!! *** other tags *** !!

!! output: ldos, band weight, local magnetic moment, etc.
 LORBIT = 11 ! optional but recommended

!! parallelization control (optional)
! NPAR = 32 ! (default: no. of cores) band parallelization
! NCORE = 32 ! (default: 1) plane-wave parallelization
! KPAR = 1 ! (default: 1) k-point parallelization, not available in old versions

!! to improve convergence (e.g. for magnetic systems, SOCcalc,...)
! ALGO = A ! CG method (default: blocked Davidson). For metal: ALGO=D with an appropriate TIME is recommended.
! AMIX = 0.1
! BMIX = 0.00001
! AMIX_MAG = 0.2
! BMIX_MAG = 0.00001

!! wannier
!! First run: get orbitals with parallelization, Second run: restart with ISTART=1 and NPAR=N (NCORE should be 1)
!! First & Second runs
! ISYM = -1
! NBANDS = 200 ! sufficiently large value to get unoccupied bands for wannierization
!! Second run
! ISTART = 1
! NELMIN = 6 ! set a large value (5--10) to get well-converged unoccupied bands
! LWANNIER90 = .TRUE.
! LWANNIER90_RUN = .TRUE.
! LWRITE_MMN_AMN = .TRUE.

!! LDOS (LORBIT=11 necessary)
!! assuming LDOS calc using a fine k-mesh after an SCF run
! ISYM = -1
! NPAR = 1 ! version-dependent. see VASPwiki.
! ISTART = 0
! ICHARG = 11 ! use an SCF charge density
! ISMEAR = -5 ! tetrahedron recommended
! SIGMA = 0.05
! NEDOS = 3000
! EMIN = -0.5
! EMAX = 14.5

!! charged-state calc.
! NELECT = 1224

!! static dielectric properties
! ISMEAR = 0
! SIGMA = 0.01
! LEPSILON = .TRUE. !! alternatively LCALCEPS=.TRUE. can be used (e.g. for hybrid functionals)
! LPEAD = .TRUE.
! IBRION = 8
! LRPA = .FALSE. !! .TRUE.: the local field effect is calculated at the Hartree level only

参考链接:比较完整的INCAR模板

8. LINUX基础命令

./configure  
make  
make install 

 1)./configure:
configure是一个脚本,一般由Autoconf工具生成,它会检验当前的系统环境,看是否满足安装软件所必需的条件:比如当前系统是否支持待安装软件,是否已经安装软件依赖等。configure脚本最后会生成一个Makefile文件。
2)make
make是一个命令,它使用第1步得到的Makefile文件,如果只有"make"命令,而没有指明"目标",一般情况下是编译源码。
3)make install
make install表示运行"目标为install的make命令",即将编译后的结果复制到相应目录中。

make相关的一些命令 

make all:编译程序、库、文档等(等同于make)

make install:安装已经编译好的程序。复制文件树中到文件到指定的位置

make unistall:卸载已经安装的程序。

make clean:删除由make命令产生的文件

make distclean:删除由./configure产生的文件

make check:测试刚刚编译的软件(某些程序可能不支持)

make installcheck:检查安装的库和程序(某些程序可能不支持)

make dist:重新打包成packname-version.tar.gz

df -h                                # 查看硬盘占用
free -m                              # 查看内存占用
top                                  # 监控linux的系统状况,比如cpu、内存的使用
echo $PATH                           # 查看环境变量PATH的值
echo $HOME                           # 查看当前用户的主目录的环境变量,$HOME别名 “~”
export                               # 命令显示当前系统定义的所有环境变量
du -h                                # 查看指定文件夹下的所有文件大小(包含子文件夹)
rpm -qa                              # 查看已经安装的所有软件包
echo $SHELL                          # 查看SHELL的种类,一般为bash
lsb_release -a                       # 查看linux系统版本
uname -m                             # 查看系统架构,如x86_64
whereis openmpi                      # Linux whereis命令用于查找文件
rm -rf 目录                           # 删除文件夹命令
gfortran --version                   # 查看gfortran版本


$ 1 (after top)                      # show status of all CPUs
$ adduser aaa                        # add a user aaa
$ cat file1                          # display all of file1
$ cd ~                               # move to home directory (~: tilde)
$ cd ..                              # move to upper directory
$ cd aaa                             # move to directory aaa
$ chmod 755                          # change all files to execution mode
$ chmod +x aaa                       # change aaa file to execution mode
$ cp filename1 filename2             # copy filename1 as filename2
$ ↵ d                                # exit from Linux
$ dir                                # show directories and files
$ echo Hello, world! > file1         # create directory file1 and save the text in file1
$ free                               # show status of memory only
$ grep “F=” OSZICAR                  # show lines with “F=” in OSZICAR file
$ head -n aaa                        # show the first n lines of file aaa
$ history 5                          # show last five commands
$ jobs -1                            # list process IDs
$ kill -9 2316                       # kill run number 2316
$ killall -9 vasp-5.2.2              # kill all CPUs running on VASP
$ less POTCAR                        # show the first part of POTCAR file
                                     (↵ for more)
$ ls                                 # list directories and files
$ ls –la                             # list directories and files in long/all formats
$ man passwd                         # show manual for passwd
$ mkdir aaa                          # make new directory aaa
$ more file1                         # display first part of file1 (↵ for more)
$ mv file1 dir1                      # move file1 under dir1
$ mv file1 file2                     # change file name from file1 to file2
$ nohub vasp &                       # run VASP in a background mode
$ passwd                             # change password

$ passwd aaa                         # changing password for user aaa
$ pestat                             # show load for each node
$ poweroff                           # turn off supercom
$ ps -ef                             # show process status for all
$ ps -ef | grep jglee                # show process status for jglee
$ psh node1-node2 “killall -9 vasp”  # kill VASP on multiple nodes
$ pwd                                # show the present working directory
$ :q                                 # exit from editor without save
$ :q!                                # exit from editor
$ qsub filename                      # submit filename to be calculated
$ qdel job ID                        # delete job
$ qstat –u username                  # show the status of username’s jobs
$ qstat –f                           # show status of nodes and jobs
$ rm file2                           # remove file2
$ rmdir aaa                          # remove directory aaa
$ scp POTCAR IP1:IP2                 # copy POTCAR from IP1to IP2
$ ssh node193                        # move to node193
$ ssh ready aaa                      # set remote access for user aaa
$ su -                               # move to root
$ su – jglee                         # to jglee
$ tail -f aaa                        # show the update of the last 10 lines of file aaa
$ tail POTCAR                        # show the last parts of POTCAR
$ top                                # show status of CPU/Memory/Swap
$ touch file1                        # create an empty file1
$ userdel aaa                        # remove account for aaa
$ userdel -r aaa                     # remove account/directory for aaa
$ vi file1                           # show file1 on editor

参考资料

比较完整的INCAR模板 - VASPKIT与量化软件

Gaussian.com | Expanding the limits of computational chemistry

你可能感兴趣的:(学习)