mirror of https://gitlab.com/QEF/q-e.git
EPW: support for cartesian coordinates in fine grid files
This commit is contained in:
parent
a2b77998da
commit
ea3e6b4db8
|
@ -70,14 +70,20 @@
|
||||||
!! weights k-points
|
!! weights k-points
|
||||||
REAL(KIND = DP), ALLOCATABLE :: wkf_tmp(:)
|
REAL(KIND = DP), ALLOCATABLE :: wkf_tmp(:)
|
||||||
!! Temporary weights
|
!! Temporary weights
|
||||||
|
CHARACTER(LEN = 10) :: coordinate_type
|
||||||
|
!! filkf coordinate type (crystal or cartesian)
|
||||||
|
LOGICAL, EXTERNAL :: imatches
|
||||||
!
|
!
|
||||||
IF (mpime == ionode_id) THEN
|
IF (mpime == ionode_id) THEN
|
||||||
IF (filkf /= '') THEN ! load from file (crystal coordinates)
|
IF (filkf /= '') THEN ! load from file
|
||||||
!
|
!
|
||||||
WRITE(stdout, *) ' Using k-mesh file: ', TRIM(filkf)
|
WRITE(stdout, *) ' Using k-mesh file: ', TRIM(filkf)
|
||||||
OPEN(UNIT = iunkf, FILE = filkf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
OPEN(UNIT = iunkf, FILE = filkf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
||||||
IF (ios /= 0) CALL errore('loadkmesh_para', 'opening file ' // filkf, ABS(ios))
|
IF (ios /= 0) CALL errore('loadkmesh_para', 'opening file ' // filkf, ABS(ios))
|
||||||
READ(iunkf, *) nkqtotf
|
READ(iunkf, FMT='(I, A)') nkqtotf, coordinate_type
|
||||||
|
IF ( TRIM(coordinate_type) .EQ. ' ') coordinate_type = 'crystal'
|
||||||
|
IF (.NOT.imatches("crystal", coordinate_type) .AND. .NOT.imatches("cartesian", coordinate_type)) &
|
||||||
|
CALL errore('loadkmesh_para', 'ERROR: Specify either crystal or cartesian coordinates in the filkf file', 1)
|
||||||
!
|
!
|
||||||
ALLOCATE(xkf_(3, 2 * nkqtotf), STAT = ierr)
|
ALLOCATE(xkf_(3, 2 * nkqtotf), STAT = ierr)
|
||||||
IF (ierr /= 0) CALL errore('loadkmesh_para', 'Error allocating xkf_', 1)
|
IF (ierr /= 0) CALL errore('loadkmesh_para', 'Error allocating xkf_', 1)
|
||||||
|
@ -94,15 +100,14 @@
|
||||||
! SP: This is so we can input a weight of 1 to random file
|
! SP: This is so we can input a weight of 1 to random file
|
||||||
! This way you can feed the same file for the k and q grid
|
! This way you can feed the same file for the k and q grid
|
||||||
wkf_(ikk) = wkf_(ikk) * 2.d0
|
wkf_(ikk) = wkf_(ikk) * 2.d0
|
||||||
!
|
|
||||||
! bring the k point to crystal coordinates
|
|
||||||
! CALL cryst_to_cart( 1, xkf_ (:,ikk), at, -1)
|
|
||||||
!
|
|
||||||
xkf_(:, ikq) = xkf_(:, ikk)
|
xkf_(:, ikq) = xkf_(:, ikk)
|
||||||
wkf_(ikq) = 0.d0
|
wkf_(ikq) = 0.d0
|
||||||
!
|
!
|
||||||
ENDDO
|
ENDDO
|
||||||
CLOSE(iunkf)
|
CLOSE(iunkf)
|
||||||
|
IF (imatches("cartesian", coordinate_type)) THEN
|
||||||
|
CALL cryst_to_cart(nkqtotf, xkf_, at, -1)
|
||||||
|
ENDIF
|
||||||
!
|
!
|
||||||
! redefine nkqtotf to include the k+q points
|
! redefine nkqtotf to include the k+q points
|
||||||
!
|
!
|
||||||
|
@ -374,16 +379,23 @@
|
||||||
!! coordinates k-points
|
!! coordinates k-points
|
||||||
REAL(KIND = DP), ALLOCATABLE :: wkf_tmp(:)
|
REAL(KIND = DP), ALLOCATABLE :: wkf_tmp(:)
|
||||||
!! weights k-points
|
!! weights k-points
|
||||||
|
CHARACTER(LEN = 10) :: coordinate_type
|
||||||
|
!! filkf coordinate type (crystal or cartesian)
|
||||||
|
LOGICAL, EXTERNAL :: imatches
|
||||||
!
|
!
|
||||||
IF (mpime == ionode_id) THEN
|
IF (mpime == ionode_id) THEN
|
||||||
IF (filkf /= '') THEN ! load from file (crystal coordinates)
|
IF (filkf /= '') THEN ! load from file
|
||||||
!
|
!
|
||||||
! Each pool gets its own copy from the action=read statement
|
! Each pool gets its own copy from the action=read statement
|
||||||
!
|
!
|
||||||
WRITE(stdout, *) ' Using k-mesh file: ', TRIM(filkf)
|
WRITE(stdout, *) ' Using k-mesh file: ', TRIM(filkf)
|
||||||
OPEN(UNIT = iunkf, FILE = filkf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
OPEN(UNIT = iunkf, FILE = filkf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
||||||
IF (ios /= 0) CALL errore('loadkmesh_serial', 'opening file ' // filkf, ABS(ios))
|
IF (ios /= 0) CALL errore('loadkmesh_serial', 'opening file ' // filkf, ABS(ios))
|
||||||
READ(iunkf, *) nkqtotf
|
READ(iunkf, FMT='(I, A)') nkqtotf, coordinate_type
|
||||||
|
IF ( TRIM(coordinate_type) .EQ. ' ') coordinate_type = 'crystal'
|
||||||
|
IF (.NOT.imatches("crystal", coordinate_type) .AND. .NOT.imatches("cartesian", coordinate_type)) &
|
||||||
|
CALL errore('loadkmesh_serial', 'ERROR: Specify either crystal or cartesian coordinates in the filkf file', 1)
|
||||||
|
!
|
||||||
ALLOCATE(xkf(3, 2 * nkqtotf), STAT = ierr)
|
ALLOCATE(xkf(3, 2 * nkqtotf), STAT = ierr)
|
||||||
IF (ierr /= 0) CALL errore('loadkmesh_serial', 'Error allocating xkf', 1)
|
IF (ierr /= 0) CALL errore('loadkmesh_serial', 'Error allocating xkf', 1)
|
||||||
ALLOCATE(wkf(2 * nkqtotf), STAT = ierr)
|
ALLOCATE(wkf(2 * nkqtotf), STAT = ierr)
|
||||||
|
@ -398,15 +410,14 @@
|
||||||
! SP: This is so we can input a weight of 1 to random file
|
! SP: This is so we can input a weight of 1 to random file
|
||||||
! This way you can feed the same file for the k and q grid
|
! This way you can feed the same file for the k and q grid
|
||||||
wkf(ikk) = wkf(ikk) * 2.d0
|
wkf(ikk) = wkf(ikk) * 2.d0
|
||||||
!
|
|
||||||
! bring the k point to crystal coordinates
|
|
||||||
! CALL cryst_to_cart( 1, xkf_ (:,ikk), at, -1)
|
|
||||||
!
|
|
||||||
xkf(:, ikq) = xkf(:, ikk)
|
xkf(:, ikq) = xkf(:, ikk)
|
||||||
wkf(ikq) = 0.d0
|
wkf(ikq) = 0.d0
|
||||||
!
|
!
|
||||||
ENDDO
|
ENDDO
|
||||||
CLOSE(iunkf)
|
CLOSE(iunkf)
|
||||||
|
IF (imatches("cartesian", coordinate_type)) THEN
|
||||||
|
CALL cryst_to_cart(nkqtotf, xkf, at, -1)
|
||||||
|
ENDIF
|
||||||
!
|
!
|
||||||
! redefine nkqtotf to include the k+q points
|
! redefine nkqtotf to include the k+q points
|
||||||
!
|
!
|
||||||
|
@ -906,15 +917,21 @@
|
||||||
!! Temporary q-point
|
!! Temporary q-point
|
||||||
REAL(KIND = DP), ALLOCATABLE :: wqf_(:)
|
REAL(KIND = DP), ALLOCATABLE :: wqf_(:)
|
||||||
!! Temporary weight of q-point
|
!! Temporary weight of q-point
|
||||||
|
CHARACTER(LEN = 10) :: coordinate_type
|
||||||
|
!! filqf coordinate type (crystal or cartesian)
|
||||||
|
LOGICAL, EXTERNAL :: imatches
|
||||||
!
|
!
|
||||||
IF (mpime == ionode_id) THEN
|
IF (mpime == ionode_id) THEN
|
||||||
IF (filqf /= '') THEN ! load from file (crystal coordinates)
|
IF (filqf /= '') THEN ! load from file
|
||||||
!
|
!
|
||||||
WRITE(stdout, *) ' Using q-mesh file: ', TRIM(filqf)
|
WRITE(stdout, *) ' Using q-mesh file: ', TRIM(filqf)
|
||||||
IF (lscreen) WRITE(stdout, *) ' WARNING: if lscreen=.TRUE., q-mesh needs to be [-0.5:0.5] (crystal)'
|
IF (lscreen) WRITE(stdout, *) ' WARNING: if lscreen=.TRUE., q-mesh needs to be [-0.5:0.5] (crystal)'
|
||||||
OPEN(UNIT = iunqf, FILE = filqf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
OPEN(UNIT = iunqf, FILE = filqf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
||||||
IF (ios /= 0) CALL errore('loadkmesh_para', 'Opening file ' // filqf, ABS(ios))
|
IF (ios /= 0) CALL errore('loadkmesh_para', 'Opening file ' // filqf, ABS(ios))
|
||||||
READ(iunqf, *) nqtotf
|
READ(iunqf, FMT='(I, A)') nqtotf, coordinate_type
|
||||||
|
IF ( TRIM(coordinate_type) .EQ. ' ') coordinate_type = 'crystal'
|
||||||
|
IF (.NOT.imatches("crystal", coordinate_type) .AND. .NOT.imatches("cartesian", coordinate_type)) &
|
||||||
|
CALL errore('loadqmesh_para', 'ERROR: Specify either crystal or cartesian coordinates in the filqf file', 1)
|
||||||
!
|
!
|
||||||
ALLOCATE(xqf_(3, nqtotf), STAT = ierr)
|
ALLOCATE(xqf_(3, nqtotf), STAT = ierr)
|
||||||
IF (ierr /= 0) CALL errore('loadqmesh_para', 'Error allocating xqf_', 1)
|
IF (ierr /= 0) CALL errore('loadqmesh_para', 'Error allocating xqf_', 1)
|
||||||
|
@ -927,6 +944,9 @@
|
||||||
!
|
!
|
||||||
ENDDO
|
ENDDO
|
||||||
CLOSE(iunqf)
|
CLOSE(iunqf)
|
||||||
|
IF (imatches("cartesian", coordinate_type)) THEN
|
||||||
|
CALL cryst_to_cart(nqtotf, xqf_, at, -1)
|
||||||
|
ENDIF
|
||||||
!
|
!
|
||||||
ELSEIF ((nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0)) THEN ! generate grid
|
ELSEIF ((nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0)) THEN ! generate grid
|
||||||
IF (mp_mesh_q) THEN
|
IF (mp_mesh_q) THEN
|
||||||
|
@ -1104,9 +1124,12 @@
|
||||||
!! Status integer
|
!! Status integer
|
||||||
INTEGER :: ierr
|
INTEGER :: ierr
|
||||||
!! Error status
|
!! Error status
|
||||||
|
CHARACTER(LEN = 10) :: coordinate_type
|
||||||
|
!! filqf coordinate type (crystal or cartesian)
|
||||||
|
LOGICAL, EXTERNAL :: imatches
|
||||||
!
|
!
|
||||||
IF (mpime == ionode_id) THEN
|
IF (mpime == ionode_id) THEN
|
||||||
IF (filqf /= '') THEN ! load from file (crystal coordinates)
|
IF (filqf /= '') THEN ! load from file
|
||||||
!
|
!
|
||||||
! Each pool gets its own copy from the action=read statement
|
! Each pool gets its own copy from the action=read statement
|
||||||
!
|
!
|
||||||
|
@ -1114,18 +1137,25 @@
|
||||||
IF (lscreen) WRITE(stdout, *) ' WARNING: if lscreen=.TRUE., q-mesh needs to be [-0.5:0.5] (crystal)'
|
IF (lscreen) WRITE(stdout, *) ' WARNING: if lscreen=.TRUE., q-mesh needs to be [-0.5:0.5] (crystal)'
|
||||||
OPEN(UNIT = iunqf, FILE = filqf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
OPEN(UNIT = iunqf, FILE = filqf, STATUS = 'old', FORM = 'formatted', IOSTAT = ios)
|
||||||
IF (ios /= 0) CALL errore('loadqmesh_serial', 'opening file ' // filqf, ABS(ios))
|
IF (ios /= 0) CALL errore('loadqmesh_serial', 'opening file ' // filqf, ABS(ios))
|
||||||
READ(iunqf, *) nqtotf
|
READ(iunqf, FMT='(I, A)') nqtotf, coordinate_type
|
||||||
|
IF ( TRIM(coordinate_type) .EQ. ' ') coordinate_type = 'crystal'
|
||||||
|
IF (.NOT.imatches("crystal", coordinate_type) .AND. .NOT.imatches("cartesian", coordinate_type)) &
|
||||||
|
CALL errore('loadqmesh_serial', 'ERROR: Specify either crystal or cartesian coordinates in the filqf file', 1)
|
||||||
|
!
|
||||||
ALLOCATE(xqf(3, nqtotf), STAT = ierr)
|
ALLOCATE(xqf(3, nqtotf), STAT = ierr)
|
||||||
IF (ierr /= 0) CALL errore('loadqmesh_serial', 'Error allocating xqf', 1)
|
IF (ierr /= 0) CALL errore('loadqmesh_serial', 'Error allocating xqf', 1)
|
||||||
ALLOCATE(wqf(nqtotf), STAT = ierr)
|
ALLOCATE(wqf(nqtotf), STAT = ierr)
|
||||||
IF (ierr /= 0) CALL errore('loadqmesh_serial', 'Error allocating wqf', 1)
|
IF (ierr /= 0) CALL errore('loadqmesh_serial', 'Error allocating wqf', 1)
|
||||||
|
!
|
||||||
DO iq = 1, nqtotf
|
DO iq = 1, nqtotf
|
||||||
|
!
|
||||||
READ (iunqf, *) xqf(:, iq), wqf(iq)
|
READ (iunqf, *) xqf(:, iq), wqf(iq)
|
||||||
|
!
|
||||||
ENDDO
|
ENDDO
|
||||||
CLOSE(iunqf)
|
CLOSE(iunqf)
|
||||||
!
|
IF (imatches("cartesian", coordinate_type)) THEN
|
||||||
! bring xqf in crystal coordinates
|
CALL cryst_to_cart(nqtotf, xqf, at, -1)
|
||||||
! CALL cryst_to_cart(nqtotf, xqf, at, -1)
|
ENDIF
|
||||||
!
|
!
|
||||||
ELSEIF ((nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0)) THEN ! generate grid
|
ELSEIF ((nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0)) THEN ! generate grid
|
||||||
IF (mp_mesh_q) THEN
|
IF (mp_mesh_q) THEN
|
||||||
|
|
Loading…
Reference in New Issue