LCOV - code coverage report
Current view: top level - src/xc - xc_xbecke88_long_range.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:123285f) Lines: 61.0 % 767 468
Test Date: 2026-11-04 00:58:17 Functions: 100.0 % 6 6

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief calculates the longrange part of Becke 88 exchange functional
      10              : !> \par History
      11              : !>      01.2008 created [mguidon]
      12              : !> \author Manuel Guidon
      13              : ! **************************************************************************************************
      14              : MODULE xc_xbecke88_long_range
      15              :    USE bibliography,                    ONLY: Becke1988,&
      16              :                                               cite_reference
      17              :    USE cp_array_utils,                  ONLY: cp_3d_r_cp_type
      18              :    USE input_section_types,             ONLY: section_vals_type,&
      19              :                                               section_vals_val_get
      20              :    USE kinds,                           ONLY: dp
      21              :    USE mathconstants,                   ONLY: pi,&
      22              :                                               rootpi
      23              :    USE xc_derivative_desc,              ONLY: deriv_norm_drho,&
      24              :                                               deriv_norm_drhoa,&
      25              :                                               deriv_norm_drhob,&
      26              :                                               deriv_rho,&
      27              :                                               deriv_rhoa,&
      28              :                                               deriv_rhob
      29              :    USE xc_derivative_set_types,         ONLY: xc_derivative_set_type,&
      30              :                                               xc_dset_get_derivative
      31              :    USE xc_derivative_types,             ONLY: xc_derivative_get,&
      32              :                                               xc_derivative_type
      33              :    USE xc_rho_cflags_types,             ONLY: xc_rho_cflags_type
      34              :    USE xc_rho_set_types,                ONLY: xc_rho_set_get,&
      35              :                                               xc_rho_set_type
      36              : #include "../base/base_uses.f90"
      37              : 
      38              :    IMPLICIT NONE
      39              :    PRIVATE
      40              : 
      41              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      42              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xc_xbecke88_long_range'
      43              :    REAL(kind=dp), PARAMETER :: beta = 0.0042_dp
      44              : 
      45              :    PUBLIC :: xb88_lr_lda_info, xb88_lr_lsd_info, xb88_lr_lda_eval, xb88_lr_lsd_eval
      46              : CONTAINS
      47              : 
      48              : ! **************************************************************************************************
      49              : !> \brief return various information on the functional
      50              : !> \param reference string with the reference of the actual functional
      51              : !> \param shortform string with the shortform of the functional name
      52              : !> \param needs the components needed by this functional are set to
      53              : !>        true (does not set the unneeded components to false)
      54              : !> \param max_deriv ...
      55              : !> \par History
      56              : !>      01.2008 created [mguidon]
      57              : !> \author Manuel Guidon
      58              : ! **************************************************************************************************
      59         1576 :    SUBROUTINE xb88_lr_lda_info(reference, shortform, needs, max_deriv)
      60              :       CHARACTER(LEN=*), INTENT(OUT), OPTIONAL            :: reference, shortform
      61              :       TYPE(xc_rho_cflags_type), INTENT(inout), OPTIONAL  :: needs
      62              :       INTEGER, INTENT(out), OPTIONAL                     :: max_deriv
      63              : 
      64         1576 :       IF (PRESENT(reference)) THEN
      65            8 :          reference = "A. Becke, Phys. Rev. A 38, 3098 (1988) {LDA version}"
      66              :       END IF
      67         1576 :       IF (PRESENT(shortform)) THEN
      68            8 :          shortform = "Becke 1988 Exchange Functional (LDA)"
      69              :       END IF
      70         1576 :       IF (PRESENT(needs)) THEN
      71         1568 :          needs%rho = .TRUE.
      72         1568 :          needs%norm_drho = .TRUE.
      73              :       END IF
      74         1576 :       IF (PRESENT(max_deriv)) max_deriv = 3
      75              : 
      76         1576 :    END SUBROUTINE xb88_lr_lda_info
      77              : 
      78              : ! **************************************************************************************************
      79              : !> \brief return various information on the functional
      80              : !> \param reference string with the reference of the actual functional
      81              : !> \param shortform string with the shortform of the functional name
      82              : !> \param needs the components needed by this functional are set to
      83              : !>        true (does not set the unneeded components to false)
      84              : !> \param max_deriv ...
      85              : !> \par History
      86              : !>      01.2008 created [mguidon]
      87              : !> \author Manuel Guidon
      88              : ! **************************************************************************************************
      89           57 :    SUBROUTINE xb88_lr_lsd_info(reference, shortform, needs, max_deriv)
      90              :       CHARACTER(LEN=*), INTENT(OUT), OPTIONAL            :: reference, shortform
      91              :       TYPE(xc_rho_cflags_type), INTENT(inout), OPTIONAL  :: needs
      92              :       INTEGER, INTENT(out), OPTIONAL                     :: max_deriv
      93              : 
      94           57 :       IF (PRESENT(reference)) THEN
      95            1 :          reference = "A. Becke, Phys. Rev. A 38, 3098 (1988) {LSD version}"
      96              :       END IF
      97           57 :       IF (PRESENT(shortform)) THEN
      98            1 :          shortform = "Becke 1988 Exchange Functional (LSD)"
      99              :       END IF
     100           57 :       IF (PRESENT(needs)) THEN
     101           56 :          needs%rho_spin = .TRUE.
     102           56 :          needs%rho_spin_1_3 = .TRUE.
     103           56 :          needs%norm_drho_spin = .TRUE.
     104              :       END IF
     105           57 :       IF (PRESENT(max_deriv)) max_deriv = 3
     106              : 
     107           57 :    END SUBROUTINE xb88_lr_lsd_info
     108              : 
     109              : ! **************************************************************************************************
     110              : !> \brief evaluates the becke 88 longrange exchange functional for lda
     111              : !> \param rho_set the density where you want to evaluate the functional
     112              : !> \param deriv_set place where to store the functional derivatives (they are
     113              : !>        added to the derivatives)
     114              : !> \param grad_deriv maximum degree of the derivative that should be evaluated
     115              : !> \param xb88_lr_params input parameters (scaling)
     116              : !> \par History
     117              : !>      01.2008 created [mguidon]
     118              : !> \author Manuel Guidon
     119              : ! **************************************************************************************************
     120         4552 :    SUBROUTINE xb88_lr_lda_eval(rho_set, deriv_set, grad_deriv, xb88_lr_params)
     121              :       TYPE(xc_rho_set_type), INTENT(IN)                  :: rho_set
     122              :       TYPE(xc_derivative_set_type), INTENT(IN)           :: deriv_set
     123              :       INTEGER, INTENT(in)                                :: grad_deriv
     124              :       TYPE(section_vals_type), POINTER                   :: xb88_lr_params
     125              : 
     126              :       CHARACTER(len=*), PARAMETER                        :: routineN = 'xb88_lr_lda_eval'
     127              : 
     128              :       INTEGER                                            :: handle, npoints
     129              :       INTEGER, DIMENSION(2, 3)                           :: bo
     130              :       REAL(kind=dp)                                      :: epsilon_rho, omega, sx
     131         1138 :       REAL(kind=dp), CONTIGUOUS, DIMENSION(:, :, :), POINTER :: dummy, e_0, e_ndrho, &
     132         1138 :          e_ndrho_ndrho, e_ndrho_ndrho_ndrho, e_ndrho_ndrho_rho, e_ndrho_rho, e_ndrho_rho_rho, &
     133         1138 :          e_rho, e_rho_rho, e_rho_rho_rho, norm_drho, rho
     134              :       TYPE(xc_derivative_type), POINTER                  :: deriv
     135              : 
     136         1138 :       CALL timeset(routineN, handle)
     137              : 
     138         1138 :       CALL section_vals_val_get(xb88_lr_params, "scale_x", r_val=sx)
     139         1138 :       CALL section_vals_val_get(xb88_lr_params, "omega", r_val=omega)
     140              : 
     141         1138 :       CALL cite_reference(Becke1988)
     142              : 
     143              :       CALL xc_rho_set_get(rho_set, rho=rho, &
     144         1138 :                           norm_drho=norm_drho, local_bounds=bo, rho_cutoff=epsilon_rho)
     145         1138 :       npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
     146              : 
     147              :       ! meaningful default for the arrays we don't need: let us make compiler
     148              :       ! and debugger happy...
     149         1138 :       dummy => rho
     150              : 
     151         1138 :       e_0 => dummy
     152         1138 :       e_rho => dummy
     153         1138 :       e_ndrho => dummy
     154         1138 :       e_rho_rho => dummy
     155         1138 :       e_ndrho_rho => dummy
     156         1138 :       e_ndrho_ndrho => dummy
     157         1138 :       e_rho_rho_rho => dummy
     158         1138 :       e_ndrho_rho_rho => dummy
     159         1138 :       e_ndrho_ndrho_rho => dummy
     160         1138 :       e_ndrho_ndrho_ndrho => dummy
     161              : 
     162              :       deriv => xc_dset_get_derivative(deriv_set, [INTEGER::], &
     163         1138 :                                       allocate_deriv=.TRUE.)
     164         1138 :       CALL xc_derivative_get(deriv, deriv_data=e_0)
     165         1138 :       IF (grad_deriv >= 1) THEN
     166              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rho], &
     167         1124 :                                          allocate_deriv=.TRUE.)
     168         1124 :          CALL xc_derivative_get(deriv, deriv_data=e_rho)
     169              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drho], &
     170         1124 :                                          allocate_deriv=.TRUE.)
     171         1124 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho)
     172              :       END IF
     173         1138 :       IF (grad_deriv >= 2) THEN
     174              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rho, deriv_rho], &
     175          264 :                                          allocate_deriv=.TRUE.)
     176          264 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho)
     177              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drho, deriv_rho], &
     178          264 :                                          allocate_deriv=.TRUE.)
     179          264 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho)
     180              :          deriv => xc_dset_get_derivative(deriv_set, &
     181          264 :                                          [deriv_norm_drho, deriv_norm_drho], allocate_deriv=.TRUE.)
     182          264 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho)
     183              :       END IF
     184         1138 :       IF (grad_deriv >= 3) THEN
     185              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rho, deriv_rho, deriv_rho], &
     186            0 :                                          allocate_deriv=.TRUE.)
     187            0 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_rho)
     188              :          deriv => xc_dset_get_derivative(deriv_set, &
     189            0 :                                          [deriv_norm_drho, deriv_rho, deriv_rho], allocate_deriv=.TRUE.)
     190            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho_rho)
     191              :          deriv => xc_dset_get_derivative(deriv_set, &
     192            0 :                                          [deriv_norm_drho, deriv_norm_drho, deriv_rho], allocate_deriv=.TRUE.)
     193            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_rho)
     194              :          deriv => xc_dset_get_derivative(deriv_set, &
     195            0 :                                          [deriv_norm_drho, deriv_norm_drho, deriv_norm_drho], allocate_deriv=.TRUE.)
     196            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_ndrho)
     197              :       END IF
     198         1138 :       IF (grad_deriv > 3) THEN
     199            0 :          CPABORT("derivatives bigger than 3 not implemented")
     200              :       END IF
     201              : 
     202              : !$OMP     PARALLEL DEFAULT(NONE) &
     203              : !$OMP              SHARED(rho, norm_drho, e_0, e_rho, e_ndrho, e_rho_rho) &
     204              : !$OMP              SHARED(e_ndrho_rho, e_ndrho_ndrho, e_rho_rho_rho) &
     205              : !$OMP              SHARED(e_ndrho_rho_rho, e_ndrho_ndrho_rho) &
     206              : !$OMP              SHARED(e_ndrho_ndrho_ndrho, grad_deriv, npoints) &
     207         1138 : !$OMP              SHARED(epsilon_rho, sx, omega)
     208              : 
     209              :       CALL xb88_lr_lda_calc(rho=rho, norm_drho=norm_drho, &
     210              :                             e_0=e_0, e_rho=e_rho, e_ndrho=e_ndrho, e_rho_rho=e_rho_rho, &
     211              :                             e_ndrho_rho=e_ndrho_rho, e_ndrho_ndrho=e_ndrho_ndrho, &
     212              :                             e_rho_rho_rho=e_rho_rho_rho, e_ndrho_rho_rho=e_ndrho_rho_rho, &
     213              :                             e_ndrho_ndrho_rho=e_ndrho_ndrho_rho, &
     214              :                             e_ndrho_ndrho_ndrho=e_ndrho_ndrho_ndrho, grad_deriv=grad_deriv, &
     215              :                             npoints=npoints, epsilon_rho=epsilon_rho, &
     216              :                             sx=sx, omega=omega)
     217              : 
     218              : !$OMP     END PARALLEL
     219              : 
     220         1138 :       CALL timestop(handle)
     221         1138 :    END SUBROUTINE xb88_lr_lda_eval
     222              : 
     223              : ! **************************************************************************************************
     224              : !> \brief low level calculation of the becke 88 exchange functional for lda
     225              : !> \param rho alpha or beta spin density
     226              : !> \param norm_drho || grad rho ||
     227              : !> \param e_0 adds to it the local value of the functional
     228              : !> \param e_rho derivative of the functional wrt. to the variables
     229              : !>        named where the * is.
     230              : !> \param e_ndrho ...
     231              : !> \param e_rho_rho ...
     232              : !> \param e_ndrho_rho ...
     233              : !> \param e_ndrho_ndrho ...
     234              : !> \param e_rho_rho_rho ...
     235              : !> \param e_ndrho_rho_rho ...
     236              : !> \param e_ndrho_ndrho_rho ...
     237              : !> \param e_ndrho_ndrho_ndrho ...
     238              : !> \param grad_deriv ...
     239              : !> \param npoints ...
     240              : !> \param epsilon_rho ...
     241              : !> \param sx scaling-parameter for exchange
     242              : !> \param omega parameter for erfc
     243              : !> \par History
     244              : !>      01.2008 created [mguidon]
     245              : !> \author Manuel Guidon
     246              : !> \note
     247              : !>      - Just took the lsd code and scaled rho and ndrho by 1/2 (e_0 with 2.0)
     248              : !>      - Derivatives higher than 1 not tested
     249              : ! **************************************************************************************************
     250         1138 :    SUBROUTINE xb88_lr_lda_calc(rho, norm_drho, &
     251         1138 :                                e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
     252         1138 :                                e_ndrho_ndrho, e_rho_rho_rho, e_ndrho_rho_rho, e_ndrho_ndrho_rho, &
     253         1138 :                                e_ndrho_ndrho_ndrho, grad_deriv, npoints, epsilon_rho, sx, &
     254              :                                omega)
     255              :       INTEGER, INTENT(in)                                :: npoints, grad_deriv
     256              :       REAL(kind=dp), DIMENSION(1:npoints), INTENT(inout) :: e_ndrho_ndrho_ndrho, &
     257              :          e_ndrho_ndrho_rho, e_ndrho_rho_rho, e_rho_rho_rho, e_ndrho_ndrho, e_ndrho_rho, e_rho_rho, &
     258              :          e_ndrho, e_rho, e_0
     259              :       REAL(kind=dp), DIMENSION(1:npoints), INTENT(in)    :: norm_drho, rho
     260              :       REAL(kind=dp), INTENT(in)                          :: epsilon_rho, sx, omega
     261              : 
     262              :       INTEGER                                            :: ii
     263              :       REAL(kind=dp) :: Cx, epsilon_rho43, my_epsilon_rho, my_ndrho, my_rho, t1, t10, t100, t1002, &
     264              :          t1009, t101, t1013, t103, t104, t1044, t105, t1069, t109, t1091, t11, t1102, t112, t113, &
     265              :          t1136, t1141, t1146, t1153, t1156, t116, t1163, t1167, t117, t1177, t118, t12, t122, &
     266              :          t1220, t126, t127, t128, t1284, t130, t132, t133, t1334, t1341, t1345, t135, t136, t137, &
     267              :          t1370, t1396, t140, t1400, t1404, t1405, t141, t1412, t143, t1449, t1456, t146, t1467, &
     268              :          t147, t1472, t148, t151, t155, t1553, t16, t168, t169, t17, t172, t173, t176, t177, t18, &
     269              :          t185, t186, t190, t196, t2, t200, t207, t21, t211, t212, t213
     270              :       REAL(kind=dp) :: t216, t219, t22, t221, t222, t225, t226, t23, t230, t231, t232, t233, t237, &
     271              :          t24, t241, t244, t245, t250, t251, t254, t255, t258, t259, t26, t264, t265, t27, t270, &
     272              :          t271, t28, t281, t284, t285, t289, t29, t293, t297, t3, t30, t304, t31, t311, t312, t313, &
     273              :          t316, t319, t321, t323, t325, t326, t328, t330, t335, t339, t34, t343, t346, t347, t351, &
     274              :          t354, t358, t36, t365, t368, t37, t372, t377, t38, t382, t383, t384, t39, t393, t397, &
     275              :          t40, t400, t401, t404, t405, t408, t41, t412, t413, t417, t418, t42, t428, t429, t43, &
     276              :          t435, t44, t451, t452, t455, t457, t46, t460, t462, t463, t464
     277              :       REAL(kind=dp) :: t465, t466, t467, t47, t470, t473, t478, t479, t48, t482, t486, t489, t49, &
     278              :          t492, t496, t5, t501, t502, t505, t508, t51, t513, t514, t519, t52, t521, t525, t526, &
     279              :          t529, t530, t533, t534, t536, t537, t539, t55, t562, t566, t570, t571, t572, t573, t574, &
     280              :          t575, t576, t580, t586, t59, t590, t6, t60, t601, t605, t606, t613, t624, t628, t632, &
     281              :          t639, t64, t640, t641, t657, t667, t669, t677, t68, t687, t69, t7, t71, t716, t72, t722, &
     282              :          t735, t739, t746, t75, t76, t769, t77, t79, t791, t793, t8, t838, t84, t842, t846, t85, &
     283              :          t857, t86, t860, t867, t87, t880, t90, t91, t933, t94, t95, t961
     284              :       REAL(kind=dp) :: t98, t99, xx
     285              : 
     286         1138 :       my_epsilon_rho = epsilon_rho
     287         1138 :       epsilon_rho43 = my_epsilon_rho**(4.0_dp/3.0_dp)
     288         1138 :       Cx = 1.5_dp*(3.0_dp/4.0_dp/pi)**(1.0_dp/3.0_dp)
     289              : 
     290              : !$OMP     DO
     291              :       DO ii = 1, npoints
     292              :          !! scale densities with 0.5 because code comes from LSD
     293     21280328 :          my_rho = rho(ii)*0.5_dp
     294     21280328 :          my_ndrho = norm_drho(ii)*0.5_dp
     295     21280328 :          IF (my_rho > my_epsilon_rho) THEN
     296     19592540 :             t1 = my_rho**(0.1e1_dp/0.3e1_dp)
     297     19592540 :             t2 = t1*my_rho
     298     19592540 :             t3 = 0.1e1_dp/t2
     299     19592540 :             xx = my_ndrho*MAX(t3, epsilon_rho43)
     300     19592540 :             t5 = my_ndrho**2
     301     19592540 :             t6 = beta*t5
     302     19592540 :             t7 = my_rho**2
     303     19592540 :             t8 = t1**2
     304     19592540 :             t10 = 0.1e1_dp/t8/t7
     305     19592540 :             t11 = beta*my_ndrho
     306     19592540 :             t12 = LOG(xx + SQRT(xx**0.2e1_dp + 0.1e1_dp))
     307     19592540 :             t16 = 0.10e1_dp + 0.60e1_dp*t11*t3*t12
     308     19592540 :             t17 = 0.1e1_dp/t16
     309     19592540 :             t18 = t10*t17
     310     19592540 :             t21 = 0.20e1_dp*Cx + 0.20e1_dp*t6*t18
     311     19592540 :             t22 = SQRT(t21)
     312     19592540 :             t23 = t22*t21
     313     19592540 :             t24 = my_rho*t23
     314     19592540 :             t26 = rootpi
     315     19592540 :             t27 = 0.1e1_dp/t26
     316     19592540 :             t28 = 0.1e1_dp/omega
     317     19592540 :             t29 = 0.1e1_dp/t22
     318     19592540 :             t30 = t28*t29
     319     19592540 :             t31 = t26*t1
     320     19592540 :             t34 = erf(0.3000000000e1_dp*t30*t31)
     321     19592540 :             t36 = omega*t22
     322     19592540 :             t37 = 0.1e1_dp/t1
     323     19592540 :             t38 = t27*t37
     324     19592540 :             t39 = omega**2
     325     19592540 :             t40 = 0.1e1_dp/t39
     326     19592540 :             t41 = 0.1e1_dp/t21
     327     19592540 :             t42 = t40*t41
     328     19592540 :             t43 = pi*t8
     329     19592540 :             t44 = t42*t43
     330     19592540 :             t46 = EXP(-0.8999999998e1_dp*t44)
     331     19592540 :             t47 = t39*t21
     332     19592540 :             t48 = 0.1e1_dp/pi
     333     19592540 :             t49 = 0.1e1_dp/t8
     334     19592540 :             t51 = t46 - 0.10e1_dp
     335     19592540 :             t52 = t48*t49*t51
     336     19592540 :             t55 = t46 - 0.15e1_dp - 0.5555555558e-1_dp*t47*t52
     337     19592540 :             t59 = t26*t34 + 0.3333333334e0_dp*t36*t38*t55
     338     19592540 :             t60 = t27*t59
     339              : 
     340              :                !! Multiply with 2.0 because it code comes from LSD
     341     19592540 :             e_0(ii) = e_0(ii) - 0.2222222224e0_dp*t24*omega*t60*sx*2.0_dp
     342              : 
     343     19592540 :             IF (grad_deriv >= 1) THEN
     344     19163265 :                t64 = t23*omega
     345     19163265 :                t68 = my_rho*t22*omega
     346     19163265 :                t69 = t7*my_rho
     347     19163265 :                t71 = 0.1e1_dp/t8/t69
     348     19163265 :                t72 = t71*t17
     349     19163265 :                t75 = t16**2
     350     19163265 :                t76 = 0.1e1_dp/t75
     351     19163265 :                t77 = t10*t76
     352     19163265 :                t79 = 0.1e1_dp/t1/t7
     353     19163265 :                t84 = 1 + t5*t10
     354     19163265 :                t85 = SQRT(t84)
     355     19163265 :                t86 = 0.1e1_dp/t85
     356     19163265 :                t87 = t71*t86
     357     19163265 :                t90 = -0.8000000000e1_dp*t11*t79*t12 - 0.8000000000e1_dp*t6*t87
     358     19163265 :                t91 = t77*t90
     359     19163265 :                t94 = -0.5333333333e1_dp*t6*t72 - 0.20e1_dp*t6*t91
     360     19163265 :                t95 = t60*t94
     361     19163265 :                t98 = omega*t27
     362     19163265 :                t99 = SQRT(0.3141592654e1_dp)
     363     19163265 :                t100 = 0.1e1_dp/t99
     364     19163265 :                t101 = t26*t100
     365     19163265 :                t103 = EXP(-0.9000000000e1_dp*t44)
     366     19163265 :                t104 = 0.1e1_dp/t23
     367     19163265 :                t105 = t28*t104
     368     19163265 :                t109 = t26*t49
     369              :                t112 = -0.1500000000e1_dp*t105*t31*t94 + 0.1000000000e1_dp*t30* &
     370     19163265 :                       t109
     371     19163265 :                t113 = t103*t112
     372     19163265 :                t116 = omega*t29
     373     19163265 :                t117 = t116*t27
     374     19163265 :                t118 = t37*t55
     375     19163265 :                t122 = t27*t3
     376     19163265 :                t126 = t21**2
     377     19163265 :                t127 = 0.1e1_dp/t126
     378     19163265 :                t128 = t40*t127
     379     19163265 :                t130 = t128*t43*t94
     380     19163265 :                t132 = pi*t37
     381     19163265 :                t133 = t42*t132
     382     19163265 :                t135 = 0.8999999998e1_dp*t130 - 0.5999999999e1_dp*t133
     383     19163265 :                t136 = t135*t46
     384     19163265 :                t137 = t39*t94
     385     19163265 :                t140 = t8*my_rho
     386     19163265 :                t141 = 0.1e1_dp/t140
     387     19163265 :                t143 = t48*t141*t51
     388     19163265 :                t146 = t47*t48
     389     19163265 :                t147 = t49*t135
     390     19163265 :                t148 = t147*t46
     391              :                t151 = t136 - 0.5555555558e-1_dp*t137*t52 + 0.3703703705e-1_dp*t47 &
     392     19163265 :                       *t143 - 0.5555555558e-1_dp*t146*t148
     393              :                t155 = REAL(2*t101*t113, KIND=dp) + 0.1666666667e0_dp*t117*t118*t94 - &
     394              :                       0.1111111111e0_dp*t36*t122*t55 + 0.3333333334e0_dp*t36*t38* &
     395     19163265 :                       t151
     396              : 
     397              :                e_rho(ii) = e_rho(ii) + (-0.2222222224e0_dp*t64*t60 - 0.3333333336e0_dp*t68*t95 - &
     398     19163265 :                                         0.2222222224e0_dp*t24*t98*t155)*sx
     399              : 
     400     19163265 :                t168 = 0.60e1_dp*beta*t3*t12 + 0.60e1_dp*t11*t10*t86
     401     19163265 :                t169 = t77*t168
     402     19163265 :                t172 = 0.40e1_dp*t11*t18 - 0.20e1_dp*t6*t169
     403     19163265 :                t173 = t60*t172
     404     19163265 :                t176 = pi*t100
     405     19163265 :                t177 = t176*t103
     406     19163265 :                t185 = t128*pi
     407     19163265 :                t186 = t8*t172
     408     19163265 :                t190 = t39*t172
     409              :                t196 = 0.8999999998e1_dp*t185*t186*t46 - 0.5555555558e-1_dp*t190 &
     410     19163265 :                       *t52 - 0.5000000001e0_dp*t41*t172*t46
     411              :                t200 = -0.3000000000e1_dp*t177*t105*t1*t172 + 0.1666666667e0_dp* &
     412     19163265 :                       t117*t118*t172 + 0.3333333334e0_dp*t36*t38*t196
     413              : 
     414              :                e_ndrho(ii) = e_ndrho(ii) + (-0.3333333336e0_dp*t68*t173 - 0.2222222224e0_dp*t24*t98 &
     415     19163265 :                                             *t200)*sx
     416              : 
     417              :             END IF
     418     19592540 :             IF (grad_deriv >= 2) THEN
     419      1700712 :                t207 = t27*t155
     420      1700712 :                t211 = my_rho*t29*omega
     421      1700712 :                t212 = t94**2
     422      1700712 :                t213 = t60*t212
     423      1700712 :                t216 = t207*t94
     424      1700712 :                t219 = t7**2
     425      1700712 :                t221 = 0.1e1_dp/t8/t219
     426      1700712 :                t222 = t221*t17
     427      1700712 :                t225 = t71*t76
     428      1700712 :                t226 = t225*t90
     429      1700712 :                t230 = 0.1e1_dp/t75/t16
     430      1700712 :                t231 = t10*t230
     431      1700712 :                t232 = t90**2
     432      1700712 :                t233 = t231*t232
     433      1700712 :                t237 = 0.1e1_dp/t1/t69
     434      1700712 :                t241 = t221*t86
     435      1700712 :                t244 = t5**2
     436      1700712 :                t245 = beta*t244
     437      1700712 :                t250 = 0.1e1_dp/t85/t84
     438      1700712 :                t251 = 0.1e1_dp/t1/t219/t69*t250
     439              :                t254 = 0.1866666667e2_dp*t11*t237*t12 + 0.4000000000e2_dp*t6*t241 &
     440      1700712 :                       - 0.1066666667e2_dp*t245*t251
     441      1700712 :                t255 = t77*t254
     442              :                t258 = 0.1955555555e2_dp*t6*t222 + 0.1066666667e2_dp*t6*t226 + 0.40e1_dp &
     443      1700712 :                       *t6*t233 - 0.20e1_dp*t6*t255
     444      1700712 :                t259 = t60*t258
     445      1700712 :                t264 = 0.9000000000e1_dp*t130 - 0.6000000000e1_dp*t133
     446      1700712 :                t265 = t264*t103
     447      1700712 :                t270 = 0.1e1_dp/t22/t126
     448      1700712 :                t271 = t28*t270
     449      1700712 :                t281 = t26*t141
     450              :                t284 = 0.2250000000e1_dp*t271*t31*t212 - 0.1000000000e1_dp*t105* &
     451              :                       t109*t94 - 0.1500000000e1_dp*t105*t31*t258 - 0.6666666667e0_dp &
     452      1700712 :                       *t30*t281
     453      1700712 :                t285 = t103*t284
     454      1700712 :                t289 = omega*t104*t27
     455      1700712 :                t293 = t3*t55
     456      1700712 :                t297 = t37*t151
     457      1700712 :                t304 = t27*t79
     458      1700712 :                t311 = t126*t21
     459      1700712 :                t312 = 0.1e1_dp/t311
     460      1700712 :                t313 = t40*t312
     461      1700712 :                t316 = 0.1800000000e2_dp*t313*t43*t212
     462      1700712 :                t319 = 0.1200000000e2_dp*t128*t132*t94
     463      1700712 :                t321 = t128*t43*t258
     464      1700712 :                t323 = pi*t3
     465      1700712 :                t325 = 0.2000000000e1_dp*t42*t323
     466      1700712 :                t326 = -t316 + t319 + 0.8999999998e1_dp*t321 + t325
     467      1700712 :                t328 = t135**2
     468      1700712 :                t330 = t39*t258
     469      1700712 :                t335 = t137*t48
     470      1700712 :                t339 = t48*t10*t51
     471      1700712 :                t343 = t141*t135*t46
     472      1700712 :                t346 = t49*t326
     473      1700712 :                t347 = t346*t46
     474      1700712 :                t351 = t49*t328*t46
     475              :                t354 = t326*t46 + t328*t46 - 0.5555555558e-1_dp*t330*t52 + 0.7407407410e-1_dp &
     476              :                       *t137*t143 - 0.1111111112e0_dp*t335*t148 - 0.6172839508e-1_dp &
     477              :                       *t47*t339 + 0.7407407410e-1_dp*t146*t343 - 0.5555555558e-1_dp &
     478      1700712 :                       *t146*t347 - 0.5555555558e-1_dp*t146*t351
     479              :                t358 = REAL(2*t101*t265*t112, KIND=dp) + REAL(2*t101*t285, KIND=dp) - 0.8333333335e-1_dp &
     480              :                       *t289*t118*t212 - 0.1111111111e0_dp*t117*t293*t94 &
     481              :                       + 0.3333333334e0_dp*t117*t297*t94 + 0.1666666667e0_dp*t117* &
     482              :                       t118*t258 + 0.1481481481e0_dp*t36*t304*t55 - 0.2222222222e0_dp* &
     483      1700712 :                       t36*t122*t151 + 0.3333333334e0_dp*t36*t38*t354
     484              : 
     485              :                e_rho_rho(ii) = e_rho_rho(ii) + (-0.6666666672e0_dp*t36*t95 - 0.4444444448e0_dp*t64*t207 - &
     486              :                                                 0.1666666668e0_dp*t211*t213 - 0.6666666672e0_dp*t68*t216 - 0.3333333336e0_dp &
     487      1700712 :                                                 *t68*t259 - 0.2222222224e0_dp*t24*t98*t358)*sx
     488              : 
     489      1700712 :                t365 = t27*t200
     490      1700712 :                t368 = t94*t172
     491      1700712 :                t372 = t365*t94
     492      1700712 :                t377 = t225*t168
     493      1700712 :                t382 = t6*t10
     494      1700712 :                t383 = t230*t90
     495      1700712 :                t384 = t383*t168
     496      1700712 :                t393 = beta*t5*my_ndrho
     497      1700712 :                t397 = 0.1e1_dp/t1/t219/t7*t250
     498              :                t400 = -0.8000000000e1_dp*beta*t79*t12 - 0.2400000000e2_dp*t11* &
     499      1700712 :                       t87 + 0.8000000000e1_dp*t393*t397
     500      1700712 :                t401 = t77*t400
     501              :                t404 = -0.1066666667e2_dp*t11*t72 + 0.5333333333e1_dp*t6*t377 - 0.40e1_dp &
     502      1700712 :                       *t11*t91 + 0.40e1_dp*t382*t384 - 0.20e1_dp*t6*t401
     503      1700712 :                t405 = t60*t404
     504      1700712 :                t408 = t207*t172
     505      1700712 :                t412 = t26*pi*t100
     506      1700712 :                t413 = t412*t128
     507      1700712 :                t417 = t271*t26
     508      1700712 :                t418 = t1*t94
     509              :                t428 = 0.2250000000e1_dp*t417*t418*t172 - 0.1500000000e1_dp*t105 &
     510      1700712 :                       *t31*t404 - 0.5000000000e0_dp*t105*t109*t172
     511      1700712 :                t429 = t103*t428
     512      1700712 :                t435 = t37*t196
     513      1700712 :                t451 = t313*pi
     514      1700712 :                t452 = t8*t94
     515      1700712 :                t455 = 0.1800000000e2_dp*t451*t452*t172
     516      1700712 :                t457 = t128*t43*t404
     517      1700712 :                t460 = t128*t132*t172
     518      1700712 :                t462 = -t455 + 0.8999999998e1_dp*t457 + 0.5999999999e1_dp*t460
     519      1700712 :                t463 = t462*t46
     520      1700712 :                t464 = t135*t40
     521      1700712 :                t465 = t464*t127
     522      1700712 :                t466 = t172*t46
     523      1700712 :                t467 = t43*t466
     524      1700712 :                t470 = t39*t404
     525      1700712 :                t473 = t94*t127
     526      1700712 :                t478 = 0.1e1_dp/my_rho
     527      1700712 :                t479 = t41*t478
     528      1700712 :                t482 = t190*t48
     529      1700712 :                t486 = t49*t462*t46
     530      1700712 :                t489 = t41*t135
     531              :                t492 = t463 + 0.8999999998e1_dp*t465*t467 - 0.5555555558e-1_dp*t470 &
     532              :                       *t52 - 0.5000000001e0_dp*t473*t466 + 0.3703703705e-1_dp*t190*t143 &
     533              :                       + 0.3333333334e0_dp*t479*t466 - 0.5555555558e-1_dp*t482*t148 &
     534      1700712 :                       - 0.5555555558e-1_dp*t146*t486 - 0.5000000001e0_dp*t489*t466
     535              :                t496 = 0.1800000000e2_dp*t413*t186*t113 + REAL(2*t101*t429, KIND=dp) &
     536              :                       - 0.8333333335e-1_dp*t289*t118*t368 + 0.1666666667e0_dp*t117*t435 &
     537              :                       *t94 + 0.1666666667e0_dp*t117*t118*t404 - 0.5555555555e-1_dp &
     538              :                       *t117*t293*t172 - 0.1111111111e0_dp*t36*t122*t196 + 0.1666666667e0_dp &
     539      1700712 :                       *t117*t297*t172 + 0.3333333334e0_dp*t36*t38*t492
     540              : 
     541              :                e_ndrho_rho(ii) = e_ndrho_rho(ii) + (-0.3333333336e0_dp*t36*t173 - 0.2222222224e0_dp*t64*t365 - &
     542              :                                                     0.1666666668e0_dp*t211*t60*t368 - 0.3333333336e0_dp*t68*t372 &
     543              :                                                     - 0.3333333336e0_dp*t68*t405 - 0.3333333336e0_dp*t68*t408 - 0.2222222224e0_dp &
     544      1700712 :                                                     *t24*t98*t496)*sx
     545              : 
     546      1700712 :                t501 = t172**2
     547      1700712 :                t502 = t60*t501
     548      1700712 :                t505 = t365*t172
     549      1700712 :                t508 = beta*t10
     550      1700712 :                t513 = t168**2
     551      1700712 :                t514 = t231*t513
     552      1700712 :                t519 = t219*my_rho
     553      1700712 :                t521 = 0.1e1_dp/t1/t519
     554      1700712 :                t525 = 0.120e2_dp*t508*t86 - 0.60e1_dp*t6*t521*t250
     555      1700712 :                t526 = t77*t525
     556              :                t529 = 0.40e1_dp*t508*t17 - 0.80e1_dp*t11*t169 + 0.40e1_dp*t6*t514 &
     557      1700712 :                       - 0.20e1_dp*t6*t526
     558      1700712 :                t530 = t60*t529
     559      1700712 :                t533 = pi**2
     560      1700712 :                t534 = t533*t100
     561      1700712 :                t536 = 0.1e1_dp/t39/omega
     562      1700712 :                t537 = t534*t536
     563      1700712 :                t539 = 0.1e1_dp/t22/t311
     564      1700712 :                t562 = t8*t501
     565      1700712 :                t566 = t8*t529
     566      1700712 :                t570 = t39**2
     567      1700712 :                t571 = 0.1e1_dp/t570
     568      1700712 :                t572 = t126**2
     569      1700712 :                t573 = 0.1e1_dp/t572
     570      1700712 :                t574 = t571*t573
     571      1700712 :                t575 = t574*t533
     572      1700712 :                t576 = t2*t501
     573      1700712 :                t580 = t39*t529
     574              :                t586 = -0.2250000000e2_dp*t451*t562*t46 + 0.8999999998e1_dp*t185 &
     575              :                       *t566*t46 + 0.8099999996e2_dp*t575*t576*t46 - 0.5555555558e-1_dp &
     576      1700712 :                       *t580*t52 - 0.5000000001e0_dp*t41*t529*t46
     577              :                t590 = -0.2700000000e2_dp*t537*t539*my_rho*t501*t103 + 0.4500000000e1_dp &
     578              :                       *t177*t271*t1*t501 - 0.3000000000e1_dp*t177*t105* &
     579              :                       t1*t529 - 0.8333333335e-1_dp*t289*t118*t501 + 0.3333333334e0_dp &
     580              :                       *t117*t435*t172 + 0.1666666667e0_dp*t117*t118*t529 + 0.3333333334e0_dp &
     581      1700712 :                       *t36*t38*t586
     582              : 
     583              :                e_ndrho_ndrho(ii) = e_ndrho_ndrho(ii) + (-0.1666666668e0_dp*t211*t502 - 0.6666666672e0_dp*t68*t505 &
     584              :                                                         - 0.3333333336e0_dp*t68*t530 - 0.2222222224e0_dp*t24*t98*t590) &
     585      1700712 :                                    *sx
     586              : 
     587              :             END IF
     588     19592540 :             IF (grad_deriv >= 3) THEN
     589            0 :                t601 = t27*t358
     590            0 :                t605 = my_rho*t104*omega
     591            0 :                t606 = t212*t94
     592            0 :                t613 = t94*t258
     593            0 :                t624 = 0.1e1_dp/t8/t519
     594            0 :                t628 = t221*t76
     595            0 :                t632 = t71*t230
     596            0 :                t639 = t75**2
     597            0 :                t640 = 0.1e1_dp/t639
     598            0 :                t641 = t10*t640
     599            0 :                t657 = t219**2
     600            0 :                t667 = t84**2
     601            0 :                t669 = 0.1e1_dp/t85/t667
     602              :                t677 = -0.9125925923e2_dp*t6*t624*t17 - 0.5866666667e2_dp*t6*t628 &
     603              :                       *t90 - 0.3200000001e2_dp*t6*t632*t232 + 0.1600000000e2_dp*t6 &
     604              :                       *t225*t254 - 0.120e2_dp*t6*t641*t232*t90 + 0.120e2_dp*t382 &
     605              :                       *t383*t254 - 0.20e1_dp*t6*t77*(-0.6222222223e2_dp*t11/t1/ &
     606              :                                                      t219*t12 - 0.2115555556e3_dp*t6*t624*t86 + 0.1315555556e3_dp* &
     607              :                                                      t245/t1/t657*t250 - 0.4266666668e2_dp*beta*t244*t5/t657 &
     608            0 :                                                      /t69*t669)
     609            0 :                t687 = t28*t539
     610            0 :                t716 = t264**2
     611            0 :                t722 = omega*t270*t27
     612            0 :                t735 = t79*t55
     613            0 :                t739 = t3*t151
     614            0 :                t746 = t37*t354
     615            0 :                t769 = t40*t573
     616              :                t791 = 0.5400000000e2_dp*t769*t43*t606 - 0.3600000000e2_dp*t313* &
     617              :                       t132*t212 - 0.5400000000e2_dp*t451*t452*t258 - 0.6000000000e1_dp &
     618              :                       *t128*t323*t94 + 0.1800000000e2_dp*t128*t132*t258 + 0.8999999998e1_dp &
     619            0 :                       *t128*t43*t677 - 0.2666666667e1_dp*t42*pi*t79
     620            0 :                t793 = t328*t135
     621              :                t838 = REAL(3*t326*t135*t46, KIND=dp) + REAL(t791*t46, KIND=dp) + REAL(t793* &
     622              :                                                           t46, KIND=dp) - 0.5555555558e-1_dp*t39*t677*t52 + 0.1111111112e0_dp*t330 &
     623              :                       *t143 - 0.1666666668e0_dp*t330*t48*t148 - 0.1851851853e0_dp*t137 &
     624              :                       *t339 + 0.2222222223e0_dp*t335*t343 - 0.1666666668e0_dp*t335* &
     625              :                       t347 - 0.1666666668e0_dp*t335*t351 + 0.1646090535e0_dp*t47*t48 &
     626              :                       *t71*t51 - 0.1851851853e0_dp*REAL(t146, KIND=dp)*REAL(t10, KIND=dp)*REAL(t135, KIND=dp) &
     627              :                       *REAL(t46, KIND=dp) + 0.1111111112e0_dp*REAL(t146, KIND=dp)*REAL(t141, KIND=dp)*REAL(t326, KIND=dp) &
     628              :                       *REAL(t46, KIND=dp) + 0.1111111112e0_dp*REAL(t146, KIND=dp)*REAL(t141, KIND=dp)*REAL(t328, KIND=dp) &
     629              :                       *REAL(t46, KIND=dp) - 0.5555555558e-1_dp*REAL(t146, KIND=dp)*REAL(t49, KIND=dp)*REAL(t791, KIND=dp) &
     630              :                       *REAL(t46, KIND=dp) - 0.1666666668e0_dp*REAL(t146, KIND=dp)*REAL(t346, KIND=dp)*REAL(t136, KIND=dp) &
     631              :                       - 0.5555555558e-1_dp*REAL(t146, KIND=dp)*REAL(t49, KIND=dp)*REAL(t793, KIND=dp)* &
     632            0 :                       REAL(t46, KIND=dp)
     633              :                t842 = 0.2e1_dp*t101*(-t316 + t319 + 0.9000000000e1_dp*t321 + t325) &
     634              :                       *t103*t112 + 0.2e1_dp*t101*t103*(-0.5625000000e1_dp*t687*t31 &
     635              :                                                        *t606 + 0.2250000000e1_dp*t271*t109*t212 + 0.6750000000e1_dp* &
     636              :                                                        t417*t418*t258 + 0.1000000000e1_dp*t105*t281*t94 - 0.1500000000e1_dp &
     637              :                                                        *t105*t109*t258 - 0.1500000000e1_dp*t105*t31*t677 &
     638              :                                                        + 0.1111111111e1_dp*t30*t26*t10) + 0.4e1_dp*t101*t265*t284 + &
     639              :                       0.2e1_dp*t101*t716*t103*t112 + 0.1250000000e0_dp*t722*t118 &
     640              :                       *t606 + 0.8333333333e-1_dp*t289*t293*t212 - 0.2500000000e0_dp*t289 &
     641              :                       *t297*t212 - 0.2500000000e0_dp*t289*t118*t613 + 0.2222222222e0_dp &
     642              :                       *t117*t735*t94 - 0.3333333333e0_dp*t117*t739*t94 - &
     643              :                       0.1666666667e0_dp*t117*t293*t258 + 0.5000000001e0_dp*t117*t746 &
     644              :                       *t94 + 0.5000000001e0_dp*t117*t297*t258 + 0.1666666667e0_dp*t117 &
     645              :                       *t118*t677 - 0.3456790122e0_dp*t36*t27*t237*t55 + 0.4444444444e0_dp &
     646              :                       *t36*t304*t151 - 0.3333333333e0_dp*t36*t122*t354 &
     647            0 :                       + 0.3333333334e0_dp*t36*t38*t838
     648              :                t846 = -0.5000000004e0_dp*t116*t213 - 0.2000000001e1_dp*t36*t216 &
     649              :                       - 0.1000000001e1_dp*t36*t259 - 0.6666666672e0_dp*t64*t601 + 0.8333333340e-1_dp &
     650              :                       *t605*t60*t606 - 0.5000000004e0_dp*t211*t207*t212 &
     651              :                       - 0.5000000004e0_dp*t211*t60*t613 - 0.1000000001e1_dp*t68* &
     652              :                       t601*t94 - 0.1000000001e1_dp*t68*t207*t258 - 0.3333333336e0_dp* &
     653            0 :                       t68*t60*t677 - 0.2222222224e0_dp*t24*t98*t842
     654              : 
     655            0 :                e_rho_rho_rho(ii) = e_rho_rho_rho(ii) + t846*sx
     656              : 
     657            0 :                t857 = t27*t496
     658            0 :                t860 = t212*t172
     659            0 :                t867 = t94*t404
     660            0 :                t880 = t258*t172
     661              :                t933 = 0.3911111110e2_dp*t11*t222 - 0.1955555555e2_dp*t6*t628*t168 &
     662              :                       + 0.2133333334e2_dp*t11*t226 - 0.2133333334e2_dp*t6*t71*t384 &
     663              :                       + 0.1066666667e2_dp*t6*t225*t400 + 0.80e1_dp*t11*t233 - 0.120e2_dp &
     664              :                       *t382*t640*t232*t168 + 0.80e1_dp*t382*t383*t400 - 0.40e1_dp &
     665              :                       *t11*t255 + 0.40e1_dp*t382*t230*t254*t168 - 0.20e1_dp* &
     666              :                       t6*t77*(0.1866666667e2_dp*beta*t237*t12 + 0.9866666667e2_dp* &
     667              :                               t11*t241 - 0.8266666668e2_dp*t393*t251 + 0.3200000001e2_dp*beta &
     668            0 :                               *t244*my_ndrho/t657/t7*t669)
     669            0 :                t961 = t687*t26
     670            0 :                t1002 = t3*t196
     671              :                t1009 = 0.2e1_dp*t101*(-t455 + 0.9000000000e1_dp*t457 + 0.6000000000e1_dp &
     672              :                                       *t460)*t103*t112 + 0.1800000000e2_dp*t412*t264*t40*t127 &
     673              :                        *t8*t172*t103*t112 + 0.2e1_dp*t101*t265*t428 + 0.1800000000e2_dp &
     674              :                        *t413*t186*t285 + 0.2e1_dp*t101*t103*(-0.5625000000e1_dp &
     675              :                                                              *t961*t1*t212*t172 + 0.4500000000e1_dp*t417*t418*t404 &
     676              :                                                              + 0.1500000000e1_dp*t417*t49*t94*t172 - 0.1000000000e1_dp* &
     677              :                                                           t105*t109*t404 + 0.2250000000e1_dp*t417*t1*t258*t172 - 0.1500000000e1_dp &
     678              :                                                              *t105*t31*t933 + 0.3333333334e0_dp*t105*t281* &
     679              :                                                              t172) + 0.1250000000e0_dp*t722*t118*t860 - 0.8333333335e-1_dp*t289 &
     680              :                        *t435*t212 - 0.1666666667e0_dp*t289*t118*t867 + 0.5555555555e-1_dp &
     681              :                        *t289*t293*t368 - 0.1111111111e0_dp*t117*t1002*t94 &
     682            0 :                        - 0.1111111111e0_dp*t117*t293*t404
     683            0 :                t1013 = t37*t492
     684            0 :                t1044 = t769*pi
     685              :                t1069 = 0.5400000000e2_dp*t1044*t8*t212*t172 - 0.3600000000e2_dp &
     686              :                        *t451*t452*t404 - 0.2400000000e2_dp*t451*t37*t94*t172 + &
     687              :                        0.1200000000e2_dp*t128*t132*t404 - 0.1800000000e2_dp*t451*t8* &
     688              :                        t258*t172 + 0.8999999998e1_dp*t128*t43*t933 - 0.2000000000e1_dp &
     689            0 :                        *t128*t323*t172
     690            0 :                t1091 = t127*t172*t46
     691              :                t1102 = t1069*t46 + 0.8999999998e1_dp*t326*t40*t127*t467 + REAL(2 &
     692              :                                                                      *t136*t462, KIND=dp) + 0.8999999998e1_dp*t328*t40*t127*t467 - &
     693              :                        0.5555555558e-1_dp*t39*t933*t52 - 0.5000000001e0_dp*t258*t127 &
     694              :                        *t466 + 0.7407407410e-1_dp*t470*t143 + 0.6666666668e0_dp*t94*t478 &
     695              :                        *t1091 - 0.1111111112e0_dp*t470*t48*t148 - 0.1111111112e0_dp &
     696            0 :                        *t335*t486 - 0.1000000001e1_dp*t94*t135*t1091
     697              :                t1136 = -0.6172839508e-1_dp*t190*t339 - 0.5555555556e0_dp*t41/t7 &
     698              :                        *t466 + 0.7407407410e-1_dp*t482*t343 + 0.7407407410e-1_dp*t146* &
     699              :                        t141*t462*t46 + 0.6666666668e0_dp*t479*t135*t172*t46 - 0.5555555558e-1_dp &
     700              :                        *t482*t347 - 0.5555555558e-1_dp*t146*t49*t1069 &
     701              :                        *t46 - 0.5000000001e0_dp*t41*t326*t466 - 0.5555555558e-1_dp*t482 &
     702              :                        *t351 - 0.1111111112e0_dp*t146*t147*t463 - 0.5000000001e0_dp* &
     703            0 :                        t41*t328*t466
     704              :                t1141 = -0.1666666667e0_dp*t289*t297*t368 + 0.3333333334e0_dp*t117 &
     705              :                        *t1013*t94 + 0.3333333334e0_dp*t117*t297*t404 - 0.8333333335e-1_dp &
     706              :                        *t289*t118*t880 + 0.1666666667e0_dp*t117*t435*t258 + &
     707              :                        0.1666666667e0_dp*t117*t118*t933 + 0.7407407405e-1_dp*t117*t735 &
     708              :                        *t172 + 0.1481481481e0_dp*t36*t304*t196 - 0.1111111111e0_dp* &
     709              :                        t117*t739*t172 - 0.2222222222e0_dp*t36*t122*t492 + 0.1666666667e0_dp &
     710              :                        *t117*t746*t172 + 0.3333333334e0_dp*t36*t38*(t1102 &
     711            0 :                                                                     + t1136)
     712              :                t1146 = -0.3333333336e0_dp*t117*t59*t94*t172 - 0.6666666672e0_dp &
     713              :                        *t36*t372 - 0.6666666672e0_dp*t36*t405 - 0.6666666672e0_dp*t36 &
     714              :                        *t408 - 0.4444444448e0_dp*t64*t857 + 0.8333333340e-1_dp*t605*t60 &
     715              :                        *t860 - 0.1666666668e0_dp*t211*t365*t212 - 0.3333333336e0_dp* &
     716              :                        t211*t60*t867 - 0.3333333336e0_dp*t211*t207*t368 - 0.6666666672e0_dp &
     717              :                        *t68*t857*t94 - 0.6666666672e0_dp*t68*t207*t404 - 0.1666666668e0_dp &
     718              :                        *t211*t60*t880 - 0.3333333336e0_dp*t68*t365* &
     719              :                        t258 - 0.3333333336e0_dp*t68*t60*t933 - 0.3333333336e0_dp*t68* &
     720            0 :                        t601*t172 - 0.2222222224e0_dp*t24*t98*(t1009 + t1141)
     721              : 
     722            0 :                e_ndrho_rho_rho(ii) = e_ndrho_rho_rho(ii) + t1146*sx
     723              : 
     724            0 :                t1153 = t27*t590
     725            0 :                t1156 = t94*t501
     726            0 :                t1163 = t404*t172
     727            0 :                t1167 = t94*t529
     728            0 :                t1177 = beta*t71
     729              :                t1220 = -0.1066666667e2_dp*t1177*t17 + 0.2133333334e2_dp*t11*t377 &
     730              :                        - 0.1066666667e2_dp*t6*t632*t513 + 0.5333333333e1_dp*t6*t225 &
     731              :                        *t525 - 0.40e1_dp*t508*t76*t90 + 0.160e2_dp*t11*t10*t384 - &
     732              :                        0.80e1_dp*t11*t401 - 0.120e2_dp*t382*t640*t90*t513 + 0.80e1_dp &
     733              :                        *t382*t230*t400*t168 + 0.40e1_dp*t382*t383*t525 - 0.20e1_dp &
     734              :                        *t6*t77*(-0.3200000000e2_dp*t1177*t86 + 0.4800000000e2_dp*t6 &
     735            0 :                                 *t397 - 0.2400000000e2_dp*t245/t657/my_rho*t669)
     736            0 :                t1284 = t37*t586
     737              :                t1334 = 0.5400000000e2_dp*t1044*t452*t501 - 0.3600000000e2_dp*t451 &
     738              :                        *t8*t404*t172 - 0.1800000000e2_dp*t451*t452*t529 + 0.8999999998e1_dp &
     739              :                        *t128*t43*t1220 - 0.1200000000e2_dp*t313*t132*t501 &
     740            0 :                        + 0.5999999999e1_dp*t128*t132*t529
     741            0 :                t1341 = t501*t46
     742            0 :                t1345 = t529*t46
     743            0 :                t1370 = t40*pi
     744              :                t1396 = t1334*t46 + 0.1800000000e2_dp*t462*t40*t127*t467 - 0.2250000000e2_dp &
     745              :                        *t464*t312*t43*t1341 + 0.8999999998e1_dp*t465 &
     746              :                        *t43*t1345 - 0.1000000000e1_dp*t404*t127*t466 + 0.8099999996e2_dp &
     747              :                        *t135*t571*t573*t533*t2*t1341 - 0.5555555558e-1_dp*t39 &
     748              :                        *t1220*t52 - 0.5000000001e0_dp*t473*t1345 + 0.3333333334e0_dp* &
     749              :                        t479*t1345 + 0.1000000000e1_dp*t94*t312*t1341 - 0.4500000000e1_dp &
     750              :                        *t94*t573*t501*t1370*t8*t46 + 0.3703703705e-1_dp*t580 &
     751              :                        *t143 + 0.3000000000e1_dp*t312*t37*t501*t1370*t46 - 0.5555555558e-1_dp &
     752              :                        *t580*t48*t148 - 0.1111111112e0_dp*t482*t486 - 0.5555555558e-1_dp &
     753              :                        *t146*t49*t1334*t46 - 0.1000000000e1_dp*t41* &
     754            0 :                        t462*t466 - 0.5000000001e0_dp*t489*t1345
     755              :                t1400 = -0.3600000000e2_dp*t412*t313*t562*t113 + 0.1800000000e2_dp &
     756              :                        *t413*t566*t113 + 0.3600000000e2_dp*t413*t186*t429 + 0.1620000000e3_dp &
     757              :                        *t26*t533*t100*t574*t576*t113 + 0.2e1_dp*t101 &
     758              :                        *t103*(-0.5625000000e1_dp*t961*t418*t501 + 0.4500000000e1_dp &
     759              :                               *t417*t1*t404*t172 + 0.2250000000e1_dp*t417*t418*t529 - &
     760              :                               0.1500000000e1_dp*t105*t31*t1220 + 0.7500000000e0_dp*t271*t109 &
     761              :                               *t501 - 0.5000000000e0_dp*t105*t109*t529) + 0.1250000000e0_dp* &
     762              :                        t722*t118*t1156 - 0.1666666667e0_dp*t289*t435*t368 - 0.1666666667e0_dp &
     763              :                        *t289*t118*t1163 - 0.8333333335e-1_dp*t289*t118*t1167 &
     764              :                        + 0.1666666667e0_dp*t117*t1284*t94 + 0.3333333334e0_dp*t117 &
     765              :                        *t435*t404 + 0.1666666667e0_dp*t117*t118*t1220 + 0.2777777778e-1_dp &
     766              :                        *t289*t293*t501 - 0.1111111111e0_dp*t117*t1002*t172 &
     767              :                        - 0.5555555555e-1_dp*t117*t293*t529 - 0.1111111111e0_dp*t36*t122 &
     768              :                        *t586 - 0.8333333335e-1_dp*t289*t297*t501 + 0.3333333334e0_dp &
     769              :                        *t117*t1013*t172 + 0.1666666667e0_dp*t117*t297*t529 + 0.3333333334e0_dp &
     770            0 :                        *t36*t38*t1396
     771              :                t1404 = -0.1666666668e0_dp*t116*t502 - 0.6666666672e0_dp*t36*t505 &
     772              :                        - 0.3333333336e0_dp*t36*t530 - 0.2222222224e0_dp*t64*t1153 + 0.8333333340e-1_dp &
     773              :                        *t605*t60*t1156 - 0.3333333336e0_dp*t211*t365 &
     774              :                        *t368 - 0.3333333336e0_dp*t211*t60*t1163 - 0.1666666668e0_dp*t211 &
     775              :                        *t60*t1167 - 0.3333333336e0_dp*t68*t1153*t94 - 0.6666666672e0_dp &
     776              :                        *t68*t365*t404 - 0.3333333336e0_dp*t68*t60*t1220 - 0.1666666668e0_dp &
     777              :                        *t211*t207*t501 - 0.6666666672e0_dp*t68*t857* &
     778              :                        t172 - 0.3333333336e0_dp*t68*t207*t529 - 0.2222222224e0_dp*t24* &
     779            0 :                        t98*t1400
     780              : 
     781            0 :                e_ndrho_ndrho_rho(ii) = e_ndrho_ndrho_rho(ii) + t1404*sx
     782              : 
     783            0 :                t1405 = t501*t172
     784            0 :                t1412 = t172*t529
     785              :                t1449 = -0.120e2_dp*t508*t76*t168 + 0.240e2_dp*t11*t514 - 0.120e2_dp &
     786              :                        *t11*t526 - 0.120e2_dp*t6*t641*t513*t168 + 0.120e2_dp*t382 &
     787              :                        *t230*t168*t525 - 0.20e1_dp*t6*t77*(-0.240e2_dp*beta*t521 &
     788            0 :                                                            *t250*my_ndrho + 0.180e2_dp*t393/t657*t669)
     789            0 :                t1456 = t1405*t103
     790            0 :                t1467 = t533*pi
     791            0 :                t1472 = t572*t21
     792              :                t1553 = 0.1350000000e3_dp*t537/t22/t572*my_rho*t1456 - 0.8100000000e2_dp &
     793              :                        *t534*t536*t539*my_rho*t172*t103*t529 - 0.2430000000e3_dp &
     794              :                        *t1467*t100/t570/omega/t22/t1472*t140*t1456 - &
     795              :                        0.1125000000e2_dp*t177*t687*t1*t1405 + 0.1350000000e2_dp*t176 &
     796              :                        *t103*t28*t270*t1*t1412 - 0.3000000000e1_dp*t177*t105* &
     797              :                        t1*t1449 + 0.1250000000e0_dp*t722*t118*t1405 - 0.2500000000e0_dp &
     798              :                        *t289*t435*t501 - 0.2500000000e0_dp*t289*t118*t1412 + 0.5000000001e0_dp &
     799              :                        *t117*t1284*t172 + 0.5000000001e0_dp*t117*t435 &
     800              :                        *t529 + 0.1666666667e0_dp*t117*t118*t1449 + 0.3333333334e0_dp*t36 &
     801              :                        *t38*(0.6750000000e2_dp*t1044*t8*t1405*t46 - 0.6750000000e2_dp &
     802              :                              *t451*t186*t1345 - 0.5264999998e3_dp*t571/t1472*t533 &
     803              :                              *t2*t1405*t46 + 0.8999999998e1_dp*t185*t8*t1449*t46 + 0.2429999999e3_dp &
     804              :                              *t575*t2*t529*t466 + 0.7289999995e3_dp/t570/t39 &
     805              :                              /t572/t126*t1467*t7*t1405*t46 - 0.5555555558e-1_dp*t39 &
     806            0 :                              *t1449*t52 - 0.5000000001e0_dp*t41*t1449*t46)
     807              : 
     808              :                e_ndrho_ndrho_ndrho(ii) = e_ndrho_ndrho_ndrho(ii) + (0.8333333340e-1_dp*t605*t60*t1405 - &
     809              :                                            0.5000000004e0_dp*t211*t365*t501 - 0.5000000004e0_dp*t211*t60*t1412 - 0.1000000001e1_dp &
     810              :                                                              *t68*t1153*t172 - 0.1000000001e1_dp*t68*t365*t529 - 0.3333333336e0_dp &
     811              :                                                                     *t68*t60*t1449 - 0.2222222224e0_dp*t24*t98*t1553) &
     812            0 :                                          *sx
     813              : 
     814              :             END IF
     815              :          END IF
     816              :       END DO
     817              : !$OMP     END DO
     818              : 
     819         1138 :    END SUBROUTINE xb88_lr_lda_calc
     820              : 
     821              : ! **************************************************************************************************
     822              : !> \brief evaluates the becke 88 longrange exchange functional for lsd
     823              : !> \param rho_set ...
     824              : !> \param deriv_set ...
     825              : !> \param grad_deriv ...
     826              : !> \param xb88_lr_params ...
     827              : !> \par History
     828              : !>      01.2008 created [mguidon]
     829              : !> \author Manuel Guidon
     830              : ! **************************************************************************************************
     831          260 :    SUBROUTINE xb88_lr_lsd_eval(rho_set, deriv_set, grad_deriv, xb88_lr_params)
     832              :       TYPE(xc_rho_set_type), INTENT(IN)                  :: rho_set
     833              :       TYPE(xc_derivative_set_type), INTENT(IN)           :: deriv_set
     834              :       INTEGER, INTENT(in)                                :: grad_deriv
     835              :       TYPE(section_vals_type), POINTER                   :: xb88_lr_params
     836              : 
     837              :       CHARACTER(len=*), PARAMETER                        :: routineN = 'xb88_lr_lsd_eval'
     838              : 
     839              :       INTEGER                                            :: handle, i, ispin, npoints
     840              :       INTEGER, DIMENSION(2, 3)                           :: bo
     841              :       REAL(kind=dp)                                      :: epsilon_rho, omega, sx
     842              :       REAL(kind=dp), CONTIGUOUS, DIMENSION(:, :, :), &
     843           52 :          POINTER                                         :: dummy, e_0
     844          468 :       TYPE(cp_3d_r_cp_type), DIMENSION(2) :: e_ndrho, e_ndrho_ndrho, e_ndrho_ndrho_ndrho, &
     845          936 :          e_ndrho_ndrho_rho, e_ndrho_rho, e_ndrho_rho_rho, e_rho, e_rho_rho, e_rho_rho_rho, &
     846          312 :          norm_drho, rho
     847              :       TYPE(xc_derivative_type), POINTER                  :: deriv
     848              : 
     849           52 :       CALL timeset(routineN, handle)
     850              : 
     851           52 :       CALL cite_reference(Becke1988)
     852              : 
     853           52 :       NULLIFY (deriv)
     854          156 :       DO i = 1, 2
     855          156 :          NULLIFY (norm_drho(i)%array, rho(i)%array)
     856              :       END DO
     857              : 
     858           52 :       CALL section_vals_val_get(xb88_lr_params, "scale_x", r_val=sx)
     859           52 :       CALL section_vals_val_get(xb88_lr_params, "omega", r_val=omega)
     860              : 
     861              :       CALL xc_rho_set_get(rho_set, &
     862              :                           rhoa=rho(1)%array, &
     863              :                           rhob=rho(2)%array, norm_drhoa=norm_drho(1)%array, &
     864              :                           norm_drhob=norm_drho(2)%array, rho_cutoff=epsilon_rho, &
     865           52 :                           local_bounds=bo)
     866           52 :       npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
     867              : 
     868              :       ! meaningful default for the arrays we don't need: let us make compiler
     869              :       ! and debugger happy...
     870           52 :       dummy => rho(1)%array
     871              : 
     872           52 :       e_0 => dummy
     873          156 :       DO i = 1, 2
     874          104 :          e_rho(i)%array => dummy
     875          104 :          e_ndrho(i)%array => dummy
     876          104 :          e_rho_rho(i)%array => dummy
     877          104 :          e_ndrho_rho(i)%array => dummy
     878          104 :          e_ndrho_ndrho(i)%array => dummy
     879          104 :          e_rho_rho_rho(i)%array => dummy
     880          104 :          e_ndrho_rho_rho(i)%array => dummy
     881          104 :          e_ndrho_ndrho_rho(i)%array => dummy
     882          156 :          e_ndrho_ndrho_ndrho(i)%array => dummy
     883              :       END DO
     884              : 
     885              :       deriv => xc_dset_get_derivative(deriv_set, [INTEGER::], &
     886           52 :                                       allocate_deriv=.TRUE.)
     887           52 :       CALL xc_derivative_get(deriv, deriv_data=e_0)
     888           52 :       IF (grad_deriv >= 1) THEN
     889              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhoa], &
     890           52 :                                          allocate_deriv=.TRUE.)
     891           52 :          CALL xc_derivative_get(deriv, deriv_data=e_rho(1)%array)
     892              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhob], &
     893           52 :                                          allocate_deriv=.TRUE.)
     894           52 :          CALL xc_derivative_get(deriv, deriv_data=e_rho(2)%array)
     895              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhoa], &
     896           52 :                                          allocate_deriv=.TRUE.)
     897           52 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho(1)%array)
     898              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhob], &
     899           52 :                                          allocate_deriv=.TRUE.)
     900           52 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho(2)%array)
     901              :       END IF
     902           52 :       IF (grad_deriv >= 2) THEN
     903              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhoa, deriv_rhoa], &
     904            0 :                                          allocate_deriv=.TRUE.)
     905            0 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho(1)%array)
     906              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhob, deriv_rhob], &
     907            0 :                                          allocate_deriv=.TRUE.)
     908            0 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho(2)%array)
     909              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhoa, deriv_rhoa], &
     910            0 :                                          allocate_deriv=.TRUE.)
     911            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho(1)%array)
     912              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhob, deriv_rhob], &
     913            0 :                                          allocate_deriv=.TRUE.)
     914            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho(2)%array)
     915              :          deriv => xc_dset_get_derivative(deriv_set, &
     916            0 :                                          [deriv_norm_drhoa, deriv_norm_drhoa], allocate_deriv=.TRUE.)
     917            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho(1)%array)
     918              :          deriv => xc_dset_get_derivative(deriv_set, &
     919            0 :                                          [deriv_norm_drhob, deriv_norm_drhob], allocate_deriv=.TRUE.)
     920            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho(2)%array)
     921              :       END IF
     922           52 :       IF (grad_deriv >= 3) THEN
     923              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhoa, deriv_rhoa, deriv_rhoa], &
     924            0 :                                          allocate_deriv=.TRUE.)
     925            0 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_rho(1)%array)
     926              :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhob, deriv_rhob, deriv_rhob], &
     927            0 :                                          allocate_deriv=.TRUE.)
     928            0 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_rho(2)%array)
     929              :          deriv => xc_dset_get_derivative(deriv_set, &
     930            0 :                                          [deriv_norm_drhoa, deriv_rhoa, deriv_rhoa], allocate_deriv=.TRUE.)
     931            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho_rho(1)%array)
     932              :          deriv => xc_dset_get_derivative(deriv_set, &
     933            0 :                                          [deriv_norm_drhob, deriv_rhob, deriv_rhob], allocate_deriv=.TRUE.)
     934            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho_rho(2)%array)
     935              :          deriv => xc_dset_get_derivative(deriv_set, &
     936            0 :                                          [deriv_norm_drhoa, deriv_norm_drhoa, deriv_rhoa], allocate_deriv=.TRUE.)
     937            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_rho(1)%array)
     938              :          deriv => xc_dset_get_derivative(deriv_set, &
     939            0 :                                          [deriv_norm_drhob, deriv_norm_drhob, deriv_rhob], allocate_deriv=.TRUE.)
     940            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_rho(2)%array)
     941              :          deriv => xc_dset_get_derivative(deriv_set, &
     942            0 :                                          [deriv_norm_drhoa, deriv_norm_drhoa, deriv_norm_drhoa], allocate_deriv=.TRUE.)
     943            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_ndrho(1)%array)
     944              :          deriv => xc_dset_get_derivative(deriv_set, &
     945            0 :                                          [deriv_norm_drhob, deriv_norm_drhob, deriv_norm_drhob], allocate_deriv=.TRUE.)
     946            0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_ndrho(2)%array)
     947              :       END IF
     948           52 :       IF (grad_deriv > 3) THEN
     949            0 :          CPABORT("derivatives bigger than 3 not implemented")
     950              :       END IF
     951              : 
     952          156 :       DO ispin = 1, 2
     953              : 
     954              : !$OMP        PARALLEL DEFAULT(NONE) &
     955              : !$OMP                 SHARED(rho, norm_drho, e_0, e_rho, e_ndrho) &
     956              : !$OMP                 SHARED(e_rho_rho, e_ndrho_rho, e_ndrho_ndrho) &
     957              : !$OMP                 SHARED(e_rho_rho_rho, e_ndrho_rho_rho) &
     958              : !$OMP                 SHARED(e_ndrho_ndrho_rho, e_ndrho_ndrho_ndrho) &
     959              : !$OMP                 SHARED(grad_deriv, npoints, epsilon_rho, sx, omega) &
     960          156 : !$OMP                 SHARED(ispin)
     961              : 
     962              :          CALL xb88_lr_lsd_calc( &
     963              :             rho_spin=rho(ispin)%array, &
     964              :             norm_drho_spin=norm_drho(ispin)%array, &
     965              :             e_0=e_0, &
     966              :             e_rho_spin=e_rho(ispin)%array, &
     967              :             e_ndrho_spin=e_ndrho(ispin)%array, &
     968              :             e_rho_rho_spin=e_rho_rho(ispin)%array, &
     969              :             e_ndrho_rho_spin=e_ndrho_rho(ispin)%array, &
     970              :             e_ndrho_ndrho_spin=e_ndrho_ndrho(ispin)%array, &
     971              :             e_rho_rho_rho_spin=e_rho_rho_rho(ispin)%array, &
     972              :             e_ndrho_rho_rho_spin=e_ndrho_rho_rho(ispin)%array, &
     973              :             e_ndrho_ndrho_rho_spin=e_ndrho_ndrho_rho(ispin)%array, &
     974              :             e_ndrho_ndrho_ndrho_spin=e_ndrho_ndrho_ndrho(ispin)%array, &
     975              :             grad_deriv=grad_deriv, npoints=npoints, &
     976              :             epsilon_rho=epsilon_rho, &
     977              :             sx=sx, omega=omega)
     978              : 
     979              : !$OMP        END PARALLEL
     980              : 
     981              :       END DO
     982              : 
     983           52 :       CALL timestop(handle)
     984              : 
     985           52 :    END SUBROUTINE xb88_lr_lsd_eval
     986              : 
     987              : ! **************************************************************************************************
     988              : !> \brief low level calculation of the becke 88 exchange functional for lsd
     989              : !> \param rho_spin alpha or beta spin density
     990              : !> \param norm_drho_spin || grad rho_spin ||
     991              : !> \param e_0 adds to it the local value of the functional
     992              : !> \param e_rho_spin e_*_spin derivative of the functional wrt. to the variables
     993              : !>        named where the * is. Everything wrt. to the spin of the arguments.
     994              : !> \param e_ndrho_spin ...
     995              : !> \param e_rho_rho_spin ...
     996              : !> \param e_ndrho_rho_spin ...
     997              : !> \param e_ndrho_ndrho_spin ...
     998              : !> \param e_rho_rho_rho_spin ...
     999              : !> \param e_ndrho_rho_rho_spin ...
    1000              : !> \param e_ndrho_ndrho_rho_spin ...
    1001              : !> \param e_ndrho_ndrho_ndrho_spin ...
    1002              : !> \param grad_deriv ...
    1003              : !> \param npoints ...
    1004              : !> \param epsilon_rho ...
    1005              : !> \param sx scaling-parameter for exchange
    1006              : !> \param omega ...
    1007              : !> \par History
    1008              : !>      01.2008 created [mguidon]
    1009              : !> \author Manuel Guidon
    1010              : !> \note
    1011              : !>      - Derivatives higher than one not tested
    1012              : ! **************************************************************************************************
    1013          104 :    SUBROUTINE xb88_lr_lsd_calc(rho_spin, norm_drho_spin, e_0, &
    1014              :                                e_rho_spin, e_ndrho_spin, e_rho_rho_spin, e_ndrho_rho_spin, &
    1015              :                                e_ndrho_ndrho_spin, e_rho_rho_rho_spin, e_ndrho_rho_rho_spin, &
    1016              :                                e_ndrho_ndrho_rho_spin, &
    1017              :                                e_ndrho_ndrho_ndrho_spin, grad_deriv, npoints, epsilon_rho, sx, &
    1018              :                                omega)
    1019              :       REAL(kind=dp), DIMENSION(*), INTENT(in)            :: rho_spin, norm_drho_spin
    1020              :       REAL(kind=dp), DIMENSION(*), INTENT(inout) :: e_0, e_rho_spin, e_ndrho_spin, e_rho_rho_spin, &
    1021              :          e_ndrho_rho_spin, e_ndrho_ndrho_spin, e_rho_rho_rho_spin, e_ndrho_rho_rho_spin, &
    1022              :          e_ndrho_ndrho_rho_spin, e_ndrho_ndrho_ndrho_spin
    1023              :       INTEGER, INTENT(in)                                :: grad_deriv, npoints
    1024              :       REAL(kind=dp), INTENT(in)                          :: epsilon_rho, sx, omega
    1025              : 
    1026              :       INTEGER                                            :: ii
    1027              :       REAL(kind=dp) :: Cx, epsilon_rho43, my_epsilon_rho, ndrho, rho, t1, t10, t100, t1002, t1009, &
    1028              :          t101, t1013, t103, t104, t1044, t105, t1069, t109, t1091, t11, t1102, t112, t113, t1136, &
    1029              :          t1141, t1146, t1153, t1156, t116, t1163, t1167, t117, t1177, t118, t12, t122, t1220, &
    1030              :          t126, t127, t128, t1284, t130, t132, t133, t1334, t1341, t1345, t135, t136, t137, t1370, &
    1031              :          t1396, t140, t1400, t1404, t1405, t141, t1412, t143, t1449, t1456, t146, t1467, t147, &
    1032              :          t1472, t148, t151, t155, t1553, t16, t168, t169, t17, t172, t173, t176, t177, t18, t185, &
    1033              :          t186, t190, t196, t2, t200, t207, t21, t211, t212, t213, t216
    1034              :       REAL(kind=dp) :: t219, t22, t221, t222, t225, t226, t23, t230, t231, t232, t233, t237, t24, &
    1035              :          t241, t244, t245, t250, t251, t254, t255, t258, t259, t26, t264, t265, t27, t270, t271, &
    1036              :          t28, t281, t284, t285, t289, t29, t293, t297, t3, t30, t304, t31, t311, t312, t313, t316, &
    1037              :          t319, t321, t323, t325, t326, t328, t330, t335, t339, t34, t343, t346, t347, t351, t354, &
    1038              :          t358, t36, t365, t368, t37, t372, t377, t38, t382, t383, t384, t39, t393, t397, t40, &
    1039              :          t400, t401, t404, t405, t408, t41, t412, t413, t417, t418, t42, t428, t429, t43, t435, &
    1040              :          t44, t451, t452, t455, t457, t46, t460, t462, t463, t464, t465
    1041              :       REAL(kind=dp) :: t466, t467, t47, t470, t473, t478, t479, t48, t482, t486, t489, t49, t492, &
    1042              :          t496, t5, t501, t502, t505, t508, t51, t513, t514, t519, t52, t521, t525, t526, t529, &
    1043              :          t530, t533, t534, t536, t537, t539, t55, t562, t566, t570, t571, t572, t573, t574, t575, &
    1044              :          t576, t580, t586, t59, t590, t6, t60, t601, t605, t606, t613, t624, t628, t632, t639, &
    1045              :          t64, t640, t641, t657, t667, t669, t677, t68, t687, t69, t7, t71, t716, t72, t722, t735, &
    1046              :          t739, t746, t75, t76, t769, t77, t79, t791, t793, t8, t838, t84, t842, t846, t85, t857, &
    1047              :          t86, t860, t867, t87, t880, t90, t91, t933, t94, t95, t961, t98
    1048              :       REAL(kind=dp) :: t99, xx
    1049              : 
    1050          104 :       my_epsilon_rho = 0.5_dp*epsilon_rho
    1051          104 :       epsilon_rho43 = my_epsilon_rho**(4.0_dp/3.0_dp)
    1052          104 :       Cx = 1.5_dp*(3.0_dp/4.0_dp/pi)**(1.0_dp/3.0_dp)
    1053              : 
    1054          104 : !$OMP     DO
    1055              :       DO ii = 1, npoints
    1056      4224064 :          rho = rho_spin(ii)
    1057      4224064 :          ndrho = norm_drho_spin(ii)
    1058      4224064 :          IF (rho > my_epsilon_rho) THEN
    1059      4216664 :             t1 = rho**(0.1e1_dp/0.3e1_dp)
    1060      4216664 :             t2 = t1*rho
    1061      4216664 :             t3 = 0.1e1_dp/t2
    1062      4216664 :             xx = ndrho*MAX(t3, epsilon_rho43)
    1063      4216664 :             t5 = ndrho**2
    1064      4216664 :             t6 = beta*t5
    1065      4216664 :             t7 = rho**2
    1066      4216664 :             t8 = t1**2
    1067      4216664 :             t10 = 0.1e1_dp/t8/t7
    1068      4216664 :             t11 = beta*ndrho
    1069      4216664 :             t12 = LOG(xx + SQRT(xx**0.2e1_dp + 0.1e1_dp))
    1070      4216664 :             t16 = 0.10e1_dp + 0.60e1_dp*t11*t3*t12
    1071      4216664 :             t17 = 0.1e1_dp/t16
    1072      4216664 :             t18 = t10*t17
    1073      4216664 :             t21 = 0.20e1_dp*Cx + 0.20e1_dp*t6*t18
    1074      4216664 :             t22 = SQRT(t21)
    1075      4216664 :             t23 = t22*t21
    1076      4216664 :             t24 = rho*t23
    1077      4216664 :             t26 = rootpi
    1078      4216664 :             t27 = 0.1e1_dp/t26
    1079      4216664 :             t28 = 0.1e1_dp/omega
    1080      4216664 :             t29 = 0.1e1_dp/t22
    1081      4216664 :             t30 = t28*t29
    1082      4216664 :             t31 = t26*t1
    1083      4216664 :             t34 = erf(0.3000000000e1_dp*t30*t31)
    1084      4216664 :             t36 = omega*t22
    1085      4216664 :             t37 = 0.1e1_dp/t1
    1086      4216664 :             t38 = t27*t37
    1087      4216664 :             t39 = omega**2
    1088      4216664 :             t40 = 0.1e1_dp/t39
    1089      4216664 :             t41 = 0.1e1_dp/t21
    1090      4216664 :             t42 = t40*t41
    1091      4216664 :             t43 = pi*t8
    1092      4216664 :             t44 = t42*t43
    1093      4216664 :             t46 = EXP(-0.8999999998e1_dp*t44)
    1094      4216664 :             t47 = t39*t21
    1095      4216664 :             t48 = 0.1e1_dp/pi
    1096      4216664 :             t49 = 0.1e1_dp/t8
    1097      4216664 :             t51 = t46 - 0.10e1_dp
    1098      4216664 :             t52 = t48*t49*t51
    1099      4216664 :             t55 = t46 - 0.15e1_dp - 0.5555555558e-1_dp*t47*t52
    1100      4216664 :             t59 = t26*t34 + 0.3333333334e0_dp*t36*t38*t55
    1101      4216664 :             t60 = t27*t59
    1102              : 
    1103      4216664 :             e_0(ii) = e_0(ii) - 0.2222222224e0_dp*t24*omega*t60*sx
    1104              : 
    1105      4216664 :             IF (grad_deriv >= 1) THEN
    1106      4216664 :                t64 = t23*omega
    1107      4216664 :                t68 = rho*t22*omega
    1108      4216664 :                t69 = t7*rho
    1109      4216664 :                t71 = 0.1e1_dp/t8/t69
    1110      4216664 :                t72 = t71*t17
    1111      4216664 :                t75 = t16**2
    1112      4216664 :                t76 = 0.1e1_dp/t75
    1113      4216664 :                t77 = t10*t76
    1114      4216664 :                t79 = 0.1e1_dp/t1/t7
    1115      4216664 :                t84 = 1 + t5*t10
    1116      4216664 :                t85 = SQRT(t84)
    1117      4216664 :                t86 = 0.1e1_dp/t85
    1118      4216664 :                t87 = t71*t86
    1119      4216664 :                t90 = -0.8000000000e1_dp*t11*t79*t12 - 0.8000000000e1_dp*t6*t87
    1120      4216664 :                t91 = t77*t90
    1121      4216664 :                t94 = -0.5333333333e1_dp*t6*t72 - 0.20e1_dp*t6*t91
    1122      4216664 :                t95 = t60*t94
    1123      4216664 :                t98 = omega*t27
    1124      4216664 :                t99 = SQRT(0.3141592654e1_dp)
    1125      4216664 :                t100 = 0.1e1_dp/t99
    1126      4216664 :                t101 = t26*t100
    1127      4216664 :                t103 = EXP(-0.9000000000e1_dp*t44)
    1128      4216664 :                t104 = 0.1e1_dp/t23
    1129      4216664 :                t105 = t28*t104
    1130      4216664 :                t109 = t26*t49
    1131              :                t112 = -0.1500000000e1_dp*t105*t31*t94 + 0.1000000000e1_dp*t30* &
    1132      4216664 :                       t109
    1133      4216664 :                t113 = t103*t112
    1134      4216664 :                t116 = omega*t29
    1135      4216664 :                t117 = t116*t27
    1136      4216664 :                t118 = t37*t55
    1137      4216664 :                t122 = t27*t3
    1138      4216664 :                t126 = t21**2
    1139      4216664 :                t127 = 0.1e1_dp/t126
    1140      4216664 :                t128 = t40*t127
    1141      4216664 :                t130 = t128*t43*t94
    1142      4216664 :                t132 = pi*t37
    1143      4216664 :                t133 = t42*t132
    1144      4216664 :                t135 = 0.8999999998e1_dp*t130 - 0.5999999999e1_dp*t133
    1145      4216664 :                t136 = t135*t46
    1146      4216664 :                t137 = t39*t94
    1147      4216664 :                t140 = t8*rho
    1148      4216664 :                t141 = 0.1e1_dp/t140
    1149      4216664 :                t143 = t48*t141*t51
    1150      4216664 :                t146 = t47*t48
    1151      4216664 :                t147 = t49*t135
    1152      4216664 :                t148 = t147*t46
    1153              :                t151 = t136 - 0.5555555558e-1_dp*t137*t52 + 0.3703703705e-1_dp*t47 &
    1154      4216664 :                       *t143 - 0.5555555558e-1_dp*t146*t148
    1155              :                t155 = REAL(2*t101*t113, KIND=dp) + 0.1666666667e0_dp*t117*t118*t94 - &
    1156              :                       0.1111111111e0_dp*t36*t122*t55 + 0.3333333334e0_dp*t36*t38* &
    1157      4216664 :                       t151
    1158              : 
    1159              :                e_rho_spin(ii) = e_rho_spin(ii) + (-0.2222222224e0_dp*t64*t60 - 0.3333333336e0_dp*t68*t95 - &
    1160      4216664 :                                                   0.2222222224e0_dp*t24*t98*t155)*sx
    1161              : 
    1162      4216664 :                t168 = 0.60e1_dp*beta*t3*t12 + 0.60e1_dp*t11*t10*t86
    1163      4216664 :                t169 = t77*t168
    1164      4216664 :                t172 = 0.40e1_dp*t11*t18 - 0.20e1_dp*t6*t169
    1165      4216664 :                t173 = t60*t172
    1166      4216664 :                t176 = pi*t100
    1167      4216664 :                t177 = t176*t103
    1168      4216664 :                t185 = t128*pi
    1169      4216664 :                t186 = t8*t172
    1170      4216664 :                t190 = t39*t172
    1171              :                t196 = 0.8999999998e1_dp*t185*t186*t46 - 0.5555555558e-1_dp*t190 &
    1172      4216664 :                       *t52 - 0.5000000001e0_dp*t41*t172*t46
    1173              :                t200 = -0.3000000000e1_dp*t177*t105*t1*t172 + 0.1666666667e0_dp* &
    1174      4216664 :                       t117*t118*t172 + 0.3333333334e0_dp*t36*t38*t196
    1175              : 
    1176              :                e_ndrho_spin(ii) = e_ndrho_spin(ii) + (-0.3333333336e0_dp*t68*t173 - 0.2222222224e0_dp*t24*t98 &
    1177      4216664 :                                                       *t200)*sx
    1178              : 
    1179              :             END IF
    1180      4216664 :             IF (grad_deriv >= 2) THEN
    1181            0 :                t207 = t27*t155
    1182            0 :                t211 = rho*t29*omega
    1183            0 :                t212 = t94**2
    1184            0 :                t213 = t60*t212
    1185            0 :                t216 = t207*t94
    1186            0 :                t219 = t7**2
    1187            0 :                t221 = 0.1e1_dp/t8/t219
    1188            0 :                t222 = t221*t17
    1189            0 :                t225 = t71*t76
    1190            0 :                t226 = t225*t90
    1191            0 :                t230 = 0.1e1_dp/t75/t16
    1192            0 :                t231 = t10*t230
    1193            0 :                t232 = t90**2
    1194            0 :                t233 = t231*t232
    1195            0 :                t237 = 0.1e1_dp/t1/t69
    1196            0 :                t241 = t221*t86
    1197            0 :                t244 = t5**2
    1198            0 :                t245 = beta*t244
    1199            0 :                t250 = 0.1e1_dp/t85/t84
    1200            0 :                t251 = 0.1e1_dp/t1/t219/t69*t250
    1201              :                t254 = 0.1866666667e2_dp*t11*t237*t12 + 0.4000000000e2_dp*t6*t241 &
    1202            0 :                       - 0.1066666667e2_dp*t245*t251
    1203            0 :                t255 = t77*t254
    1204              :                t258 = 0.1955555555e2_dp*t6*t222 + 0.1066666667e2_dp*t6*t226 + 0.40e1_dp &
    1205            0 :                       *t6*t233 - 0.20e1_dp*t6*t255
    1206            0 :                t259 = t60*t258
    1207            0 :                t264 = 0.9000000000e1_dp*t130 - 0.6000000000e1_dp*t133
    1208            0 :                t265 = t264*t103
    1209            0 :                t270 = 0.1e1_dp/t22/t126
    1210            0 :                t271 = t28*t270
    1211            0 :                t281 = t26*t141
    1212              :                t284 = 0.2250000000e1_dp*t271*t31*t212 - 0.1000000000e1_dp*t105* &
    1213              :                       t109*t94 - 0.1500000000e1_dp*t105*t31*t258 - 0.6666666667e0_dp &
    1214            0 :                       *t30*t281
    1215            0 :                t285 = t103*t284
    1216            0 :                t289 = omega*t104*t27
    1217            0 :                t293 = t3*t55
    1218            0 :                t297 = t37*t151
    1219            0 :                t304 = t27*t79
    1220            0 :                t311 = t126*t21
    1221            0 :                t312 = 0.1e1_dp/t311
    1222            0 :                t313 = t40*t312
    1223            0 :                t316 = 0.1800000000e2_dp*t313*t43*t212
    1224            0 :                t319 = 0.1200000000e2_dp*t128*t132*t94
    1225            0 :                t321 = t128*t43*t258
    1226            0 :                t323 = pi*t3
    1227            0 :                t325 = 0.2000000000e1_dp*t42*t323
    1228            0 :                t326 = -t316 + t319 + 0.8999999998e1_dp*t321 + t325
    1229            0 :                t328 = t135**2
    1230            0 :                t330 = t39*t258
    1231            0 :                t335 = t137*t48
    1232            0 :                t339 = t48*t10*t51
    1233            0 :                t343 = t141*t135*t46
    1234            0 :                t346 = t49*t326
    1235            0 :                t347 = t346*t46
    1236            0 :                t351 = t49*t328*t46
    1237              :                t354 = t326*t46 + t328*t46 - 0.5555555558e-1_dp*t330*t52 + 0.7407407410e-1_dp &
    1238              :                       *t137*t143 - 0.1111111112e0_dp*t335*t148 - 0.6172839508e-1_dp &
    1239              :                       *t47*t339 + 0.7407407410e-1_dp*t146*t343 - 0.5555555558e-1_dp &
    1240            0 :                       *t146*t347 - 0.5555555558e-1_dp*t146*t351
    1241              :                t358 = REAL(2*t101*t265*t112, KIND=dp) + REAL(2*t101*t285, KIND=dp) - 0.8333333335e-1_dp &
    1242              :                       *t289*t118*t212 - 0.1111111111e0_dp*t117*t293*t94 &
    1243              :                       + 0.3333333334e0_dp*t117*t297*t94 + 0.1666666667e0_dp*t117* &
    1244              :                       t118*t258 + 0.1481481481e0_dp*t36*t304*t55 - 0.2222222222e0_dp* &
    1245            0 :                       t36*t122*t151 + 0.3333333334e0_dp*t36*t38*t354
    1246              : 
    1247              :                e_rho_rho_spin(ii) = e_rho_rho_spin(ii) + (-0.6666666672e0_dp*t36*t95 - 0.4444444448e0_dp*t64*t207 - &
    1248              :                                                       0.1666666668e0_dp*t211*t213 - 0.6666666672e0_dp*t68*t216 - 0.3333333336e0_dp &
    1249            0 :                                                           *t68*t259 - 0.2222222224e0_dp*t24*t98*t358)*sx
    1250              : 
    1251            0 :                t365 = t27*t200
    1252            0 :                t368 = t94*t172
    1253            0 :                t372 = t365*t94
    1254            0 :                t377 = t225*t168
    1255            0 :                t382 = t6*t10
    1256            0 :                t383 = t230*t90
    1257            0 :                t384 = t383*t168
    1258            0 :                t393 = beta*t5*ndrho
    1259            0 :                t397 = 0.1e1_dp/t1/t219/t7*t250
    1260              :                t400 = -0.8000000000e1_dp*beta*t79*t12 - 0.2400000000e2_dp*t11* &
    1261            0 :                       t87 + 0.8000000000e1_dp*t393*t397
    1262            0 :                t401 = t77*t400
    1263              :                t404 = -0.1066666667e2_dp*t11*t72 + 0.5333333333e1_dp*t6*t377 - 0.40e1_dp &
    1264            0 :                       *t11*t91 + 0.40e1_dp*t382*t384 - 0.20e1_dp*t6*t401
    1265            0 :                t405 = t60*t404
    1266            0 :                t408 = t207*t172
    1267            0 :                t412 = t26*pi*t100
    1268            0 :                t413 = t412*t128
    1269            0 :                t417 = t271*t26
    1270            0 :                t418 = t1*t94
    1271              :                t428 = 0.2250000000e1_dp*t417*t418*t172 - 0.1500000000e1_dp*t105 &
    1272            0 :                       *t31*t404 - 0.5000000000e0_dp*t105*t109*t172
    1273            0 :                t429 = t103*t428
    1274            0 :                t435 = t37*t196
    1275            0 :                t451 = t313*pi
    1276            0 :                t452 = t8*t94
    1277            0 :                t455 = 0.1800000000e2_dp*t451*t452*t172
    1278            0 :                t457 = t128*t43*t404
    1279            0 :                t460 = t128*t132*t172
    1280            0 :                t462 = -t455 + 0.8999999998e1_dp*t457 + 0.5999999999e1_dp*t460
    1281            0 :                t463 = t462*t46
    1282            0 :                t464 = t135*t40
    1283            0 :                t465 = t464*t127
    1284            0 :                t466 = t172*t46
    1285            0 :                t467 = t43*t466
    1286            0 :                t470 = t39*t404
    1287            0 :                t473 = t94*t127
    1288            0 :                t478 = 0.1e1_dp/rho
    1289            0 :                t479 = t41*t478
    1290            0 :                t482 = t190*t48
    1291            0 :                t486 = t49*t462*t46
    1292            0 :                t489 = t41*t135
    1293              :                t492 = t463 + 0.8999999998e1_dp*t465*t467 - 0.5555555558e-1_dp*t470 &
    1294              :                       *t52 - 0.5000000001e0_dp*t473*t466 + 0.3703703705e-1_dp*t190*t143 &
    1295              :                       + 0.3333333334e0_dp*t479*t466 - 0.5555555558e-1_dp*t482*t148 &
    1296            0 :                       - 0.5555555558e-1_dp*t146*t486 - 0.5000000001e0_dp*t489*t466
    1297              :                t496 = 0.1800000000e2_dp*t413*t186*t113 + REAL(2*t101*t429, KIND=dp) &
    1298              :                       - 0.8333333335e-1_dp*t289*t118*t368 + 0.1666666667e0_dp*t117*t435 &
    1299              :                       *t94 + 0.1666666667e0_dp*t117*t118*t404 - 0.5555555555e-1_dp &
    1300              :                       *t117*t293*t172 - 0.1111111111e0_dp*t36*t122*t196 + 0.1666666667e0_dp &
    1301            0 :                       *t117*t297*t172 + 0.3333333334e0_dp*t36*t38*t492
    1302              : 
    1303              :                e_ndrho_rho_spin(ii) = e_ndrho_rho_spin(ii) + (-0.3333333336e0_dp*t36*t173 - 0.2222222224e0_dp*t64*t365 - &
    1304              :                                                               0.1666666668e0_dp*t211*t60*t368 - 0.3333333336e0_dp*t68*t372 &
    1305              :                                                      - 0.3333333336e0_dp*t68*t405 - 0.3333333336e0_dp*t68*t408 - 0.2222222224e0_dp &
    1306            0 :                                                               *t24*t98*t496)*sx
    1307              : 
    1308            0 :                t501 = t172**2
    1309            0 :                t502 = t60*t501
    1310            0 :                t505 = t365*t172
    1311            0 :                t508 = beta*t10
    1312            0 :                t513 = t168**2
    1313            0 :                t514 = t231*t513
    1314            0 :                t519 = t219*rho
    1315            0 :                t521 = 0.1e1_dp/t1/t519
    1316            0 :                t525 = 0.120e2_dp*t508*t86 - 0.60e1_dp*t6*t521*t250
    1317            0 :                t526 = t77*t525
    1318              :                t529 = 0.40e1_dp*t508*t17 - 0.80e1_dp*t11*t169 + 0.40e1_dp*t6*t514 &
    1319            0 :                       - 0.20e1_dp*t6*t526
    1320            0 :                t530 = t60*t529
    1321            0 :                t533 = pi**2
    1322            0 :                t534 = t533*t100
    1323            0 :                t536 = 0.1e1_dp/t39/omega
    1324            0 :                t537 = t534*t536
    1325            0 :                t539 = 0.1e1_dp/t22/t311
    1326            0 :                t562 = t8*t501
    1327            0 :                t566 = t8*t529
    1328            0 :                t570 = t39**2
    1329            0 :                t571 = 0.1e1_dp/t570
    1330            0 :                t572 = t126**2
    1331            0 :                t573 = 0.1e1_dp/t572
    1332            0 :                t574 = t571*t573
    1333            0 :                t575 = t574*t533
    1334            0 :                t576 = t2*t501
    1335            0 :                t580 = t39*t529
    1336              :                t586 = -0.2250000000e2_dp*t451*t562*t46 + 0.8999999998e1_dp*t185 &
    1337              :                       *t566*t46 + 0.8099999996e2_dp*t575*t576*t46 - 0.5555555558e-1_dp &
    1338            0 :                       *t580*t52 - 0.5000000001e0_dp*t41*t529*t46
    1339              :                t590 = -0.2700000000e2_dp*t537*t539*rho*t501*t103 + 0.4500000000e1_dp &
    1340              :                       *t177*t271*t1*t501 - 0.3000000000e1_dp*t177*t105* &
    1341              :                       t1*t529 - 0.8333333335e-1_dp*t289*t118*t501 + 0.3333333334e0_dp &
    1342              :                       *t117*t435*t172 + 0.1666666667e0_dp*t117*t118*t529 + 0.3333333334e0_dp &
    1343            0 :                       *t36*t38*t586
    1344              : 
    1345              :                e_ndrho_ndrho_spin(ii) = e_ndrho_ndrho_spin(ii) + (-0.1666666668e0_dp*t211*t502 - 0.6666666672e0_dp*t68*t505 &
    1346              :                                                                   - 0.3333333336e0_dp*t68*t530 - 0.2222222224e0_dp*t24*t98*t590) &
    1347            0 :                                         *sx
    1348              : 
    1349              :             END IF
    1350      4216664 :             IF (grad_deriv >= 3) THEN
    1351            0 :                t601 = t27*t358
    1352            0 :                t605 = rho*t104*omega
    1353            0 :                t606 = t212*t94
    1354            0 :                t613 = t94*t258
    1355            0 :                t624 = 0.1e1_dp/t8/t519
    1356            0 :                t628 = t221*t76
    1357            0 :                t632 = t71*t230
    1358            0 :                t639 = t75**2
    1359            0 :                t640 = 0.1e1_dp/t639
    1360            0 :                t641 = t10*t640
    1361            0 :                t657 = t219**2
    1362            0 :                t667 = t84**2
    1363            0 :                t669 = 0.1e1_dp/t85/t667
    1364              :                t677 = -0.9125925923e2_dp*t6*t624*t17 - 0.5866666667e2_dp*t6*t628 &
    1365              :                       *t90 - 0.3200000001e2_dp*t6*t632*t232 + 0.1600000000e2_dp*t6 &
    1366              :                       *t225*t254 - 0.120e2_dp*t6*t641*t232*t90 + 0.120e2_dp*t382 &
    1367              :                       *t383*t254 - 0.20e1_dp*t6*t77*(-0.6222222223e2_dp*t11/t1/ &
    1368              :                                                      t219*t12 - 0.2115555556e3_dp*t6*t624*t86 + 0.1315555556e3_dp* &
    1369              :                                                      t245/t1/t657*t250 - 0.4266666668e2_dp*beta*t244*t5/t657 &
    1370            0 :                                                      /t69*t669)
    1371            0 :                t687 = t28*t539
    1372            0 :                t716 = t264**2
    1373            0 :                t722 = omega*t270*t27
    1374            0 :                t735 = t79*t55
    1375            0 :                t739 = t3*t151
    1376            0 :                t746 = t37*t354
    1377            0 :                t769 = t40*t573
    1378              :                t791 = 0.5400000000e2_dp*t769*t43*t606 - 0.3600000000e2_dp*t313* &
    1379              :                       t132*t212 - 0.5400000000e2_dp*t451*t452*t258 - 0.6000000000e1_dp &
    1380              :                       *t128*t323*t94 + 0.1800000000e2_dp*t128*t132*t258 + 0.8999999998e1_dp &
    1381            0 :                       *t128*t43*t677 - 0.2666666667e1_dp*t42*pi*t79
    1382            0 :                t793 = t328*t135
    1383              :                t838 = REAL(3*t326*t135*t46, KIND=dp) + REAL(t791*t46, KIND=dp) + REAL(t793* &
    1384              :                                                           t46, KIND=dp) - 0.5555555558e-1_dp*t39*t677*t52 + 0.1111111112e0_dp*t330 &
    1385              :                       *t143 - 0.1666666668e0_dp*t330*t48*t148 - 0.1851851853e0_dp*t137 &
    1386              :                       *t339 + 0.2222222223e0_dp*t335*t343 - 0.1666666668e0_dp*t335* &
    1387              :                       t347 - 0.1666666668e0_dp*t335*t351 + 0.1646090535e0_dp*t47*t48 &
    1388              :                       *t71*t51 - 0.1851851853e0_dp*REAL(t146, KIND=dp)*REAL(t10, KIND=dp)*REAL(t135, KIND=dp) &
    1389              :                       *REAL(t46, KIND=dp) + 0.1111111112e0_dp*REAL(t146, KIND=dp)*REAL(t141, KIND=dp)*REAL(t326, KIND=dp) &
    1390              :                       *REAL(t46, KIND=dp) + 0.1111111112e0_dp*REAL(t146, KIND=dp)*REAL(t141, KIND=dp)*REAL(t328, KIND=dp) &
    1391              :                       *REAL(t46, KIND=dp) - 0.5555555558e-1_dp*REAL(t146, KIND=dp)*REAL(t49, KIND=dp)*REAL(t791, KIND=dp) &
    1392              :                       *REAL(t46, KIND=dp) - 0.1666666668e0_dp*REAL(t146, KIND=dp)*REAL(t346, KIND=dp)*REAL(t136, KIND=dp) &
    1393              :                       - 0.5555555558e-1_dp*REAL(t146, KIND=dp)*REAL(t49, KIND=dp)*REAL(t793, KIND=dp)* &
    1394            0 :                       REAL(t46, KIND=dp)
    1395              :                t842 = 0.2e1_dp*t101*(-t316 + t319 + 0.9000000000e1_dp*t321 + t325) &
    1396              :                       *t103*t112 + 0.2e1_dp*t101*t103*(-0.5625000000e1_dp*t687*t31 &
    1397              :                                                        *t606 + 0.2250000000e1_dp*t271*t109*t212 + 0.6750000000e1_dp* &
    1398              :                                                        t417*t418*t258 + 0.1000000000e1_dp*t105*t281*t94 - 0.1500000000e1_dp &
    1399              :                                                        *t105*t109*t258 - 0.1500000000e1_dp*t105*t31*t677 &
    1400              :                                                        + 0.1111111111e1_dp*t30*t26*t10) + 0.4e1_dp*t101*t265*t284 + &
    1401              :                       0.2e1_dp*t101*t716*t103*t112 + 0.1250000000e0_dp*t722*t118 &
    1402              :                       *t606 + 0.8333333333e-1_dp*t289*t293*t212 - 0.2500000000e0_dp*t289 &
    1403              :                       *t297*t212 - 0.2500000000e0_dp*t289*t118*t613 + 0.2222222222e0_dp &
    1404              :                       *t117*t735*t94 - 0.3333333333e0_dp*t117*t739*t94 - &
    1405              :                       0.1666666667e0_dp*t117*t293*t258 + 0.5000000001e0_dp*t117*t746 &
    1406              :                       *t94 + 0.5000000001e0_dp*t117*t297*t258 + 0.1666666667e0_dp*t117 &
    1407              :                       *t118*t677 - 0.3456790122e0_dp*t36*t27*t237*t55 + 0.4444444444e0_dp &
    1408              :                       *t36*t304*t151 - 0.3333333333e0_dp*t36*t122*t354 &
    1409            0 :                       + 0.3333333334e0_dp*t36*t38*t838
    1410              :                t846 = -0.5000000004e0_dp*t116*t213 - 0.2000000001e1_dp*t36*t216 &
    1411              :                       - 0.1000000001e1_dp*t36*t259 - 0.6666666672e0_dp*t64*t601 + 0.8333333340e-1_dp &
    1412              :                       *t605*t60*t606 - 0.5000000004e0_dp*t211*t207*t212 &
    1413              :                       - 0.5000000004e0_dp*t211*t60*t613 - 0.1000000001e1_dp*t68* &
    1414              :                       t601*t94 - 0.1000000001e1_dp*t68*t207*t258 - 0.3333333336e0_dp* &
    1415            0 :                       t68*t60*t677 - 0.2222222224e0_dp*t24*t98*t842
    1416              : 
    1417            0 :                e_rho_rho_rho_spin(ii) = e_rho_rho_rho_spin(ii) + t846*sx
    1418              : 
    1419            0 :                t857 = t27*t496
    1420            0 :                t860 = t212*t172
    1421            0 :                t867 = t94*t404
    1422            0 :                t880 = t258*t172
    1423              :                t933 = 0.3911111110e2_dp*t11*t222 - 0.1955555555e2_dp*t6*t628*t168 &
    1424              :                       + 0.2133333334e2_dp*t11*t226 - 0.2133333334e2_dp*t6*t71*t384 &
    1425              :                       + 0.1066666667e2_dp*t6*t225*t400 + 0.80e1_dp*t11*t233 - 0.120e2_dp &
    1426              :                       *t382*t640*t232*t168 + 0.80e1_dp*t382*t383*t400 - 0.40e1_dp &
    1427              :                       *t11*t255 + 0.40e1_dp*t382*t230*t254*t168 - 0.20e1_dp* &
    1428              :                       t6*t77*(0.1866666667e2_dp*beta*t237*t12 + 0.9866666667e2_dp* &
    1429              :                               t11*t241 - 0.8266666668e2_dp*t393*t251 + 0.3200000001e2_dp*beta &
    1430            0 :                               *t244*ndrho/t657/t7*t669)
    1431            0 :                t961 = t687*t26
    1432            0 :                t1002 = t3*t196
    1433              :                t1009 = 0.2e1_dp*t101*(-t455 + 0.9000000000e1_dp*t457 + 0.6000000000e1_dp &
    1434              :                                       *t460)*t103*t112 + 0.1800000000e2_dp*t412*t264*t40*t127 &
    1435              :                        *t8*t172*t103*t112 + 0.2e1_dp*t101*t265*t428 + 0.1800000000e2_dp &
    1436              :                        *t413*t186*t285 + 0.2e1_dp*t101*t103*(-0.5625000000e1_dp &
    1437              :                                                              *t961*t1*t212*t172 + 0.4500000000e1_dp*t417*t418*t404 &
    1438              :                                                              + 0.1500000000e1_dp*t417*t49*t94*t172 - 0.1000000000e1_dp* &
    1439              :                                                           t105*t109*t404 + 0.2250000000e1_dp*t417*t1*t258*t172 - 0.1500000000e1_dp &
    1440              :                                                              *t105*t31*t933 + 0.3333333334e0_dp*t105*t281* &
    1441              :                                                              t172) + 0.1250000000e0_dp*t722*t118*t860 - 0.8333333335e-1_dp*t289 &
    1442              :                        *t435*t212 - 0.1666666667e0_dp*t289*t118*t867 + 0.5555555555e-1_dp &
    1443              :                        *t289*t293*t368 - 0.1111111111e0_dp*t117*t1002*t94 &
    1444            0 :                        - 0.1111111111e0_dp*t117*t293*t404
    1445            0 :                t1013 = t37*t492
    1446            0 :                t1044 = t769*pi
    1447              :                t1069 = 0.5400000000e2_dp*t1044*t8*t212*t172 - 0.3600000000e2_dp &
    1448              :                        *t451*t452*t404 - 0.2400000000e2_dp*t451*t37*t94*t172 + &
    1449              :                        0.1200000000e2_dp*t128*t132*t404 - 0.1800000000e2_dp*t451*t8* &
    1450              :                        t258*t172 + 0.8999999998e1_dp*t128*t43*t933 - 0.2000000000e1_dp &
    1451            0 :                        *t128*t323*t172
    1452            0 :                t1091 = t127*t172*t46
    1453              :                t1102 = t1069*t46 + 0.8999999998e1_dp*t326*t40*t127*t467 + REAL(2 &
    1454              :                                                                      *t136*t462, KIND=dp) + 0.8999999998e1_dp*t328*t40*t127*t467 - &
    1455              :                        0.5555555558e-1_dp*t39*t933*t52 - 0.5000000001e0_dp*t258*t127 &
    1456              :                        *t466 + 0.7407407410e-1_dp*t470*t143 + 0.6666666668e0_dp*t94*t478 &
    1457              :                        *t1091 - 0.1111111112e0_dp*t470*t48*t148 - 0.1111111112e0_dp &
    1458            0 :                        *t335*t486 - 0.1000000001e1_dp*t94*t135*t1091
    1459              :                t1136 = -0.6172839508e-1_dp*t190*t339 - 0.5555555556e0_dp*t41/t7 &
    1460              :                        *t466 + 0.7407407410e-1_dp*t482*t343 + 0.7407407410e-1_dp*t146* &
    1461              :                        t141*t462*t46 + 0.6666666668e0_dp*t479*t135*t172*t46 - 0.5555555558e-1_dp &
    1462              :                        *t482*t347 - 0.5555555558e-1_dp*t146*t49*t1069 &
    1463              :                        *t46 - 0.5000000001e0_dp*t41*t326*t466 - 0.5555555558e-1_dp*t482 &
    1464              :                        *t351 - 0.1111111112e0_dp*t146*t147*t463 - 0.5000000001e0_dp* &
    1465            0 :                        t41*t328*t466
    1466              :                t1141 = -0.1666666667e0_dp*t289*t297*t368 + 0.3333333334e0_dp*t117 &
    1467              :                        *t1013*t94 + 0.3333333334e0_dp*t117*t297*t404 - 0.8333333335e-1_dp &
    1468              :                        *t289*t118*t880 + 0.1666666667e0_dp*t117*t435*t258 + &
    1469              :                        0.1666666667e0_dp*t117*t118*t933 + 0.7407407405e-1_dp*t117*t735 &
    1470              :                        *t172 + 0.1481481481e0_dp*t36*t304*t196 - 0.1111111111e0_dp* &
    1471              :                        t117*t739*t172 - 0.2222222222e0_dp*t36*t122*t492 + 0.1666666667e0_dp &
    1472              :                        *t117*t746*t172 + 0.3333333334e0_dp*t36*t38*(t1102 &
    1473            0 :                                                                     + t1136)
    1474              :                t1146 = -0.3333333336e0_dp*t117*t59*t94*t172 - 0.6666666672e0_dp &
    1475              :                        *t36*t372 - 0.6666666672e0_dp*t36*t405 - 0.6666666672e0_dp*t36 &
    1476              :                        *t408 - 0.4444444448e0_dp*t64*t857 + 0.8333333340e-1_dp*t605*t60 &
    1477              :                        *t860 - 0.1666666668e0_dp*t211*t365*t212 - 0.3333333336e0_dp* &
    1478              :                        t211*t60*t867 - 0.3333333336e0_dp*t211*t207*t368 - 0.6666666672e0_dp &
    1479              :                        *t68*t857*t94 - 0.6666666672e0_dp*t68*t207*t404 - 0.1666666668e0_dp &
    1480              :                        *t211*t60*t880 - 0.3333333336e0_dp*t68*t365* &
    1481              :                        t258 - 0.3333333336e0_dp*t68*t60*t933 - 0.3333333336e0_dp*t68* &
    1482            0 :                        t601*t172 - 0.2222222224e0_dp*t24*t98*(t1009 + t1141)
    1483              : 
    1484            0 :                e_ndrho_rho_rho_spin(ii) = e_ndrho_rho_rho_spin(ii) + t1146*sx
    1485              : 
    1486            0 :                t1153 = t27*t590
    1487            0 :                t1156 = t94*t501
    1488            0 :                t1163 = t404*t172
    1489            0 :                t1167 = t94*t529
    1490            0 :                t1177 = beta*t71
    1491              :                t1220 = -0.1066666667e2_dp*t1177*t17 + 0.2133333334e2_dp*t11*t377 &
    1492              :                        - 0.1066666667e2_dp*t6*t632*t513 + 0.5333333333e1_dp*t6*t225 &
    1493              :                        *t525 - 0.40e1_dp*t508*t76*t90 + 0.160e2_dp*t11*t10*t384 - &
    1494              :                        0.80e1_dp*t11*t401 - 0.120e2_dp*t382*t640*t90*t513 + 0.80e1_dp &
    1495              :                        *t382*t230*t400*t168 + 0.40e1_dp*t382*t383*t525 - 0.20e1_dp &
    1496              :                        *t6*t77*(-0.3200000000e2_dp*t1177*t86 + 0.4800000000e2_dp*t6 &
    1497            0 :                                 *t397 - 0.2400000000e2_dp*t245/t657/rho*t669)
    1498            0 :                t1284 = t37*t586
    1499              :                t1334 = 0.5400000000e2_dp*t1044*t452*t501 - 0.3600000000e2_dp*t451 &
    1500              :                        *t8*t404*t172 - 0.1800000000e2_dp*t451*t452*t529 + 0.8999999998e1_dp &
    1501              :                        *t128*t43*t1220 - 0.1200000000e2_dp*t313*t132*t501 &
    1502            0 :                        + 0.5999999999e1_dp*t128*t132*t529
    1503            0 :                t1341 = t501*t46
    1504            0 :                t1345 = t529*t46
    1505            0 :                t1370 = t40*pi
    1506              :                t1396 = t1334*t46 + 0.1800000000e2_dp*t462*t40*t127*t467 - 0.2250000000e2_dp &
    1507              :                        *t464*t312*t43*t1341 + 0.8999999998e1_dp*t465 &
    1508              :                        *t43*t1345 - 0.1000000000e1_dp*t404*t127*t466 + 0.8099999996e2_dp &
    1509              :                        *t135*t571*t573*t533*t2*t1341 - 0.5555555558e-1_dp*t39 &
    1510              :                        *t1220*t52 - 0.5000000001e0_dp*t473*t1345 + 0.3333333334e0_dp* &
    1511              :                        t479*t1345 + 0.1000000000e1_dp*t94*t312*t1341 - 0.4500000000e1_dp &
    1512              :                        *t94*t573*t501*t1370*t8*t46 + 0.3703703705e-1_dp*t580 &
    1513              :                        *t143 + 0.3000000000e1_dp*t312*t37*t501*t1370*t46 - 0.5555555558e-1_dp &
    1514              :                        *t580*t48*t148 - 0.1111111112e0_dp*t482*t486 - 0.5555555558e-1_dp &
    1515              :                        *t146*t49*t1334*t46 - 0.1000000000e1_dp*t41* &
    1516            0 :                        t462*t466 - 0.5000000001e0_dp*t489*t1345
    1517              :                t1400 = -0.3600000000e2_dp*t412*t313*t562*t113 + 0.1800000000e2_dp &
    1518              :                        *t413*t566*t113 + 0.3600000000e2_dp*t413*t186*t429 + 0.1620000000e3_dp &
    1519              :                        *t26*t533*t100*t574*t576*t113 + 0.2e1_dp*t101 &
    1520              :                        *t103*(-0.5625000000e1_dp*t961*t418*t501 + 0.4500000000e1_dp &
    1521              :                               *t417*t1*t404*t172 + 0.2250000000e1_dp*t417*t418*t529 - &
    1522              :                               0.1500000000e1_dp*t105*t31*t1220 + 0.7500000000e0_dp*t271*t109 &
    1523              :                               *t501 - 0.5000000000e0_dp*t105*t109*t529) + 0.1250000000e0_dp* &
    1524              :                        t722*t118*t1156 - 0.1666666667e0_dp*t289*t435*t368 - 0.1666666667e0_dp &
    1525              :                        *t289*t118*t1163 - 0.8333333335e-1_dp*t289*t118*t1167 &
    1526              :                        + 0.1666666667e0_dp*t117*t1284*t94 + 0.3333333334e0_dp*t117 &
    1527              :                        *t435*t404 + 0.1666666667e0_dp*t117*t118*t1220 + 0.2777777778e-1_dp &
    1528              :                        *t289*t293*t501 - 0.1111111111e0_dp*t117*t1002*t172 &
    1529              :                        - 0.5555555555e-1_dp*t117*t293*t529 - 0.1111111111e0_dp*t36*t122 &
    1530              :                        *t586 - 0.8333333335e-1_dp*t289*t297*t501 + 0.3333333334e0_dp &
    1531              :                        *t117*t1013*t172 + 0.1666666667e0_dp*t117*t297*t529 + 0.3333333334e0_dp &
    1532            0 :                        *t36*t38*t1396
    1533              :                t1404 = -0.1666666668e0_dp*t116*t502 - 0.6666666672e0_dp*t36*t505 &
    1534              :                        - 0.3333333336e0_dp*t36*t530 - 0.2222222224e0_dp*t64*t1153 + 0.8333333340e-1_dp &
    1535              :                        *t605*t60*t1156 - 0.3333333336e0_dp*t211*t365 &
    1536              :                        *t368 - 0.3333333336e0_dp*t211*t60*t1163 - 0.1666666668e0_dp*t211 &
    1537              :                        *t60*t1167 - 0.3333333336e0_dp*t68*t1153*t94 - 0.6666666672e0_dp &
    1538              :                        *t68*t365*t404 - 0.3333333336e0_dp*t68*t60*t1220 - 0.1666666668e0_dp &
    1539              :                        *t211*t207*t501 - 0.6666666672e0_dp*t68*t857* &
    1540              :                        t172 - 0.3333333336e0_dp*t68*t207*t529 - 0.2222222224e0_dp*t24* &
    1541            0 :                        t98*t1400
    1542              : 
    1543            0 :                e_ndrho_ndrho_rho_spin(ii) = e_ndrho_ndrho_rho_spin(ii) + t1404*sx
    1544              : 
    1545            0 :                t1405 = t501*t172
    1546            0 :                t1412 = t172*t529
    1547              :                t1449 = -0.120e2_dp*t508*t76*t168 + 0.240e2_dp*t11*t514 - 0.120e2_dp &
    1548              :                        *t11*t526 - 0.120e2_dp*t6*t641*t513*t168 + 0.120e2_dp*t382 &
    1549              :                        *t230*t168*t525 - 0.20e1_dp*t6*t77*(-0.240e2_dp*beta*t521 &
    1550            0 :                                                            *t250*ndrho + 0.180e2_dp*t393/t657*t669)
    1551            0 :                t1456 = t1405*t103
    1552            0 :                t1467 = t533*pi
    1553            0 :                t1472 = t572*t21
    1554              :                t1553 = 0.1350000000e3_dp*t537/t22/t572*rho*t1456 - 0.8100000000e2_dp &
    1555              :                        *t534*t536*t539*rho*t172*t103*t529 - 0.2430000000e3_dp &
    1556              :                        *t1467*t100/t570/omega/t22/t1472*t140*t1456 - &
    1557              :                        0.1125000000e2_dp*t177*t687*t1*t1405 + 0.1350000000e2_dp*t176 &
    1558              :                        *t103*t28*t270*t1*t1412 - 0.3000000000e1_dp*t177*t105* &
    1559              :                        t1*t1449 + 0.1250000000e0_dp*t722*t118*t1405 - 0.2500000000e0_dp &
    1560              :                        *t289*t435*t501 - 0.2500000000e0_dp*t289*t118*t1412 + 0.5000000001e0_dp &
    1561              :                        *t117*t1284*t172 + 0.5000000001e0_dp*t117*t435 &
    1562              :                        *t529 + 0.1666666667e0_dp*t117*t118*t1449 + 0.3333333334e0_dp*t36 &
    1563              :                        *t38*(0.6750000000e2_dp*t1044*t8*t1405*t46 - 0.6750000000e2_dp &
    1564              :                              *t451*t186*t1345 - 0.5264999998e3_dp*t571/t1472*t533 &
    1565              :                              *t2*t1405*t46 + 0.8999999998e1_dp*t185*t8*t1449*t46 + 0.2429999999e3_dp &
    1566              :                              *t575*t2*t529*t466 + 0.7289999995e3_dp/t570/t39 &
    1567              :                              /t572/t126*t1467*t7*t1405*t46 - 0.5555555558e-1_dp*t39 &
    1568            0 :                              *t1449*t52 - 0.5000000001e0_dp*t41*t1449*t46)
    1569              : 
    1570              :                e_ndrho_ndrho_ndrho_spin(ii) = e_ndrho_ndrho_ndrho_spin(ii) + (0.8333333340e-1_dp*t605*t60*t1405 - &
    1571              :                                            0.5000000004e0_dp*t211*t365*t501 - 0.5000000004e0_dp*t211*t60*t1412 - 0.1000000001e1_dp &
    1572              :                                                              *t68*t1153*t172 - 0.1000000001e1_dp*t68*t365*t529 - 0.3333333336e0_dp &
    1573              :                                                                               *t68*t60*t1449 - 0.2222222224e0_dp*t24*t98*t1553) &
    1574            0 :                                               *sx
    1575              : 
    1576              :             END IF
    1577              :          END IF
    1578              :       END DO
    1579              : !$OMP     END DO
    1580              : 
    1581          104 :    END SUBROUTINE xb88_lr_lsd_calc
    1582              : 
    1583              : END MODULE xc_xbecke88_long_range
        

Generated by: LCOV version 2.0-1