Extention to the pp EPW script

To detect seq. calculations or parallel.
Also creation of a pointer in order to prevent a bogus out-of-bound error [P. Giannozzi].
This commit is contained in:
Samuel Ponce 2018-04-09 14:22:13 +01:00
parent ead720d9f7
commit 64e8404e65
2 changed files with 88 additions and 27 deletions

View File

@ -35,12 +35,25 @@ def hasSOC(prefix):
return lSOC
# Check if the calculation was done in sequential
def isSEQ(prefix):
fname = '_ph0/'+str(prefix)+'.dvscf'
if (os.path.isfile(fname)):
lseq = True
else:
lseq = False
return lseq
# Enter the number of irr. q-points
user_input = raw_input('Enter the prefix used for PH calculations (e.g. diam)\n')
prefix = str(user_input)
# Test if SOC
SOC = hasSOC(prefix)
# Test if seq. or parallel run
SEQ = isSEQ(prefix)
if True: # this gets the nqpt from the outputfiles
nqpt = get_nqpt(prefix)
@ -59,24 +72,49 @@ os.system('mkdir save')
for iqpt in np.arange(1,nqpt+1):
label = str(iqpt)
# Case with SOC
if SOC == 'true':
os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml')
os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml')
if (iqpt == 1):
os.system('cp _ph0/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml')
else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
# Case without SOC
if SOC == 'false':
os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label)
if (iqpt == 1):
os.system('cp _ph0/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp '+prefix+'.fc save/ifc.q2r')
else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
# Case calculation in seq.
if SEQ:
# Case with SOC
if SOC == 'true':
os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml')
os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml')
if (iqpt == 1):
os.system('cp _ph0/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml')
else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
# Case without SOC
if SOC == 'false':
os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label)
if (iqpt == 1):
os.system('cp _ph0/'+prefix+'.dvscf save/'+prefix+'.dvscf_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp '+prefix+'.fc save/ifc.q2r')
else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
else:
# Case with SOC
if SOC == 'true':
os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml')
os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml')
if (iqpt == 1):
os.system('cp _ph0/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml')
else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
# Case without SOC
if SOC == 'false':
os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label)
if (iqpt == 1):
os.system('cp _ph0/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp '+prefix+'.fc save/ifc.q2r')
else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )

View File

@ -63,7 +63,8 @@ MODULE io_base
INTEGER :: igwx, npwx, npol, j
INTEGER :: me_in_group, nproc_in_group, my_group
INTEGER, ALLOCATABLE :: itmp(:,:)
COMPLEX(DP), ALLOCATABLE :: wtmp(:)
COMPLEX(DP), ALLOCATABLE, TARGET :: wtmp(:)
COMPLEX(DP), POINTER :: wtmp2(:)
!
#if defined(__HDF5)
TYPE (qeh5_file) :: h5file
@ -136,8 +137,10 @@ MODULE io_base
!
IF ( ionode_in_group ) THEN
ALLOCATE( wtmp( MAX( npol*igwx, 1 ) ) )
IF ( npol == 2 ) wtmp2 => wtmp( igwx+1:2*igwx )
ELSE
ALLOCATE( wtmp( 1 ) )
IF ( npol == 2 ) wtmp2 => wtmp( 1:1 )
ENDIF
wtmp = 0.0_DP
!
@ -156,10 +159,16 @@ MODULE io_base
IF ( npol == 2 ) THEN
!
! Quick-and-dirty noncolinear case - mergewf should be modified
! Collect into wtmp(1:igwx) the first set of plane waves components
!
CALL mergewf( wfc(1:npwx, j), wtmp(1:igwx), ngwl, igl,&
CALL mergewf( wfc(1:npwx, j), wtmp , 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,&
!
! Collect into wtmp(igwx+1:2*igwx) the second set of plane waves
! components - pointer wtmp2 is used instead of wtmp(igwx+1:2*igwx)
! in order to avoid a bogus out-of-bound error
!
CALL mergewf( wfc(npwx+1:2*npwx,j), wtmp2, ngwl, igl,&
me_in_group, nproc_in_group, root_in_group, intra_group_comm )
!
ELSE
@ -188,6 +197,7 @@ MODULE io_base
#endif
END IF
!
IF ( npol == 2 ) NULLIFY ( wtmp2 )
DEALLOCATE( wtmp )
!
RETURN
@ -230,8 +240,9 @@ MODULE io_base
INTEGER, OPTIONAL, INTENT(OUT) :: ierr
!
INTEGER :: j
COMPLEX(DP), ALLOCATABLE :: wtmp(:)
INTEGER, ALLOCATABLE :: itmp(:,:)
COMPLEX(DP), ALLOCATABLE, TARGET :: wtmp(:)
COMPLEX(DP), POINTER :: wtmp2(:)
INTEGER :: ierr_
INTEGER :: igwx, igwx_, npwx, ik_, nbnd_
INTEGER :: me_in_group, nproc_in_group
@ -323,12 +334,14 @@ MODULE io_base
!
IF ( ionode_in_group ) THEN
ALLOCATE( wtmp( npol*MAX( igwx_, igwx ) ) )
IF ( npol == 2 ) wtmp2 => wtmp(igwx_+1:2*igwx_)
#if defined (__HDF5)
CALL qeh5_open_dataset( h5file, h5dset_wfc, ACTION = 'read', NAME = 'evc')
CALL qeh5_set_space ( h5dset_wfc, wtmp(1), RANK = 1, DIMENSIONS = [npol*igwx_], MODE = 'm')
#endif
ELSE
ALLOCATE( wtmp(1) )
IF ( npol == 2 ) wtmp2 => wtmp( 1:1 )
ENDIF
nbnd = nbnd_
DO j = 1, nbnd_
@ -348,10 +361,19 @@ MODULE io_base
END IF
!
IF ( npol == 2 ) THEN
CALL splitwf( wfc(1:npwx, j), wtmp(1:igwx_ ), &
!
! Quick-and-dirty noncolinear case - mergewf should be modified
! Collect into wtmp(1:igwx_) first set of plane wave components
!
CALL splitwf( wfc(1:npwx, j), wtmp , &
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_), &
!
! Collect into wtmp(igwx_+1:2*igwx_) the second set of plane wave
! components - instead of wtmp(igwx_+1:2*igwx_), pointer wtmp2
! is used, in order to prevent a bogus out-of-bound error
!
CALL splitwf( wfc(npwx+1:2*npwx,j), wtmp2, &
ngwl, igl, me_in_group, nproc_in_group, root_in_group, &
intra_group_comm )
ELSE
@ -372,6 +394,7 @@ MODULE io_base
#endif
END IF
!
IF ( npol == 2 ) NULLIFY ( wtmp2 )
DEALLOCATE( wtmp )
!
RETURN