mirror of https://gitlab.com/QEF/q-e.git
Some time ago I modified routine at2celldm so that it computed the value of
ibrav even if it was set to 0 and lattice defined by at vectors. It wasn't such a great idea: may break the phonon code, produces a different output for scf and non-scf runs, does not account for the unlikely but not impossible case of rotatted cell. This commit reverts to the previous behaviour, while still allowing to guess an ibrav if desired.
This commit is contained in:
parent
4ef775a971
commit
98d6147e92
|
@ -33,6 +33,7 @@ SUBROUTINE run_dist ( exit_status )
|
|||
REAL(dp) :: dr(3), dd, dn1, dn2, dn3, scalef, arg
|
||||
REAL(dp) :: angolo(nn*(nn-1)/2), drv(3), drn(3,nn), temp, rtemp(3)
|
||||
REAL(dp) :: celldm(6), a, b, c, cosab, cosac, cosbc
|
||||
INTEGER, EXTERNAL :: at2ibrav
|
||||
!
|
||||
exit_status=0
|
||||
!
|
||||
|
@ -40,6 +41,7 @@ SUBROUTINE run_dist ( exit_status )
|
|||
! and reprinted along with the lattice vectors, irrespective of
|
||||
! what was provided in output - useful for checking and conversion
|
||||
!
|
||||
IF ( ibrav == 0 ) ibrav= at2ibrav (at(1,1), at(1,2), at(1,3))
|
||||
CALL at2celldm ( ibrav, alat, at(1,1), at(1,2), at(1,3), celldm )
|
||||
CALL celldm2abc ( ibrav, celldm, a,b,c,cosab,cosac,cosbc )
|
||||
!
|
||||
|
|
|
@ -379,30 +379,23 @@ END SUBROUTINE latgen
|
|||
SUBROUTINE at2celldm (ibrav,alat,a1,a2,a3,celldm)
|
||||
!-----------------------------------------------------------------------
|
||||
!
|
||||
! Returns celldm parameters from lattice vectors
|
||||
! Tries to guess ibrav if not specified (ibrav=0)
|
||||
! See latgen for definition of celldm and lattice vectors
|
||||
! Returns celldm parameters computed from lattice vectors a1,a2,a3
|
||||
! If Bravais lattice index ibrav=0, only celldm(1) is set to alat.
|
||||
! See latgen for definition of celldm and lattice vectors.
|
||||
! a1, a2, a3, ibrav, alat are not modified
|
||||
!
|
||||
USE kinds, ONLY: DP
|
||||
IMPLICIT NONE
|
||||
INTEGER, INTENT(in) :: ibrav
|
||||
real(DP), INTENT(in) :: alat, a1(3), a2(3), a3(3)
|
||||
real(DP), INTENT(out) :: celldm(6)
|
||||
INTEGER :: jbrav
|
||||
REAL(DP), INTENT(in) :: alat, a1(3), a2(3), a3(3)
|
||||
REAL(DP), INTENT(out) :: celldm(6)
|
||||
INTEGER, EXTERNAL :: at2ibrav
|
||||
!
|
||||
celldm = 0.d0
|
||||
jbrav = 0
|
||||
!
|
||||
IF ( ibrav == 0 ) THEN
|
||||
jbrav= at2ibrav (a1, a2, a3)
|
||||
IF ( jbrav == 0 ) CALL infomsg('at2celldm', &
|
||||
'could not determine ibrav for lattice vectors')
|
||||
ELSE
|
||||
jbrav = ibrav
|
||||
ENDIF
|
||||
|
||||
SELECT CASE ( jbrav )
|
||||
SELECT CASE ( ibrav )
|
||||
CASE (0)
|
||||
celldm(1) = alat
|
||||
CASE (1)
|
||||
celldm(1) = sqrt( dot_product (a1,a1) )
|
||||
CASE (2)
|
||||
|
@ -446,7 +439,7 @@ SUBROUTINE at2celldm (ibrav,alat,a1,a2,a3,celldm)
|
|||
celldm(1) = sqrt( dot_product (a1,a1) )
|
||||
celldm(2) = sqrt( dot_product(a2(:),a2(:)) ) / celldm(1)
|
||||
celldm(3) = sqrt( dot_product(a3(:),a3(:)) ) / celldm(1)
|
||||
IF ( jbrav == 12 ) THEN
|
||||
IF ( ibrav == 12 ) THEN
|
||||
celldm(4) = dot_product(a1(:),a2(:)) / celldm(1) / &
|
||||
sqrt(dot_product(a2(:),a2(:)))
|
||||
ELSE
|
||||
|
@ -468,7 +461,7 @@ SUBROUTINE at2celldm (ibrav,alat,a1,a2,a3,celldm)
|
|||
celldm(5) = a3(1)/a1(1)/celldm(3)/2.0_dp
|
||||
!celldm(5) = DOT_PRODUCT(a1(:),a3(:)) / &
|
||||
! SQRT(DOT_PRODUCT(a1(:),a1(:)) * DOT_PRODUCT(a3(:),a3(:)))
|
||||
CASE (0,14)
|
||||
CASE (14)
|
||||
celldm(1) = sqrt(dot_product(a1(:),a1(:)))
|
||||
celldm(2) = sqrt( dot_product(a2(:),a2(:))) / celldm(1)
|
||||
celldm(3) = sqrt( dot_product(a3(:),a3(:))) / celldm(1)
|
||||
|
@ -482,8 +475,6 @@ SUBROUTINE at2celldm (ibrav,alat,a1,a2,a3,celldm)
|
|||
CALL infomsg('at2celldm', 'wrong ibrav?')
|
||||
END SELECT
|
||||
!
|
||||
IF ( alat > 0.0_dp) celldm(1) = celldm(1)*alat
|
||||
!
|
||||
END SUBROUTINE at2celldm
|
||||
!
|
||||
INTEGER FUNCTION at2ibrav (a1, a2, a3) RESULT (ibrav)
|
||||
|
|
|
@ -641,7 +641,8 @@ PROGRAM plotband
|
|||
WRITE (1,'(a)') "set title '"//trim(filename)//"_projected' noenhanced"
|
||||
WRITE (1,'(a,f12.6,a)') &
|
||||
&"plot '"//trim(filenamegnu)//&
|
||||
&"' u 1:($2 - ",eref,"):3 w l palette lw 1 notitle, \"
|
||||
&"' u 1:($2 - ",eref,"):3 w l palette lw 1 notitle, "//CHAR(91)
|
||||
! char(91) = backslash; syntax "something \" confuses the PGI compiler
|
||||
WRITE (1,'(f12.6,a)') &
|
||||
&Ef-eref," lt 2 lw 0.5 lc rgb 'grey50' notitle"
|
||||
CLOSE (unit=1)
|
||||
|
|
|
@ -1203,7 +1203,7 @@ MODULE pw_restart_new
|
|||
!! if ibrav is present, cell parameters were computed by subroutine
|
||||
!! "latgen" using ibrav and celldm parameters: recalculate celldm
|
||||
!
|
||||
CALL at2celldm (ibrav,1.0_dp,at(:,1),at(:,2),at(:,3),celldm)
|
||||
CALL at2celldm (ibrav,alat,at(:,1),at(:,2),at(:,3),celldm)
|
||||
!
|
||||
tpiba = tpi/alat
|
||||
tpiba2= tpiba**2
|
||||
|
|
Loading…
Reference in New Issue