LCOV - code coverage report
Current view: top level - ldaX - opc_setup.f90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 14 14 100.0 %
Date: 2024-05-15 04:28:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : module m_opc_setup
       2             : 
       3             :     use m_slater
       4             :     use m_types
       5             : 
       6             :     implicit none
       7             : 
       8             :     contains
       9             : 
      10          96 :     subroutine opc_setup(input, atoms, fmpi, v, den, jspin, corrections)
      11             : 
      12             :         type(t_input),  intent(in)  :: input
      13             :         type(t_atoms),  intent(in)  :: atoms
      14             :         type(t_mpi),    intent(in)  :: fmpi
      15             :         type(t_potden), intent(in)  :: v, den
      16             :         integer,        intent(in)  :: jspin
      17             :         real, allocatable, intent(out) :: corrections(:)
      18             : 
      19             :         complex :: mmpmat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const)
      20          96 :         real, allocatable :: f(:,:)
      21             : 
      22             :         integer :: i_opc, l, atomType, index, m
      23             :         real :: orb_z
      24             : 
      25         480 :         allocate(corrections(atoms%n_opc), source=0.0)
      26             : 
      27          96 :         call slater(input, jspin, atoms, v%mt(:,0,:,jspin), l_write=fmpi%irank==0, slater_parameters=f)
      28         288 :         do i_opc = 1, atoms%n_opc
      29         192 :             atomType = atoms%lda_opc(i_opc)%atomType
      30         192 :             l = atoms%lda_opc(i_opc)%l
      31             : 
      32             :             !Calculate the expectation value of the orbital moment
      33             :             !from den%mmpmat (denisty matrices for OPC are behind LDA+U and LDA+HIA)
      34             : 
      35         192 :             index = atoms%n_u + atoms%n_hia + i_opc
      36       10944 :             mmpmat = den%mmpmat(:,:,index, jspin)
      37             : 
      38         192 :             orb_z = 0.0
      39        1152 :             do m = - l, l
      40        1152 :                 orb_z = orb_z + m * real(mmpmat(m,m))
      41             :             enddo
      42             :             !calculate the racah parameter as B = (9F2 - 5F4)/441
      43         288 :             corrections(i_opc) = - (9*f(1,i_opc) - 5*f(2,i_opc))/441.0 * orb_z
      44             :         enddo
      45             :     
      46          96 :     end subroutine
      47             : 
      48             : end module m_opc_setup

Generated by: LCOV version 1.14