CASTEP 19.1 linux学术版本安装教程

1、CASTEP学术免费版本申请

CASTEP(Cambridge Sequential Total Energy Package 的缩写)是一个基于密度泛函方法的从头算量子力学程序。典型的应用包括表面化学,键结构,态密度和光学性质等研究, CASTEP也可用于研究体系的电荷密度和波函数的3D形式。此外, CASTEP可用于有效研究点缺陷(空位,间隙和置换杂质)和扩展缺陷(如晶界和位错)的性质。适用于固体物理,材料科学,化学以及化工领域,可以节省实验成本,缩短开发周期。(来源于百度百科介绍)

CASTEP作为Materials Studio的量子化学模块之一,采用Fortran90语言编写,目前已经在官网(http://www.castep.org/CASTEP/GettingCASTEP)宣布实行学术免费,最新版本为19.1

申请CASTEP学术免费版本步骤如下所示:

CASTEP 19.1 linux学术版本安装教程

2、CASTEP学术免费版本安装

按照上述要求正确申请后,会收到Dominik Jochym教授的一封邮件,该邮件附件会附带CASTEP安装包和赝势库。下载附件并上传到自己的服务器就可以开始正式安装了。

(0) 安装前必读该链接

http://www.castep.org/Tutorials/compilingcastep

(1) 解压安装包并进入解压后的文件夹

<code>tar xzvf CASTEP-19_beta.tar.gz/<code><code>cd CASTEP-19_beta/<code>

(2) 进入文件夹后认真阅读README.INSTALL文件,该文件详细描述了CASTEP的安装步骤和安装参数、以及安装CASTEP需要的库和软件(见下面)。

<code>1. A Unix-like build environment./<code><code>2. A Fortran 2003 compiler. /<code><code>3. A set of the numerical libraries implementing the LAPACK and BLAS functionality. /<code><code>4. GNU make version 3.81 or later, (3.82 preferred)./<code><code>5. The PERL language./<code><code>6. The set of "developer" packages, libraries and toolchain necessary to compile and link software on your system. /<code><code>7. An optimised FFT library./<code><code>8. The Python language. (2.4 or later)/<code><code>9. An implementation of MPI, which is required to build a parallel CASTEP executable./<code>

(3) 阅读完安装指引,可以开始正式安装了,首先source (或module)相应的环境变量(MKL、MPI、FFTW等),我是在超算上安装的,因此只需要执行下面命令就可以导入所有需要的库了。注意,CASTEP 19.1好像不支持Intel 2017以后的版本。

<code>module load intel/2017a/<code>

(4) 复制最下面命令在命令行运行,注意CASTEP_ARCH的赋值需要先执行(bin/arch),比如我的是:

<code>$ bin/arch/<code><code>linux_x86_64_ifort17/<code>
<code>export CASTEP_ARCH=linux_x86_64_ifort15/<code><code>make clean/<code><code>make COMMS_ARCH=mpi FFT=mkl MATHLIBS=mkl10 -j 32/<code><code>make install/<code>

(5) 如果环境变量都设置正确的话,耐心等待一段时间就可以成功编译。会在obj目录下找到相应的可执行程序(castep.mpi),比如我的是:

<code>cd obj/linux_x86_64_ifort17--mpi/<code>

注意:如果报错,可能找不到相应的MKL、MPI、FFTW等库,那么就需要手动设置相应库的路径,这里以FFTW为例(详细的阅读README.INSTALL)。

<code>make FFT=fftw3 FFTLIBDIR=/usr/local/bin/<code>

3、CASTEP学术免费版本测试

我们这里以官网第一个例子Si作为测试,官网教程和测试文件下载地址:

http://www.castep.org/Tutorials/BasicsAndBonding

http://www.castep.org/files/Si2.tgz

<code>gunzip Si2.tgz/<code><code>tar -xvf Si2.tar/<code><code>cd Si2/<code>

(1) 输入文件Si2.cell (赝势文件Si_00.usp可以从给定的赝势库拷贝到当前目录)

<code>! Lattice vectors of simulation cell./<code><code>! in order a(x) a(y) a(z)/<code><code>! b(x) b(y) b(z)/<code><code>! c(x) c(y) c(z)/<code><code>!/<code><code>! N.B. These are the vectors of the *primitive* rhombohedral/<code><code>! cell of Si2 in the diamond structure./<code><code>%block lattice_cart/<code><code>2.6954645 2.6954645 0.0/<code><code>2.6954645 0.0 2.6954645/<code><code>0.0 2.6954645 2.6954645/<code><code>%endblock lattice_cart/<code><code>!/<code><code>! Atomic co-ordinates for each species./<code><code>! These are in fractional co-ordinates wrt to the cell./<code><code>!/<code><code>%block positions_frac/<code><code>Si 0.00 0.00 0.00/<code><code>Si 0.25 0.25 0.25/<code><code>%endblock positions_frac/<code><code>!/<code><code>! Analyse structure to determine symmetry/<code><code>!/<code><code>symmetry_generate/<code><code>!/<code><code>! Choose which pseudopotentials to use/<code><code>! Either specify external files, or omit to generate a pseudopotential/<code><code>!/<code><code>%block species_pot/<code><code>Si Si_00.usp/<code><code>%endblock species_pot/<code><code>!/<code><code>! Specify M-P grid dimensions for electron wavevectors (K-points)/<code><code>!/<code><code>kpoint_mp_grid 4 4 4/<code>

输入文件Si2.param

<code>task singlepoint ! The TASK keyword instructs CASTEP what to do/<code><code>xc_functional LDA ! Which exchange-correlation functional to use./<code><code>basis_precision MEDIUM ! Choose high cut-off COARSE/MEDIUM/FINE/PRECISE/<code><code>fix_occupancy true ! Treat the system as an insulator/<code><code>opt_strategy speed ! Choose algorithms for best speed at expense of memory./<code><code>num_dump_cycles 0 ! Don't write unwanted ".wvfn" files./<code><code>write_formatted_density TRUE ! Write out a density file that we can view using (e.g.) Jmol./<code><code>calculate_densdiff TRUE ! Calculate the difference in density between Si and a superposition of atomic densities./<code>

(2) 准备提交任务的脚本

<code>#!/bin/bash/<code><code># Submission><code>#SBATCH --time=00:05:00 # hh:mm:ss/<code><code>#SBATCH --ntasks=1/<code><code>#SBATCH --ntasks-per-node=1/<code><code>#SBATCH --mem-per-cpu=2625 # megabytes/<code><code>#SBATCH --partition=defq/<code><code>module load intel/2017a/<code>
<code>EXEC=/xxxx/obj/linux_x86_64_ifort17--mpi/castep.mpi (xxx改为自己的)/<code>
<code>mpirun ${EXEC} Si2 /<code>

(3) 正确运行后会得到类似下面的输出文件Si2.castep

<code> Compiled for linux_x86_64_ifort17 on XXX +0100/<code><code> Compiler: Intel Fortran 17.0.1.132; Optimisation: fast/<code><code> MATHLIBS: Intel MKL(2017.0.1) (LAPACK version 3.6.0)/<code><code> FFT Lib : mkl/<code><code> Fundamental constants values: CODATA 2014/<code>
<code> Run started: Mon, 03 Feb 2020 11:19:00 +0100/<code>
<code> Pseudo atomic calculation performed for Si 3s2 3p2/<code>
<code> Converged in 16 iterations to a total energy of -102.0354 eV/<code>
<code> ************************************ Title ************************************/<code>
<code> ***************************** General Parameters ******************************/<code>
<code> output verbosity : normal (1)/<code><code> write checkpoint data to : Si2.check/<code><code> type of calculation : single point energy/<code><code> stress calculation : off/<code><code> density difference calculation : on/<code><code> electron localisation func (ELF) calculation : off/<code><code> Hirshfeld analysis : off/<code><code> unlimited duration calculation/<code><code> timing information : on/<code><code> memory usage estimate : on/<code><code> write extra output files : on/<code><code> write final potential to formatted file : off/<code><code> write final density to formatted file : on/<code><code> write BibTeX reference list : on/<code><code> write OTFG pseudopotential files : on/<code><code> write electrostatic potential file : on/<code><code> write bands file : on/<code><code> ………………………………………文件较长不一一展示了…………………………………………/<code>

以上如有错误,望各位指出!也欢迎大家投稿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


分享到:


相關文章: