Wavefunctions in the noncolinear case were written (in the "collected" format)

as two files, one for up spin components and one for down spin components.
This seems to me meaningless. Now they are written as a single file.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12877 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2016-08-29 16:25:46 +00:00
parent 810c831fa3
commit 721fee214f
2 changed files with 70 additions and 97 deletions

View File

@ -60,7 +60,7 @@ MODULE io_base
INTEGER, INTENT(IN) :: root_in_group, intra_group_comm
!
INTEGER :: j, ierr
INTEGER :: igwx
INTEGER :: igwx, npwx, npol
INTEGER :: me_in_group, nproc_in_group, my_group
COMPLEX(DP), ALLOCATABLE :: wtmp(:)
!
@ -74,7 +74,10 @@ MODULE io_base
!
igwx = MAXVAL( igl(1:ngwl) )
CALL mp_max( igwx, intra_group_comm )
ALLOCATE( wtmp( MAX( igwx, 1 ) ) )
npol = 1
IF ( nspin == 4 ) npol = 2
npwx = SIZE( wfc, 1 ) / npol
ALLOCATE( wtmp( MAX( npol*igwx, 1 ) ) )
!
wtmp = 0.0_DP
!
@ -115,14 +118,28 @@ MODULE io_base
!
DO j = 1, nbnd
!
CALL mergewf( wfc(:,j), wtmp, ngwl, igl, me_in_group, &
nproc_in_group, root_in_group, intra_group_comm )
IF ( npol == 2 ) THEN
!
! Quick-and-dirty noncolinear case - mergewf should be modified
!
CALL mergewf( wfc(1:npwx, j), wtmp(1:igwx), ngwl, igl,&
me_in_group, nproc_in_group, root_in_group, intra_group_comm )
CALL mergewf( wfc(npwx+1:2*npwx,j), wtmp(igwx+1:2*igwx), ngwl, igl,&
me_in_group, nproc_in_group, root_in_group, intra_group_comm )
!
ELSE
!
CALL mergewf( wfc(:,j), wtmp, ngwl, igl, me_in_group, &
nproc_in_group, root_in_group, intra_group_comm )
!
END IF
!
IF ( ionode_in_group ) &
#ifdef __HDF5
CALL write_evc(evc_hdf5_write,j, wtmp(1:igwx), ik)
CALL write_evc(evc_hdf5_write,j, wtmp(1:npol*igwx), ik)
#else
CALL iotk_write_dat( iuni, "evc" // iotk_index( j ), wtmp(1:igwx) )
CALL iotk_write_dat &
( iuni, "evc" // iotk_index( j ), wtmp(1:npol*igwx))
#endif
!
END DO
@ -168,7 +185,7 @@ MODULE io_base
INTEGER :: j
COMPLEX(DP), ALLOCATABLE :: wtmp(:)
INTEGER :: ierr
INTEGER :: igwx, igwx_, ik_, nk_
INTEGER :: igwx, igwx_, npwx, npol, ik_, nk_
INTEGER :: me_in_group, nproc_in_group
CHARACTER(LEN=256) :: filename_hdf5
!
@ -228,7 +245,10 @@ MODULE io_base
CALL mp_bcast( igwx_, root_in_group, intra_group_comm )
CALL mp_bcast( scalef, root_in_group, intra_group_comm )
!
ALLOCATE( wtmp( MAX( igwx_, igwx ) ) )
npol = 1
IF ( nspin == 4 ) npol = 2
ALLOCATE( wtmp( npol*MAX( igwx_, igwx ) ) )
npwx = SIZE( wfc, 1 ) / npol
!
DO j = 1, nbnd
!
@ -236,19 +256,28 @@ MODULE io_base
!
IF ( ionode_in_group ) THEN
#if defined __HDF5
CALL read_evc(evc_hdf5_write,j,wtmp(1:igwx_),ik)
CALL read_evc(evc_hdf5_write,j,wtmp(1:npol*igwx_),ik)
#else
CALL iotk_scan_dat( iuni, &
"evc" // iotk_index( j ), wtmp(1:igwx_) )
"evc" // iotk_index(j), wtmp(1:npol*igwx_) )
#endif
!
IF ( igwx > igwx_ ) wtmp((igwx_+1):igwx) = 0.0_DP
IF ( igwx > igwx_ ) wtmp((npol*igwx_+1):npol*igwx) = 0.0_DP
!
END IF
!
CALL splitwf( wfc(:,j), wtmp, ngwl, igl, &
me_in_group, nproc_in_group, root_in_group, intra_group_comm )
IF ( npol == 2 ) THEN
CALL splitwf( wfc(1:npwx, j), wtmp(1:igwx_ ), &
ngwl, igl, me_in_group, nproc_in_group, root_in_group, &
intra_group_comm )
CALL splitwf( wfc(npwx+1:2*npwx,j), wtmp(igwx_+1:2*igwx_), &
ngwl, igl, me_in_group, nproc_in_group, root_in_group, &
intra_group_comm )
ELSE
CALL splitwf( wfc(:,j), wtmp, ngwl, igl, me_in_group, &
nproc_in_group, root_in_group, intra_group_comm )
END IF
!
END IF
!

View File

@ -1,4 +1,4 @@
!initialize_hdf5
!
! Copyright (C) 2016 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
@ -653,7 +653,7 @@ MODULE pw_restart_new
!
DEALLOCATE( itmp )
!
IF ( ionode ) THEN
IF ( ionode_k ) THEN
!
filename_hdf5=trim(tmp_dir) //"gk.hdf5"
CALL prepare_for_writing_final(gk_hdf5_write,inter_pool_comm,filename_hdf5,ik)
@ -739,7 +739,7 @@ MODULE pw_restart_new
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: iun, ik, ik_g
LOGICAL :: ionode_k
LOGICAL, INTENT(IN) :: ionode_k
!
INTEGER :: ispin, ik_s, ik_eff
!
@ -777,35 +777,18 @@ MODULE pw_restart_new
ionode_k, root_pool, intra_pool_comm )
!
ELSE
!
filename = TRIM(dirname)//'/wfc'//TRIM(int_to_char(ik_g))//'.dat'
ispin = 1
!
IF ( noncolin ) THEN
!
DO ipol = 1, npol
!
IF ( ipol == 1 ) THEN
filename = TRIM(dirname)//'/wfcup'//TRIM(int_to_char(ik_g))//'.dat'
ELSE
filename = TRIM(dirname)//'/wfcdw'//TRIM(int_to_char(ik_g))//'.dat'
END IF
!
! TEMP spin-up and spin-down spinor components are written
! TEMP to different files, like in LSDA - not a smart way
!
nkl=(ipol-1)*npwx+1
nkr= ipol *npwx
CALL write_wfc( iun, ik_g, nkstot, ipol, npol, &
evc(nkl:nkr,:), npw_g, gamma_only, nbnd, &
igk_l2g_kdip(:), ngk(ik), filename, 1.D0, &
ionode_k, root_pool, intra_pool_comm )
!
END DO
!
!
CALL write_wfc( iun, ik_g, nkstot, ispin, 4, &
evc, npw_g, gamma_only, nbnd, &
igk_l2g_kdip(:), ngk(ik), filename, 1.D0, &
ionode_k, root_pool, intra_pool_comm )
ELSE
!
ispin = 1
!
IF ( ionode_k ) filename = TRIM(dirname)//'/wfc'//TRIM(int_to_char(ik_g))//'.dat'
!
CALL write_wfc( iun, ik_g, nkstot, ispin, nspin, &
evc, npw_g, gamma_only, nbnd, &
@ -2220,7 +2203,7 @@ MODULE pw_restart_new
!
CHARACTER(LEN=320) :: filename
INTEGER :: ik, ik_g, ig, ipol, ik_eff, ik_s, num_k_points
INTEGER :: nkl, nkr, npwx_g
INTEGER :: npol_, npwx_g
INTEGER :: nupdwn(2), ike, iks, npw_g, ispin
INTEGER, ALLOCATABLE :: ngk_g(:)
INTEGER, ALLOCATABLE :: igk_l2g(:,:), igk_l2g_kdip(:)
@ -2307,24 +2290,14 @@ MODULE pw_restart_new
! ... no need to read isk here: they are read from band structure
! ... and correctly distributed across pools in read_file
!
#ifdef __HDF5
CALL read_wfc( iunpun, ik_g, nkstot, ispin, nspin, &
evc, npw_g, nbnd, igk_l2g_kdip(:), &
ngk(ik), filename, scalef, &
ionode, root_pool, intra_pool_comm )
!
#else
!
IF ( ionode_k ) filename = TRIM(dirname)//'/wfcup'//TRIM(int_to_char(ik_g))//'.dat'
!
#ifndef __HDF5
filename = TRIM(dirname)//'/wfcup'//TRIM(int_to_char(ik_g))//'.dat'
#endif
CALL read_wfc( iunpun, ik_g, nkstot, ispin, nspin, &
evc, npw_g, nbnd, igk_l2g_kdip(:), &
ngk(ik), filename, scalef, &
ionode_k, root_pool, intra_pool_comm )
!
#endif
CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
!
! ... spin down
@ -2334,57 +2307,28 @@ MODULE pw_restart_new
evc=(0.0_DP, 0.0_DP)
!
ik_eff = ik_g + nkstot/2 ! FIXME: global index for spin down
#ifdef __HDF5
CALL read_wfc( iunpun, ik_eff, nkstot, ispin, nspin, &
evc, npw_g, nbnd, igk_l2g_kdip(:), &
ngk(ik_s), filename, scalef, &
ionode, root_pool, intra_pool_comm )
#else
IF ( ionode_k ) filename = TRIM(dirname)//'/wfcdw'//TRIM(int_to_char(ik_g))//'.dat'
!
#ifndef __HDF5
filename = TRIM(dirname)//'/wfcdw'//TRIM(int_to_char(ik_g))//'.dat'
#endif
CALL read_wfc( iunpun, ik_eff, nkstot, ispin, nspin, &
evc, npw_g, nbnd, igk_l2g_kdip(:), &
ngk(ik_s), filename, scalef, &
ionode_k, root_pool, intra_pool_comm )
!
#endif
CALL save_buffer ( evc, nwordwfc, iunwfc, ik_s )
!
ELSE
!
evc=(0.0_DP, 0.0_DP)
IF ( noncolin ) THEN
!
DO ipol = 1, npol
!
IF ( ipol == 1 ) THEN
filename = TRIM(dirname)//'/wfcup'//TRIM(int_to_char(ik_g))//'.dat'
ELSE
filename = TRIM(dirname)//'/wfcdw'//TRIM(int_to_char(ik_g))//'.dat'
END IF
!
!!! TEMP
nkl=(ipol-1)*npwx+1
nkr= ipol *npwx
CALL read_wfc( iunpun, ik_g, nkstot, ispin, &
npol, evc(nkl:nkr,:), npw_g, nbnd, &
igk_l2g_kdip(:), ngk(ik), &
filename, scalef, &
ionode_k, root_pool, intra_pool_comm )
!
END DO
!
ELSE
!
IF ( ionode ) filename = TRIM(dirname)//'/wfc'//TRIM(int_to_char(ik_g))//'.dat'
!
CALL read_wfc( iunpun, ik, nkstot, ispin, nspin, &
evc, npw_g, nbnd, igk_l2g_kdip(:), &
ngk(ik), filename, scalef, &
ionode_k, root_pool, intra_pool_comm )
!
END IF
#ifndef __HDF5
filename = TRIM(dirname)//'/wfc'//TRIM(int_to_char(ik_g))//'.dat'
#endif
CALL read_wfc( iunpun, ik_g, nkstot, ispin, npol_, &
evc, npw_g, nbnd, &
igk_l2g_kdip(:), ngk(ik), filename, scalef, &
ionode_k, root_pool, intra_pool_comm )
!
IF ( .NOT. noncolin ) nspin = npol_
!
CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
!