VASP+FDM+Phonopy 计算声子过程

以Ammonia为例,基本翻译自:https://atztogo.github.io/phonopy/procedure.html#tutorial.

 

1. 结构优化. 输入文件如下:

INCAR
!System settings
   SYSTEM = Ammonia
   PREC   =  accurate    low, normal, accurate
   ISTART =      0     job   : 0-new  1-cont  2-samecut
   ICHARG =      2     charge: 0-INIWAV 1-CHGCAR 2-atom 10-nonself
   ISPIN  =      1     spin polarized? 1:no 2:yes
   INIWAV =      1     0-jellium 1-rand

!Electronic Relaxation
   ENCUT  =   200.0 eV
   NELM   =   1000     max e SC
   NELMIN =      2     min e SC
   NELMDL =     -5     non-SC +:every -:first
   EDIFF  = 1.0E-6     stopping-criterion for ELM
   LREAL  =   Auto     real-space projection
   ALGO   =   fast     normal:38(D) fast:38-48(RMM) all:58 damped:53

   !IMIX = 4
   !AMIX = 0.1
   !BMIX = 0.0001
   !WC = 1000
   !INIMIX = 1
   !MIXPRE = 1
   !MAXMIX = -45

!Ionic relaxation
   EDIFFG = -0.0005    stopping-criterion for IOM +:energy -:force
   NSW    =     500    number of steps for IOM
   !NBLOCK =      1     inner block ionic cfg-XDATCAR, scale T
   !KBLOCK =   1000     outer block PCF-PCDAT,DOS-DOSCAR
   IBRION =      2     ionic relax: 0-MD 1-static 2-CG 3-dampedMD
   ISIF   =      2
   POTIM  =   1.0     time-step for ionic-motion
   !TEBEG  =  600.0
   !TEEND  =  600.0     temperature during run
   SMASS  =     -1     -3:micro -2:const -1:scaled >=0:Nose mass

!DOS related values:
   !EMIN   =  10.00
   !EMAX   = -10.00     energy-range for DOS
   !NEDOS = 300
   ISMEAR =      0     1,2:metal -5,0:sem/ins
   SIGMA  =   0.05     broadening in eV
   !RWIGS  = -1.0 -1.0 -1.0
   !NBANDS = 10       actual number of bands in calculation

!Write flags
   !NWRITE =      2     long runs use 0 or 1
   LWAVE  = .FALSE.     write WAVECAR
   LCHARG = .FALSE.     write CHGCAR
   LVTOT  = .FALSE.    write LOCPOT, local potential
   LELF   = .FALSE.    write electronic localiz. function (ELF)
   !LORBIT = 11
   !LAECHG = .TRUE.
   !LADDGRID = .TRUE.

!Parallel flags
   NPAR   =      8     # of nodes
   LPLANE =  .FALSE.
   LSCALU = .FALSE.
   LSCALAPACK = .FALSE.



POSCAR
Ammonia_rlx
1.0
    5.1305  0.0  0.0
    0.0 5.1305 0.0
    0.0 0.0 5.1305
    N H
4 12
Cart
       1.0789441   1.0789441   1.0789441
       1.4863058   4.0515558   3.6441941
       3.6441941   1.4863058   4.0515558
       4.0515558   3.6441941   1.4863058
       1.9095721   1.3477823   0.5710246
       1.9942253   3.2209279   3.9130323
       3.1362746   0.6556779   3.7827176
       4.5594753   4.4748221   1.2174676
       1.3477823   0.5710246   1.9095721
       1.2174676   4.5594753   4.4748221
       3.2209279   3.9130323   1.9942253
       0.5710246   1.9095721   1.3477823
       0.6556779   3.7827176   3.1362746
       4.4748221   1.2174676   4.5594753
       3.9130323   1.9942253   3.2209279
       3.7827176   3.1362746   0.6556779

KPOINTS
Automatic mesh
0
MP
 5  5  5
 0  0  0

--------------------------------------------------------------------------------

由于声子对结构优化比较敏感,这儿的 PREC=accurate.

 

 

2. 构建优化过的单胞

1 cp CONTCAR POSCAR
Ammonia_rlx                             
   1.00000000000000     
     5.1304999999999996    0.0000000000000000    0.0000000000000000
     0.0000000000000000    5.1304999999999996    0.0000000000000000
     0.0000000000000000    0.0000000000000000    5.1304999999999996
   N    H 
     4    12
Direct
  0.2173355638189437  0.2173355638189437  0.2173355638189437
  0.2826644166897822  0.7826644166897819  0.7173355638189437
  0.7173355638189437  0.2826644166897822  0.7826644166897819
  0.7826644166897819  0.7173355638189437  0.2826644166897822
  0.3844041525928144  0.2739307062557181  0.1256929444364981
  0.3743070360722207  0.6155958474071853  0.7739307062557181
  0.6256929444364983  0.1155958474071856  0.7260692742530075
  0.8743070360722203  0.8844041525928147  0.2260692742530077
  0.2739307062557181  0.1256929444364981  0.3844041525928144
  0.2260692742530077  0.8743070360722203  0.8844041525928147
  0.6155958474071853  0.7739307062557181  0.3743070360722207
  0.1256929444364981  0.3844041525928144  0.2739307062557181
  0.1155958474071856  0.7260692742530075  0.6256929444364983
  0.8844041525928147  0.2260692742530077  0.8743070360722203
  0.7739307062557181  0.3743070360722207  0.6155958474071853
  0.7260692742530075  0.6256929444364983  0.1155958474071856
 
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00
  0.00000000E+00  0.00000000E+00  0.00000000E+00

 

3. 构建超胞

1 python /home/zjyx/softwares/phonopy-1.10.10/bin/phonopy --vasp -c POSCAR-unitcell -d --dim="4 4 4"

 在这一步后,将会产生若干个POSCAR-??? 文件,可以用以下script将其移动到对应的文件夹内以方便后续计算。同时,也需在当前文件夹内准备好待用的其他输入文件。需要改的参数有INCAR里的IBRION, NSW和KPOINTS里的mesh points.

script:

 1 #! /usr/bin/env python
 2 
 3 '''
 4     mv all POSCAR-??? files to a new created disps directories, and
 5     copy other inputs files to the all subdirectries
 6 '''
 7 
 8 import os
 9 import sys
10 from shutil import copy, move
11 
12 other_inp = ['INCAR', 'KPOINTS', 'POTCAR']
13 
14 n_disp = 1
15 while True:
16     if os.path.isfile('POSCAR-%03d'% n_disp):
17         n_disp += 1
18     else:
19         break
20 
21 if not os.path.isdir('disps'):
22     os.mkdir('disps')
23 
24 for i in range(n_disp):
25     ''' disps-000 to store perfect supercell without perturbations'''
26     crt_dir = 'disps'+'/'+'disp-%03d'%i
27     if not os.path.isdir(crt_dir):
28         os.mkdir(crt_dir)
29     for _file in other_inp:
30         copy(_file, crt_dir)
31     if i != 0:
32         copy('POSCAR-%03d'%i, crt_dir+'/'+'POSCAR')
33     else:
34         copy('SPOSCAR', crt_dir+'/'+'POSCAR')

INCAR:

!System settings
   SYSTEM = Ammonia
   PREC   =  normal    low, normal, accurate
   ISTART =      0     job   : 0-new  1-cont  2-samecut
   ICHARG =      2     charge: 0-INIWAV 1-CHGCAR 2-atom 10-nonself
   ISPIN  =      1     spin polarized? 1:no 2:yes
   INIWAV =      1     0-jellium 1-rand

!Electronic Relaxation
   ENCUT  =   200.0 eV
   NELM   =   1000     max e SC
   NELMIN =      2     min e SC
   NELMDL =     -5     non-SC +:every -:first
   EDIFF  = 1.0E-6     stopping-criterion for ELM
   LREAL  =   Auto     real-space projection
   ALGO   =   fast     normal:38(D) fast:38-48(RMM) all:58 damped:53

   !IMIX = 4
   !AMIX = 0.1
   !BMIX = 0.0001
   !WC = 1000
   !INIMIX = 1
   !MIXPRE = 1
   !MAXMIX = -45

!Ionic relaxation
   EDIFFG = -0.0005    stopping-criterion for IOM +:energy -:force
   !NSW    =       1    number of steps for IOM
   !NBLOCK =      1     inner block ionic cfg-XDATCAR, scale T
   !KBLOCK =   1000     outer block PCF-PCDAT,DOS-DOSCAR
   IBRION =      -1     ionic relax: 0-MD 1-static 2-CG 3-dampedMD
   ISIF   =      2
   POTIM  =   1.0     time-step for ionic-motion
   !TEBEG  =  600.0
   !TEEND  =  600.0     temperature during run
   SMASS  =     -1     -3:micro -2:const -1:scaled >=0:Nose mass

!DOS related values:
   !EMIN   =  10.00
   !EMAX   = -10.00     energy-range for DOS
   !NEDOS = 300
   ISMEAR =      0     1,2:metal -5,0:sem/ins
   SIGMA  =   0.05     broadening in eV
   !RWIGS  = -1.0 -1.0 -1.0
   !NBANDS = 10       actual number of bands in calculation

!Write flags
   !NWRITE =      2     long runs use 0 or 1
   LWAVE  = .FALSE.     write WAVECAR
   LCHARG = .FALSE.     write CHGCAR
   LVTOT  = .FALSE.    write LOCPOT, local potential
   LELF   = .FALSE.    write electronic localiz. function (ELF)
   !LORBIT = 11
   !LAECHG = .TRUE.
   !LADDGRID = .TRUE.

!Parallel flags
   !NPAR   =      8     # of nodes
   LPLANE =  .FALSE.
   LSCALU = .FALSE.
   LSCALAPACK = .FALSE.

KPOINTS:

Automatic mesh
0
MP
 1  1  1
 0  0  0

 

4. 用VASP做超胞计算.

 

5. 计算Force Sets

 1 #! /usr/bin/env python
 2 
 3 # calculate force costant matrix
 4 
 5 import os
 6 import sys
 7 
 8 i = 1
 9 width = 3
10 
11 if os.path.isfile('qe.in'):
12     mode = 'pwscf'
13     post_filename = '.00.out'
14     pre_pathname = "supercell"
15     supercell_dir = "supercells"
16 elif os.path.isfile('rmg.in'):
17     mode = 'rmg'
18     post_filename = '.in.00.log'
19     pre_pathname = "supercell"
20     supercell_dir = "supercells"
21 elif os.path.isfile('SPOSCAR'):
22     mode  = 'vasp'
23     post_filename = 'vasprun.xml'
24     pre_pathname = "disp"
25     supercell_dir = "disps"
26 else:
27     print "Error: unitcell not found, exit."
28     sys.exit(1)
29 
30 force_cmd = 'python /home/zjyx/softwares/phonopy-1.10.10/bin/phonopy --%s -f'% mode
31 
32 while True:
33     path_tmp = '{pre_pathname}-{0:0{width}}'.format(i,
34                                              pre_pathname=pre_pathname,
35                                              width=width)
36     pathname = supercell_dir + ('/%s'% path_tmp)
37     if os.path.exists(pathname):
38             i += 1
39             force_cmd += ' %s/%s'%(pathname, post_filename)
40     else:
41         break
42 
43 try:
44     os.system('%s'% force_cmd)
45 except:
46     print "Error: cannot operate command, exit."
47     sys.exit(1)
48 else:
49     print ('Force sets done!\n')
50     print ('    total files: %d\n'%(i-1))

这样当前目录下会出现FORCE_SETS文件。

 

6. 计算Band structure

 1 #!/bin/bash
 2 
 3 # plot band structure 
 4 
 5 if [ -e rmg.in ]; then
 6     mode=rmg
 7     input=rmg.in
 8 elif [ -e qe.in ]; then
 9     mode=pwscf
10     input=qe.in
11 elif [ -e POSCAR-unitcell ]; then
12     mode=vasp
13     input=POSCAR-unitcell
14 else
15     echo -e "No default unitcell file found.\n"
16     exit 1
17 fi
18 
19 python /home/zjyx/softwares/phonopy-1.10.10/bin/phonopy --$mode -c $input -s -p band.conf
20 
21 exit 0

 

其中band.conf 文件如下:

DIM = 4 4 4
PRIMITIVE_AXIS = 1.0 0.0 0.0  0.0 1.0 0.0  0.0 0.0 1.0
BAND = 0.0 0.0 0.0  0.0 0.5 0.0  0.5 0.5 0.0  0.5 0.5 0.5
BAND_LABELS = \Gamma X M R

 

posted @ 2017-03-25 03:04  zjyx  阅读(1048)  评论(0编辑  收藏  举报