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 @@ ...@@ -15,7 +15,8 @@
USE m_qsf USE m_qsf
USE m_pwint USE m_pwint
USE m_types USE m_types
use m_juDFT USE m_juDFT
USE m_xmlOutput
IMPLICIT NONE IMPLICIT NONE
! .. ! ..
! .. Scalar Arguments .. ! .. Scalar Arguments ..
...@@ -43,15 +44,22 @@ ...@@ -43,15 +44,22 @@
! .. ! ..
! .. Local Arrays .. ! .. Local Arrays ..
REAL qmt(atoms%ntypd),qvac(2),q2(vacuum%nmz),rht1(vacuum%nmzd,2,input%jspins) 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 Functions ..
INTRINSIC real INTRINSIC real
! .. ! ..
! !
IF (input%film) THEN
ALLOCATE(lengths(4+vacuum%nvac,2))
ELSE
ALLOCATE(lengths(4,2))
END IF
CALL timestart("cdntot") CALL timestart("cdntot")
qtot = 0.e0 qtot = 0.e0
qistot = 0.e0 qistot = 0.e0
DO 40 jspin = 1,input%jspins DO jspin = 1,input%jspins
q = 0.e0 q = 0.e0
! -----mt charge ! -----mt charge
CALL timestart("MT") CALL timestart("MT")
...@@ -105,10 +113,28 @@ ...@@ -105,10 +113,28 @@
IF (input%film) WRITE (6,FMT=8010) (i,qvac(i),i=1,vacuum%nvac) 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) 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) 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 qtot = qtot + q
40 CONTINUE END DO ! loop over spins
DEALLOCATE (lengths)
WRITE (6,FMT=8020) qtot WRITE (6,FMT=8020) qtot
WRITE (16,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,& 8000 FORMAT (/,10x,'total charge for spin',i3,'=',f12.6,/,10x,&
& 'interst. charge = ',f12.6,/,& & 'interst. charge = ',f12.6,/,&
& (10x,'mt charge= ',4f12.6,/)) & (10x,'mt charge= ',4f12.6,/))
......
...@@ -160,18 +160,16 @@ ...@@ -160,18 +160,16 @@
! !
jspmax = input%jspins jspmax = input%jspins
IF (noco%l_mperp) jspmax = 1 IF (noco%l_mperp) jspmax = 1
DO jspin = 1,jspmax DO jspin = 1,jspmax
CALL timestart("cdngen: cdnval") CALL timestart("cdngen: cdnval")
CALL cdnval(eig_id,&
mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars, vacuum,dimension,&
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")
CALL cdnval(eig_id,&
mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars, vacuum,dimension,&
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 !-fo
enddo END DO
!-lda+U !-lda+U
IF ( (atoms%n_u.GT.0).and. (mpi%irank.EQ.0)) CALL u_mix(atoms,input%jspins,n_mmp) IF ( (atoms%n_u.GT.0).and. (mpi%irank.EQ.0)) CALL u_mix(atoms,input%jspins,n_mmp)
DEALLOCATE ( n_mmp ) DEALLOCATE ( n_mmp )
...@@ -179,9 +177,11 @@ ...@@ -179,9 +177,11 @@
!+t3e !+t3e
IF (mpi%irank.EQ.0) THEN IF (mpi%irank.EQ.0) THEN
!-t3e !-t3e
IF (l_enpara) CLOSE (40) IF (l_enpara) CLOSE (40)
CALL cdntot(stars,atoms,sym, vacuum,input,cell,oneD, qpw,rho,rht, qtot,dummy) CALL openXMLElementNoAttributes('valenceCharges')
CALL cdntot(stars,atoms,sym, vacuum,input,cell,oneD, qpw,rho,rht, qtot,dummy)
CALL closeXMLElement('valenceCharges')
! !
!---> changes !---> changes
! !
...@@ -313,7 +313,9 @@ enddo ...@@ -313,7 +313,9 @@ enddo
IF (mpi%irank.EQ.0) THEN IF (mpi%irank.EQ.0) THEN
! block 2 unnecessary for slicing: begin ! block 2 unnecessary for slicing: begin
IF (.NOT.sliceplot%slice) THEN 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 qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD, qpw,rhtxy,rho,rht, fix)
CALL closeXMLElement('allElectronCharges')
!---> pk non-collinear !---> pk non-collinear
IF (noco%l_noco) THEN IF (noco%l_noco) THEN
!---> fix also the off-diagonal part of the density matrix !---> 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