gnuplot <<EOF set term dumb set title 'Energy of each ionic step' set xlabel 'Ionic steps' set ylabel 'Energy(eV)' plot 'temp.e' u 1:5 w l t "Energy in eV" set title 'Max Force of each ionic step' set xlabel 'Ionic steps' set ylabel 'Force (eV/Angstrom)' plot 'force.conv' w l t "Force in eV/Angstrom" EOF
if [ $steps -gt 8 ] ; then tail -5 force.conv >temp.fff tail -5 temp.e >temp.ee gnuplot <<EOF set term dumb set title 'Energy of each ionic step for the last few steps' set xlabel 'Ionic steps' set ylabel 'Energy(eV)' plot 'temp.ee' u 1:5 w l t "Energy in eV" set title 'Max Force of each ionic step for the last few steps' set xlabel 'Ionic steps' set ylabel 'Force (eV/Angstrom)' plot 'temp.fff' w l t "Force in eV/Angstrom" EOF rm temp.fff temp.ee fi
rm temp.e temp.f temp.ff temp.fix temp.fixx
批量提交任务
适用于测试、有限位移法求力常数矩阵等情况。 简单: for i in *; do cd $i ; qsub sub4; cd $OLDPWD; done
{.line-numbers}
1 2 3 4 5 6 7 8 9 10 11 12
#!/bin/sh root_path='pwd'
#在每个job文件夹里进行静态计算。 for i in {001..1316} #按顺序从job-001到116做静态vasp计算,根据生成的文件夹设定 do cd job-$i echo "job-$i", time sbatch sub.sh wait cd .. done
批量产生文件夹
i in {2..9}; do cp 0.01 0.0$i -r ; done ``` #批量复制0.01文件夹复制成0.02-0.09
# -*- coding: utf-8 -*- """ Qiang Li Command: python3 vib_correct.py This is a temporary script file. """ import numpy as np from ase.ioimport read, write import os
# 获取虚频对应的OUTCAR部分 vib_lines = lines[l_position:l_position + num_atoms] #振动部分 7222到7248行 #print(vib_lines) vib_dis = [] for line invib_lines: #model_positions = [float(i) for i in line.rstrip().split()[:3]] vib_infor = [float(i) for i in line.rstrip().split()[3:]] # dx, dy, dz对应的那三列 vib_dis.append(vib_infor) vib_dis = np.array(vib_dis) #将振动部分写到一个array中。
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Qiang Li Command: python3 vib_correct.py This is a temporary script file. """ import numpy as np import os
# 获取虚频对应的OUTCAR部分 num_atoms = sum([int(i) for i in lines_pos[6].rstrip().split()]) vib_lines = lines[l_position:l_position + num_atoms] #振动部分 7222到7248行
model_positions = [] vib_dis = [] for line invib_lines: position = [float(i) for i in line.rstrip().split()[:3]] vib_infor = [float(i) for i in line.rstrip().split()[3:]] # dx, dy, dz对应的那三列 model_positions.append(position) vib_dis.append(vib_infor)
###保存结构 f_out = open('POSCAR_new','w') f_out.writelines(lines_pos[:8]) f_out.write('Cartesian\n') for i innew_positions: f_out.write(' '.join([str(coord) for coord in i]) + ' F F F\n') f_out.close()
nebresult.pl没用过,看结果“forces and energy:”下面的数据的第四列应该就是切线力,正常的计算切线力是由正值变到负值,或者由负值变到正值,然后找接近于0的点。你图里的数据只有正值,因此要么初末态构型有问题,要么你要找的点在0和1两个image之间。 不过1号image的切线力已经很接近0了,可以尝试直接做过dimer
另一个可以用来观察收敛情况的命令是nebbarrier.pl(同样不带参数)。该命令没有输出到屏幕的内容,而是生成neb.dat文件。 neb.dat文件第二列表示距离(即临近两结构的dist.pl的计算结果),第三列表示能量(以初态能量为参考值),第四列为力(forces along the neb)。
EDIFFG参数对应的力是nebef.pl输出中的force of images in the neb.
$ unzip disorder-main $ cd disorder-main $ make disorder (Only disorder is compilied) $ make supercell (Only supercell is compilied) $ make or make all (Both disorder and supercell are compilied) $ make clean (rm *.o *.mod disorder supercell) export PATH=$PATH:disorder_installation_path/disorder-main/bin (Add this to the ~/.bashrc file as you wish)
Note: The default compiler is ifort, and you can modify the Makefile in the src directory to use another compiler (e.g. gfortran).
需要准备两个文件SPOSCAR和INDSOD,以examples的1和2为例:
例子1:SnxPb1-xTe
扩建超胞,保证整除
1 2 3 4 5 6 7 8 9
Te Pb 1.0 13.1323995589999996 0.0000000000000000 0.0000000000000000 0.0000000000000000 13.1323995589999996 0.0000000000000000 0.0000000000000000 0.0000000000000000 13.1323995589999996 Te Pb 32 32 Direct * * *
准备INDSOD文件
1 2 3 4 5 6 7 8 9 10 11 12
&input nsub = 2 subs = 16,16 symb = 'Sn','Pb' ! The quotes is unnecessary for the ifort compiler site = 2 prec = 1D-5 ! lpro = .true. ! lpos = .true. ! leqa = .true. ! lspg = .true. lcfg = .false. /
其全称为 Alloy Theoretic Automated Toolkit (ATAT) 引用官网的一句话,ATAT is a generic name that refers to a collection of alloy theory tools developped by Axel van de Walle, in collaboration with various research groups and with various sources of financial support.
maps.log:开始可能的warnings: ’Not enough known energies to fit CE’ ’True ground states not = fitted ground states’ ’New ground states predicted, see predstr.out’ 随着结构增多: ’Among structures of known energy, true and predicted ground states agree.’ ’No other ground states of xx atoms/unit cell or less exist.’ 最后一行有crossvalidation score (in eV/atom),该值要小于0.025。精确小于0.001.
fit.out:拟合的结构,一个结构一行,共6列,分别代表concentration、 energy 、fitted_energy (energy-fitted_energy)、 weight 、index
predstr.out:预测的能量,一个结构一行,共5列,分别代表concentration、 energy 、predicted_energy、index、status.其中status包括status is either b for busy (being calculated), e for error, u for unknown (not yet calculated) or g if that structure is predicted to be a ground state (g can be combined with the above).
gs.out:基态能量,一个结构一行,四列,分别是concentration、 energy、 fitted_energy、 index
# # To run VASP this script calls $vasp_std # (or posibly $vasp_gam and/or $vasp_ncl). # These variables can be defined by sourcing vaspcmd . vaspcmd 2> /dev/null
# # When vaspcmd is not available and $vasp_std, # $vasp_gam, and/or $vasp_ncl are not set as environment # variables, you can specify them here [ -z "`echo $vasp_std`" ] && vasp_std="mpirun -np 8 /path-to-your-vasp/vasp_std" [ -z "`echo $vasp_gam`" ] && vasp_gam="mpirun -np 8 /path-to-your-vasp/vasp_gam" [ -z "`echo $vasp_ncl`" ] && vasp_ncl="mpirun -np 8 /path-to-your-vasp/vasp_ncl"
The optimal length of the lattice vector c normal to the stacking direction is determined in a series of single point calculations with varied value of c (all other degrees of freedom are fixed at their experimental values).
The computed c vs. energy dependence is written in the file results.dat and can be visualized e.g. using xmgrace. The optimal value can be obtained using the attached utility (python with numpy or Numeric is needed):
./utilities/fit.py results.dat This should yield:
1 2 3 4 5 6 7
200 iterations performed Ch-square: 4.30305519481e-09 ---------
E0(eV): -37.433456779 d0(A): 6.65603352689 The computed value of 6.66 Å agrees well with experiment (6.71 Å).
# # To run VASP this script calls $vasp_std # (or posibly $vasp_gam and/or $vasp_ncl). # These variables can be defined by sourcing vaspcmd . vaspcmd 2> /dev/null
# # When vaspcmd is not available and $vasp_std, # $vasp_gam, and/or $vasp_ncl are not set as environment # variables, you can specify them here [ -z "`echo $vasp_std`" ] && vasp_std="mpirun -np 8 /path-to-your-vasp/vasp_std" [ -z "`echo $vasp_gam`" ] && vasp_gam="mpirun -np 8 /path-to-your-vasp/vasp_gam" [ -z "`echo $vasp_ncl`" ] && vasp_ncl="mpirun -np 8 /path-to-your-vasp/vasp_ncl"
# # The real work starts here #
# Here the work starts rm results.dat
drct=$(pwd)
for i in graphene graphite do cd $drct/$i $vasp_std done
cd $drct
# obtain total energy for graphite en2=$(grep "free ene" graphite/OUTCAR |tail -1|awk '{print $5}')
# obtain total energy for graphene en1=$(grep "free ene" graphene/OUTCAR |tail -1|awk '{print $5}')
echo "Binding energy (eV/atom): " $deltaE >results.dat
Note that the calculation is performed in two steps (two separate single-point calculations) in which the energy for bulk graphite and for graphene are obtained. The binding energy is computed automatically and it is written in the file results.dat. (N.B.: for the latter python needs to be available.)
The computed value of 0.050 eV/A is now fairly close to the RPA reference of 0.048 eV/atom [1].
# # To run VASP this script calls $vasp_std # (or posibly $vasp_gam and/or $vasp_ncl). # These variables can be defined by sourcing vaspcmd . vaspcmd 2> /dev/null
# # When vaspcmd is not available and $vasp_std, # $vasp_gam, and/or $vasp_ncl are not set as environment # variables, you can specify them here [ -z "`echo $vasp_std`" ] && vasp_std="mpirun -np 8 /path-to-your-vasp/vasp_std" [ -z "`echo $vasp_gam`" ] && vasp_gam="mpirun -np 8 /path-to-your-vasp/vasp_gam" [ -z "`echo $vasp_ncl`" ] && vasp_ncl="mpirun -np 8 /path-to-your-vasp/vasp_ncl"
# # The real work starts here #
rm results.dat
drct=$(pwd)
for i in graphene graphite do cd $drct/$i $vasp_std done
cd $drct
# obtain total energy for graphite en2=$(grep "free ene" graphite/OUTCAR |tail -1|awk '{print $5}')
# obtain total energy for graphene en1=$(grep "free ene" graphene/OUTCAR |tail -1|awk '{print $5}')
echo "Binding energy (eV/atom): " $deltaE >results.dat
Note that the calculation is performed in two steps (two separate single-point calculations) in which the energy for bulk graphite and for graphene are obtained. The binding energy is computed automatically and it is written in the file results.dat. (N.B.: for the latter python needs to be available.)
Even though the TS method predicts a reasonable geometry (see the Graphite interlayer distance example) it overestimates the energetics strongly: the computed binding energy of -0.083 eV/atom is too large compared to the RPA reference of 0.048 eV/atom. This overestimation is - at least in part - due to neglecting the many-body interactions (see example Graphite MBD binding energy).
自洽计算其实也是单点计算,静态自洽计算前需要提供 较稳定体系 的晶格结构信息(即结构优化完的CONTCAR),从而通过电子自洽计算,通过自洽迭代求解薛定谔方程(微观中描述电子的状态,相当于宏观的运动方程)) 完整地计算出体系基态下费米能级(准确值,The fermi level location is accurate only in self-consistent calculation.)、 电子的波函数、电荷密度等信息,可以直接分析原子间的键合作用,也可以在非自洽之后进一步分析晶体的电子结构和材料的相关性质。
xy 方向上表面的大小(15 Å或者100原子左右); A 这个影响表面吸附物种的覆盖度; B 影响体系的尺寸大小和计算时间; C 不同的大小需要选取对应的K点;回想一下我们前面提到的经验规则。
不同的晶面,(111), (100),(110); A 这取决于你研究的方向;低指数面、解离面。 B 不同晶面的表面能; C 不同晶面的表面结构,反应活性等。
表面结构的层数(3+3以上,6Å+6Å) A 层数多了,原子变多,体系在 z 方向的尺寸增加,也会影响计算速度; B 计算中需要弛豫的层数; C 不同层数对你要计算的性质会产生影响,比如表面能; D 不同晶面需要的层数也不尽相同,一般开放的表面需要更多的层数; E 根据自己感兴趣的性质,选择合适的层数,也就是需要你去测试一番。
1)POSCAR第7行后面加一行加S, Sed –i ‘7a S’ POSCAR 原子坐标加F/T。 Sed –i ’10,11s/$/ F F F/g’ POSCAR Sed –i ’12,13,14s/$/ T T T/g’ POSCAR vaspkit –task 402/403 或者ctrl+v,选中列-大写A-输入 T T T - ESC. 2)POTCAR和KPOINTS不变。 INCAR设置:IBRION=1、2,EDIFF=1E-6,EDIFFG=-0.03(比块体小一点),ISIF=2, 提交任务。
5 表面能计算
表面能是创造物质表面时,破坏分子间化学键所需消耗的能量。在固体物理理论中,表面原子比物质内部的原子具有更多的能量,因此,根据能量最低原理,原子会自发的趋于物质内部而不是表面。表面能的另一种定义是,材料表面相对于材料内部所多出的能量。把一个固体材料分解成小块需要破坏它内部的化学键,所以需要消耗能量。如果这个分解的过程是可逆的,那么把材料分解成小块所需要的能量就和小块材料表面所增加的能量相等。但事实上,只有在真空中刚刚形成的表面才符合上述能量守恒。因为新形成的表面是非常不稳定的,它们通过表面原子重组和相互间的反应,或者对周围其他分子或原子的吸附,从而使表面能量降低。 γ=($E_{surf}$ - N * $E_{bulkatom}$)/(2A)
tamas@tamas-PC:~/Desktop/scan$ python scan_adsorption_energy.py -g Input which atom you want to move to scan adsorption energy–>-1 脚本提示我们移动第几个原子产生不同的吸附结构,我们可以输入97或者-1,移动最后一个Li。这个Cu(111)面是(331)的超胞,因此我们最需要取左下角的1/9的小区域撒点即可,然后程序会将小区域内的数据点进行平移得到整个表面的数据。如何根据不同的表面调整这个参数以及撒点的密度呢?可以使用-u参数进行自定义设置。
Input how many supercells in x axis–>3 Input how many supercells in y axis–>3 Input interporate how many points for each unit cell in x axis,even number are suggested–>2 Input interporate how many points for each unit cell in y axis,even number are suggested–>2 command to submit jobs,e.g. qsub vasp.pbs–>qsub vasp.pbs Input which atom you want to move to scan adsorption energy–>-1 手动选择x方向的超胞数3,y方向的超胞数3,在小区域内的x方向的撒点数,y方向的撒点数(为了包含中心点,建议选择偶数)和提交排队脚本的命令(我的是qsub vasp.pbs)。脚本会自动产生4个结构(2*2),并会将每个计算所需的文件都复制到相应的文件夹内,并提交排队脚本进行计算。同时脚本会写出一个grid.info里面包含了超胞数,选择移动的原子以及晶格常数信息。 在所有的计算完成后,同样使用该脚本提取数据。
cd / //切换到根目录 cd /bin //切换到根目录下的bin目录 cd ../ //切换到上一级目录 或者使用命令:cd .. cd ~ //切换到home目录 cd - //切换到上次访问的目录 cd xx(文件夹名) //切换到本目录下的名为xx的文件目录,如果目录不存在报错 cd /xxx/xx/x //可以输入完整的路径,直接切换到目标目录,输入过程中可以使用tab键快速补全
2 查看目录(ls)
{.line-numbers}
1 2 3 4
ls //查看当前目录下的所有目录和文件 ls -a //查看当前目录下的所有目录和文件(包括隐藏的文件) ls -l //列表查看当前目录下的所有目录和文件(列表查看,显示更多信息),与命令"ll"效果一样 ls /bin //查看指定目录下的所有目录和文件
INCARin ** STOPCARin stout out POTCARin ** KPOINTSin ** IBZKPT out POSCARin ** CONTCAR out CHGCARin/out CHG out WAVECARin/out TMPCARin/out EIGENVAL out DOSCAR out PROCAR out OSZICAR out PCDAT out XDATCAR out LOCPOT out ELFCAR out PROOUT out
tar -xzvf vasp.6.3.0.tgz cd vasp.6.3.0 cp arch/makefile.include.intel makefile.include vim makefile.include 注释掉 MKLROOT ?= /path/to/your/mkl/installation 保存退出 make all或者make std gam ncl
We present a new implementation of the program nMoldyn, which has been developed for the computation and decomposition of neutron scattering intensities from Molecular Dynamics trajectories ./nMOLDYNStart.py
再次,如果需要,通过使用拟合的势能面作为输入,进行进一步的后处理,使用1D薛定谔求解器。由J. Buckeridge(UCL)编写的Fortran代码在1DSchrodingerSolver中提供。该代码使用傅里叶方法获得非简谐势中的特征值和特征向量,并确定一个有效的重正化(简谐)频率,以再现其在给定温度下对热力学分区函数的贡献。由J. M. Frost编写的TISH代码可以与多项式拟合一起工作,用于研究带隙变形势能。