LCOV - code coverage report
Current view: top level - types - types_force.f90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 48 56 85.7 %
Date: 2024-04-26 04:44:34 Functions: 3 5 60.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2018 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             : 
       7             : MODULE m_types_force
       8             : 
       9             :   IMPLICIT NONE
      10             : 
      11             :   PRIVATE
      12             : 
      13             :   TYPE t_force
      14             :      COMPLEX, ALLOCATABLE :: f_a12(:,:)
      15             :      COMPLEX, ALLOCATABLE :: f_a21(:,:)
      16             :      COMPLEX, ALLOCATABLE :: f_b4(:,:)
      17             :      COMPLEX, ALLOCATABLE :: f_b8(:,:)
      18             : 
      19             :      COMPLEX, ALLOCATABLE :: e1cof(:,:,:)
      20             :      COMPLEX, ALLOCATABLE :: e2cof(:,:,:)
      21             :      COMPLEX, ALLOCATABLE :: aveccof(:,:,:,:)
      22             :      COMPLEX, ALLOCATABLE :: bveccof(:,:,:,:)
      23             :      COMPLEX, ALLOCATABLE :: cveccof(:,:,:,:,:)
      24             : 
      25             :      COMPLEX, ALLOCATABLE :: acoflo(:,:,:,:)
      26             :      COMPLEX, ALLOCATABLE :: bcoflo(:,:,:,:)
      27             : 
      28             :    CONTAINS
      29             :      PROCEDURE,PASS :: init1 => force_init1
      30             :      PROCEDURE,PASS :: init2 => force_init2
      31             :      PROCEDURE      :: addContribsA21A12
      32             :   END TYPE t_force
      33             : 
      34             :   PUBLIC t_force
      35             : 
      36             : CONTAINS
      37             : 
      38        1018 :   SUBROUTINE force_init1(thisForce,input,atoms)
      39             : 
      40             :     USE m_types_setup
      41             : 
      42             :     IMPLICIT NONE
      43             : 
      44             :     CLASS(t_force),     INTENT(INOUT) :: thisForce
      45             :     TYPE(t_input),      INTENT(IN)    :: input
      46             :     TYPE(t_atoms),      INTENT(IN)    :: atoms
      47             : 
      48        1018 :     IF (input%l_f) THEN
      49         174 :        ALLOCATE (thisForce%f_a12(3,atoms%ntype))
      50         116 :        ALLOCATE (thisForce%f_a21(3,atoms%ntype))
      51         116 :        ALLOCATE (thisForce%f_b4(3,atoms%ntype))
      52         116 :        ALLOCATE (thisForce%f_b8(3,atoms%ntype))
      53             :     ELSE
      54         960 :        ALLOCATE (thisForce%f_a12(1,1))
      55         960 :        ALLOCATE (thisForce%f_a21(1,1))
      56         960 :        ALLOCATE (thisForce%f_b4(1,1))
      57         960 :        ALLOCATE (thisForce%f_b8(1,1))
      58             :     END IF
      59             : 
      60        3418 :     thisForce%f_a12 = CMPLX(0.0,0.0)
      61        3418 :     thisForce%f_a21 = CMPLX(0.0,0.0)
      62        3418 :     thisForce%f_b4 = CMPLX(0.0,0.0)
      63        3418 :     thisForce%f_b8 = CMPLX(0.0,0.0)
      64             : 
      65        1018 :   END SUBROUTINE force_init1
      66             : 
      67          62 :   SUBROUTINE force_init2(thisForce,noccbd,input,atoms)
      68             : 
      69             :     USE m_types_setup
      70             : 
      71             :     IMPLICIT NONE
      72             : 
      73             :     CLASS(t_force),     INTENT(INOUT) :: thisForce
      74             :     TYPE(t_input),      INTENT(IN)    :: input
      75             :     TYPE(t_atoms),      INTENT(IN)    :: atoms
      76             :     INTEGER,            INTENT(IN)    :: noccbd
      77             : 
      78          62 :     IF (ALLOCATED(thisForce%e1cof)) DEALLOCATE(thisForce%e1cof)
      79          62 :     IF (ALLOCATED(thisForce%e2cof)) DEALLOCATE(thisForce%e2cof)
      80          62 :     IF (ALLOCATED(thisForce%acoflo)) DEALLOCATE(thisForce%acoflo)
      81          62 :     IF (ALLOCATED(thisForce%bcoflo)) DEALLOCATE(thisForce%bcoflo)
      82          62 :     IF (ALLOCATED(thisForce%aveccof)) DEALLOCATE(thisForce%aveccof)
      83          62 :     IF (ALLOCATED(thisForce%bveccof)) DEALLOCATE(thisForce%bveccof)
      84          62 :     IF (ALLOCATED(thisForce%cveccof)) DEALLOCATE(thisForce%cveccof)
      85             : 
      86          62 :     IF (input%l_f) THEN
      87         310 :        ALLOCATE (thisForce%e1cof(noccbd,0:atoms%lmaxd*(atoms%lmaxd+2),atoms%nat))
      88         248 :        ALLOCATE (thisForce%e2cof(noccbd,0:atoms%lmaxd*(atoms%lmaxd+2),atoms%nat))
      89         372 :        ALLOCATE (thisForce%acoflo(-atoms%llod:atoms%llod,noccbd,atoms%nlod,atoms%nat))
      90         310 :        ALLOCATE (thisForce%bcoflo(-atoms%llod:atoms%llod,noccbd,atoms%nlod,atoms%nat))
      91         310 :        ALLOCATE (thisForce%aveccof(3,noccbd,0:atoms%lmaxd*(atoms%lmaxd+2),atoms%nat))
      92         248 :        ALLOCATE (thisForce%bveccof(3,noccbd,0:atoms%lmaxd*(atoms%lmaxd+2),atoms%nat))
      93         372 :        ALLOCATE (thisForce%cveccof(3,-atoms%llod:atoms%llod,noccbd,atoms%nlod,atoms%nat))
      94             :     ELSE
      95           0 :        ALLOCATE (thisForce%e1cof(1,1,1))
      96           0 :        ALLOCATE (thisForce%e2cof(1,1,1))
      97           0 :        ALLOCATE (thisForce%acoflo(1,1,1,1))
      98           0 :        ALLOCATE (thisForce%bcoflo(1,1,1,1))
      99           0 :        ALLOCATE (thisForce%aveccof(1,1,1,1))
     100           0 :        ALLOCATE (thisForce%bveccof(1,1,1,1))
     101           0 :        ALLOCATE (thisForce%cveccof(1,1,1,1,1))
     102             :     END IF
     103             : 
     104      239966 :     thisForce%e1cof = CMPLX(0.0,0.0)
     105      239966 :     thisForce%e2cof = CMPLX(0.0,0.0)
     106       19958 :     thisForce%acoflo = CMPLX(0.0,0.0)
     107       19958 :     thisForce%bcoflo = CMPLX(0.0,0.0)
     108      921518 :     thisForce%aveccof = CMPLX(0.0,0.0)
     109      921518 :     thisForce%bveccof = CMPLX(0.0,0.0)
     110       64022 :     thisForce%cveccof = CMPLX(0.0,0.0)
     111             : 
     112          62 :   END SUBROUTINE force_init2
     113             : 
     114          62 :   SUBROUTINE addContribsA21A12(thisForce,input,atoms,sym,cell ,enpara,&
     115          62 :        usdus,tlmplm,vtot,eigVecCoeffs,noccbd,ispin,eig,we,results,jsp_start,jspin,nbasfcn,zMat,lapw,sphhar,k1,k2,k3,bkpt)
     116             : 
     117             :     USE m_types_setup
     118             :     USE m_types_lapw
     119             :     USE m_types_mat
     120             :     USE m_types_sphhar
     121             :     USE m_types_usdus
     122             :     USE m_types_tlmplm
     123             :     USE m_types_enpara
     124             :     USE m_types_cdnval, ONLY: t_eigVecCoeffs
     125             :     USE m_types_misc
     126             :     USE m_types_potden
     127             :     USE m_forcea12
     128             :     USE m_forcea21
     129             :     USE m_force_a12_lv2
     130             : 
     131             :     IMPLICIT NONE
     132             : 
     133             :     CLASS(t_force),       INTENT(INOUT) :: thisForce
     134             :     TYPE(t_input),        INTENT(IN)    :: input
     135             :     TYPE(t_atoms),        INTENT(IN)    :: atoms
     136             :     TYPE(t_sym),          INTENT(IN)    :: sym
     137             :     TYPE(t_cell),         INTENT(IN)    :: cell
     138             :      
     139             :     TYPE(t_enpara),       INTENT(IN)    :: enpara
     140             :     TYPE(t_usdus),        INTENT(IN)    :: usdus
     141             :     TYPE(t_tlmplm),       INTENT(IN)    :: tlmplm
     142             :     TYPE(t_potden),       INTENT(IN)    :: vtot
     143             :     TYPE(t_eigVecCoeffs), INTENT(IN)    :: eigVecCoeffs
     144             :     TYPE(t_results),      INTENT(INOUT) :: results
     145             :     TYPE(t_lapw), INTENT(IN)            :: lapw
     146             :     TYPE(t_mat), INTENT(IN)             :: zMat
     147             :     TYPE(t_sphhar), INTENT(IN)          :: sphhar
     148             : 
     149             :     INTEGER,              INTENT(IN)    :: noccbd,k1(:,:),k2(:,:),k3(:,:)
     150             :     INTEGER,              INTENT(IN)    :: ispin,jsp_start,jspin,nbasfcn
     151             : 
     152             :     REAL,                 INTENT(IN)    :: eig(noccbd),bkpt(3)
     153             :     REAL,                 INTENT(IN)    :: we(noccbd)
     154             : 
     155             : 
     156          62 :     IF (.NOT.input%l_useapw) THEN
     157             : 
     158          62 :        IF (input%f_level.LT.2) THEN
     159             :           CALL force_a12(atoms,noccbd,sym,cell ,&
     160             :                we,ispin,noccbd,usdus,eigVecCoeffs,thisForce%acoflo,thisForce%bcoflo,&
     161          60 :                thisForce%e1cof,thisForce%e2cof,thisForce%f_a12,results)
     162             :        ELSE ! Klueppelberg (force level 2)
     163           2 :           IF (ispin.eq.jsp_start) THEN ! since we use IS rep, this part needs to be calculated only once
     164             :              CALL force_a12_lv2(jspin,input%jspins,noccbd,input%neig,atoms%ntype,atoms%ntype,atoms%nat,nbasfcn, &! or ispin?
     165             :                   sym%nop,lapw%dim_nvd(),atoms%lmaxd,cell%omtil,lapw%nv,atoms%neq,k1,k2,k3, &
     166        7337 :                   sym%invarind,sym%invarop,sym%invtab,sym%mrot,sym%ngopr,cell%amat,cell%bmat,eig,atoms%rmt,atoms%taual,we,bkpt,zMat,thisForce%f_a12,results%force )
     167             :           END IF
     168             :        END IF
     169             :     END IF
     170             :     CALL force_a21(input,atoms,sym ,cell,we,ispin,&
     171             :          enpara%el0(0:,:,ispin),noccbd,eig,usdus,tlmplm,vtot,eigVecCoeffs,&
     172             :          thisForce%aveccof,thisForce%bveccof,thisForce%cveccof,&
     173          62 :          thisForce%f_a21,thisForce%f_b4,results)
     174             : 
     175          62 :   END SUBROUTINE addContribsA21A12
     176             : 
     177           0 : END MODULE m_types_force

Generated by: LCOV version 1.14