1、CASTEP学术免费版本申请
CASTEP(Cambridge Sequential Total Energy Package 的缩写)是一个基于密度泛函方法的从头算量子力学程序。典型的应用包括表面化学,键结构,态密度和光学性质等研究, CASTEP也可用于研究体系的电荷密度和波函数的3D形式。此外, CASTEP可用于有效研究点缺陷(空位,间隙和置换杂质)和扩展缺陷(如晶界和位错)的性质。适用于固体物理,材料科学,化学以及化工领域,可以节省实验成本,缩短开发周期。(来源于百度百科介绍)
CASTEP作为Materials Studio的量子化学模块之一,采用Fortran90语言编写,目前已经在官网(http://www.castep.org/CASTEP/GettingCASTEP)宣布实行学术免费,最新版本为19.1。
申请CASTEP学术免费版本步骤如下所示:
![67c623a3f52048b4deeb41751e4278da.png](https://i-blog.csdnimg.cn/blog_migrate/d5f2541fdded73b3d97bd8ca8bb17ffb.jpeg)
2、CASTEP学术免费版本安装
按照上述要求正确申请后,会收到Dominik Jochym教授的一封邮件,该邮件附件会附带CASTEP安装包和赝势库。下载附件并上传到自己的服务器就可以开始正式安装了。
(0) 安装前必读该链接:
http://www.castep.org/Tutorials/compilingcastep
(1) 解压安装包并进入解压后的文件夹
tar xzvf CASTEP-19_beta.tar.gz
cd CASTEP-19_beta
(2) 进入文件夹后认真阅读README.INSTALL文件,该文件详细描述了CASTEP的安装步骤和安装参数、以及安装CASTEP需要的库和软件(见下面)。
1. A Unix-like build environment.
2. A Fortran 2003 compiler.
3. A set of the numerical libraries implementing the LAPACK and BLAS functionality.
4. GNU make version 3.81 or later, (3.82 preferred).
5. The PERL language.
6. The set of "developer" packages, libraries and toolchain necessary to compile and link software on your system.
7. An optimised FFT library.
8. The Python language. (2.4 or later)
9. An implementation of MPI, which is required to build a parallel CASTEP executable.
(3) 阅读完安装指引,可以开始正式安装了,首先source (或module)相应的环境变量(MKL、MPI、FFTW等),我是在超算上安装的,因此只需要执行下面命令就可以导入所有需要的库了。注意,CASTEP 19.1好像不支持Intel 2017以后的版本。
module load intel/2017a
(4) 复制最下面命令在命令行运行,注意CASTEP_ARCH的赋值需要先执行(bin/arch),比如我的是:
$ bin/arch
linux_x86_64_ifort17
export CASTEP_ARCH=linux_x86_64_ifort15
make clean
make COMMS_ARCH=mpi FFT=mkl MATHLIBS=mkl10 -j 32
make install
(5) 如果环境变量都设置正确的话,耐心等待一段时间就可以成功编译。会在obj目录下找到相应的可执行程序(castep.mpi),比如我的是:
cd obj/linux_x86_64_ifort17--mpi
注意:如果报错,可能找不到相应的MKL、MPI、FFTW等库,那么就需要手动设置相应库的路径,这里以FFTW为例(详细的阅读README.INSTALL)。
make FFT=fftw3 FFTLIBDIR=/usr/local/bin
3、CASTEP学术免费版本测试
我们这里以官网第一个例子Si作为测试,官网教程和测试文件下载地址:
http://www.castep.org/Tutorials/BasicsAndBonding
http://www.castep.org/files/Si2.tgz
gunzip Si2.tgz
tar -xvf Si2.tar
cd Si2
(1) 输入文件Si2.cell (赝势文件Si_00.usp可以从给定的赝势库拷贝到当前目录)
! Lattice vectors of simulation cell.
! in order a(x) a(y) a(z)
! b(x) b(y) b(z)
! c(x) c(y) c(z)
!
! N.B. These are the vectors of the *primitive* rhombohedral
! cell of Si2 in the diamond structure.
%block lattice_cart
2.6954645 2.6954645 0.0
2.6954645 0.0 2.6954645
0.0 2.6954645 2.6954645
%endblock lattice_cart
!
! Atomic co-ordinates for each species.
! These are in fractional co-ordinates wrt to the cell.
!
%block positions_frac
Si 0.00 0.00 0.00
Si 0.25 0.25 0.25
%endblock positions_frac
!
! Analyse structure to determine symmetry
!
symmetry_generate
!
! Choose which pseudopotentials to use
! Either specify external files, or omit to generate a pseudopotential
!
%block species_pot
Si Si_00.usp
%endblock species_pot
!
! Specify M-P grid dimensions for electron wavevectors (K-points)
!
kpoint_mp_grid 4 4 4
输入文件Si2.param
task singlepoint ! The TASK keyword instructs CASTEP what to do
xc_functional LDA ! Which exchange-correlation functional to use.
basis_precision MEDIUM ! Choose high cut-off COARSE/MEDIUM/FINE/PRECISE
fix_occupancy true ! Treat the system as an insulator
opt_strategy speed ! Choose algorithms for best speed at expense of memory.
num_dump_cycles 0 ! Don't write unwanted ".wvfn" files.
write_formatted_density TRUE ! Write out a density file that we can view using (e.g.) Jmol.
calculate_densdiff TRUE ! Calculate the difference in density between Si and a superposition of atomic densities.
(2) 准备提交任务的脚本
#!/bin/bash
# Submission script for Vega
#SBATCH --time=00:05:00 # hh:mm:ss
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --mem-per-cpu=2625 # megabytes
#SBATCH --partition=defq
module load intel/2017a
EXEC=/xxxx/obj/linux_x86_64_ifort17--mpi/castep.mpi (xxx改为自己的)
mpirun ${EXEC} Si2
(3) 正确运行后会得到类似下面的输出文件Si2.castep
Compiled for linux_x86_64_ifort17 on XXX +0100
Compiler: Intel Fortran 17.0.1.132; Optimisation: fast
MATHLIBS: Intel MKL(2017.0.1) (LAPACK version 3.6.0)
FFT Lib : mkl
Fundamental constants values: CODATA 2014
Run started: Mon, 03 Feb 2020 11:19:00 +0100
Pseudo atomic calculation performed for Si 3s2 3p2
Converged in 16 iterations to a total energy of -102.0354 eV
************************************ Title ************************************
***************************** General Parameters ******************************
output verbosity : normal (1)
write checkpoint data to : Si2.check
type of calculation : single point energy
stress calculation : off
density difference calculation : on
electron localisation func (ELF) calculation : off
Hirshfeld analysis : off
unlimited duration calculation
timing information : on
memory usage estimate : on
write extra output files : on
write final potential to formatted file : off
write final density to formatted file : on
write BibTeX reference list : on
write OTFG pseudopotential files : on
write electrostatic potential file : on
write bands file : on
………………………………………文件较长不一一展示了…………………………………………
以上如有错误,望各位指出!也欢迎大家投稿CASTEP使用教程!
4、CASTEP相应前处理和后处理脚本链接
https://www.c2x.org.uk/downloads/c2x_man.html
https://github.com/NickWoods1/runscf
https://github.com/cja14/CASTEP_VCA_scripts
https://github.com/tfgg/castepy