mirror of https://gitlab.com/QEF/q-e.git
A bug with memory allocation leading to the crash in some cases is fixed (A. Smogunov)
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@3894 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
4e98f3c84f
commit
59ac7f2777
|
@ -248,6 +248,20 @@ ELSE
|
|||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF (lwrite_cond) then
|
||||
call save_cond (.true.,1,efl,nrzl,nocrosl,noinsl, &
|
||||
norbl,rl,rabl,betarl)
|
||||
if(ikind.gt.0) call save_cond (.true.,2,efs,nrzs,-1, &
|
||||
noinss,norbs,rs,rabs,betars)
|
||||
if(ikind.gt.1) call save_cond (.true.,3,efr,nrzr,nocrosr,&
|
||||
noinsr,norbr,rr,rabr,betarr)
|
||||
write(stdout,*) 'information needed for PWCOND has been written in file'
|
||||
CALL stop_clock('init')
|
||||
CALL print_clock_pwcond()
|
||||
CALL stop_clock('PWCOND')
|
||||
return
|
||||
endif
|
||||
|
||||
IF (lorb.and.okvan) call errore('do_cond','lorb not working with US-PP',1)
|
||||
#ifdef __PARA
|
||||
IF (lorb) call errore('do_cond','lorb not working in parallel',1)
|
||||
|
@ -266,16 +280,6 @@ IF (nkpts==0) THEN
|
|||
CALL mp_bcast( wkpt, ionode_id )
|
||||
ENDIF
|
||||
|
||||
|
||||
IF (lwrite_cond) then
|
||||
call save_cond (.true.,1,efl,nrzl,nocrosl,noinsl, &
|
||||
norbl,rl,rabl,betarl)
|
||||
if(ikind.gt.0) call save_cond (.true.,2,efs,nrzs,-1, &
|
||||
noinss,norbs,rs,rabs,betars)
|
||||
if(ikind.gt.1) call save_cond (.true.,3,efr,nrzr,nocrosr,&
|
||||
noinsr,norbr,rr,rabr,betarr)
|
||||
endif
|
||||
|
||||
CALL cond_out
|
||||
|
||||
CALL stop_clock('init')
|
||||
|
|
|
@ -55,32 +55,44 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
allocate( taunew(4,norb) )
|
||||
allocate( tblm(4,norb) )
|
||||
allocate( cros(norb, nrz) )
|
||||
if (noncolin) then
|
||||
allocate(zpseu_nc(2, norb, norb, nspin))
|
||||
else
|
||||
allocate( zpseu(2, norb, norb) )
|
||||
if (noncolin) allocate(zpseu_nc(2, norb, norb, nspin))
|
||||
endif
|
||||
if(lsr.eq.1) then
|
||||
vppot = vppotl
|
||||
z = zl
|
||||
taunew = taunewl
|
||||
tblm = tblml
|
||||
cros = crosl
|
||||
if (noncolin) then
|
||||
zpseu_nc = zpseul_nc
|
||||
else
|
||||
zpseu = zpseul
|
||||
if (noncolin) zpseu_nc = zpseul_nc
|
||||
endif
|
||||
elseif(lsr.eq.2) then
|
||||
vppot = vppots
|
||||
z = zs
|
||||
taunew = taunews
|
||||
tblm = tblms
|
||||
cros = cross
|
||||
if (noncolin) then
|
||||
zpseu_nc = zpseus_nc
|
||||
else
|
||||
zpseu = zpseus
|
||||
if (noncolin) zpseu_nc = zpseus_nc
|
||||
endif
|
||||
elseif(lsr.eq.3) then
|
||||
vppot = vppotr
|
||||
z = zr
|
||||
taunew = taunewr
|
||||
tblm = tblmr
|
||||
cros = crosr
|
||||
if (noncolin) then
|
||||
zpseu_nc = zpseur_nc
|
||||
else
|
||||
zpseu = zpseur
|
||||
if (noncolin) zpseu_nc = zpseur_nc
|
||||
endif
|
||||
endif
|
||||
open (3,file=trim(save_file)//ext,form='formatted', &
|
||||
status='unknown')
|
||||
|
@ -97,6 +109,12 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
write(3,'(120i1)') ((cros(j,i),i=1,nrz),j=1,norb)
|
||||
write(3,'(6f20.14)') ((taunew(i,j),i=1,4),j=1,norb)
|
||||
! write zpseu
|
||||
if(noncolin) then
|
||||
write(3,'(6f20.14)') (((( DBLE(zpseu_nc(i,j,k,l)),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
write(3,'(6f20.14)') ((((AIMAG(zpseu_nc(i,j,k,l)),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
else
|
||||
allocate( ind(3,2*norb*norb) )
|
||||
allocate( c(2*norb*norb) )
|
||||
m=0
|
||||
|
@ -118,11 +136,6 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
write(3,'(6f20.14)') (c(i),i=1,m)
|
||||
deallocate(ind)
|
||||
deallocate(c)
|
||||
if(noncolin) then
|
||||
write(3,'(6f20.14)') (((( DBLE(zpseu_nc(i,j,k,l)),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
write(3,'(6f20.14)') ((((AIMAG(zpseu_nc(i,j,k,l)),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
endif
|
||||
write(3,'(6f20.14)') (z(i), i=1, nrz+1)
|
||||
write(3,'(6f20.14)') (((( DBLE(vppot(i,j,k,l)),i=1,nrz), &
|
||||
|
@ -207,12 +220,26 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
allocate( taunew(4,norb) )
|
||||
allocate( tblm(4,norb) )
|
||||
allocate( cros(norb, nrz) )
|
||||
if (noncolin) then
|
||||
allocate(zpseu_nc(2, norb, norb, nspin))
|
||||
else
|
||||
allocate( zpseu(2, norb, norb) )
|
||||
if (noncolin) allocate(zpseu_nc(2, norb, norb, nspin))
|
||||
endif
|
||||
read(3,'(40i3)') ((tblm(i,j),i=1,4),j=1,norb)
|
||||
read(3,'(120i1)') ((cros(j,i),i=1,nrz),j=1,norb)
|
||||
read(3,'(6f20.14)') ((taunew(i,j),i=1,4),j=1,norb)
|
||||
! read zpseu
|
||||
if(noncolin) then
|
||||
allocate ( re(2,norb,norb,nspin) )
|
||||
allocate ( im(2,norb,norb,nspin) )
|
||||
read(3,'(6f20.14)') ((((re(i,j,k,l),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
read(3,'(6f20.14)') ((((im(i,j,k,l),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
zpseu_nc = CMPLX(re,im)
|
||||
deallocate(re)
|
||||
deallocate(im)
|
||||
else
|
||||
read(3,*) m
|
||||
allocate( ind(3,m) )
|
||||
allocate( c(m) )
|
||||
|
@ -224,17 +251,8 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
enddo
|
||||
deallocate(ind)
|
||||
deallocate(c)
|
||||
if(noncolin) then
|
||||
allocate ( re(2,norb,norb,nspin) )
|
||||
allocate ( im(2,norb,norb,nspin) )
|
||||
read(3,'(6f20.14)') ((((re(i,j,k,l),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
read(3,'(6f20.14)') ((((im(i,j,k,l),i=1,2), &
|
||||
j=1,norb),k=1,norb),l=1,nspin)
|
||||
zpseu_nc = CMPLX(re,im)
|
||||
deallocate(re)
|
||||
deallocate(im)
|
||||
endif
|
||||
!-------------
|
||||
read(3,'(6f20.14)') (z(i), i=1, nrz+1)
|
||||
allocate ( re(nrz,nrx*nry,npol,npol) )
|
||||
allocate ( im(nrz,nrx*nry,npol,npol) )
|
||||
|
@ -288,45 +306,63 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
allocate( taunewl(4,norb) )
|
||||
allocate( tblml(4,norb) )
|
||||
allocate( crosl(norb, nrz) )
|
||||
if (noncolin) then
|
||||
allocate(zpseul_nc(2, norb, norb, nspin))
|
||||
else
|
||||
allocate( zpseul(2, norb, norb) )
|
||||
if (noncolin) allocate(zpseul_nc(2, norb, norb, nspin))
|
||||
endif
|
||||
vppotl = vppot
|
||||
zl = z
|
||||
taunewl = taunew
|
||||
tblml = tblm
|
||||
crosl = cros
|
||||
if (noncolin) then
|
||||
zpseul_nc = zpseu_nc
|
||||
else
|
||||
zpseul = zpseu
|
||||
if (noncolin) zpseul_nc = zpseu_nc
|
||||
endif
|
||||
elseif(lsr.eq.2) then
|
||||
allocate( vppots(nrz, nrx * nry, npol, npol) )
|
||||
allocate( zs(nrz+1) )
|
||||
allocate( taunews(4,norb) )
|
||||
allocate( tblms(4,norb) )
|
||||
allocate( cross(norb, nrz) )
|
||||
if (noncolin) then
|
||||
allocate(zpseus_nc(2, norb, norb, nspin))
|
||||
else
|
||||
allocate( zpseus(2, norb, norb) )
|
||||
if (noncolin) allocate(zpseus_nc(2, norb, norb, nspin))
|
||||
endif
|
||||
vppots = vppot
|
||||
zs = z
|
||||
taunews = taunew
|
||||
tblms = tblm
|
||||
cross = cros
|
||||
if (noncolin) then
|
||||
zpseus_nc = zpseu_nc
|
||||
else
|
||||
zpseus = zpseu
|
||||
if (noncolin) zpseus_nc = zpseu_nc
|
||||
endif
|
||||
elseif(lsr.eq.3) then
|
||||
allocate( vppotr(nrz, nrx * nry, npol, npol) )
|
||||
allocate( zr(nrz+1) )
|
||||
allocate( taunewr(4,norb) )
|
||||
allocate( tblmr(4,norb) )
|
||||
allocate( crosr(norb, nrz) )
|
||||
if (noncolin) then
|
||||
allocate(zpseur_nc(2, norb, norb, nspin))
|
||||
else
|
||||
allocate( zpseur(2, norb, norb) )
|
||||
if (noncolin) allocate(zpseur_nc(2, norb, norb, nspin))
|
||||
endif
|
||||
vppotr = vppotr
|
||||
zr = z
|
||||
taunewr = taunew
|
||||
tblmr = tblm
|
||||
crosr = cros
|
||||
if (noncolin) then
|
||||
zpseur_nc = zpseu_nc
|
||||
else
|
||||
zpseur = zpseu
|
||||
if (noncolin) zpseur_nc = zpseu_nc
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -335,8 +371,11 @@ subroutine save_cond (lwrite, lsr, ef, nrz, nocros, noins, &
|
|||
deallocate( taunew )
|
||||
deallocate( tblm )
|
||||
deallocate( cros )
|
||||
if (noncolin) then
|
||||
deallocate(zpseu_nc)
|
||||
else
|
||||
deallocate( zpseu )
|
||||
if (noncolin) deallocate(zpseu_nc)
|
||||
endif
|
||||
|
||||
call stop_clock('save_cond')
|
||||
|
||||
|
|
Loading…
Reference in New Issue