Commit 59db4fde authored by Gregor Michalicek's avatar Gregor Michalicek

Refactor results type initialization + add neig array to this type

parent 713fc03a
......@@ -534,7 +534,6 @@ CONTAINS
results,denCoeffs,orb,denCoeffsOffdiag,den,den%mmpMat(:,:,:,jspin))
END DO
CALL timestop("cdnval: mpi_col_den")
CALL MPI_BARRIER(mpi%mpi_comm,ie)
#endif
IF (mpi%irank==0) THEN
......
......@@ -18,7 +18,7 @@ CONTAINS
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SUBROUTINE initParallelProcesses(atoms,vacuum,input,stars,sliceplot,banddos,&
dimension,cell,sym,xcpot,noco,oneD,hybrid,&
kpts,enpara,sphhar,mpi,results,obsolete)
kpts,enpara,sphhar,mpi,obsolete)
USE m_types
......@@ -41,7 +41,6 @@ SUBROUTINE initParallelProcesses(atoms,vacuum,input,stars,sliceplot,banddos,&
TYPE(t_dimension),INTENT(INOUT) :: dimension
TYPE(t_enpara), INTENT(INOUT) :: enpara
TYPE(t_sphhar), INTENT(INOUT) :: sphhar
TYPE(t_results), INTENT(INOUT) :: results
TYPE(t_obsolete), INTENT(INOUT) :: obsolete
#ifdef CPP_MPI
INCLUDE 'mpif.h'
......@@ -166,9 +165,6 @@ SUBROUTINE initParallelProcesses(atoms,vacuum,input,stars,sliceplot,banddos,&
IF(ALLOCATED(stars%ufft)) DEALLOCATE(stars%ufft)
ALLOCATE(stars%ufft(0:27*stars%mx1*stars%mx2*stars%mx3-1),stars%ustep(stars%ng3))
ALLOCATE(results%force(3,atoms%ntype,dimension%jspd))
ALLOCATE(results%force_old(3,atoms%ntype))
ALLOCATE(oneD%ig1(-oneD%odd%k3:oneD%odd%k3,-oneD%odd%M:oneD%odd%M))
ALLOCATE(oneD%kv1(2,oneD%odd%n2d),oneD%nstr1(oneD%odd%n2d))
ALLOCATE(oneD%ngopr1(atoms%nat),oneD%mrot1(3,3,oneD%odd%nop),oneD%tau1(3,oneD%odd%nop))
......@@ -200,7 +196,6 @@ SUBROUTINE initParallelProcesses(atoms,vacuum,input,stars,sliceplot,banddos,&
oneD%odd%nq2 = oneD%odd%n2d
atoms%vr0(:) = 0.0
results%force(:,:,:) = 0.0
stars%sk2(:) = 0.0
stars%phi2(:) = 0.0
END IF
......
......@@ -9,7 +9,7 @@ CONTAINS
!> Collection of code for old-style inp-file treatment
SUBROUTINE fleur_init_old(mpi,&
input,DIMENSION,atoms,sphhar,cell,stars,sym,noco,vacuum,forcetheo,&
sliceplot,banddos,obsolete,enpara,xcpot,results,kpts,hybrid,&
sliceplot,banddos,obsolete,enpara,xcpot,kpts,hybrid,&
oneD,coreSpecInput,l_opti)
USE m_judft
USE m_types
......@@ -39,7 +39,6 @@ CONTAINS
TYPE(t_obsolete) ,INTENT(OUT) :: obsolete
TYPE(t_enpara) ,INTENT(OUT) :: enpara
TYPE(t_xcpot) ,INTENT(OUT) :: xcpot
TYPE(t_results) ,INTENT(INOUT):: results
TYPE(t_kpts) ,INTENT(INOUT):: kpts
TYPE(t_hybrid) ,INTENT(OUT) :: hybrid
TYPE(t_oneD) ,INTENT(OUT) :: oneD
......@@ -108,8 +107,6 @@ CONTAINS
ALLOCATE ( stars%phi2(stars%ng2) )
ALLOCATE ( atoms%taual(3,atoms%nat),atoms%volmts(atoms%ntype),atoms%zatom(atoms%ntype) )
ALLOCATE ( stars%rgphs(-stars%mx1:stars%mx1,-stars%mx2:stars%mx2,-stars%mx3:stars%mx3) )
ALLOCATE ( results%force(3,atoms%ntype,DIMENSION%jspd) )
ALLOCATE ( results%force_old(3,atoms%ntype) )
ALLOCATE ( kpts%bk(3,kpts%nkpt),kpts%wtkpt(kpts%nkpt) )
ALLOCATE ( stars%pgfft(0:DIMENSION%nn3d-1),stars%pgfft2(0:DIMENSION%nn2d-1) )
ALLOCATE ( stars%ufft(0:27*stars%mx1*stars%mx2*stars%mx3-1) )
......@@ -141,7 +138,6 @@ CONTAINS
atoms%vr0(:) = 0.0
results%force(:,:,:) = 0.0
IF(.NOT.juDFT_was_argument("-toXML")) THEN
PRINT *,"--------------WARNING----------------------"
......
......@@ -118,11 +118,8 @@ CONTAINS
oneD,coreSpecInput,wann,l_opti)
CALL timestop("Initialization")
IF (l_opti) &
CALL OPTIONAL(mpi,atoms,sphhar,vacuum,DIMENSION,&
stars,input,sym,cell,sliceplot,obsolete,xcpot,noco,oneD)
IF (l_opti) CALL optional(mpi,atoms,sphhar,vacuum,dimension,&
stars,input,sym,cell,sliceplot,obsolete,xcpot,noco,oneD)
!+Wannier
......@@ -141,7 +138,6 @@ CONTAINS
ithf = 0
l_cont = ( it < input%itmax )
results%last_distance = -1.0
IF (mpi%irank.EQ.0) CALL openXMLElementNoAttributes('scfLoop')
! Initialize and load inDen density (start)
......@@ -316,8 +312,6 @@ CONTAINS
! ----> fermi level and occupancies
IF ( noco%l_soc .AND. (.NOT. noco%l_noco) ) DIMENSION%neigd = 2*DIMENSION%neigd
IF( .NOT. ALLOCATED(results%w_iks) )&
ALLOCATE ( results%w_iks(DIMENSION%neigd,kpts%nkpt,DIMENSION%jspd) )
IF ( (mpi%irank.EQ.0)) THEN
CALL timestart("determination of fermi energy")
......
......@@ -103,20 +103,10 @@
IF (.NOT.l_found) CALL judft_error("No input file found",calledby='fleur_init',hint="To use FLEUR, you have to provide either an 'inp' or an 'inp.xml' file in the working directory")
END IF
CALL check_command_line()
#ifdef CPP_HDF
CALL hdf_init()
#endif
results%seigscv = 0.0
results%te_vcoul = 0.0
results%te_veff = 0.0
results%te_exc = 0.0
results%te_hfex%valence = 0.0
results%te_hfex%core = 0.0
results%e_ldau = 0.0
results%ts = 0.0
input%gw = -1
input%gw_neigd = 0
!-t3e
......@@ -182,10 +172,6 @@
noel,namex,relcor,a1,a2,a3,dtild,xmlElectronStates,&
xmlPrintCoreStates,xmlCoreOccs,atomTypeSpecies,speciesRepAtomType,&
l_kpts)
ALLOCATE (results%force(3,atoms%ntype,DIMENSION%jspd))
ALLOCATE (results%force_old(3,atoms%ntype))
results%force(:,:,:) = 0.0
END IF
CALL postprocessInput(mpi,input,sym,stars,atoms,vacuum,obsolete,kpts,&
......@@ -212,14 +198,14 @@
#ifdef CPP_MPI
CALL initParallelProcesses(atoms,vacuum,input,stars,sliceplot,banddos,&
DIMENSION,cell,sym,xcpot,noco,oneD,hybrid,&
kpts,enpara,sphhar,mpi,results,obsolete)
kpts,enpara,sphhar,mpi,obsolete)
CALL mpi_dist_forcetheorem(mpi,forcetheo)
#endif
ELSE ! else branch of "IF (input%l_inpXML) THEN"
CALL fleur_init_old(mpi,&
input,DIMENSION,atoms,sphhar,cell,stars,sym,noco,vacuum,forcetheo,&
sliceplot,banddos,obsolete,enpara,xcpot,results,kpts,hybrid,&
sliceplot,banddos,obsolete,enpara,xcpot,kpts,hybrid,&
oneD,coreSpecInput,l_opti)
END IF ! end of else branch of "IF (input%l_inpXML) THEN"
!
......@@ -521,7 +507,7 @@
CALL add_usage_data("LOs",atoms%nlotot)
CALL add_usage_data("Iterations",input%itmax)
CALL results%init(dimension,input,atoms,kpts)
IF (mpi%irank.EQ.0) THEN
CALL setStartingDensity(noco%l_noco)
......
......@@ -44,24 +44,28 @@ IMPLICIT NONE
TYPE t_results
REAL, ALLOCATABLE :: force(:,:,:) !< Forces calculated on all atoms (for each spin)
REAL, ALLOCATABLE :: force_old(:,:) !< Forces on all atoms from last iteration
REAL :: ef !<Fermie energy
REAL :: seigc !<sum of the core eigenvalues
REAL :: seigsc !<weighted sum of the semi-core eigenvalues
REAL :: seigv !<weighted sum of the occupied valence eigenvalues
REAL :: seigscv !<sum of seigv and seigsc
REAL :: ts !<entropy contribution to the free energy
REAL :: te_vcoul !<charge density-coulomb potential integral
REAL :: te_veff !<charge density-effective potential integral
REAL :: te_exc !<charge density-ex-corr.energy density integral
REAL :: e_ldau !<total energy contribution of LDA+U
REAL :: tote
REAL :: last_distance
REAL :: bandgap
TYPE(t_energy_hf) :: te_hfex
REAL :: te_hfex_loc(2)
REAL, ALLOCATABLE :: w_iks(:,:,:)
REAL, ALLOCATABLE :: force(:,:,:) !< Forces calculated on all atoms (for each spin)
REAL, ALLOCATABLE :: force_old(:,:) !< Forces on all atoms from last iteration
REAL :: ef !<Fermie energy
REAL :: seigc !<sum of the core eigenvalues
REAL :: seigsc !<weighted sum of the semi-core eigenvalues
REAL :: seigv !<weighted sum of the occupied valence eigenvalues
REAL :: seigscv !<sum of seigv and seigsc
REAL :: ts !<entropy contribution to the free energy
REAL :: te_vcoul !<charge density-coulomb potential integral
REAL :: te_veff !<charge density-effective potential integral
REAL :: te_exc !<charge density-ex-corr.energy density integral
REAL :: e_ldau !<total energy contribution of LDA+U
REAL :: tote
REAL :: last_distance
REAL :: bandgap
TYPE(t_energy_hf) :: te_hfex
REAL :: te_hfex_loc(2)
REAL, ALLOCATABLE :: w_iks(:,:,:)
INTEGER, ALLOCATABLE :: neig(:,:) ! neig(nkpts,jspins) number of calculated eigenvalues for each k point, spin
CONTAINS
PROCEDURE,PASS :: init => results_init
END TYPE t_results
TYPE t_zMat
......@@ -107,5 +111,49 @@ SUBROUTINE zMat_init(thisZMat,l_real,nbasfcn,nbands)
END IF
END SUBROUTINE zMat_init
SUBROUTINE results_init(thisResults,dimension,input,atoms,kpts)
USE m_types_setup
USE m_types_kpts
IMPLICIT NONE
CLASS(t_results), INTENT(INOUT) :: thisResults
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_input), INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_kpts), INTENT(IN) :: kpts
thisResults%seigc = 0.0
thisResults%seigsc = 0.0
thisResults%seigv = 0.0
thisResults%seigscv = 0.0
thisResults%e_ldau = 0.0
thisResults%ts = 0.0
thisResults%te_vcoul = 0.0
thisResults%te_veff = 0.0
thisResults%te_exc = 0.0
thisResults%te_hfex%valence = 0.0
thisResults%te_hfex%core = 0.0
thisResults%te_hfex_loc = 0.0
thisResults%tote = 0.0
thisResults%last_distance = -1.0
thisResults%bandgap = 0.0
thisResults%ef = 0.0
ALLOCATE (thisResults%force(3,atoms%ntype,input%jspins))
ALLOCATE (thisResults%force_old(3,atoms%ntype))
ALLOCATE (thisResults%w_iks(dimension%neigd,kpts%nkpt,input%jspins))
ALLOCATE (thisResults%neig(kpts%nkpt,input%jspins))
thisResults%force = 0.0
thisResults%force_old = 0.0
thisResults%w_iks = 0.0
thisResults%neig = 0
END SUBROUTINE results_init
END MODULE m_types_misc
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