LCOV - code coverage report
Current view: top level - main - vgen.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 28 28 100.0 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : MODULE m_vgen
       7             : 
       8             :    USE m_juDFT
       9             : 
      10             : CONTAINS
      11             :    !> FLAPW potential generator
      12             :    !! The full potential is generated by the following main steps:
      13             :    !! * generation of Coulomb potential
      14             :    !! * copy of VCoul to both spins
      15             :    !! * generation of XC potential
      16             :    !! In addition, the rotation of the density in the noco case and some scaling is done
      17             :    !! In results we store:
      18             :    !!     TE_VCOUL  :   charge density-coulomb potential integral
      19             :    !!     TE_VEFF:   charge density-effective potential integral
      20             :    !!     TE_EXC :   charge density-ex-corr.energy density integral
      21             : 
      22         340 :    SUBROUTINE vgen(hybrid,field,input,xcpot,DIMENSION,atoms,sphhar,stars,vacuum,sym,&
      23             :                    obsolete,cell,oneD,sliceplot,mpi,results,noco,EnergyDen,den,vTot,vx,vCoul)
      24             : 
      25             :       USE m_types
      26             :       USE m_rotate_int_den_to_local
      27             :       USE m_bfield
      28             :       USE m_vgen_coulomb
      29             :       USE m_vgen_xcpot
      30             :       USE m_vgen_finalize
      31             :       USE m_rotate_mt_den_tofrom_local
      32             : #ifdef CPP_MPI
      33             :       USE m_mpi_bc_potden
      34             : #endif
      35             :       IMPLICIT NONE
      36             : 
      37             :       TYPE(t_results),   INTENT(INOUT)  :: results
      38             :       CLASS(t_xcpot),    INTENT(INOUT)  :: xcpot
      39             :       TYPE(t_hybrid),    INTENT(IN)     :: hybrid
      40             :       TYPE(t_mpi),       INTENT(IN)     :: mpi
      41             :       TYPE(t_dimension), INTENT(IN)     :: dimension
      42             :       TYPE(t_oneD),      INTENT(IN)     :: oneD
      43             :       TYPE(t_obsolete),  INTENT(IN)     :: obsolete
      44             :       TYPE(t_sliceplot), INTENT(IN)     :: sliceplot
      45             :       TYPE(t_input),     INTENT(IN)     :: input
      46             :       TYPE(t_field),     INTENT(INOUT)  :: field  !efield can be modified
      47             :       TYPE(t_vacuum),    INTENT(IN)     :: vacuum
      48             :       TYPE(t_noco),      INTENT(INOUT)  :: noco
      49             :       TYPE(t_sym),       INTENT(IN)     :: sym
      50             :       TYPE(t_stars),     INTENT(IN)     :: stars
      51             :       TYPE(t_cell),      INTENT(IN)     :: cell
      52             :       TYPE(t_sphhar),    INTENT(IN)     :: sphhar
      53             :       TYPE(t_atoms),     INTENT(IN)     :: atoms
      54             :       TYPE(t_potden),    INTENT(IN)     :: EnergyDen
      55             :       TYPE(t_potden),    INTENT(INOUT)  :: den
      56             :       TYPE(t_potden),    INTENT(INOUT)  :: vTot,vx,vCoul
      57             : 
      58         340 :       TYPE(t_potden)                    :: workden,denRot
      59             : 
      60         340 :       if (mpi%irank==0) WRITE (6,FMT=8000)
      61             : 8000  FORMAT (/,/,t10,' p o t e n t i a l   g e n e r a t o r',/)
      62             : 
      63         340 :       CALL vTot%resetPotDen()
      64         340 :       CALL vCoul%resetPotDen()
      65         340 :       CALL vx%resetPotDen()
      66         340 :       ALLOCATE(vx%pw_w,mold=vTot%pw)
      67        1196 :       vx%pw_w = 0.0
      68             : #ifndef CPP_OLDINTEL
      69         340 :       ALLOCATE(vTot%pw_w,mold=vTot%pw)
      70             : #else
      71             :       ALLOCATE( vTot%pw_w(size(vTot%pw,1),size(vTot%pw,2)))
      72             : #endif
      73         340 :       ALLOCATE(vCoul%pw_w(SIZE(vCoul%pw,1),size(vCoul%pw,2)))
      74        1196 :       vCoul%pw_w = CMPLX(0.0,0.0)
      75             : 
      76         340 :       CALL workDen%init(stars,atoms,sphhar,vacuum,noco,input%jspins,0)
      77             : 
      78             :       !sum up both spins in den into workden
      79         340 :       CALL den%sum_both_spin(workden)
      80             : 
      81         340 :       CALL vgen_coulomb(1,mpi,dimension,oneD,input,field,vacuum,sym,stars,cell,sphhar,atoms,workden,vCoul,results)
      82             : 
      83         340 :       CALL vCoul%copy_both_spin(vTot)
      84         340 :       vCoul%mt(:,:,:,input%jspins)=vCoul%mt(:,:,:,1)
      85             : 
      86         340 :       IF (noco%l_noco) THEN
      87         248 :          CALL denRot%init(stars,atoms,sphhar,vacuum,noco,input%jspins,0)
      88         248 :          denRot=den
      89         248 :          CALL rotate_int_den_to_local(DIMENSION,sym,stars,atoms,sphhar,vacuum,cell,input,noco,oneD,denRot)
      90         248 :          IF (noco%l_mtnocoPot) CALL rotate_mt_den_to_local(atoms,sphhar,sym,denrot)         
      91             :       ENDIF
      92             : 
      93             :       CALL vgen_xcpot(hybrid,input,xcpot,dimension,atoms,sphhar,stars,vacuum,sym,&
      94         340 :                       obsolete,cell,oneD,sliceplot,mpi,noco,den,denRot,EnergyDen,vTot,vx,results)
      95             : 
      96             :       !ToDo, check if this is needed for more potentials as well...
      97         340 :       CALL vgen_finalize(atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot)
      98             :       !DEALLOCATE(vcoul%pw_w)
      99             : 
     100         340 :       CALL bfield(input,noco,atoms,field,vTot)
     101             : 
     102             : #ifdef CPP_MPI
     103         340 :       CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,vTot)
     104         340 :       CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,vCoul)
     105         340 :       CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,vx)
     106             : #endif
     107         340 :    END SUBROUTINE vgen
     108             : END MODULE m_vgen

Generated by: LCOV version 1.13