Commit 10b201c2 authored by Gregor Michalicek's avatar Gregor Michalicek

Write out valence and all electron charges to out.xml

Note: The output for valenceDensity, valenceCharges, and allElectronCharges is
      preliminary. It does not look nice in out.xml. The date should be
      collected in the routines to enable a nicer output at a different place.
parent 5889d477
......@@ -15,7 +15,8 @@
USE m_qsf
USE m_pwint
USE m_types
use m_juDFT
USE m_juDFT
USE m_xmlOutput
IMPLICIT NONE
! ..
! .. Scalar Arguments ..
......@@ -43,15 +44,22 @@
! ..
! .. Local Arrays ..
REAL qmt(atoms%ntypd),qvac(2),q2(vacuum%nmz),rht1(vacuum%nmzd,2,input%jspins)
INTEGER, ALLOCATABLE :: lengths(:,:)
CHARACTER(LEN=20) :: attributes(6), names(6)
! ..
! .. Intrinsic Functions ..
INTRINSIC real
! ..
!
IF (input%film) THEN
ALLOCATE(lengths(4+vacuum%nvac,2))
ELSE
ALLOCATE(lengths(4,2))
END IF
CALL timestart("cdntot")
qtot = 0.e0
qistot = 0.e0
DO 40 jspin = 1,input%jspins
DO jspin = 1,input%jspins
q = 0.e0
! -----mt charge
CALL timestart("MT")
......@@ -105,10 +113,28 @@
IF (input%film) WRITE (6,FMT=8010) (i,qvac(i),i=1,vacuum%nvac)
WRITE (16,FMT=8000) jspin,q,qis, (qmt(n),n=1,atoms%ntype)
IF (input%film) WRITE (16,FMT=8010) (i,qvac(i),i=1,vacuum%nvac)
names(1) = 'spin' ; WRITE(attributes(1),'(i0)') jspin ; lengths(1,1)=4 ; lengths(1,2)=1
names(2) = 'total' ; WRITE(attributes(2),'(f17.10)') q ; lengths(2,1)=5 ; lengths(2,2)=17
names(3) = 'interstitial' ; WRITE(attributes(3),'(f17.10)') qis ; lengths(3,1)=12 ; lengths(3,2)=17
names(4) = 'mtSpheres' ; WRITE(attributes(4),'(f17.10)') SUM(qmt(1:atoms%ntype)) ; lengths(4,1)=9 ; lengths(4,2)=17
IF(input%film) THEN
DO i = 1, vacuum%nvac
WRITE(names(4+i),'(a6,i0)') 'vacuum', i
WRITE(attributes(4+i),'(f17.10)') qvac(i)
lengths(4+i,1)=7
lengths(4+i,2)=17
END DO
CALL writeXMLElementFormPoly('spinDependentCharge',names(1:4+vacuum%nvac),&
attributes(1:4+vacuum%nvac),lengths)
ELSE
CALL writeXMLElementFormPoly('spinDependentCharge',names(1:4),attributes(1:4),lengths)
END IF
qtot = qtot + q
40 CONTINUE
END DO ! loop over spins
DEALLOCATE (lengths)
WRITE (6,FMT=8020) qtot
WRITE (16,FMT=8020) qtot
CALL writeXMLElementFormPoly('totalCharge',(/'value'/),(/qtot/),reshape((/5,20/),(/1,2/)))
8000 FORMAT (/,10x,'total charge for spin',i3,'=',f12.6,/,10x,&
& 'interst. charge = ',f12.6,/,&
& (10x,'mt charge= ',4f12.6,/))
......
......@@ -168,10 +168,8 @@
sphhar, sym,obsolete, igq_fft, vr,vz(:,:,jspin), oneD,&
n_mmp(-3:,-3:,:,jspin),results, qpw,rhtxy,rho,rht,cdom,cdomvz,cdomvxy,qa21, chmom,clmom)
CALL timestop("cdngen: cdnval")
!-fo
enddo
END DO
!-lda+U
IF ( (atoms%n_u.GT.0).and. (mpi%irank.EQ.0)) CALL u_mix(atoms,input%jspins,n_mmp)
DEALLOCATE ( n_mmp )
......@@ -181,7 +179,9 @@
!-t3e
IF (l_enpara) CLOSE (40)
CALL openXMLElementNoAttributes('valenceCharges')
CALL cdntot(stars,atoms,sym, vacuum,input,cell,oneD, qpw,rho,rht, qtot,dummy)
CALL closeXMLElement('valenceCharges')
!
!---> changes
!
......@@ -313,7 +313,9 @@ enddo
IF (mpi%irank.EQ.0) THEN
! block 2 unnecessary for slicing: begin
IF (.NOT.sliceplot%slice) THEN
CALL openXMLElement('allElectronCharges',(/'comment'/),(/'inQFix'/))
CALL qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD, qpw,rhtxy,rho,rht, fix)
CALL closeXMLElement('allElectronCharges')
!---> pk non-collinear
IF (noco%l_noco) THEN
!---> fix also the off-diagonal part of the density matrix
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment