目录

VASP固定基矢优化结构

misaraty 更新 | 2024-02-15
前言
对于二维材料,如何固定z方向晶胞参数不变(固定z轴),优化x、y晶胞参数呢?

下载所有方案

网上解决方法的原理接近,主要是修改constr_cell_relax.F文件,按发布时间顺序可分三种:

方案一

2018-03-19 chempeng 《VASP固定基矢优化结构》1

  • 修改INCARISIF=3

  • 修改/src/constr_cell_relax.F

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
!-----------------------------------------------------------------------
!
! At present, VASP does not allow to relax the cellshape selectively
! i.e. for instance only cell relaxation in x direction.
! To be more precisse, this behaviour can not be achived via the INCAR
! or POSCAR file.
! However, it is possible to set selected components of the stress tensor
! to zero.
! The most conveninent position to do this is the routines 
! CONSTR_CELL_RELAX  (constraint cell relaxation).
! FCELL contains the forces on the basis vectors.
! These forces are used to modify the basis vectors according
! to the following equations:
!
!      A_OLD(1:3,1:3)=A(1:3,1:3) ! F90 style 
!      DO J=1,3
!      DO I=1,3
!      DO K=1,3
!        A(I,J)=A(I,J) + FCELL(I,K)*A_OLD(K,J)*STEP_SIZE
!      ENDDO
!      ENDDO
!      ENDDO
! where A holds the basis vectors (in cartesian coordinates).
!
!-----------------------------------------------------------------------
      SUBROUTINE CONSTR_CELL_RELAX(FCELL)
      USE prec
      REAL(q) FCELL(3,3)
      DO I=1,3
      ! fix z
        FCELL(3,I)=0
        FCELL(I,3)=0
      ! ! fix x
        ! FCELL(1,I)=0
        ! FCELL(I,1)=0
      ! ! fix y
        ! FCELL(2,I)=0
        ! FCELL(I,2)=0        
      ENDDO
!     just one simple example
!     relaxation in x directions only
!      SAVE=FCELL(1,1)
!      FCELL=0   ! F90 style: set the whole array to zero
!      FCELL(1,1)=SAVE
!     relaxation in z direction only
!      SAVE=FCELL(3,3)
!      FCELL=0   ! F90 style: set the whole array to zero
!      FCELL(3,3)=SAVE
      RETURN
      END SUBROUTINE
  • 固定z轴,弛豫x、y轴。若以WSe2为例,POSCAR为,
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Se2 W
1.0
        3.2899999619         0.0000000000         0.0000000000
       -1.6449999809         2.8492235454         0.0000000000
        0.0000000000         0.0000000000        12.9700002670
    W   Se
    2    4
Direct
     0.333333343         0.666666687         0.250000000
     0.666666627         0.333333313         0.750000000
     0.333333343         0.666666687         0.620999992
     0.666666627         0.333333313         0.379000008
     0.666666627         0.333333313         0.120999992
     0.333333343         0.666666687         0.879000008
  • 计算后的CONTCAR为,
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
Se2 W                                   
   1.00000000000000     
     3.2988809157024286   -0.0000009118894020    0.0000000000000000
    -1.6494412476071403    2.8569140950044987    0.0000000000000000
     0.0000000000000000    0.0000000000000000   12.9700002669999996
   W    Se
     2     4
Direct
  0.3333332795709047  0.6666667206026287  0.2499999920982164
  0.6666666936724241  0.3333332807801080  0.7499999970341932
  0.3333333290727808  0.6666666860461303  0.6193498945590813
  0.6666666393043650  0.3333333132884654  0.3806501104445901
  0.6666666352755654  0.3333333096490192  0.1193498971153154
  0.3333333331039529  0.6666666896336484  0.8806501087486037
 
  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

方案二(推荐)

2018-05-20 Chengcheng-Xiao 《VASP_OPT_AXIS》2

2018-09-06 Mr.ZhengGang 《VASP固定晶胞方向不优化》3

  • 修改INCARISIF=3

  • 修改/src/constr_cell_relax.F

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
      SUBROUTINE CONSTR_CELL_RELAX(FCELL)
      USE PREC
      REAL(Q) FCELL(3,3), SAVE(3)
      LOGICAL FILFLG
      INTEGER ICELL(3)
      INQUIRE(FILE='OPTCELL',EXIST=FILFLG)
      IF (FILFLG) THEN
        OPEN(67,FILE='OPTCELL',FORM='FORMATTED',STATUS='OLD')
          READ(67,"(3I1)") (ICELL(I),I=1,3)
        CLOSE(67)
        DO I=1,3
          SAVE(I)=FCELL(I,I)
        ENDDO
        FCELL=0.0d0
        DO I=1,3
          IF (ICELL(I)==1) FCELL(I,I)=SAVE(I)
        ENDDO
      ENDIF
!     just one simple example
!     relaxation in x directions only
!      SAVE=FCELL(1,1)
!      FCELL=0   ! F90 style: set the whole array to zero
!      FCELL(1,1)=SAVE
      RETURN
      END SUBROUTINE
  • 计算目录中增加OPTCELL
1
110 #1表示优化,0表示不优化;三个数字依次对应于xyz方向。比如 110 表示z轴不优化;001 表示x和y轴都不优化。
  • 计算后的CONTCAR为,
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
Se2 W                                   
   1.00000000000000     
     3.2988809154146170    0.0000000000000000    0.0000000000000000
    -1.6494404576571737    2.8569136389682201    0.0000000000000000
     0.0000000000000000    0.0000000000000000   12.9700002669999996
   W    Se
     2     4
Direct
  0.3333332763757423  0.6666667206116557  0.2499999920871069
  0.6666666968682680  0.3333332807560439  0.7499999970274550
  0.3333333274478362  0.6666666860442724  0.6193498945625138
  0.6666666409113122  0.3333333132431017  0.3806501104629225
  0.6666666368917313  0.3333333096672763  0.1193498970910784
  0.3333333315051024  0.6666666896776502  0.8806501087689232
 
  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
注意
Chengcheng-Xiao VASP_OPT_AXIS还可以对xx xy xz yx yy yz zx zy zz方向进行固定或弛豫。

方案三

2019-05-05 Jincheng Liu 《VASP固定基矢优化结构方法》4

  • 修改INCARISIF=3

  • 修改/src/constr_cell_relax.F

  • 增加OPTCELL

  • 计算后的CONTCAR为,

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
Se2 W                                   
   1.00000000000000     
     3.2988809156770467   -0.0000009123103790    0.0000000000000000
    -1.6494412475791849    2.8569140951081820    0.0000000000000000
     0.0000000000000000    0.0000000000000000   12.9700002669999996
   W    Se
     2     4
Direct
  0.3333332795922008  0.6666667206713092  0.2499999920944698
  0.6666666936429270  0.3333332808269298  0.7499999970276957
  0.3333333290707461  0.6666666860010831  0.6193498945606164
  0.6666666392590765  0.3333333132864525  0.3806501104582833
  0.6666666352395026  0.3333333095723708  0.1193498971142689
  0.3333333331955395  0.6666666896418546  0.8806501087446658
 
  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

  1. VASP固定基矢优化结构 ↩︎

  2. VASP_OPT_AXIS ↩︎

  3. VASP固定晶胞方向不优化 ↩︎

  4. VASP固定基矢优化结构方法 ↩︎