!----------------------------------------------------------------------- ! ! 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)
! 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
LOGICAL FILFLG INTEGER ICELL(3,3) INQUIRE(FILE='OPTCELL',EXIST=FILFLG) IF (FILFLG) THEN OPEN(67,FILE='OPTCELL',FORM='FORMATTED',STATUS='OLD') DO J=1,3 READ(67,"(3I1)") (ICELL(I,J),I=1,3) ENDDO CLOSE(67) DO J=1,3 DO I=1,3 IF (ICELL(I,J)==0) FCELL(I,J)=0.0 ENDDO ENDDO ENDIF RETURN END SUBROUTINE
比如优化单层MoS2,POSCAR如下:
1 2 3 4 5 6 7 8 9 10 11
MoS2 1.0 3.1659998894 0.0000000000 0.0000000000 -1.5829999447 2.7418363326 0.0000000000 0.0000000000 0.0000000000 18.4099998474 S Mo 2 1 Direct 0.000000000 0.000000000 0.413899988 0.000000000 0.000000000 0.586099982 0.666666687 0.333333343 0.500000000
VASP优化的时候,用OPTCELL就限制真空层就行了。OPTCELL如下:
1 2 3
100 110 000
ISIF = 3 优化之后CONTCAR如下:
1 2 3 4 5 6 7 8 9 10 11
MoS2 1.00000000000000 3.1822561751580456 0.0000000000000000 0.0000000000000000 -1.5911280875790228 2.7559146890376600 0.0000000000000000 0.0000000000000000 0.0000000000000000 18.4099998474000017 S Mo 2 1 Direct -0.0000000000000000 -0.0000000000000000 0.4150537162890733 -0.0000000000000000 0.0000000000000000 0.5849462537109242 0.6666666870000029 0.3333333429999996 0.5000000000000000
由此可见 a = b = 3.1659998894,变成了 a = b = 3.1822561751580456。而 c = 18.4099998474没有变。
如果不固定基矢优化,得到的CONTCAR如下:
1 2 3 4 5 6 7 8 9 10 11
MoS2 1.00000000000000 3.1822639795633445 0.0000000000000000 0.0000000000000000 -1.5911319897816723 2.7559214478509104 0.0000000000000000 0.0000000000000000 -0.0000000000000000 18.2494484388264482 S Mo 2 1 Direct -0.0000000000000000 -0.0000000000000000 0.4143158624764718 -0.0000000000000000 -0.0000000000000000 0.5856841075235258 0.6666666870000029 0.3333333429999996 0.5000000000000000