@sculxb
2017-12-19T16:16:22.000000Z
字数 2927
阅读 1739
DFT
收敛测试
截断能
k点
晶格常数
首先是晶格常数测试
#!/bin/sh
#for i in 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69
#for i in 3.544 3.545 3.546 3.547 3.548 3.549 3.550 3.551 3.552 3.553 3.554
for i in 12 14 16 18 22 24 26
do
mkdir $i
cd $i
j=$(echo "scale=8;$i/0.52917721067"|bc)
echo $j
q=$(echo "scale=8;17/$i"|bc)
echo $q
cat <<EOF > relax.in
&control
calculation='relax',
prefix='t-s',
pseudo_dir='/home/xbLiu/src/qe-6.1/pseudo'
outdir='./'
etot_conv_thr = 1.0E-4,
forc_conv_thr = 1.0D-3,
nstep = 200,
/
&system
ibrav = 4,
celldm(1) = 6.70285856
celldm(3) = 4.79278263
nat = 3,
ntyp = 2,
ecutwfc = 60,
ecutrho = 800,
occupations = 'smearing',
smearing = 'mp',
degauss = 0.005,
! la2F = .true.,
nosym =.true.,
/
&electrons
electron_maxstep = 100,
mixing_mode = 'plain',
mixing_beta = 0.7,
conv_thr = 1.0d-6,
diagonalization = 'cg',
diago_cg_maxiter = 50,
/
&IONS
ion_dynamics = 'bfgs',
!pot_extrapolation = 'second_order',
!wfc_extrapolation = 'second_order',
/
ATOMIC_SPECIES
Ti 47.867 Ti.pbe-spn-kjpaw_psl.0.3.1.UPF
Se 78.96 Se.pbe-n-kjpaw_psl.0.2.UPF
ATOMIC_POSITIONS (crystal)
Ti 0.000000000 0.000000000 0.500000008
Se 0.333333334 0.666666666 0.590939645
Se 0.666666669 0.333333335 0.409060355
K_POINTS {automatic}
$i $i 1 0 0 0
EOF
cat <<EOF > run.sh
#PBS -N vc-relax
#PBS -l nodes=1:ppn=12
#PBS -l walltime=1:00:00:00
#PBS -q batch
#PBS -V
#PBS -S /bin/bash
### Set intel environment###
source /opt/software/intel/composer_xe_2015.6.233/bin/compilervars.sh intel64
source /opt/software/intel/mkl/bin/intel64/mklvars_intel64.sh
source /opt/software/intel/impi/5.0.3.049/bin64/mpivars.sh
cd \$PBS_O_WORKDIR
EXEC=/home/xbLiu/src/qe-6.1/bin/
NP=\`cat \$PBS_NODEFILE | wc -l\`
NN=\`cat \$PBS_NODEFILE | sort | uniq | tee /tmp/nodes.\$$ | wc -l\`
cat \$PBS_NODEFILE > /tmp/nodefile.\$$
mpirun -genv I_MPI_DEVICE rdssm -machinefile /tmp/nodefile.\$$ -n \$NP \\
\$EXEC/pw.x <relax.in> relax.out
rm -rf /tmp/nodefile.\$$
rm -rf /tmp/nodes.\$$
EOF
qsub run.sh
cd ..
done
#qsub *.scf.in
然后测试完用的提取数据的脚本
#!/bin/sh
#for i in 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60
#for i in 3.544 3.545 3.546 3.547 3.548 3.549 3.550 3.551 3.552 3.553 3.554
for i in 12 14 16 18 22 24 26
do
cd $i
tot_e=`grep ! total energy *.out|tail -n 1|awk '{print $5}' `
echo $i $tot_e>> ../kp-out
cd ..
#j=$(echo "scale=8;$i/0.52917721067"|bc)
#echo $j
#q=$(echo "scale=8;17/$i"|bc)
#echo $q
done
画图用的python脚本
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 14:55:41 2017
@author: cris
"""
import numpy as np
import matplotlib.pyplot as plt
np.set_printoptions(threshold=np.NaN)
plt.rcParams['font.sans-serif']=['Abyssinica SIL']
tot_e = np.array([])
tot_e_dat = open('../file/kp-out')
for line in tot_e_dat.readlines():
line = line.split()
tot_e = np.concatenate((tot_e,line))
size=len(tot_e)
col = size/2
tot_e = tot_e.astype(float)
tot_e = tot_e.reshape(col,2)
tot_e = np.transpose(tot_e)
print tot_e[0]
plt.plot(tot_e[0],tot_e[1],'-',color='k')
plt.xticks(fontsize=15,rotation=40)
plt.yticks(fontsize=15)
ax=plt.gca()
ax.get_yaxis().set_tick_params(direction='in', width=1)
ax.get_xaxis().set_tick_params(direction='in', width=1)
plt.savefig('../graph/tot_e-0.005-paw-kp.jpeg',dpi=150)
plt.show()