# [Pw_forum] spin polarized lowdin charges

Cyrille Barreteau cbarreteau at cea.fr
Thu Apr 29 16:42:25 CEST 2004

```Dear Francesco

thank you very much for helping in adapting the code.
I have implemented it and it works fine. I just made minor changes.
Here are the lines of code for those interested:

define totcharge_up and totcharge_down
define charges_up(:,:), charges_down(:,:) (instead of charges(:,:))
and put the following lines in projwfc.f90 instead of the previous non spin
polarized analysis:

allocate ( charges_up (nat, 0:lmax_wfc ) )
allocate ( charges_down (nat, 0:lmax_wfc ) )
charges_up=0.0
charges_down=0.0
do ik = 1, nkstot
do ibnd = 1, nbnd
do nwfc = 1, natomwfc
na= nlmchi(nwfc)%na
l = nlmchi(nwfc)%l
if((.not.(lsda)).or.((lsda).and.(ik.le.(nkstot/2)))) then
charges_up(na,l) = charges_up(na,l) + wg (ibnd,ik) * &
proj (nwfc, ibnd, ik)
else
charges_down(na,l) = charges_down(na,l) + wg (ibnd,ik)* &
proj (nwfc, ibnd, ik)
end if
enddo
end do
end do
!
write (stdout, '(/"Lowdin Charges: "/)')
!
psum = 0.0
do na = 1, nat
totcharge_up = 0.d0
totcharge_down = 0.d0
do l = 0, lmax_wfc
totcharge_up = totcharge_up + charges_up(na,l)
totcharge_down = totcharge_down + charges_down(na,l)
end do
psum = psum + totcharge_up+totcharge_down
if(.not.(lsda)) then
write (stdout,2000) na, totcharge_up, ( charges_up(na,l), l=
0,lmax_wfc)
else
write (stdout,2001) na, totcharge_up, ( charges_up(na,l), l= 0,lmax_wfc)
write (stdout,2002) na, totcharge_down, ( charges_down(na,l), l=
0,lmax_wfc)
write (stdout,2003) na, totcharge_up-totcharge_down, &
( charges_up(na,l)-charges_down(na,l), l= 0,lmax_wfc)
end if
end do
2000  FORMAT(5x,"Atom # ",i3,": local charge           = ",f8.4 ,", s, p, d, f
= ",4f8.4)
2001  FORMAT(5x,"Atom # ",i3,": local charge spin up   = ",f8.4 ,", s, p, d, f
= ",4f8.4)
2002  FORMAT(5x,"Atom # ",i3,": local charge spin down = ",f8.4 ,", s, p, d, f
= ",4f8.4)
2003  FORMAT(5x,"Atom # ",i3,": local magnetic moment  = ",f8.4 ,", s, p, d, f
= ",4f8.4)

psum = psum / nelec
write (stdout, '(5x,"Spilling Parameter: ",f8.4)') 1.0 - psum
!
! Sanchez-Portal et al., Sol. State Commun.  95, 685 (1995).
! The spilling parameter measures the ability of the basis provided by
! the pseudo-atomic wfc to represent the PW eigenstates,
! by measuring how much of the subspace of the Hamiltonian
! eigenstates falls outside the subspace spanned by the atomic basis
!
deallocate (charges_up,charges_down)

Francesco Antoniella wrote:
> Il gio, 2004-04-29 alle 08:07, Cyrille Barreteau ha scritto:
>
>>Dear pwscf users,
>>
>>I am doing a calculation of a magnetic Fe (cuboctahedron) cluster and I would
>>like to get the magnetic decomposition on  each atomic site of the cluster.
>> From projwfc.x I am able to get the total Lowdin charge decomposition
>>(see below) but I would also like the up and down spin charge decomposition.
>>How can I obtain this information?
>>
>>  thanks,
>>
>>      cyrille
>>
>>Lowdin Charges:
>>
>>   Atom #   1: total charge =   7.4091, s, p, d, f =   0.8321  0.0000  6.5770
>>   Atom #   2: total charge =   7.9526, s, p, d, f =   0.8952  0.0000  7.0574
>>   Atom #   3: total charge =   7.9526, s, p, d, f =   0.8952  0.0000  7.0574
>>   Atom #   4: total charge =   7.9526, s, p, d, f =   0.8952  0.0000  7.0574
>>   Atom #   5: total charge =   7.9526, s, p, d, f =   0.8952  0.0000  7.0574
>>   Atom #   6: total charge =   7.9526, s, p, d, f =   0.8952  0.0000  7.0574
>>   Atom #   7: total     !
>
>
>
>
> This is the modification of the code
> ---->put this in the variables declaration
>  charges_up(:,:), charges_down(:,:)
> in place of :
> charges(:,:)
>
> ---->put this in the lowdin charges calc
>      allocate ( charges_up (nat, 0:lmax_wfc ) )
>      allocate ( charges_down (nat, 0:lmax_wfc ) )
>      charges_up=0.0
>      charges_down=0.0
>      do ik = 1, nkstot
>         do ibnd = 1, nbnd
>            do nwfc = 1, natomwfc
>               na= nlmchi(nwfc)%na
>               l = nlmchi(nwfc)%l
>               if((.not.(lsda)).or.((lsda).and.(ik.le.(nkstot/2)))) then
>                  charges_up(na,l) = charges_up(na,l) + wg (ibnd,ik) * &
>                       proj (nwfc, ibnd, ik)
>               else
>                  charges_down(na,l) = charges_down(na,l) + wg (ibnd,ik)
> * &
>                       proj (nwfc, ibnd, ik)
>               end if
>               enddo
>         end do
>      end do
>      !
>      write (4, '(/"Lowdin Charges: "/)')
>      !
>      psum = 0.0
>      do na = 1, nat
>         totcharge_up = 0.d0
>         totcharge_down = 0.d0
>         do l = 0, lmax_wfc
>            totcharge_up = totcharge_up + charges_up(na,l)
>            totcharge_down = totcharge_down + charges_down(na,l)
>         end do
>         psum = psum + totcharge_up+totcharge_down
>         if(.not.(lsda)) then
>         write (4, '(5x,"Atom # ",i3,": total charge = ",f8.4, &
>              &                ", s, p, d = ",4f8.4    )') &
>              na, totcharge_up, ( charges_up(na,l), l= 0,lmax_wfc)
>      else
>         write (4, '(5x,"Atom # ",i3,": total charge spin up   = ",f8.4,
> &
>              &                ", s, p, d = ",4f8.4    )') &
>              na, totcharge_up, ( charges_up(na,l), l= 0,lmax_wfc)
>         write (4, '(5x,"       ",i3,": total charge spin down = ",f8.4,
> &
>              &                ", s, p, d = ",4f8.4    )') &
>              na, totcharge_down, ( charges_down(na,l), l= 0,lmax_wfc)
>         write (4, '(5x,"       ",i3,": total pol.  (up-down)  = ",f8.4,
> &
>              &                ", s, p, d = ",4f8.4    )') &
>              na, totcharge_up-totcharge_down,&
>              ( charges_up(na,l)-charges_down(na,l), l= 0,lmax_wfc)
>      end if
>      end do
>      psum = psum / nelec
>      write (4, '(5x,"Spilling Parameter: ",f8.4)') 1.0 - psum
>
>
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://www.democritos.it/mailman/listinfo/pw_forum

--
============================================================
| Cyrille Barreteau           |  phone:+33 (0)1 69 08 29 51  |
| CEA Saclay                  |                              |
| DSM/DRECAM/SPCSI            |  fax : +33 (0)1 69 08 84 46  |
| Batiment 462                |                              |
| 91191 Gif sur Yvette Cedex  |  email: cbarreteau at cea.fr    |
| FRANCE                      |                              |
|             ~~~~~~~~~~~~~~~~~~~~~~~~                       |
|    web : http://www-drecam.cea.fr/spcsi/groupe1.htm        |
============================================================

```

More information about the users mailing list