Commit 5b87fe42 authored by Gregor Michalicek's avatar Gregor Michalicek

Move reading of density out of vgen

parent 5159e3b0
......@@ -966,6 +966,14 @@ CONTAINS
err=0
pd%iter=0
IF(ALLOCATED(pd%pw)) DEALLOCATE(pd%pw)
IF(ALLOCATED(pd%mt)) DEALLOCATE(pd%mt)
IF(ALLOCATED(pd%vacz)) DEALLOCATE(pd%vacz)
IF(ALLOCATED(pd%vacxy)) DEALLOCATE(pd%vacxy)
IF(ALLOCATED(pd%cdom)) DEALLOCATE(pd%cdom)
IF(ALLOCATED(pd%cdomvz)) DEALLOCATE(pd%cdomvz)
IF(ALLOCATED(pd%cdomvxy)) DEALLOCATE(pd%cdomvxy)
IF(ALLOCATED(pd%mmpMat)) DEALLOCATE(pd%mmpMat)
ALLOCATE(pd%pw(ng3,jsp),stat=err(1))
ALLOCATE(pd%mt(jmtd,0:nlhd,ntype,jsp),stat=err(2))
IF (PRESENT(nmzd)) THEN
......
......@@ -41,6 +41,8 @@ CONTAINS
USE m_fleur_init
USE m_pldngen
USE m_optional
USE m_cdn_io
USE m_qfix
USE m_vgen
USE m_rhodirgen
USE m_writexcstuff
......@@ -70,6 +72,7 @@ CONTAINS
USE m_ylm
#ifdef CPP_MPI
USE m_mpi_bc_all, ONLY : mpi_bc_all
USE m_mpi_bc_potden
#endif
USE m_eig66_io, ONLY : open_eig, close_eig
IMPLICIT NONE
......@@ -100,11 +103,13 @@ CONTAINS
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: v,vx
TYPE(t_potden) :: inDen, outDen
! .. Local Scalars ..
INTEGER:: eig_id
INTEGER:: eig_id, archiveType
INTEGER:: n,it,ithf,pc
LOGICAL:: stop80,reap,l_endit,l_opti,l_cont
LOGICAL:: stop80,reap,l_endit,l_opti,l_cont,l_qfix
REAL :: fermiEnergyTemp, fix
!--- J<
INTEGER :: phn
REAL, PARAMETER :: tol = 1.e-8
......@@ -223,6 +228,33 @@ CONTAINS
END IF
END IF
! Initialize and load inDen density (start)
CALL inDen%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.)
IF (noco%l_noco) THEN
ALLOCATE (inDen%cdom(stars%ng3),inDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (inDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
archiveType = CDN_ARCHIVE_TYPE_NOCO_const
ELSE
ALLOCATE (inDen%cdom(1),inDen%cdomvz(1,1),inDen%cdomvxy(1,1,1))
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
END IF
IF(mpi%irank.EQ.0) THEN
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
0,fermiEnergyTemp,l_qfix,inDen%iter,inDen%mt,inDen%pw,inDen%vacz,inDen%vacxy,&
inDen%cdom,inDen%cdomvz,inDen%cdomvxy)
CALL timestart("Qfix")
CALL qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD,inDen%pw,inDen%vacxy,inDen%mt,inDen%vacz,&
.FALSE.,.false.,fix)
CALL timestop("Qfix")
CALL writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
0,-1.0,0.0,.FALSE.,inDen%iter,inDen%mt,inDen%pw,inDen%vacz,inDen%vacxy,inDen%cdom,&
inDen%cdomvz,inDen%cdomvxy)
END IF
#ifdef CPP_MPI
CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,inDen)
#endif
! Initialize and load inDen density (end)
DO qcount=1,jij%nqpt
IF (jij%l_J) THEN
noco%qss(:)=jij%qj(:,qcount)
......@@ -263,7 +295,7 @@ CONTAINS
CALL timestart("generation of potential")
IF (mpi%irank==0) WRITE(*,"(a)",advance="no") " * Potential generation "
CALL vgen(hybrid,reap,input,xcpot,DIMENSION, atoms,sphhar,stars,vacuum,&
sym,obsolete,cell, oneD,sliceplot,mpi ,results,noco,v,vx)
sym,obsolete,cell, oneD,sliceplot,mpi ,results,noco,inDen,v,vx)
CALL timestop("generation of potential")
IF (mpi%irank.EQ.0) THEN
......@@ -567,9 +599,32 @@ CONTAINS
IF (obsolete%disp) THEN
reap = .FALSE.
input%total = .FALSE.
! Initialize and load outDen density (start)
CALL outDen%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.)
IF (noco%l_noco) THEN
ALLOCATE (outDen%cdom(stars%ng3),outDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (outDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
ELSE
ALLOCATE (outDen%cdom(1),outDen%cdomvz(1,1),outDen%cdomvxy(1,1,1))
END IF
IF(mpi%irank.EQ.0) THEN
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN1_const,CDN_OUTPUT_DEN_const,&
0,fermiEnergyTemp,l_qfix,outDen%iter,outDen%mt,outDen%pw,outDen%vacz,outDen%vacxy,&
outDen%cdom,outDen%cdomvz,outDen%cdomvxy)
CALL timestart("Qfix")
CALL qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD,outDen%pw,outDen%vacxy,outDen%mt,outDen%vacz,&
.FALSE.,.false.,fix)
CALL timestop("Qfix")
END IF
#ifdef CPP_MPI
CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,outDen)
#endif
! Initialize and load outDen density (end)
CALL timestart("generation of potential (total)")
CALL vgen(hybrid,reap,input,xcpot,DIMENSION, atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi, results,noco,v,vx)
obsolete,cell,oneD,sliceplot,mpi, results,noco,outDen,v,vx)
CALL timestop("generation of potential (total)")
CALL potdis(stars,vacuum,atoms,sphhar, input,cell,sym)
......
This diff is collapsed.
......@@ -5,6 +5,7 @@ if (${FLEUR_USE_MPI})
mpi/mingeselle.F90
mpi/mpi_bc_all.F90
mpi/mpi_bc_pot.F90
mpi/mpi_bc_potden.F90
mpi/mpi_bc_coreDen.F90
mpi/mpi_bc_st.F90
mpi/mpi_col_den.F90
......
!--------------------------------------------------------------------------------
! Copyright (c) 2017 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_mpi_bc_potden
CONTAINS
SUBROUTINE mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,potden)
USE m_types
USE m_constants
IMPLICIT NONE
INCLUDE 'mpif.h'
TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_input),INTENT(IN) :: input
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_potden),INTENT(INOUT) :: potden
INTEGER :: n, ierr(3)
LOGICAL :: l_nocoAlloc, l_denMatAlloc
CALL MPI_BCAST(potden%iter,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
l_nocoAlloc = .FALSE.
l_denMatAlloc = .FALSE.
IF(mpi%irank.EQ.0) THEN
IF (ALLOCATED(potden%cdom)) l_nocoAlloc = .TRUE.
IF (ALLOCATED(potden%mmpMat)) l_denMatAlloc = .TRUE.
END IF
CALL MPI_BCAST(l_nocoAlloc,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(l_denMatAlloc,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
IF((mpi%irank.NE.0).AND.l_nocoAlloc) THEN
IF (noco%l_noco) THEN
IF(.NOT.ALLOCATED(potden%cdom)) ALLOCATE (potden%cdom(stars%ng3))
IF(.NOT.ALLOCATED(potden%cdomvz)) ALLOCATE (potden%cdomvz(vacuum%nmzd,2))
IF(.NOT.ALLOCATED(potden%cdomvxy)) ALLOCATE (potden%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
ELSE
IF(.NOT.ALLOCATED(potden%cdom)) ALLOCATE (potden%cdom(1))
IF(.NOT.ALLOCATED(potden%cdomvz)) ALLOCATE (potden%cdomvz(1,1))
IF(.NOT.ALLOCATED(potden%cdomvxy)) ALLOCATE (potden%cdomvxy(1,1,1))
END IF
END IF
IF((mpi%irank.NE.0).AND.l_denMatAlloc) THEN
IF ((atoms%n_u.GT.0)) THEN
IF(.NOT.ALLOCATED(potden%mmpMat)) THEN
ALLOCATE(potDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_u,input%jspins))
END IF
ELSE
IF(.NOT.ALLOCATED(potden%mmpMat)) THEN
ALLOCATE(potDen%mmpMat(-lmaxU_const:-lmaxU_const,-lmaxU_const:-lmaxU_const,1,2))
END IF
ENDIF
END IF
n = stars%ng3 * input%jspins
CALL MPI_BCAST(potden%pw,n,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
n = atoms%jmtd * (sphhar%nlhd+1) * atoms%ntype * input%jspins
CALL MPI_BCAST(potden%mt,n,MPI_DOUBLE,0,mpi%mpi_comm,ierr)
n = vacuum%nmzd * 2 * SIZE(potden%vacz,3)
CALL MPI_BCAST(potden%vacz,n,MPI_DOUBLE,0,mpi%mpi_comm,ierr)
n = vacuum%nmzxyd * (stars%ng2-1) * 2 * input%jspins
CALL MPI_BCAST(potden%vacxy,n,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
IF (l_nocoAlloc) THEN
n = SIZE(potden%cdom,1)
CALL MPI_BCAST(potden%cdom,n,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
n = SIZE(potden%cdomvz,1) * SIZE(potden%cdomvz,2)
CALL MPI_BCAST(potden%cdomvz,n,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
n = SIZE(potden%cdomvxy,1) * SIZE(potden%cdomvxy,2) * SIZE(potden%cdomvxy,3)
CALL MPI_BCAST(potden%cdomvxy,n,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
END IF
IF (l_denMatAlloc) THEN
n = SIZE(potden%mmpMat,1) * SIZE(potden%mmpMat,2) * SIZE(potden%mmpMat,3) * SIZE(potden%mmpMat,4)
CALL MPI_BCAST(potden%mmpMat,n,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
END IF
END SUBROUTINE mpi_bc_potden
END MODULE m_mpi_bc_potden
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