Commit 25773d9a authored by Gregor Michalicek's avatar Gregor Michalicek

Move doswrite and Ek_write_sl to main/cdngen.F90

parent fe411e52
......@@ -3,8 +3,8 @@ MODULE m_cdnval
CONTAINS
SUBROUTINE cdnval(eig_id, mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars,&
vacuum,dimension,sphhar,sym,obsolete,vTot,oneD,coreSpecInput,cdnvalKLoop,den,regCharges,results,&
moments)
!
moments,mcd,slab)
! ***********************************************************
! this subroutin is a modified version of cdnval.F.
! it calculates a layer charge distribution and an orbital
......@@ -43,7 +43,7 @@ CONTAINS
! sqal : l-like charge of each atom type. sum over all k-points
! and bands
!***********************************************************************
!
USE m_constants
USE m_eig66_io,ONLY: write_dos
USE m_genMTBasis
......@@ -68,10 +68,8 @@ CONTAINS
USE m_orbmom ! coeffd for orbital moments
USE m_qmtsl ! These subroutines divide the input%film into vacuum%layers
USE m_qintsl ! (slabs) and intergate the DOS in these vacuum%layers
USE m_orbcomp ! calculate corbital composition (like p_x,p_y,p_z)
USE m_Ekwritesl ! and write to file.
USE m_orbcomp ! calculate orbital composition (like p_x,p_y,p_z)
USE m_abcrot2
USE m_doswrite
USE m_eig66_io, ONLY : read_eig
USE m_corespec, only : l_cs ! calculation of core spectra (EELS)
USE m_corespec_io, only : corespec_init
......@@ -105,6 +103,8 @@ CONTAINS
TYPE(t_potden), INTENT(INOUT) :: den
TYPE(t_regionCharges), INTENT(INOUT) :: regCharges
TYPE(t_moments), INTENT(INOUT) :: moments
TYPE(t_mcd), INTENT(INOUT) :: mcd
TYPE(t_slab), INTENT(INOUT) :: slab
! .. Scalar Arguments ..
INTEGER, INTENT(IN) :: eig_id,jspin
......@@ -131,9 +131,7 @@ CONTAINS
TYPE (t_denCoeffs) :: denCoeffs
TYPE (t_denCoeffsOffdiag) :: denCoeffsOffdiag
TYPE (t_force) :: force
TYPE (t_slab) :: slab
TYPE (t_eigVecCoeffs) :: eigVecCoeffs
TYPE (t_mcd) :: mcd
TYPE (t_usdus) :: usdus
TYPE (t_zMat) :: zMat
TYPE (t_orbcomp) :: orbcomp
......@@ -393,16 +391,6 @@ CONTAINS
IF(l_cs) CALL corespec_ddscs(jspin,input%jspins)
IF (((jspin.eq.input%jspins).OR.noco%l_mperp) .AND. (banddos%dos.or.banddos%vacdos.or.input%cdinf) ) THEN
CALL timestart("cdnval: dos")
CALL doswrite(eig_id,dimension,kpts,atoms,vacuum,input,banddos,&
sliceplot,noco,sym,cell,mcd,results,slab%nsld,oneD)
IF (banddos%dos.AND.(banddos%ndir.EQ.-3)) THEN
CALL Ek_write_sl(eig_id,dimension,kpts,atoms,vacuum,input,jspin,sym,cell,slab)
END IF
CALL timestop("cdnval: dos")
END IF
DO ispin = jsp_start,jsp_end
!---> check continuity of charge density
......@@ -438,10 +426,5 @@ CONTAINS
CALL MPI_BARRIER(mpi%mpi_comm,ie) ! Synchronizes the RMA operations
#endif
IF ((jsp_end.EQ.input%jspins)) THEN
IF ((banddos%dos.OR.banddos%vacdos).AND.(banddos%ndir/=-2)) CALL juDFT_end("DOS OK",mpi%irank)
IF (vacuum%nstm.EQ.3) CALL juDFT_end("VACWAVE OK",mpi%irank)
END IF
END SUBROUTINE cdnval
END MODULE m_cdnval
......@@ -34,6 +34,8 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
USE m_magMoms
USE m_orbMagMoms
USE m_cdncore
USE m_doswrite
USE m_Ekwritesl
#ifdef CPP_MPI
USE m_mpi_bc_potden
#endif
......@@ -69,8 +71,11 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
TYPE(t_noco) :: noco_new
TYPE(t_regionCharges) :: regCharges
TYPE(t_moments) :: moments
TYPE(t_mcd) :: mcd
TYPE(t_slab) :: slab
TYPE(t_cdnvalKLoop) :: cdnvalKLoop
!Local Scalars
REAL :: fix, qtot, dummy
INTEGER :: jspin, jspmax
......@@ -90,10 +95,24 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
CALL timestart("cdngen: cdnval")
CALL cdnvalKLoop%init(mpi,input,kpts,banddos,noco,results,jspin,sliceplot)
CALL cdnval(eig_id,mpi,kpts,jspin,sliceplot,noco,input,banddos,cell,atoms,enpara,stars,vacuum,dimension,&
sphhar,sym,obsolete,vTot,oneD,coreSpecInput,cdnvalKLoop,outDen,regCharges,results,moments)
sphhar,sym,obsolete,vTot,oneD,coreSpecInput,cdnvalKLoop,outDen,regCharges,results,moments,mcd,slab)
CALL timestop("cdngen: cdnval")
END DO
IF (mpi%irank.EQ.0) THEN
IF (banddos%dos.or.banddos%vacdos.or.input%cdinf) THEN
CALL timestart("cdnval: dos")
CALL doswrite(eig_id,dimension,kpts,atoms,vacuum,input,banddos,sliceplot,noco,sym,cell,mcd,results,slab%nsld,oneD)
IF (banddos%dos.AND.(banddos%ndir.EQ.-3)) THEN
CALL Ek_write_sl(eig_id,dimension,kpts,atoms,vacuum,input,jspmax,sym,cell,slab)
END IF
CALL timestop("cdnval: dos")
END IF
END IF
IF ((banddos%dos.OR.banddos%vacdos).AND.(banddos%ndir/=-2)) CALL juDFT_end("DOS OK",mpi%irank)
IF (vacuum%nstm.EQ.3) CALL juDFT_end("VACWAVE OK",mpi%irank)
IF (mpi%irank.EQ.0) THEN
CALL cdntot(stars,atoms,sym,vacuum,input,cell,oneD,outDen,.TRUE.,qtot,dummy)
CALL closeXMLElement('valenceDensity')
......
......@@ -535,6 +535,14 @@ SUBROUTINE slab_init(thisSlab,banddos,dimension,atoms,cell)
nsld=1
IF (ALLOCATED(thisSlab%nmtsl)) DEALLOCATE(thisSlab%nmtsl)
IF (ALLOCATED(thisSlab%nslat)) DEALLOCATE(thisSlab%nslat)
IF (ALLOCATED(thisSlab%zsl)) DEALLOCATE(thisSlab%zsl)
IF (ALLOCATED(thisSlab%volsl)) DEALLOCATE(thisSlab%volsl)
IF (ALLOCATED(thisSlab%volintsl)) DEALLOCATE(thisSlab%volintsl)
IF (ALLOCATED(thisSlab%qintsl)) DEALLOCATE(thisSlab%qintsl)
IF (ALLOCATED(thisSlab%qmtsl)) DEALLOCATE(thisSlab%qmtsl)
IF ((banddos%ndir.EQ.-3).AND.banddos%dos) THEN
CALL slab_dim(atoms, nsld)
ALLOCATE (thisSlab%nmtsl(atoms%ntype,nsld))
......@@ -605,6 +613,11 @@ SUBROUTINE mcd_init1(thisMCD,banddos,dimension,input,atoms)
TYPE(t_input), INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms
IF (ALLOCATED(thisMCD%ncore)) DEALLOCATE(thisMCD%ncore)
IF (ALLOCATED(thisMCD%e_mcd)) DEALLOCATE(thisMCD%e_mcd)
IF (ALLOCATED(thisMCD%m_mcd)) DEALLOCATE(thisMCD%m_mcd)
IF (ALLOCATED(thisMCD%mcd)) DEALLOCATE(thisMCD%mcd)
ALLOCATE (thisMCD%ncore(atoms%ntype))
ALLOCATE (thisMCD%e_mcd(atoms%ntype,input%jspins,dimension%nstd))
IF (banddos%l_mcd) THEN
......
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