Commit 39cb43ea authored by dalcorso's avatar dalcorso

Save memory in the nonmagnetic spin-orbit case. Some variables are

allocated nspin_mag.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@6079 c92efa57-630b-4861-b058-cf58834340f0
parent 558efe27
......@@ -17,10 +17,9 @@ subroutine addnlcc (imode0, drhoscf, npe)
USE cell_base, ONLY : omega, alat
use scf, only : rho, rho_core
USE gvect, ONLY : nrxx, g, ngm, nl, nrx1, nrx2, nrx3, nr1, nr2, nr3
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : nspin_lsda, nspin_gga
USE noncollin_module, ONLY : nspin_lsda, nspin_gga, nspin_mag
USE dynmat, ONLY : dyn, dyn_rec
USE modes, ONLY : nirr, npert, npertx
USE modes, ONLY : nirr, npert
USE gc_ph, ONLY: grho, dvxc_rr, dvxc_sr, dvxc_ss, dvxc_s
USE eqv, ONLY : dmuxc
USE nlcc_ph, ONLY : nlcc_any
......@@ -36,7 +35,7 @@ subroutine addnlcc (imode0, drhoscf, npe)
! input: the number of perturbations
! input: the change of density due to perturbation
complex(DP) :: drhoscf (nrxx, nspin, npe)
complex(DP) :: drhoscf (nrxx, nspin_mag, npe)
integer :: nrtot, ipert, jpert, is, is1, irr, ir, mode, mode1
! the total number of points
......@@ -46,8 +45,7 @@ subroutine addnlcc (imode0, drhoscf, npe)
! counter on real space points
! counter on modes
complex(DP) :: zdotc, dyn1 (3 * nat, 3 * nat)
! the scalar product function
complex(DP) :: dyn1 (3 * nat, 3 * nat)
! auxiliary dynamical matrix
complex(DP), allocatable :: drhoc (:), dvaux (:,:)
! the change of the core
......@@ -55,30 +53,39 @@ subroutine addnlcc (imode0, drhoscf, npe)
real(DP) :: fac
! auxiliary factor
complex(DP), external :: zdotc
! the scalar product function
if (.not.nlcc_any) return
allocate (drhoc( nrxx))
allocate (dvaux( nrxx , nspin))
allocate (dvaux( nrxx , nspin_mag))
dyn1 (:,:) = (0.d0, 0.d0)
!
! compute the exchange and correlation potential for this mode
!
!
! compute the exchange and correlation potential for this mode
!
nrtot = nr1 * nr2 * nr3
fac = 1.d0 / DBLE (nspin_lsda)
!
! add core charge to the density
!
DO is=1,nspin_lsda
rho%of_r(:,is) = rho%of_r(:,is) + fac * rho_core(:)
ENDDO
!
! Compute the change of xc potential due to the perturbation
!
do ipert = 1, npe
mode = imode0 + ipert
dvaux (:,:) = (0.d0, 0.d0)
call addcore (mode, drhoc)
do is = 1, nspin_lsda
call daxpy (nrxx, fac, rho_core, 1, rho%of_r(1, is), 1)
call daxpy (2 * nrxx, fac, drhoc, 1, drhoscf (1, is, ipert), 1)
enddo
do is = 1, nspin
do is1 = 1, nspin
do is = 1, nspin_lsda
do is1 = 1, nspin_mag
do ir = 1, nrxx
dvaux (ir, is) = dvaux (ir, is) + dmuxc (ir, is, is1) * &
drhoscf ( ir, is1, ipert)
......@@ -92,9 +99,8 @@ subroutine addnlcc (imode0, drhoscf, npe)
if ( dft_is_gradient() ) &
call dgradcorr (rho%of_r, grho, dvxc_rr, dvxc_sr, dvxc_ss, dvxc_s, xq, &
drhoscf (1, 1, ipert), nr1, nr2, nr3, nrx1, nrx2, nrx3, nrxx, &
nspin, nspin_gga, nl, ngm, g, alat, dvaux)
nspin_mag, nspin_gga, nl, ngm, g, alat, dvaux)
do is = 1, nspin_lsda
call daxpy (nrxx, - fac, rho_core, 1, rho%of_r(1, is), 1)
call daxpy (2 * nrxx, - fac, drhoc, 1, drhoscf (1, is, ipert), 1)
enddo
mode1 = 0
......@@ -110,9 +116,12 @@ subroutine addnlcc (imode0, drhoscf, npe)
enddo
enddo
enddo
DO is=1,nspin_lsda
rho%of_r(:,is) = rho%of_r(:,is) - fac * rho_core(:)
ENDDO
#ifdef __PARA
!
! collect contributions from all pools (sum over k-points)
! collect contributions from all r/G points.
!
call mp_sum ( dyn1, intra_pool_comm )
#endif
......
......@@ -13,7 +13,17 @@ subroutine addusddens (drhoscf, dbecsum, mode0, npe, iflag)
! This routine adds to the change of the charge and of the
! magnetization densities the part due to the US augmentation.
! It assumes that the array dbecsum has already accumulated the
! change of the becsum term.
! change of the becsum term. It calculates Eq. B31 of Ref [1].
! If called from drho (iflag=1), dbecsum and drhoscf contain the
! orthogonalization contribution to the change of the wavefunctions
! and the terms with alphasum and becsum are added. If called
! from solve_* (iflag=0) drhoscf and dbecsum contain the contribution
! of the solution of the linear system and the terms due to alphasum
! and becsum are not added. In this case the change of the charge
! calculated by drho (called \Delta \rho in [1]) is read from file
! and added. The contribution of the change of
! the Fermi energy is not calculated here but added later by ef_shift.
! [1] PRB 64, 235118 (2001).
!
!
USE kinds, only : DP
......@@ -28,7 +38,7 @@ subroutine addusddens (drhoscf, dbecsum, mode0, npe, iflag)
USE paw_variables, ONLY : okpaw
USE noncollin_module, ONLY : nspin_mag
USE modes, ONLY : u, npert, npertx
USE modes, ONLY : u
USE qpoint, ONLY : xq, eigqts
USE phus, ONLY : becsumort, alphasum
USE units_ph, ONLY : iudrhous, lrdrhous
......@@ -44,7 +54,7 @@ subroutine addusddens (drhoscf, dbecsum, mode0, npe, iflag)
! input: if zero does not compute drho
! input: the number of perturbations
complex(DP) :: drhoscf (nrxx, nspin, npe), &
complex(DP) :: drhoscf (nrxx, nspin_mag, npe), &
dbecsum (nhm*(nhm+1)/2, nat, nspin, npe)
! inp/out: change of the charge density
!input: sum over kv of bec
......@@ -82,7 +92,7 @@ subroutine addusddens (drhoscf, dbecsum, mode0, npe, iflag)
if (.not.okvan) return
call start_clock ('addusddens')
allocate (aux( ngm , nspin , npertx))
allocate (aux( ngm , nspin_mag , npe))
allocate (sk ( ngm))
allocate (ylmk0(ngm , lmaxq * lmaxq))
allocate (qgm( ngm))
......@@ -192,11 +202,11 @@ subroutine addusddens (drhoscf, dbecsum, mode0, npe, iflag)
deallocate (aux)
if (iflag == 0) then
allocate (drhous( nrxx, nspin))
allocate (drhous( nrxx, nspin_mag))
do ipert = 1, npe
mu = mode0 + ipert
call davcio (drhous, lrdrhous, iudrhous, mu, -1)
call daxpy (2*nrxx*nspin, 1.d0, drhous, 1, drhoscf(1,1,ipert), 1)
call daxpy (2*nrxx*nspin_mag, 1.d0, drhous, 1, drhoscf(1,1,ipert), 1)
end do
deallocate (drhous)
end if
......
......@@ -10,10 +10,13 @@
subroutine addusddense (drhoscf, dbecsum)
!----------------------------------------------------------------------
!
! This routine adds to the change of the charge density the part
! which is due to the US augmentation.
! This routine adds to the change of the charge and magnetization
! densities due to an electric field perturbation
! the part due to the US augmentation.
! It assumes that the array dbecsum has already accumulated the
! change of the becsum term.
! change of the becsum term.
! The expression implemented is given in Eq. B32 of PRB 64, 235118
! (2001) with b=c=0.
!
USE kinds, only : DP
......@@ -22,10 +25,10 @@ subroutine addusddense (drhoscf, dbecsum)
ngm, eigts1, eigts2, eigts3, ig1, ig2, ig3
USE uspp, ONLY: okvan
USE uspp_param, ONLY: upf, lmaxq, nh, nhm
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : nspin_mag
USE qpoint, ONLY : eigqts
USE lsda_mod, ONLY : nspin
implicit none
!
! the dummy variables
......@@ -34,7 +37,8 @@ subroutine addusddense (drhoscf, dbecsum)
! input: if zero does not compute drho
! input: the number of perturbations
complex(DP) :: drhoscf(nrxx,nspin,3), dbecsum(nhm*(nhm+1)/2,nat,nspin,3)
complex(DP) :: drhoscf(nrxx,nspin_mag,3), &
dbecsum(nhm*(nhm+1)/2,nat,nspin,3)
! inp/out: change of the charge density
! input: sum over kv of bec
......@@ -42,7 +46,7 @@ subroutine addusddense (drhoscf, dbecsum)
! here the local variables
!
integer :: ig, na, nt, ih, jh, ir, mode, ipert, ijh, is
integer :: ig, na, nt, ih, jh, ipert, ijh, is
! counters
......@@ -57,7 +61,7 @@ subroutine addusddense (drhoscf, dbecsum)
if (.not.okvan) return
call start_clock ('addusddense')
allocate (aux( ngm, nspin, 3))
allocate (aux( ngm, nspin_mag, 3))
allocate (sk ( ngm))
allocate (qg ( nrxx))
allocate (ylmk0(ngm , lmaxq * lmaxq))
......
......@@ -17,13 +17,14 @@ subroutine addusldos (ldos, becsum1)
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ityp, ntyp => nsp
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : nspin_mag
USE gvect, ONLY : nrxx, nrx1, nrx2, nrx3, nr1, nr2, nr3, nl, &
eigts1, eigts2, eigts3, ig1, ig2, ig3, gg, g, ngm
USE wavefunctions_module, ONLY: psic
USE uspp, ONLY: okvan
USE uspp_param, ONLY: upf, lmaxq, nh, nhm
implicit none
complex(DP) :: ldos (nrxx, nspin)
complex(DP) :: ldos (nrxx, nspin_mag)
! local density of states
real(DP) :: becsum1 ( (nhm * (nhm + 1) ) / 2, nat, nspin)
......@@ -42,7 +43,7 @@ subroutine addusldos (ldos, becsum1)
complex(DP), allocatable :: aux (:,:), qgm (:)
! work space
allocate (aux ( ngm , nspin))
allocate (aux ( ngm , nspin_mag))
allocate (ylmk0(ngm , lmaxq * lmaxq))
allocate (qgm ( ngm))
allocate (qmod( ngm))
......@@ -64,7 +65,7 @@ subroutine addusldos (ldos, becsum1)
!
! Multiply becsum and qg with the correct structure factor
!
do is = 1, nspin
do is = 1, nspin_mag
do ig = 1, ngm
aux (ig, is) = aux (ig, is) + &
qgm (ig) * becsum1 (ijh, na, is) * &
......@@ -83,7 +84,7 @@ subroutine addusldos (ldos, becsum1)
! convert aux to real space and adds to the charge density
!
if (okvan) then
do is = 1, nspin
do is = 1, nspin_mag
psic (:) = (0.d0,0.d0)
do ig = 1, ngm
psic (nl (ig) ) = aux (ig, is)
......
......@@ -20,7 +20,7 @@ subroutine allocate_phq
USE wvfct, ONLY : nbnd, igk, npwx
USE gvect, ONLY : nrxx, ngm
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : noncolin, npol
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE wavefunctions_module, ONLY: evc
USE spin_orb, ONLY : lspinorb
USE becmod, ONLY: bec_type, becp, allocate_bec_type
......@@ -66,7 +66,7 @@ subroutine allocate_phq
allocate ( dpsi ( npwx*npol , nbnd))
!
allocate (vlocq ( ngm , ntyp))
allocate (dmuxc ( nrxx , nspin , nspin))
allocate (dmuxc ( nrxx , nspin_mag , nspin_mag))
allocate (eprec ( nbnd, nksq) )
!
allocate (eigqts ( nat))
......
......@@ -11,13 +11,12 @@ SUBROUTINE apply_dpot(aux1, dvscfins, current_spin)
! one wavefunction
!
USE kinds, ONLY : DP
USE noncollin_module, ONLY : noncolin, npol
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE spin_orb, ONLY : domag
USE lsda_mod, ONLY : nspin
USE gsmooth, ONLY : nrxxs
IMPLICIT NONE
COMPLEX(DP), INTENT(IN) :: dvscfins(nrxxs,nspin)
COMPLEX(DP), INTENT(IN) :: dvscfins(nrxxs,nspin_mag)
COMPLEX(DP), INTENT(INOUT) :: aux1(nrxxs,npol)
INTEGER, INTENT(IN) :: current_spin
......
......@@ -22,7 +22,7 @@ subroutine compute_drhous_nc (drhous, dbecsum, wgg, becq, alpq)
USE gvect, ONLY : nrxx
USE gsmooth, ONLY : nrxxs, nr1s,nr2s,nr3s, nrx1s,nrx2s,nrx3s, nls
USE wvfct, ONLY : npw, npwx, nbnd, igk
USE noncollin_module, ONLY : noncolin, npol
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE wavefunctions_module, ONLY: evc
USE io_files, ONLY: iunigk
USE uspp, ONLY: okvan, nkb, vkb
......@@ -40,7 +40,7 @@ subroutine compute_drhous_nc (drhous, dbecsum, wgg, becq, alpq)
!
complex(DP) :: dbecsum (nhm, nhm, nat, nspin, 3 * nat), &
drhous (nrxx, nspin, 3 * nat)
drhous (nrxx, nspin_mag, 3 * nat)
!output:the derivative of becsum
! output: add the orthogonality term
type (bec_type) :: becq(nksq), & ! (nkb, nbnd)
......
......@@ -21,28 +21,28 @@ SUBROUTINE davcio_drho( drho, lrec, iunit, nrec, isw )
USE mp_global, ONLY : inter_pool_comm, me_pool
USE mp, ONLY : mp_bcast, mp_barrier
USE gvect, ONLY : nrx1, nrx2, nrx3, nrxx
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : nspin_mag
!
IMPLICIT NONE
!
INTEGER :: iunit, lrec, nrec, isw
COMPLEX(DP) :: drho(nrxx,nspin)
COMPLEX(DP) :: drho(nrxx,nspin_mag)
!
#ifdef __PARA
!
! ... local variables
!
INTEGER :: itmp, proc, is, dim
INTEGER :: is
COMPLEX(DP), ALLOCATABLE :: ddrho(:,:)
!
!
ALLOCATE( ddrho( nrx1 * nrx2 * nrx3 , nspin) )
ALLOCATE( ddrho( nrx1 * nrx2 * nrx3 , nspin_mag) )
!
IF ( isw == 1 ) THEN
!
! ... First task is the only task allowed to write the file
!
DO is = 1, nspin
DO is = 1, nspin_mag
!
CALL cgather_sym( drho(:,is), ddrho(:,is) )
!
......@@ -62,7 +62,7 @@ SUBROUTINE davcio_drho( drho, lrec, iunit, nrec, isw )
!
! ... distributes ddrho between between the tasks of the pool
!
DO is = 1, nspin
DO is = 1, nspin_mag
!
CALL cscatter_sym ( ddrho(:,is), drho(:,is) )
!
......
......@@ -109,7 +109,7 @@ subroutine drho
! now we compute the change of the charge density due to the change of
! the orthogonality constraint
!
allocate (drhous ( nrxx , nspin , 3 * nat))
allocate (drhous ( nrxx , nspin_mag , 3 * nat))
allocate (dbecsum( nhm * (nhm + 1) /2 , nat , nspin , 3 * nat))
dbecsum=(0.d0,0.d0)
IF (noncolin) THEN
......@@ -175,7 +175,7 @@ subroutine drho
!
! add the augmentation term to the charge density and save it
!
allocate (drhoust( nrxx , nspin , npertx))
allocate (drhoust( nrxx , nspin_mag , npertx))
drhoust=(0.d0,0.d0)
#ifdef __PARA
!
......@@ -202,10 +202,10 @@ subroutine drho
enddo
enddo
else
call zcopy (nrxx*nspin*npe, drhous(1,1,mode+1), 1, drhoust, 1)
call zcopy (nrxx*nspin_mag*npe, drhous(1,1,mode+1), 1, drhoust, 1)
endif
call dscal (2*nrxx*nspin*npe, 0.5d0, drhoust, 1)
call dscal (2*nrxx*nspin_mag*npe, 0.5d0, drhoust, 1)
call addusddens (drhoust, dbecsum(1,1,1,mode+1), mode, npe, 1)
do iper = 1, npe
......
......@@ -10,7 +10,12 @@ subroutine drhodv (nu_i0, nper, drhoscf)
!-----------------------------------------------------------------------
!
! This subroutine computes the electronic term
! <psi|dv|dpsi> of the dynamical matrix
! <psi|dv - e ds|dpsi> of the dynamical matrix.
! Eq. B35 of PRB 64, 235118 (2001). The contribution of
! the nonlocal potential is calculated in rhodvnl, the
! contribution of the local potential in drhodvloc.
! Note that drhoscf contain only the smooth part of the
! induced charge density, calculated in solve linter.
!
!
USE kinds, ONLY : DP
......@@ -23,7 +28,7 @@ subroutine drhodv (nu_i0, nper, drhoscf)
USE uspp, ONLY : nkb, vkb
USE becmod, ONLY : calbec
USE io_global, ONLY : stdout
USE noncollin_module, ONLY : noncolin, npol
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE io_files, ONLY: iunigk
USE dynmat, ONLY : dyn, dyn_rec
......@@ -42,7 +47,7 @@ subroutine drhodv (nu_i0, nper, drhoscf)
! input: number of perturbations of this represent
! input: the initial position of the mode
complex(DP) :: drhoscf (nrxx, nspin, npertx)
complex(DP) :: drhoscf (nrxx, nspin_mag, nper)
! the change of density due to perturbations
integer :: mu, ik, ikq, ig, nu_i, nu_j, na_jcart, ibnd, nrec, &
......
......@@ -6,7 +6,7 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
!-----------------------------------------------------------------------
subroutine drhodvloc (nu_i0, nper, drhoscf, wdyn)
subroutine drhodvloc (nu_i0, npe, drhoscf, wdyn)
!-----------------------------------------------------------------------
! following comment is obsolete
! This subroutine computes the electronic term
......@@ -20,18 +20,17 @@ subroutine drhodvloc (nu_i0, nper, drhoscf, wdyn)
USE gsmooth, ONLY : nrxxs, nr1s, nr2s, nr3s
USE cell_base, ONLY : omega
USE lsda_mod, ONLY : nspin
USE modes, ONLY : npertx
USE noncollin_module, ONLY : nspin_lsda
USE noncollin_module, ONLY : nspin_lsda, nspin_mag
USE mp_global, ONLY: intra_pool_comm
USE mp, ONLY: mp_sum
implicit none
integer :: nper, nu_i0
integer :: npe, nu_i0
! input: the number of perturbation of this representations
! input: the initial position of the mode
complex(DP) :: drhoscf (nrxx, nspin, npertx), wdyn (3 * nat, 3 * nat)
complex(DP) :: drhoscf (nrxx, nspin_mag, npe), wdyn (3 * nat, 3 * nat)
! the change of density due to perturbations
! auxiliary matrix where drhodv is stored
......@@ -52,7 +51,7 @@ subroutine drhodvloc (nu_i0, nper, drhoscf, wdyn)
!
do nu_j = 1, 3 * nat
call compute_dvloc (nu_j, dvloc)
do ipert = 1, nper
do ipert = 1, npe
nu_i = nu_i0 + ipert
do is = 1, nspin_lsda
dynwrk (nu_i, nu_j) = dynwrk (nu_i, nu_j) + &
......
......@@ -20,7 +20,6 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ntyp=>nsp, ityp
USE gvect, ONLY : nrxx, nr1, nr2, nr3
USE lsda_mod, ONLY : nspin
USE cell_base, ONLY : omega
USE ions_base, ONLY : nat
USE uspp, ONLY : okvan
......@@ -29,7 +28,7 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
USE paw_variables, ONLY : okpaw
USE noncollin_module, ONLY : nspin_mag
USE modes, ONLY : npert, npertx, nirr
USE modes, ONLY : npert, nirr, u
USE dynmat, ONLY : dyn, dyn_rec
USE phus, ONLY : becsumort, int3_paw
USE units_ph, ONLY : iudrhous, lrdrhous
......@@ -43,7 +42,7 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
! input: starting position of this represe
! input: the number of perturbations
complex(DP) :: dvscfin (nrxx, nspin, npe)
complex(DP) :: dvscfin (nrxx, nspin_mag, npe)
! input: the change of V_Hxc
integer :: ipert, irr1, mode0, mu, is, nu_i, nu_j, nrtot, &
......@@ -54,7 +53,7 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
complex(DP) :: dyn1 (3 * nat, 3 * nat)
! the dynamical matrix
complex(DP), allocatable :: drhous (:,:,:)
complex(DP), allocatable :: drhous (:,:)
! the change of the charge
complex(DP), external :: zdotc
......@@ -63,24 +62,19 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
return
endif
call start_clock ('drhodvus')
allocate (drhous ( nrxx , nspin, npertx))
allocate (drhous ( nrxx , nspin_mag))
dyn1 (:,:) = (0.d0, 0.d0)
nrtot = nr1 * nr2 * nr3
mode0 = 0
do irr1 = 1, nirr
do ipert = 1, npert (irr1)
nu_j = mode0 + ipert
call davcio (drhous (1, 1, ipert), lrdrhous, iudrhous, nu_j, - 1)
enddo
do ipert = 1, npert (irr1)
nu_j = mode0 + ipert
call davcio (drhous, lrdrhous, iudrhous, nu_j, - 1)
do mu = 1, npert (irr)
nu_i = imode0 + mu
do is = 1, nspin_mag
dyn1 (nu_i, nu_j) = dyn1 (nu_i, nu_j) + &
zdotc (nrxx, dvscfin (1,is,mu), 1, drhous (1,is,ipert), 1) &
dyn1 (nu_i, nu_j) = dyn1 (nu_i, nu_j) + &
zdotc (nrxx*nspin_mag,dvscfin(1,1,mu),1,drhous, 1) &
* omega / DBLE (nrtot)
enddo
enddo
enddo
mode0 = mode0 + npert (irr1)
......
......@@ -18,11 +18,9 @@ subroutine dv_of_drho (mode, dvscf, flag)
USE gvect, ONLY : nrxx, nr1, nr2, nr3, nrx1, nrx2, nrx3, &
nl, ngm, g
USE cell_base, ONLY : alat, tpiba2
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : nspin_gga, nspin_lsda
USE noncollin_module, ONLY : nspin_lsda, nspin_mag, nspin_gga
USE funct, ONLY : dft_is_gradient
USE scf, ONLY : rho, rho_core
USE eqv, ONLY : dmuxc
USE nlcc_ph, ONLY : nlcc_any
USE qpoint, ONLY : xq
......@@ -34,7 +32,7 @@ subroutine dv_of_drho (mode, dvscf, flag)
integer :: mode
! input: the mode to do
complex(DP) :: dvscf (nrxx, nspin)
complex(DP) :: dvscf (nrxx, nspin_mag)
! input: the change of the charge,
! output: change of the potential
......@@ -56,7 +54,7 @@ subroutine dv_of_drho (mode, dvscf, flag)
call start_clock ('dv_of_drho')
allocate (dvaux( nrxx, nspin))
allocate (dvaux( nrxx, nspin_mag))
allocate (drhoc( nrxx))
!
! the exchange-correlation contribution is computed in real space
......@@ -72,8 +70,8 @@ subroutine dv_of_drho (mode, dvscf, flag)
dvscf(:, is) = dvscf(:, is) + fac * drhoc (:)
enddo
endif
do is = 1, nspin
do is1 = 1, nspin
do is = 1, nspin_mag
do is1 = 1, nspin_mag
do ir = 1, nrxx
dvaux(ir,is) = dvaux(ir,is) + dmuxc(ir,is,is1) * dvscf(ir,is1)
enddo
......@@ -85,7 +83,7 @@ subroutine dv_of_drho (mode, dvscf, flag)
!
if ( dft_is_gradient() ) call dgradcorr &
(rho%of_r, grho, dvxc_rr, dvxc_sr, dvxc_ss, dvxc_s, xq, &
dvscf, nr1, nr2, nr3, nrx1, nrx2, nrx3, nrxx, nspin, nspin_gga, &
dvscf, nr1, nr2, nr3, nrx1, nrx2, nrx3, nrxx, nspin_mag, nspin_gga, &
nl, ngm, g, alat, dvaux)
if (nlcc_any.and.flag) then
do is = 1, nspin_lsda
......@@ -97,7 +95,7 @@ subroutine dv_of_drho (mode, dvscf, flag)
!
! copy the total (up+down) delta rho in dvscf(*,1) and go to G-space
!
if (nspin == 2) then
if (nspin_mag == 2) then
dvscf(:,1) = dvscf(:,1) + dvscf(:,2)
end if
!
......
......@@ -39,8 +39,8 @@ subroutine ef_shift (drhoscf, ldos, ldoss, dos_ef, irr, npe, flag)
integer :: npe
! input: the number of perturbation
complex(DP) :: drhoscf(nrxx,nspin,npe), &
ldos(nrxx,nspin), ldoss(nrxxs,nspin)
complex(DP) :: drhoscf(nrxx,nspin_mag,npe), &
ldos(nrxx,nspin_mag), ldoss(nrxxs,nspin_mag)
! inp/out:the change of the charge
! inp: local DOS at Ef
! inp: local DOS at Ef without augme
......@@ -170,7 +170,7 @@ subroutine ef_shift_paw (drhoscf, dbecsum, ldos, ldoss, becsum1, &
! modules from phcom
USE qpoint, ONLY : nksq
USE control_ph, ONLY : nbnd_occ, lgamma_gamma
USE noncollin_module, ONLY : noncolin, npol, nspin_lsda
USE noncollin_module, ONLY : noncolin, npol, nspin_lsda, nspin_mag
USE units_ph, ONLY : lrwfc, iuwfc, lrdwf, iudwf
USE eqv, ONLY : dpsi
USE modes, ONLY : npert
......@@ -184,8 +184,8 @@ subroutine ef_shift_paw (drhoscf, dbecsum, ldos, ldoss, becsum1, &
integer :: npe
! input: the number of perturbation
complex(DP) :: drhoscf(nrxx,nspin,npe), &
ldos(nrxx,nspin), ldoss(nrxxs,nspin), &
complex(DP) :: drhoscf(nrxx,nspin_mag,npe), &
ldos(nrxx,nspin_mag), ldoss(nrxxs,nspin_mag), &
dbecsum ( (nhm * (nhm + 1))/2 , nat , nspin, npe)
! inp/out:the change of the charge
! inp: local DOS at Ef
......@@ -286,7 +286,7 @@ subroutine ef_shift_paw (drhoscf, dbecsum, ldos, ldoss, becsum1, &
enddo
enddo
do ipert = 1, npert (irr)
do is = 1, nspin_lsda
do is = 1, nspin_mag
call zaxpy (nrxxs, def(ipert), ldoss(1,is), 1, drhoscf(1,is,ipert), 1)
enddo
enddo
......
!
! Copyright (C) 2001-2008 Quantu-ESPRESSO group
! Copyright (C) 2001-2009 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
......@@ -21,7 +21,7 @@ subroutine incdrhoscf_nc (drhoscf, weight, ik, dbecsum)
USE gsmooth, ONLY : nrxxs, nls, nr1s, nr2s, nr3s, nrx1s, nrx2s, nrx3s
USE lsda_mod, ONLY : nspin
USE spin_orb, ONLY : domag
USE noncollin_module, ONLY : npol
USE noncollin_module, ONLY : npol, nspin_mag
USE uspp_param,ONLY : nhm
USE wvfct, ONLY : npw, npwx, igk
USE wavefunctions_module, ONLY: evc
......@@ -36,7 +36,7 @@ subroutine incdrhoscf_nc (drhoscf, weight, ik, dbecsum)
real(DP) :: weight
! input: the weight of the k point
complex(DP) :: drhoscf (nrxx,nspin), dbecsum (nhm,nhm,nat,nspin)
complex(DP) :: drhoscf (nrxx,nspin_mag), dbecsum (nhm,nhm,nat,nspin)
! output: the change of the charge densit
! inp/out: the accumulated dbec
!
......
......@@ -22,7 +22,7 @@ subroutine incdrhous_nc (drhoscf, weight, ik, dbecsum, evcr, wgg, becq, &
USE gsmooth, ONLY : nrxxs, nls, nr1s, nr2s, nr3s, nrx1s, nrx2s, nrx3s
USE lsda_mod, ONLY : nspin
USE spin_orb, ONLY : lspinorb, domag
USE noncollin_module, ONLY : npol
USE noncollin_module, ONLY : npol, nspin_mag
USE uspp, ONLY : nkb, qq, qq_so
USE uspp_param,ONLY : nhm, nh
USE wvfct, ONLY : nbnd, npwx
......@@ -46,7 +46,7 @@ subroutine incdrhous_nc (drhoscf, weight, ik, dbecsum, evcr, wgg, becq, &
! input: the weight of the k point
! input: the weights
complex(DP) :: evcr (nrxxs, npol, nbnd), drhoscf (nrxx,nspin), &
complex(DP) :: evcr (nrxxs, npol, nbnd), drhoscf (nrxx,nspin_mag), &
dbecsum(nhm, nhm, nat, nspin)
! input: the wavefunctions at k in real
! output: the change of the charge densi
......
......@@ -26,7 +26,7 @@ subroutine localdos (ldos, ldoss, dos_ef)
nr1s, nr2s, nr3s, nrx1s, nrx2s, nrx3s
USE klist, ONLY : xk, wk, degauss, ngauss
USE lsda_mod, ONLY : nspin, lsda, current_spin, isk
USE noncollin_module, ONLY : noncolin, npol
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE wvfct, ONLY : nbnd, npw, npwx, igk, et
USE becmod, ONLY: calbec, bec_type, allocate_bec_type, deallocate_bec_type
USE noncollin_module, ONLY : noncolin, npol
......@@ -43,7 +43,7 @@ subroutine localdos (ldos, ldoss, dos_ef)
implicit none
complex(DP) :: ldos (nrxx, nspin), ldoss (nrxxs, nspin)
complex(DP) :: ldos (nrxx, nspin_mag), ldoss (nrxxs, nspin_mag)
! output: the local density of states at Ef
! output: the local density of states at Ef without augmentation
real(DP) :: dos_ef
......@@ -190,7 +190,7 @@ subroutine localdos (ldos, ldoss, dos_ef)