LCOV - code coverage report
Current view: top level - src/xc - xc_xwpbe.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 2037 3408 59.8 %
Date: 2024-11-21 06:45:46 Functions: 17 24 70.8 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief Calculates short range exchange part for wPBE functional and averaged
      10             : !>      PBE exchange-hole functional (omega = 0.0 )
      11             : !> \par History
      12             : !>      Manuel Guidon (05.2007)  : initial version
      13             : !> \author Manuel Guidon (05.2007)
      14             : ! **************************************************************************************************
      15             : MODULE xc_xwpbe
      16             :    USE bibliography,                    ONLY: Heyd2004,&
      17             :                                               cite_reference
      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 mathlib,                         ONLY: expint
      24             :    USE xc_derivative_desc,              ONLY: deriv_norm_drho,&
      25             :                                               deriv_norm_drhoa,&
      26             :                                               deriv_norm_drhob,&
      27             :                                               deriv_rho,&
      28             :                                               deriv_rhoa,&
      29             :                                               deriv_rhob
      30             :    USE xc_derivative_set_types,         ONLY: xc_derivative_set_type,&
      31             :                                               xc_dset_get_derivative
      32             :    USE xc_derivative_types,             ONLY: xc_derivative_get,&
      33             :                                               xc_derivative_type
      34             :    USE xc_rho_cflags_types,             ONLY: xc_rho_cflags_type
      35             :    USE xc_rho_set_types,                ONLY: xc_rho_set_get,&
      36             :                                               xc_rho_set_type
      37             : #include "../base/base_uses.f90"
      38             : 
      39             :    IMPLICIT NONE
      40             : 
      41             :    PRIVATE
      42             : 
      43             : ! *** Global parameters ***
      44             : 
      45             :    PUBLIC :: xwpbe_lda_info, xwpbe_lda_eval, xwpbe_lsd_info, &
      46             :              xwpbe_lsd_eval
      47             : 
      48             :    REAL(KIND=dp), PARAMETER :: alpha1 = -1.128223946706117_dp, &
      49             :                                alpha2 = 1.452736265762971_dp, &
      50             :                                alpha3 = -1.243162299390327_dp, &
      51             :                                alpha4 = 0.971824836115601_dp, &
      52             :                                alpha5 = -0.568861079687373_dp, &
      53             :                                alpha6 = 0.246880514820192_dp, &
      54             :                                alpha7 = -0.065032363850763_dp, &
      55             :                                alpha8 = 0.008401793031216_dp
      56             :    REAL(KIND=dp), PARAMETER :: beta = 1.455915450052607_dp, &
      57             :                                beta2 = 2.0_dp
      58             :    REAL(KIND=dp), PARAMETER :: a1 = 0.00979681_dp, &
      59             :                                a2 = 0.04108340_dp, &
      60             :                                a3 = 0.18744000_dp, &
      61             :                                a4 = 0.00120824_dp, &
      62             :                                a5 = 0.0347188_dp
      63             :    REAL(KIND=dp), PARAMETER :: A = 1.0161144_dp, &
      64             :                                B = -0.37170836_dp, &
      65             :                                C = -0.077215461_dp, &
      66             :                                DD = 0.57786348_dp, &
      67             :                                E = -0.051955731_dp, &
      68             :                                F1 = 0.47965830_dp, &
      69             :                                F2 = 6.4753871_dp, &
      70             :                                clda = -0.73855876638202240588423_dp
      71             :    REAL(KIND=dp), PARAMETER :: expcutoff = 700.0_dp, &
      72             :                                exei1 = 4.0364_dp, &
      73             :                                exei2 = 1.15198_dp, &
      74             :                                exei3 = 5.03627_dp, &
      75             :                                exei4 = 4.19160_dp
      76             :    REAL(KIND=dp), PARAMETER :: smax = 8.572844_dp, &
      77             :                                sconst = 18.79622316_dp, &
      78             :                                scutoff = 8.3_dp
      79             :    REAL(KIND=dp), PARAMETER :: gcutoff = 0.08_dp, &
      80             :                                g1 = -0.02628417880_dp/E, &
      81             :                                g2 = -0.07117647788_dp/E, &
      82             :                                g3 = 0.08534541323_dp/E, &
      83             :                                g4 = 0.0_dp
      84             :    REAL(KIND=dp), PARAMETER :: wcutoff = 14.0_dp
      85             :    REAL(KIND=dp), PARAMETER :: f12 = 0.5_dp, f14 = 0.25_dp, f158 = 15.0_dp/8.0_dp, &
      86             :                                f1516 = 15.0_dp/16.0_dp, f24364 = 243.0_dp/64.0_dp, &
      87             :                                f2716 = 27.0_dp/16.0_dp, f2732 = 27.0_dp/32.0_dp, &
      88             :                                f34 = 0.75_dp, f32 = 1.5_dp, f38 = 0.375_dp, f68 = 0.75_dp, &
      89             :                                f6561512 = 6561.0_dp/512.0_dp, f8132 = 81.0_dp/32.0_dp, &
      90             :                                f8164 = 81.0_dp/64.0_dp, f729128 = 729.0_dp/128.0_dp, &
      91             :                                f52 = 2.5_dp, f94 = 9.0_dp/4.0_dp, f916 = 9.0_dp/16.0_dp, &
      92             :                                f89 = 8.0_dp/9.0_dp, f2187256 = 2187.0_dp/256.0_dp, &
      93             :                                r1 = 1.0_dp, f98 = 9.0_dp/8.0_dp, r15 = 15.0_dp, &
      94             :                                r3 = 3.0_dp, r4 = 4.0_dp, r16 = 16.0_dp, r8 = 8.0_dp, &
      95             :                                r6 = 6.0_dp, r2 = 2.0_dp
      96             : 
      97             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xc_xwpbe'
      98             : 
      99             : CONTAINS
     100             : 
     101             : ! **************************************************************************************************
     102             : !> \brief return various information on the functional
     103             : !> \param reference string with the reference of the actual functional
     104             : !> \param shortform string with the shortform of the functional name
     105             : !> \param needs the components needed by this functional are set to
     106             : !>        true (does not set the unneeded components to false)
     107             : !> \param max_deriv ...
     108             : !> \par History
     109             : !>      05.2007 created [Manuel Guidon]
     110             : !> \author Manuel Guidon
     111             : ! **************************************************************************************************
     112        1777 :    SUBROUTINE xwpbe_lda_info(reference, shortform, needs, max_deriv)
     113             :       CHARACTER(LEN=*), INTENT(OUT), OPTIONAL            :: reference, shortform
     114             :       TYPE(xc_rho_cflags_type), INTENT(inout), OPTIONAL  :: needs
     115             :       INTEGER, INTENT(out), OPTIONAL                     :: max_deriv
     116             : 
     117        1777 :       IF (PRESENT(reference)) THEN
     118           9 :          reference = "Jochen Heyd and Gustavo E. Scuseria, J. Chem. Phys., 120, 7274 {LDA version}"
     119             :       END IF
     120        1777 :       IF (PRESENT(shortform)) THEN
     121           9 :          shortform = "shortrange part of PBE exchange {LDA}"
     122             :       END IF
     123        1777 :       IF (PRESENT(needs)) THEN
     124        1768 :          needs%rho = .TRUE.
     125        1768 :          needs%norm_drho = .TRUE.
     126             :       END IF
     127             :       ! deriv > 1 are not correct
     128             :       ! IF (PRESENT(max_deriv)) max_deriv = 2
     129        1777 :       IF (PRESENT(max_deriv)) max_deriv = 1
     130        1777 :    END SUBROUTINE xwpbe_lda_info
     131             : 
     132             : ! **************************************************************************************************
     133             : !> \brief evaluates the screened hole averaged PBE exchange functional for lda
     134             : !> \param rho_set the density where you want to evaluate the functional
     135             : !> \param deriv_set place where to store the functional derivatives (they are
     136             : !>        added to the derivatives)
     137             : !> \param order degree of the derivative that should be evaluated,
     138             : !>        if positive all the derivatives up to the given degree are evaluated,
     139             : !>        if negative only the given degree is calculated
     140             : !> \param xwpbe_params input parameters (scaling,omega)
     141             : !> \par History
     142             : !>      05.2007 created [Manuel Guidon]
     143             : !> \author Manuel Guidon
     144             : !> \note
     145             : !>      The current version provides code for derivatives up to second order.
     146             : !>      Using the maple sheet in cp2k/doc it is straightforward to produce routines
     147             : !>      for higher derivatives.
     148             : ! **************************************************************************************************
     149       10490 :    SUBROUTINE xwpbe_lda_eval(rho_set, deriv_set, order, xwpbe_params)
     150             : 
     151             :       TYPE(xc_rho_set_type), INTENT(IN)                  :: rho_set
     152             :       TYPE(xc_derivative_set_type), INTENT(IN)           :: deriv_set
     153             :       INTEGER, INTENT(IN)                                :: order
     154             :       TYPE(section_vals_type), POINTER                   :: xwpbe_params
     155             : 
     156             :       CHARACTER(len=*), PARAMETER                        :: routineN = 'xwpbe_lda_eval'
     157             : 
     158             :       INTEGER                                            :: handle, npoints
     159             :       INTEGER, DIMENSION(2, 3)                           :: bo
     160             :       REAL(kind=dp)                                      :: epsilon_norm_drho, epsilon_rho, omega, &
     161             :                                                             sx, sx0
     162             :       REAL(kind=dp), CONTIGUOUS, DIMENSION(:, :, :), &
     163        2098 :          POINTER                                         :: dummy, e_0, e_ndrho, e_ndrho_ndrho, &
     164        2098 :                                                             e_ndrho_rho, e_rho, e_rho_rho, &
     165        2098 :                                                             norm_drho, rho
     166             :       TYPE(xc_derivative_type), POINTER                  :: deriv
     167             : 
     168        2098 :       CALL timeset(routineN, handle)
     169             : 
     170        2098 :       CALL cite_reference(Heyd2004)
     171             : 
     172        2098 :       CALL section_vals_val_get(xwpbe_params, "SCALE_X", r_val=sx)
     173        2098 :       CALL section_vals_val_get(xwpbe_params, "SCALE_X0", r_val=sx0)
     174        2098 :       CALL section_vals_val_get(xwpbe_params, "OMEGA", r_val=omega)
     175             : 
     176             :       CALL xc_rho_set_get(rho_set, rho=rho, &
     177             :                           norm_drho=norm_drho, local_bounds=bo, rho_cutoff=epsilon_rho, &
     178        2098 :                           drho_cutoff=epsilon_norm_drho)
     179        2098 :       npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
     180             : 
     181        2098 :       dummy => rho
     182             : 
     183        2098 :       e_0 => dummy
     184        2098 :       e_rho => dummy
     185        2098 :       e_ndrho => dummy
     186        2098 :       e_rho_rho => dummy
     187        2098 :       e_ndrho_rho => dummy
     188        2098 :       e_ndrho_ndrho => dummy
     189             : 
     190        2098 :       IF (order >= 0) THEN
     191             :          deriv => xc_dset_get_derivative(deriv_set, [INTEGER::], &
     192        2098 :                                          allocate_deriv=.TRUE.)
     193        2098 :          CALL xc_derivative_get(deriv, deriv_data=e_0)
     194             :       END IF
     195        2098 :       IF (order >= 1 .OR. order == -1) THEN
     196             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rho], &
     197        1780 :                                          allocate_deriv=.TRUE.)
     198        1780 :          CALL xc_derivative_get(deriv, deriv_data=e_rho)
     199             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drho], &
     200        1780 :                                          allocate_deriv=.TRUE.)
     201        1780 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho)
     202             :       END IF
     203        2098 :       IF (order >= 2 .OR. order == -2) THEN
     204           0 :          CPABORT("derivatives bigger than 1 do not work correctly")
     205             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rho, deriv_rho], &
     206           0 :                                          allocate_deriv=.TRUE.)
     207           0 :          CALL xc_derivative_get(deriv, deriv_data=e_rho_rho)
     208             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drho, deriv_rho], &
     209           0 :                                          allocate_deriv=.TRUE.)
     210           0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_rho)
     211             :          deriv => xc_dset_get_derivative(deriv_set, &
     212           0 :                                          [deriv_norm_drho, deriv_norm_drho], allocate_deriv=.TRUE.)
     213           0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho)
     214             :       END IF
     215        2098 :       IF (order > 1 .OR. order < -1) THEN
     216           0 :          CPABORT("derivatives bigger than 1 do not work correctly")
     217             :       END IF
     218        2098 :       IF (order > 2 .OR. order < -2) THEN
     219           0 :          CPABORT("derivatives bigger than 2 not implemented")
     220             :       END IF
     221             : 
     222             : !$OMP     PARALLEL DEFAULT(NONE) &
     223             : !$OMP     SHARED(npoints, order, rho, norm_drho, e_0, e_rho, e_ndrho) &
     224             : !$OMP     SHARED(e_rho_rho, e_ndrho_rho, e_ndrho_ndrho, epsilon_rho) &
     225        2098 : !$OMP     SHARED(sx, sx0, omega)
     226             : 
     227             :       CALL xwpbe_lda_calc(npoints, order, rho=rho, norm_drho=norm_drho, &
     228             :                           e_0=e_0, e_rho=e_rho, e_ndrho=e_ndrho, e_rho_rho=e_rho_rho, &
     229             :                           e_ndrho_rho=e_ndrho_rho, e_ndrho_ndrho=e_ndrho_ndrho, &
     230             :                           epsilon_rho=epsilon_rho, sx=sx, sx0=sx0, omega=omega)
     231             : 
     232             : !$OMP     END PARALLEL
     233             : 
     234        2098 :       CALL timestop(handle)
     235             : 
     236        2098 :    END SUBROUTINE xwpbe_lda_eval
     237             : 
     238             : ! **************************************************************************************************
     239             : !> \brief evaluates the screened hole averaged PBE exchange functional for lda
     240             : !> \param npoints ...
     241             : !> \param order degree of the derivative that should be evaluated,
     242             : !>        if positive all the derivatives up to the given degree are evaluated,
     243             : !>        if negative only the given degree is calculated
     244             : !> \param rho , ndrho: density and norm of the density gradient
     245             : !> \param norm_drho ...
     246             : !> \param e_0 ...
     247             : !> \param e_rho ...
     248             : !> \param e_ndrho ...
     249             : !> \param e_rho_rho ...
     250             : !> \param e_ndrho_rho ...
     251             : !> \param e_ndrho_ndrho ...
     252             : !> \param epsilon_rho ...
     253             : !> \param sx , sx0: scaling factor for omega!=0 and omega=0
     254             : !> \param sx0 ...
     255             : !> \param omega screening parameter
     256             : !> \par History
     257             : !>      05.2007 created [Manuel Guidon]
     258             : !> \author Manuel Guidon
     259             : !> \note
     260             : !>      In order to avoid numerical instabilities, this routine calls different
     261             : !>      subroutines. There are 4 routines for the case omega!=0 and 2 routines
     262             : !>      for omega=0.
     263             : ! **************************************************************************************************
     264        2098 :    SUBROUTINE xwpbe_lda_calc(npoints, order, rho, norm_drho, e_0, e_rho, e_ndrho, &
     265        2098 :                              e_rho_rho, e_ndrho_rho, e_ndrho_ndrho, &
     266             :                              epsilon_rho, sx, sx0, omega)
     267             : 
     268             :       INTEGER, INTENT(in)                                :: npoints, order
     269             :       REAL(kind=dp), DIMENSION(1:npoints), INTENT(inout) :: rho, norm_drho, e_0, e_rho, e_ndrho, &
     270             :                                                             e_rho_rho, e_ndrho_rho, e_ndrho_ndrho
     271             :       REAL(kind=dp), INTENT(in)                          :: epsilon_rho, sx, sx0, omega
     272             : 
     273             :       INTEGER                                            :: ip
     274             :       REAL(dp)                                           :: my_ndrho, my_rho
     275             :       REAL(KIND=dp)                                      :: ss, ss2, sscale, t1, t2, t3, t4, t5, t6, &
     276             :                                                             t7, t8, ww
     277             : 
     278             : !$OMP     DO
     279             : 
     280             :       DO ip = 1, npoints
     281    63980210 :          my_rho = MAX(rho(ip), 0.0_dp)
     282    63980210 :          IF (my_rho > epsilon_rho) THEN
     283    50693210 :             my_ndrho = MAX(norm_drho(ip), 0.0_dp)
     284             : 
     285             :             !Do some precalculation in order to catch the correct branch afterwards
     286    50693210 :             sscale = 1.0_dp
     287    50693210 :             t1 = pi**2
     288    50693210 :             t2 = t1*my_rho
     289    50693210 :             t3 = t2**(0.1e1_dp/0.3e1_dp)
     290    50693210 :             t4 = 0.1e1_dp/t3
     291    50693210 :             t5 = omega*t4
     292    50693210 :             ww = 0.6933612743506347048433524e0_dp*t5
     293    50693210 :             t6 = my_ndrho*t4
     294    50693210 :             t7 = 0.1e1_dp/my_rho
     295    50693210 :             t8 = t7*sscale
     296    50693210 :             ss = 0.3466806371753173524216762e0_dp*t6*t8
     297    50693210 :             IF (ss > scutoff) THEN
     298    32745280 :                ss2 = ss*ss
     299    32745280 :                sscale = (smax*ss2 - sconst)/(ss2*ss)
     300             :             END IF
     301             : 
     302    50693210 :             IF (sx0 /= 0.0_dp) THEN
     303             :                !original PBE hole
     304    44641362 :                IF (ss*sscale > gcutoff) THEN
     305             :                   CALL xwpbe_lda_calc_0(e_0(ip), e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
     306             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
     307    44416914 :                                         my_ndrho, sscale, sx0, order)
     308             :                ELSE
     309             :                   CALL xwpbe_lda_calc_01(e_0(ip), e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
     310             :                                          e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
     311      224448 :                                          my_ndrho, sscale, sx0, order)
     312             :                END IF
     313             :             END IF
     314             : 
     315    50693210 :             IF (sx /= 0.0_dp) THEN
     316    16565056 :                IF (ww < wcutoff .AND. ss*sscale > gcutoff) THEN
     317             :                   CALL xwpbe_lda_calc_1(e_0(ip), e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
     318             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
     319    12023716 :                                         my_ndrho, omega, sscale, sx, order)
     320      200690 :                ELSE IF (ww < wcutoff .AND. ss*sscale <= gcutoff) THEN
     321             :                   CALL xwpbe_lda_calc_2(e_0(ip), e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
     322             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
     323      200690 :                                         my_ndrho, omega, sscale, sx, order)
     324     4340650 :                ELSE IF (ww >= wcutoff .AND. ss*sscale > gcutoff) THEN
     325             :                   CALL xwpbe_lda_calc_3(e_0(ip), e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
     326             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
     327     4340650 :                                         my_ndrho, omega, sscale, sx, order)
     328             :                ELSE
     329             :                   CALL xwpbe_lda_calc_4(e_0(ip), e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
     330             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
     331           0 :                                         my_ndrho, omega, sscale, sx, order)
     332             :                END IF
     333             :             END IF
     334             :          END IF
     335             :       END DO
     336             : 
     337             : !$OMP     END DO
     338             : 
     339        2098 :    END SUBROUTINE xwpbe_lda_calc
     340             : 
     341             : ! **************************************************************************************************
     342             : !> \brief Evaluates the screened hole averaged PBE exchange functional for lda
     343             : !> \param e_0 ...
     344             : !> \param e_rho ...
     345             : !> \param e_ndrho ...
     346             : !> \param e_rho_rho ...
     347             : !> \param e_ndrho_rho ...
     348             : !> \param e_ndrho_ndrho ...
     349             : !> \param rho , ndrho: density and norm of the density gradient
     350             : !> \param ndrho ...
     351             : !> \param sscale scaling factor to enforce Lieb-Oxford bound
     352             : !> \param sx0 scaling factor
     353             : !> \param order degree of the derivative that should be evaluated,
     354             : !>        if positive all the derivatives up to the given degree are evaluated,
     355             : !>        if negative only the given degree is calculated
     356             : !> \par History
     357             : !>      05.2007 created [Manuel Guidon]
     358             : !> \author Manuel Guidon
     359             : !> \note
     360             : !>      This routine evaluates the exact functional for omega=0.
     361             : ! **************************************************************************************************
     362    66968425 :    SUBROUTINE xwpbe_lda_calc_0(e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
     363             :                                e_ndrho_ndrho, rho, ndrho, sscale, sx0, order)
     364             :       REAL(KIND=dp), INTENT(INOUT)                       :: e_0, e_rho, e_ndrho, e_rho_rho, &
     365             :                                                             e_ndrho_rho, e_ndrho_ndrho
     366             :       REAL(KIND=dp), INTENT(IN)                          :: rho, ndrho, sscale, sx0
     367             :       INTEGER, INTENT(IN)                                :: order
     368             : 
     369             :       REAL(KIND=dp) :: d2Qndrhondrho, d2Qrhondrho, d2Qrhorho, dQndrho, dQrho, Q, t1, t10, t100, &
     370             :          t1003, t1007, t1018, t1023, t1024, t103, t1037, t105, t1055, t1056, t1057, t1059, t106, &
     371             :          t1060, t1073, t1079, t1082, t109, t11, t110, t1100, t111, t1110, t1114, t1117, t112, &
     372             :          t114, t1143, t116, t1165, t117, t118, t119, t12, t120, t1202, t121, t1215, t122, t123, &
     373             :          t1242, t125, t1258, t126, t1263, t127, t1286, t13, t130, t1316, t134, t1347, t135, t1352, &
     374             :          t1358, t136, t1362, t1365, t1369, t1372, t138, t1382, t1388, t139, t1392, t1395, t14, &
     375             :          t1412, t142, t143, t145, t1455, t146, t1465, t147, t148, t149, t15
     376             :       REAL(KIND=dp) :: t150, t1510, t152, t1547, t156, t1561, t158, t159, t16, t160, t163, t164, &
     377             :          t165, t166, t169, t170, t172, t173, t174, t175, t176, t18, t180, t183, t184, t185, t187, &
     378             :          t188, t19, t190, t191, t192, t193, t199, t2, t20, t200, t201, t202, t203, t207, t209, &
     379             :          t21, t215, t218, t219, t22, t220, t222, t223, t224, t225, t227, t228, t231, t233, t236, &
     380             :          t237, t24, t240, t241, t242, t245, t246, t247, t249, t25, t250, t253, t254, t258, t26, &
     381             :          t261, t262, t263, t265, t266, t269, t272, t274, t275, t278, t28, t281, t282, t284, t285, &
     382             :          t287, t288, t29, t290, t291, t294, t297, t3, t300, t301, t303
     383             :       REAL(KIND=dp) :: t304, t306, t307, t31, t314, t32, t321, t323, t326, t327, t33, t330, t334, &
     384             :          t335, t336, t337, t338, t339, t34, t340, t342, t343, t344, t345, t347, t355, t356, t357, &
     385             :          t358, t359, t36, t361, t362, t363, t367, t368, t37, t372, t374, t376, t377, t381, t383, &
     386             :          t384, t387, t388, t39, t390, t391, t394, t397, t398, t4, t40, t400, t401, t402, t404, &
     387             :          t405, t406, t408, t409, t410, t411, t412, t413, t414, t415, t416, t417, t418, t42, t423, &
     388             :          t425, t426, t429, t430, t432, t433, t435, t44, t440, t443, t444, t446, t447, t449, t46, &
     389             :          t463, t465, t47, t471, t472, t475, t476, t478, t479, t480, t484
     390             :       REAL(KIND=dp) :: t485, t489, t491, t495, t497, t5, t500, t501, t504, t505, t507, t508, t510, &
     391             :          t511, t513, t514, t515, t52, t520, t53, t530, t537, t54, t540, t542, t546, t550, t553, &
     392             :          t557, t56, t566, t569, t570, t577, t579, t58, t59, t6, t61, t616, t620, t621, t627, t628, &
     393             :          t63, t632, t647, t65, t655, t657, t66, t663, t67, t678, t68, t685, t69, t7, t70, t707, &
     394             :          t71, t716, t72, t73, t735, t74, t744, t751, t755, t76, t761, t77, t778, t78, t784, t788, &
     395             :          t79, t791, t8, t80, t81, t819, t824, t83, t84, t854, t856, t857, t86, t867, t872, t875, &
     396             :          t878, t88, t887, t888, t889, t89, t9, t905, t91, t910, t911
     397             :       REAL(KIND=dp) :: t92, t923, t924, t93, t930, t933, t94, t95, t952, t956, t968, t97, t975, &
     398             :          t98, t983
     399             : 
     400    66968425 :       IF (order >= 0) THEN
     401    66968425 :          t1 = ndrho**2
     402    66968425 :          t2 = a1*t1
     403    66968425 :          t3 = r2**2
     404    66968425 :          t4 = 0.1e1_dp/t3
     405    66968425 :          t5 = t2*t4
     406    66968425 :          t6 = pi**2
     407    66968425 :          t7 = r3*t6
     408    66968425 :          t8 = t7*rho
     409    66968425 :          t9 = t8**(0.1e1_dp/0.3e1_dp)
     410    66968425 :          t10 = t9**2
     411    66968425 :          t11 = 0.1e1_dp/t10
     412    66968425 :          t12 = rho**2
     413    66968425 :          t13 = 0.1e1_dp/t12
     414    66968425 :          t14 = t11*t13
     415    66968425 :          t15 = sscale**2
     416    66968425 :          t16 = t14*t15
     417    66968425 :          t18 = t1**2
     418    66968425 :          t19 = a2*t18
     419    66968425 :          t20 = t3**2
     420    66968425 :          t21 = 0.1e1_dp/t20
     421    66968425 :          t22 = t19*t21
     422    66968425 :          t24 = 0.1e1_dp/t9/t8
     423    66968425 :          t25 = t12**2
     424    66968425 :          t26 = 0.1e1_dp/t25
     425    66968425 :          t28 = t15**2
     426    66968425 :          t29 = t24*t26*t28
     427    66968425 :          t31 = t5*t16 + t22*t29
     428    66968425 :          t32 = f94*t31
     429    66968425 :          t33 = a3*t18
     430    66968425 :          t34 = t33*t21
     431    66968425 :          t36 = t18*ndrho
     432    66968425 :          t37 = a4*t36
     433    66968425 :          t39 = 0.1e1_dp/t20/r2
     434    66968425 :          t40 = t37*t39
     435    66968425 :          t42 = 0.1e1_dp/t10/t8
     436    66968425 :          t44 = 0.1e1_dp/t25/rho
     437    66968425 :          t46 = t28*sscale
     438    66968425 :          t47 = t42*t44*t46
     439    66968425 :          t52 = 0.1e1_dp/t20/t3
     440    66968425 :          t53 = a5*t18*t1*t52
     441    66968425 :          t54 = r3**2
     442    66968425 :          t56 = t6**2
     443    66968425 :          t58 = 0.1e1_dp/t54/t56
     444    66968425 :          t59 = t25**2
     445    66968425 :          t61 = t28*t15
     446    66968425 :          t63 = t58/t59*t61
     447    66968425 :          t65 = r1 + t34*t29 + t40*t47 + t53*t63
     448    66968425 :          t66 = 0.1e1_dp/t65
     449    66968425 :          t67 = t66*t1
     450    66968425 :          t68 = t32*t67
     451    66968425 :          t69 = t4*t11
     452    66968425 :          t70 = t13*t15
     453    66968425 :          t71 = 0.1e1_dp/A
     454    66968425 :          t72 = t70*t71
     455    66968425 :          t73 = t69*t72
     456    66968425 :          Q = t68*t73
     457    66968425 :          t74 = rho**(0.1e1_dp/0.3e1_dp)
     458    66968425 :          t76 = t74*rho*f89
     459    66968425 :          t77 = B*f12
     460    66968425 :          t78 = t1*t4
     461    66968425 :          t79 = t78*t11
     462    66968425 :          t80 = t31*t66
     463    66968425 :          t81 = t70*t80
     464    66968425 :          t83 = t79*t81 + DD
     465    66968425 :          t84 = 0.1e1_dp/t83
     466    66968425 :          t86 = F2*t31
     467    66968425 :          t88 = F1 + t86*t66
     468    66968425 :          t89 = t70*t88
     469    66968425 :          t91 = t79*t89 + r1
     470    66968425 :          t92 = f12*t91
     471    66968425 :          t93 = t83**2
     472    66968425 :          t94 = 0.1e1_dp/t93
     473    66968425 :          t95 = C*t94
     474    66968425 :          t97 = f34*pi
     475    66968425 :          t98 = rootpi
     476    66968425 :          t100 = r6*C
     477    66968425 :          t103 = r4*B
     478    66968425 :          t105 = r8*A
     479    66968425 :          t106 = t93*t83
     480    66968425 :          t109 = t98*(r15*E + t100*t91*t83 + t103*t93 + t105*t106)
     481    66968425 :          t110 = 0.1e1_dp/r16
     482    66968425 :          t111 = SQRT(t83)
     483    66968425 :          t112 = t111*t106
     484    66968425 :          t114 = t110/t112
     485    66968425 :          t116 = SQRT(A)
     486    66968425 :          t117 = EXP(Q)
     487    66968425 :          t118 = t116*t117
     488    66968425 :          t119 = f32*ndrho
     489    66968425 :          t120 = 0.1e1_dp/r2
     490    66968425 :          t121 = t119*t120
     491    66968425 :          t122 = 0.1e1_dp/t9
     492    66968425 :          t123 = 0.1e1_dp/rho
     493    66968425 :          t125 = t80*t71
     494    66968425 :          t126 = SQRT(t125)
     495    66968425 :          t127 = sscale*t126
     496    66968425 :          t130 = erfc(t121*t122*t123*t127)
     497    66968425 :          t134 = 0.1e1_dp/f1516
     498    66968425 :          t135 = (t97 + t109*t114 - t97*t118*t130)*t134
     499    66968425 :          t136 = 0.1e1_dp/t98
     500    66968425 :          t138 = 0.1e1_dp/E
     501    66968425 :          t139 = t136*t112*t138
     502    66968425 :          t142 = (-t135*t139 + r1)*E
     503    66968425 :          t143 = 0.1e1_dp/t106
     504    66968425 :          t145 = f12*A
     505    66968425 :          t146 = exei(Q)
     506    66968425 :          t147 = t78*t14
     507    66968425 :          t148 = t15*t31
     508    66968425 :          t149 = t66*t84
     509    66968425 :          t150 = t148*t149
     510    66968425 :          t152 = LOG(t147*t150)
     511             :          t156 = (t77*t84 + t92*t95 + t142*t143 + t145*(t146 + t152)) &
     512    66968425 :                 *Clda
     513    66968425 :          e_0 = e_0 + (-t76*t156)*sx0
     514             :       END IF
     515    66968425 :       IF (order >= 1 .OR. order == -1) THEN
     516    49964119 :          t158 = t4*t42
     517    49964119 :          t159 = t2*t158
     518    49964119 :          t160 = t70*t7
     519    49964119 :          t163 = t12*rho
     520    49964119 :          t164 = 0.1e1_dp/t163
     521    49964119 :          t165 = t11*t164
     522    49964119 :          t166 = t165*t15
     523    49964119 :          t169 = t54*t56
     524    49964119 :          t170 = t169*t12
     525    49964119 :          t172 = 0.1e1_dp/t9/t170
     526    49964119 :          t173 = t21*t172
     527    49964119 :          t174 = t19*t173
     528    49964119 :          t175 = t26*t28
     529    49964119 :          t176 = t175*t7
     530    49964119 :          t180 = t24*t44*t28
     531             :          t183 = -0.2e1_dp/0.3e1_dp*t159*t160 - (2._dp*t5*t166) - 0.4e1_dp/ &
     532    49964119 :                 0.3e1_dp*t174*t176 - (4._dp*t22*t180)
     533    49964119 :          t184 = f94*t183
     534    49964119 :          t185 = t184*t67
     535    49964119 :          t187 = t65**2
     536    49964119 :          t188 = 0.1e1_dp/t187
     537    49964119 :          t190 = t188*t1*t4
     538    49964119 :          t191 = t32*t190
     539    49964119 :          t192 = t15*t71
     540    49964119 :          t193 = t33*t173
     541    49964119 :          t199 = 0.1e1_dp/t10/t170
     542    49964119 :          t200 = t39*t199
     543    49964119 :          t201 = t37*t200
     544    49964119 :          t202 = t44*t46
     545    49964119 :          t203 = t202*t7
     546    49964119 :          t207 = 0.1e1_dp/t25/t12
     547    49964119 :          t209 = t42*t207*t46
     548    49964119 :          t215 = t58/t59/rho*t61
     549             :          t218 = -0.4e1_dp/0.3e1_dp*t193*t176 - (4._dp*t34*t180) - 0.5e1_dp &
     550    49964119 :                 /0.3e1_dp*t201*t203 - (5._dp*t40*t209) - (8._dp*t53*t215)
     551    49964119 :          t219 = t192*t218
     552    49964119 :          t220 = t14*t219
     553    49964119 :          t222 = t67*t4
     554    49964119 :          t223 = t32*t222
     555    49964119 :          t224 = t42*t13
     556    49964119 :          t225 = t224*t15
     557    49964119 :          t227 = t71*r3*t6
     558    49964119 :          t228 = t225*t227
     559    49964119 :          t231 = t164*t15
     560    49964119 :          t233 = t69*t231*t71
     561             :          dQrho = t185*t73 - t191*t220 - 0.2e1_dp/0.3e1_dp*t223*t228 - (2._dp &
     562    49964119 :                                                                        *t68*t233)
     563    49964119 :          t236 = a1*ndrho
     564    49964119 :          t237 = t236*t4
     565    49964119 :          t240 = t1*ndrho
     566    49964119 :          t241 = a2*t240
     567    49964119 :          t242 = t241*t21
     568    49964119 :          t245 = 2._dp*t237*t16 + 4._dp*t242*t29
     569    49964119 :          t246 = f94*t245
     570    49964119 :          t247 = t246*t67
     571    49964119 :          t249 = a3*t240
     572    49964119 :          t250 = t249*t21
     573    49964119 :          t253 = a4*t18
     574    49964119 :          t254 = t253*t39
     575    49964119 :          t258 = a5*t36*t52
     576    49964119 :          t261 = 4._dp*t250*t29 + 5._dp*t254*t47 + 6._dp*t258*t63
     577    49964119 :          t262 = t192*t261
     578    49964119 :          t263 = t14*t262
     579    49964119 :          t265 = t66*ndrho
     580    49964119 :          t266 = t32*t265
     581    49964119 :          dQndrho = t247*t73 - t191*t263 + 2._dp*t266*t73
     582    49964119 :          t269 = t74*f89
     583    49964119 :          t272 = t78*t224
     584    49964119 :          t274 = t66*r3*t6
     585    49964119 :          t275 = t148*t274
     586    49964119 :          t278 = t231*t80
     587    49964119 :          t281 = t183*t66
     588    49964119 :          t282 = t70*t281
     589    49964119 :          t284 = t188*t218
     590    49964119 :          t285 = t148*t284
     591             :          t287 = -0.2e1_dp/0.3e1_dp*t272*t275 - (2._dp*t79*t278) + (t79 &
     592    49964119 :                                                                    *t282) - t147*t285
     593    49964119 :          t288 = t94*t287
     594    49964119 :          t290 = t15*t88
     595    49964119 :          t291 = t290*t7
     596    49964119 :          t294 = t231*t88
     597    49964119 :          t297 = F2*t183
     598    49964119 :          t300 = t297*t66 - t86*t284
     599    49964119 :          t301 = t70*t300
     600             :          t303 = -0.2e1_dp/0.3e1_dp*t272*t291 - (2._dp*t79*t294) + (t79 &
     601    49964119 :                                                                    *t301)
     602    49964119 :          t304 = f12*t303
     603    49964119 :          t306 = C*t143
     604    49964119 :          t307 = t306*t287
     605    49964119 :          t314 = t83*t287
     606             :          t321 = t98*(t100*t303*t83 + t100*t91*t287 + 2._dp*t103*t314 &
     607    49964119 :                      + 3._dp*t105*t93*t287)
     608    49964119 :          t323 = t93**2
     609    49964119 :          t326 = t110/t111/t323
     610    49964119 :          t327 = t326*t287
     611    49964119 :          t330 = t97*t116
     612    49964119 :          t334 = rootpi
     613    49964119 :          t335 = 0.1e1_dp/t334
     614    49964119 :          t336 = t117*t335
     615    49964119 :          t337 = f32**2
     616    49964119 :          t338 = t337*t1
     617    49964119 :          t339 = t338*t69
     618    49964119 :          t340 = t70*t125
     619    49964119 :          t342 = EXP(-t339*t340)
     620    49964119 :          t343 = t120*t24
     621    49964119 :          t344 = t119*t343
     622    49964119 :          t345 = t123*sscale
     623    49964119 :          t347 = t126*r3*t6
     624    49964119 :          t355 = t119*t120*t122
     625    49964119 :          t356 = 0.1e1_dp/t126
     626    49964119 :          t357 = t281*t71
     627    49964119 :          t358 = t31*t188
     628    49964119 :          t359 = t71*t218
     629    49964119 :          t361 = t357 - t358*t359
     630    49964119 :          t362 = t356*t361
     631    49964119 :          t363 = t345*t362
     632             :          t367 = t342*(-t344*t345*t347/0.3e1_dp - t121*t122*t13*t127 &
     633    49964119 :                       + t355*t363/0.2e1_dp)
     634    49964119 :          t368 = t336*t367
     635             :          t372 = (t321*t114 - 0.7e1_dp/0.2e1_dp*t109*t327 - (t330*dQrho &
     636    49964119 :                                                             *t117*t130) + (2._dp*t330*t368))*t134
     637    49964119 :          t374 = t135*t136
     638    49964119 :          t376 = t111*t93*t138
     639    49964119 :          t377 = t376*t287
     640    49964119 :          t381 = (-t372*t139 - 0.7e1_dp/0.2e1_dp*t374*t377)*E
     641    49964119 :          t383 = 0.1e1_dp/t323
     642    49964119 :          t384 = t383*t287
     643    49964119 :          t387 = dexeirho(Q, dQrho)
     644    49964119 :          t388 = t78*t225
     645    49964119 :          t390 = t84*r3*t6
     646    49964119 :          t391 = t80*t390
     647    49964119 :          t394 = t78*t165
     648    49964119 :          t397 = t15*t183
     649    49964119 :          t398 = t397*t149
     650    49964119 :          t400 = t188*t84
     651    49964119 :          t401 = t400*t218
     652    49964119 :          t402 = t148*t401
     653    49964119 :          t404 = t66*t94
     654    49964119 :          t405 = t404*t287
     655    49964119 :          t406 = t148*t405
     656             :          t408 = -0.2e1_dp/0.3e1_dp*t388*t391 - (2._dp*t394*t150) + t147 &
     657    49964119 :                 *t398 - t147*t402 - t147*t406
     658    49964119 :          t409 = 0.1e1_dp/t1
     659    49964119 :          t410 = t408*t409
     660    49964119 :          t411 = t3*t10
     661    49964119 :          t412 = t410*t411
     662    49964119 :          t413 = 0.1e1_dp/t15
     663    49964119 :          t414 = t12*t413
     664    49964119 :          t415 = 0.1e1_dp/t31
     665    49964119 :          t416 = t415*t65
     666    49964119 :          t417 = t416*t83
     667    49964119 :          t418 = t414*t417
     668             :          t423 = (-t77*t288 + t304*t95 - 2._dp*t92*t307 + t381*t143 - 3._dp &
     669    49964119 :                  *t142*t384 + t145*(t387 + t412*t418))*Clda
     670    49964119 :          e_rho = e_rho + (-0.4e1_dp/0.3e1_dp*t269*t156 - t76*t423)*sx0
     671    49964119 :          t425 = ndrho*t4
     672    49964119 :          t426 = t425*t11
     673    49964119 :          t429 = t245*t66
     674    49964119 :          t430 = t70*t429
     675    49964119 :          t432 = t188*t261
     676    49964119 :          t433 = t148*t432
     677    49964119 :          t435 = 2._dp*t426*t81 + t79*t430 - t147*t433
     678    49964119 :          t440 = F2*t245
     679    49964119 :          t443 = t440*t66 - t86*t432
     680    49964119 :          t444 = t70*t443
     681    49964119 :          t446 = 2._dp*t426*t89 + t79*t444
     682    49964119 :          t447 = f12*t446
     683    49964119 :          t449 = t306*t435
     684             :          t463 = t98*(t100*t446*t83 + t100*t91*t435 + 2._dp*t103*t83 &
     685    49964119 :                      *t435 + 3._dp*t105*t93*t435)
     686    49964119 :          t465 = t326*t435
     687    49964119 :          t471 = f32*t120
     688    49964119 :          t472 = t471*t122
     689    49964119 :          t475 = t429*t71
     690    49964119 :          t476 = t71*t261
     691    49964119 :          t478 = t475 - t358*t476
     692    49964119 :          t479 = t356*t478
     693    49964119 :          t480 = t345*t479
     694    49964119 :          t484 = t342*(t472*t345*t126 + t355*t480/0.2e1_dp)
     695    49964119 :          t485 = t336*t484
     696             :          t489 = (t463*t114 - 0.7e1_dp/0.2e1_dp*t109*t465 - (t330*dQndrho &
     697    49964119 :                                                             *t117*t130) + (2._dp*t330*t485))*t134
     698    49964119 :          t491 = t376*t435
     699    49964119 :          t495 = (-t489*t139 - 0.7e1_dp/0.2e1_dp*t374*t491)*E
     700    49964119 :          t497 = t383*t435
     701    49964119 :          t500 = dexeindrho(Q, dQndrho)
     702    49964119 :          t501 = t425*t14
     703    49964119 :          t504 = t15*t245
     704    49964119 :          t505 = t504*t149
     705    49964119 :          t507 = t400*t261
     706    49964119 :          t508 = t148*t507
     707    49964119 :          t510 = t404*t435
     708    49964119 :          t511 = t148*t510
     709    49964119 :          t513 = 2._dp*t501*t150 + t147*t505 - t147*t508 - t147*t511
     710    49964119 :          t514 = t513*t409
     711    49964119 :          t515 = t514*t411
     712             :          t520 = (-t77*t94*t435 + t447*t95 - 2._dp*t92*t449 + t495*t143 &
     713    49964119 :                  - 3._dp*t142*t497 + t145*(t500 + t515*t418))*Clda
     714    49964119 :          e_ndrho = e_ndrho + (-t76*t520)*sx0
     715             :       END IF
     716    66968425 :       IF (order >= 2 .OR. order == -2) THEN
     717           0 :          t530 = t11*t26
     718           0 :          t537 = t54*r3*t56*t6*t163
     719           0 :          t540 = t21/t9/t537
     720           0 :          t542 = t175*t169
     721           0 :          t546 = t44*t28*t7
     722           0 :          t550 = t24*t207*t28
     723             :          t553 = 0.10e2_dp/0.9e1_dp*t2*t4*t199*t70*t169 + 0.8e1_dp/0.3e1_dp &
     724             :                 *t159*t231*t7 + (6._dp*t5*t530*t15) + 0.28e2_dp/0.9e1_dp* &
     725             :                 t19*t540*t542 + 0.32e2_dp/0.3e1_dp*t174*t546 + (20._dp*t22 &
     726           0 :                                                                 *t550)
     727           0 :          t557 = t184*t190
     728           0 :          t566 = 0.1e1_dp/t187/t65
     729           0 :          t569 = t32*t566*t1*t4
     730           0 :          t570 = t218**2
     731           0 :          t577 = t32*t188*t78*t42
     732           0 :          t579 = t218*r3*t6
     733             :          t616 = 0.28e2_dp/0.9e1_dp*t33*t540*t542 + 0.32e2_dp/0.3e1_dp*t193* &
     734             :                 t546 + (20._dp*t34*t550) + 0.40e2_dp/0.9e1_dp*t37*t39/t10/ &
     735             :                 t537*t202*t169 + 0.50e2_dp/0.3e1_dp*t201*t207*t46*t7 + 0.30e2_dp &
     736             :                 *t40*t42/t25/t163*t46 + (72._dp*t53*t58/t59/ &
     737           0 :                                          t12*t61)
     738           0 :          t620 = t199*t13
     739           0 :          t621 = t620*t15
     740           0 :          t627 = t42*t164
     741           0 :          t628 = t627*t15
     742           0 :          t632 = t26*t15
     743             :          d2Qrhorho = f94*t553*t67*t73 - (2._dp*t557*t220) - 0.4e1_dp/0.3e1_dp &
     744             :                      *t184*t222*t228 - (4._dp*t185*t233) + (2._dp*t569*t14 &
     745             :                                                             *t192*t570) + 0.4e1_dp/0.3e1_dp*t577*t72*t579 + (4._dp*t191 &
     746             :                                                                            *t165*t219) - (t191*t14*t192*t616) + 0.10e2_dp/0.9e1_dp &
     747             :                      *t223*t621*t71*t54*t56 + 0.8e1_dp/0.3e1_dp*t223*t628* &
     748           0 :                      t227 + 0.6e1_dp*t68*t69*t632*t71
     749             :          t647 = -0.4e1_dp/0.3e1_dp*t236*t158*t160 - (4._dp*t237*t166) &
     750           0 :                 - 0.16e2_dp/0.3e1_dp*t241*t173*t176 - (16._dp*t242*t180)
     751           0 :          t655 = t246*t190
     752           0 :          t657 = t359*t261
     753           0 :          t663 = t32*t188*ndrho*t4
     754             :          t678 = -0.16e2_dp/0.3e1_dp*t249*t173*t176 - (16._dp*t250*t180) &
     755             :                 - 0.25e2_dp/0.3e1_dp*t253*t200*t203 - (25._dp*t254*t209) - &
     756           0 :                 (48._dp*t258*t215)
     757           0 :          t685 = t7*t261
     758             :          d2Qrhondrho = (f94*t647*t67*t73) - t557*t263 + (2._dp*t184* &
     759             :                                                          t265*t73) - (t655*t220) + (2._dp*t569*t16*t657) - (2._dp &
     760             :                                                                             *t663*t220) - (t191*t14*t192*t678) - 0.2e1_dp/0.3e1_dp &
     761             :                        *t246*t222*t228 + 0.2e1_dp/0.3e1_dp*t577*t72*t685 - 0.4e1_dp &
     762             :                        /0.3e1_dp*t32*(t265)*t4*t228 - (2._dp*t247*t233) + &
     763           0 :                        (2._dp*t191*t165*t262) - (4._dp*t266*t233)
     764           0 :          t707 = 2._dp*a1*t4*t16 + 12._dp*a2*t1*t21*t29
     765           0 :          t716 = t261**2
     766             :          t735 = 12._dp*a3*t1*t21*t29 + 20._dp*a4*t240*t39*t47 + 30._dp* &
     767           0 :                 a5*t18*t52*t63
     768             :          d2Qndrhondrho = f94*t707*t67*t73 - 2._dp*t655*t263 + 4._dp*t246*t265* &
     769             :                          t73 + 2._dp*t569*t14*t192*t716 - 4._dp*t663*t263 - t191*t14 &
     770           0 :                          *t192*t735 + 2._dp*t32*t66*t4*t14*t192
     771           0 :          t744 = t74**2
     772           0 :          t751 = t287**2
     773           0 :          t755 = t78*t620
     774           0 :          t761 = t78*t627
     775           0 :          t778 = t553*t66
     776           0 :          t784 = t566*t570
     777           0 :          t788 = t188*t616
     778             :          t791 = 0.10e2_dp/0.9e1_dp*t755*t148*t66*t54*t56 + 0.8e1_dp/0.3e1_dp &
     779             :                 *t761*t275 - 0.4e1_dp/0.3e1_dp*t272*t397*t274 + 0.4e1_dp/0.3e1_dp &
     780             :                 *t388*t358*t579 + (6._dp*t79*t632*t80) - (4._dp*t79 &
     781             :                                                           *t231*t281) + (4._dp*t394*t285) + (t79*t70*t778) &
     782             :                 - 0.2e1_dp*t147*t397*t284 + 0.2e1_dp*t147*t148*t784 - t147 &
     783           0 :                 *t148*t788
     784             :          t819 = 0.10e2_dp/0.9e1_dp*t755*t290*t169 + 0.8e1_dp/0.3e1_dp*t761* &
     785             :                 t291 - 0.4e1_dp/0.3e1_dp*t272*t15*t300*t7 + (6._dp*t79*t632 &
     786             :                                                              *t88) - 0.4e1_dp*(t79)*t231*t300 + (t79*t70*(F2 &
     787           0 :                                                                            *t553*t66 - 2._dp*t297*t284 + 2._dp*t86*t784 - t86*t788))
     788           0 :          t824 = C*t383
     789           0 :          t854 = t323*t83
     790           0 :          t856 = 0.1e1_dp/t111/t854
     791           0 :          t857 = t110*t856
     792           0 :          t867 = dQrho**2
     793           0 :          t872 = t97*t116*dQrho
     794           0 :          t875 = t97*t118
     795           0 :          t878 = t148*t66
     796           0 :          t887 = t69*t13
     797           0 :          t888 = t338*t887
     798           0 :          t889 = t188*t71
     799           0 :          t905 = t13*sscale
     800           0 :          t910 = t119*t343*t123
     801           0 :          t911 = sscale*t356
     802           0 :          t923 = 0.1e1_dp/t126/t125
     803           0 :          t924 = t361**2
     804           0 :          t930 = t183*t188
     805           0 :          t933 = t31*t566
     806           0 :          t952 = t372*t136
     807           0 :          t956 = t111*t83*t138
     808           0 :          t968 = 0.1e1_dp/t854
     809           0 :          t975 = d2exeirhorho(Q, dQrho, d2Qrhorho)
     810           0 :          t983 = t66*t143
     811           0 :          t1003 = t358*t84
     812           0 :          t1007 = t80*t94
     813           0 :          t1018 = t566*t84
     814           0 :          t1023 = t78*t16
     815           0 :          t1024 = t94*t218
     816             :          t1037 = (6._dp*t78*t530*t150) - (4._dp*t394*t398) + (4._dp &
     817             :                                                               *t394*t402) + (2._dp*t147*t148*t983*t751) - (t147 &
     818             :                                                                                  *t148*t404*t791) + (t147*t15*t553*t149) - (2._dp* &
     819             :                                                                       t147*t397*t401) - (2._dp*t147*t397*t405) - 0.4e1_dp/0.3e1_dp &
     820             :                  *t388*t281*t390 + 0.4e1_dp/0.3e1_dp*t388*t1003*t579 + 0.4e1_dp &
     821             :                  /0.3e1_dp*t388*t1007*t7*t287 + 0.10e2_dp/0.9e1_dp*(t78) &
     822             :                  *(t621)*(t80)*(t84)*(t54)*(t56) + (2._dp &
     823             :                                                     *t147*t148*t1018*t570) + 0.2e1_dp*t1023*t358*t1024 &
     824             :                  *t287 - (t147*t148*t400*t616) + 0.8e1_dp/0.3e1_dp*(t78) &
     825           0 :                  *(t628)*(t391) + (4._dp*t394*t406)
     826           0 :          t1055 = t411*t12
     827           0 :          t1056 = t410*t1055
     828           0 :          t1057 = t31**2
     829           0 :          t1059 = t413/t1057
     830           0 :          t1060 = t65*t83
     831             :          t1073 = (2._dp*t77*t143*t751) - (t77*t94*t791) + (f12 &
     832             :                                                            *t819*t95) - (4._dp*t304*t307) + (6._dp*t92*t824* &
     833             :                                                                                 t751) - (2._dp*t92*t306*t791) + (-((t98*(t100*t819 &
     834             :                                                                      *t83 + 2._dp*t100*t303*t287 + t100*t91*t791 + 2._dp*t103*t751 &
     835             :                                                                       + 2._dp*t103*t83*t791 + 6._dp*t105*t83*t751 + 3._dp*t105*t93 &
     836             :                                                                       *t791)*t114) - (7._dp*t321*t327) + 0.63e2_dp/0.4e1_dp*(t109) &
     837             :                                                                                   *(t857)*(t751) - 0.7e1_dp/0.2e1_dp*(t109)*(t326) &
     838             :                                                                                *(t791) - t330*d2Qrhorho*t117*t130 - t330*t867*t117 &
     839             :                                                                          *t130 + (4._dp*t872*t368) + 0.2e1_dp*t875*t335*(0.2e1_dp/ &
     840             :                                                                               0.3e1_dp*t338*t158*t13*t878*t227 + (2._dp*t339*t231* &
     841             :                                                                                t125) - (t339*t70*t357) + t888*t148*t889*t218)*t367 &
     842             :                                                                        + 0.2e1_dp*t330*t336*t342*(0.4e1_dp/0.9e1_dp*t119*t120*t172 &
     843             :                                                                              *t345*t126*t54*t56 + 0.2e1_dp/0.3e1_dp*t344*t905*t347 &
     844             :                                                                              - t910*t911*t7*t361/0.3e1_dp + (2._dp*t121*t122*t164* &
     845             :                                                                       t127) - t355*t905*t362 - t355*t345*t923*t924/0.4e1_dp + t355 &
     846             :                                                                               *t345*t356*(t778*t71 - 2._dp*t930*t359 + 2._dp*t933* &
     847             :                                                                            t71*t570 - t358*t71*t616)/0.2e1_dp))*t134*t139 - (7._dp &
     848             :                                                                              *t952*t377) - 0.35e2_dp/0.4e1_dp*(t374)*(t956)*(t751) &
     849             :                                                                                       - 0.7e1_dp/0.2e1_dp*(t374)*(t376)*(t791))*E* &
     850             :                  (t143) - (6._dp*t381*t384) + (12._dp*t142*t968*t751) &
     851             :                  - (3._dp*t142*t383*t791) + t145*(t975 + t1037*t409*t411 &
     852             :                                                   *t418 + 0.2e1_dp/0.3e1_dp*(t410)*(t3)*(t122)* &
     853             :                                                   (t12)*(t413)*(t415)*(t65)*(t83)*(r3) &
     854             :                                                   *(t6) + (2._dp*t412*rho*t413*t417) - t1056*t1059 &
     855             :                                                   *t1060*t183 + (t412)*t414*(t415)*t218*(t83) &
     856           0 :                                                   + (t412)*t414*t416*(t287))
     857             :          e_rho_rho = e_rho_rho + (-0.4e1_dp/0.9e1_dp/t744*f89*t156 - 0.8e1_dp/0.3e1_dp*t269*t423 &
     858           0 :                                   - t76*t1073*Clda)*sx0
     859           0 :          t1079 = t143*t287*t435
     860           0 :          t1082 = t425*t224
     861           0 :          t1100 = t647*t66
     862           0 :          t1110 = t566*t218*t261
     863           0 :          t1114 = t188*t678
     864             :          t1117 = -0.4e1_dp/0.3e1_dp*t1082*t275 - 0.2e1_dp/0.3e1_dp*t272*t504 &
     865             :                  *t274 + 0.2e1_dp/0.3e1_dp*t388*t358*t685 - (4._dp*t426*t278) &
     866             :                  - (2._dp*t79*t231*t429) + (2._dp*t394*t433) + (2._dp &
     867             :                                                                 *t426*t282) + (t79*t70*t1100) - t147*t397*t432 - (2._dp &
     868             :                                                                            *t501*t285) - t147*t504*t284 + 0.2e1_dp*t147*t148*t1110 &
     869           0 :                  - t147*t148*t1114
     870             :          t1143 = -0.4e1_dp/0.3e1_dp*t1082*t291 - 0.2e1_dp/0.3e1_dp*t272*t15 &
     871             :                  *t443*t7 - (4._dp*t426*t294) - 0.2e1_dp*t79*t231*t443 + &
     872             :                  (2._dp*t426*t301) + t79*t70*(F2*t647*t66 - t297* &
     873           0 :                                               t432 - t440*t284 + 2._dp*t86*t1110 - t86*t1114)
     874           0 :          t1165 = t435*t287
     875           0 :          t1202 = t97*t116*dQndrho
     876             :          t1215 = t335*(-2._dp*t337*ndrho*t69*t340 - t339*t70*t475 &
     877           0 :                        + t888*t148*t889*t261)
     878           0 :          t1242 = t245*t188
     879             :          t1258 = (t98*(t100*t1143*t83 + t100*t303*t435 + t100 &
     880             :                        *t446*t287 + t100*t91*t1117 + 2._dp*t103*t1165 + 2._dp*t103* &
     881             :                        t83*t1117 + 6._dp*t105*t314*t435 + 3._dp*t105*t93*t1117)* &
     882             :                   t114) - 0.7e1_dp/0.2e1_dp*t321*t465 - 0.7e1_dp/0.2e1_dp*t463*t327 &
     883             :                  + 0.63e2_dp/0.4e1_dp*(t109)*(t110)*(t856)*(t287) &
     884             :                  *(t435) - 0.7e1_dp/0.2e1_dp*(t109)*(t326)*(t1117) &
     885             :                  - t330*d2Qrhondrho*t117*t130 - t330*dQrho*dQndrho*t117*t130 &
     886             :                  + (2._dp*t872*t485) + (2._dp*t1202*t368) + (2._dp*t875 &
     887             :                                                              *t1215*t367) + 0.2e1_dp*t330*t336*t342*(-t471*t24*t123 &
     888             :                                                                         *t127*t7/0.3e1_dp - t910*t911*t7*t478/0.6e1_dp - t472*t905 &
     889             :                                                                        *t126 - t355*t905*t479/0.2e1_dp + t472*t363/0.2e1_dp - t355 &
     890             :                                                                              *t345*t923*t361*t478/0.4e1_dp + t355*t345*t356*(t1100 &
     891             :                                                                             *t71 - t930*t476 - t1242*t359 + 2._dp*t933*t657 - t358 &
     892           0 :                                                                                                                 *t71*t678)/0.2e1_dp)
     893           0 :          t1263 = t489*t136
     894           0 :          t1286 = d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
     895             :          t1316 = -0.4e1_dp/0.3e1_dp*t425*t225*t391 - 0.2e1_dp/0.3e1_dp*t388 &
     896             :                  *t429*t390 + 0.2e1_dp/0.3e1_dp*t388*t1003*t685 + 0.2e1_dp/0.3e1_dp &
     897             :                  *t388*t1007*t7*t435 - 0.4e1_dp*t425*t165*t150 - (2._dp &
     898             :                                                                   *t394*t505) + (2._dp*t394*t508) + (2._dp*t394*t511) + &
     899           0 :                  (2._dp*t501*t398) + t147*t15*t647*t149 - t147*t397*t507
     900             :          t1347 = -t147*t397*t510 - 2._dp*t501*t402 - t147*t504*t401 &
     901             :                  + 2._dp*t1023*t933*t84*t218*t261 + t1023*t358*t1024*t435 &
     902             :                  - t147*t148*t400*t678 - 2._dp*t501*t406 - t147*t504*t405 &
     903             :                  + t1023*t358*t288*t261 + 2._dp*t1023*t80*t1079 - t147 &
     904           0 :                  *t148*t404*t1117
     905           0 :          t1352 = 0.1e1_dp/t240
     906           0 :          t1358 = t1059*t1060*t245
     907           0 :          t1362 = t414*t415*t261*t83
     908           0 :          t1365 = t414*t416*t435
     909             :          t1369 = (2._dp*t77*t1079) - (t77*t94*t1117) + f12*t1143 &
     910             :                  *t95 - (2._dp*t304*t449) - (2._dp*t447*t307) + (6._dp &
     911             :                                                                  *t92*C*t384*t435) - (2._dp*t92*t306*t1117) + (-t1258 &
     912             :                                                                 *t134*t139 - 0.7e1_dp/0.2e1_dp*t952*t491 - 0.7e1_dp/0.2e1_dp*t1263 &
     913             :                                                                    *t377 - 0.35e2_dp/0.4e1_dp*t374*t956*t1165 - 0.7e1_dp/0.2e1_dp* &
     914             :                                                                             t374*t376*(t1117))*E*t143 - (3._dp*t381*t497) - (3._dp &
     915             :                                                                                *t495*t384) + (12._dp*t142*t968*t287*t435) - (3._dp &
     916             :                                                                                *t142*t383*t1117) + (t145*(t1286 + (t1316 + t1347)* &
     917             :                                                                          t409*t411*t418 - 2._dp*t408*t1352*t411*t418 - t1056*t1358 &
     918           0 :                                                                                                          + t412*t1362 + t412*t1365))
     919           0 :          e_ndrho_rho = e_ndrho_rho + (-0.4e1_dp/0.3e1_dp*t269*t520 - t76*t1369*Clda)*sx0
     920           0 :          t1372 = t435**2
     921           0 :          t1382 = t707*t66
     922           0 :          t1388 = t566*t716
     923           0 :          t1392 = t188*t735
     924             :          t1395 = 2._dp*t887*t878 + 4._dp*t426*t430 - 4._dp*t501*t433 + t79* &
     925             :                  t70*t1382 - 2._dp*t147*t504*t432 + 2._dp*t147*t148*t1388 - &
     926           0 :                  t147*t148*t1392
     927             :          t1412 = 2._dp*t69*t89 + 4._dp*t426*t444 + t79*t70*(F2*t707* &
     928           0 :                                                             t66 - 2._dp*t440*t432 + 2._dp*t86*t1388 - t86*t1392)
     929           0 :          t1455 = dQndrho**2
     930           0 :          t1465 = t478**2
     931           0 :          t1510 = d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
     932             :          t1547 = 2._dp*t887*t150 + 4._dp*t501*t505 - 4._dp*t501*t508 - 4._dp*t501 &
     933             :                  *t511 + t147*t15*t707*t149 - 2._dp*t147*t504*t507 - 2._dp &
     934             :                  *t147*t504*t510 + 2._dp*t147*t148*t1018*t716 + 2._dp*t1023 &
     935             :                  *t358*t94*t261*t435 - t147*t148*t400*t735 + 2._dp*t147 &
     936           0 :                  *t148*t983*t1372 - t147*t148*t404*t1395
     937             :          t1561 = (2._dp*t77*t143*t1372) - (t77*t94*t1395) + (f12 &
     938             :                                                              *t1412*t95) - (4._dp*t447*t449) + (6._dp*t92*t824 &
     939             :                                                                                  *t1372) - (2._dp*t92*t306*t1395) + (-((t98*(t100* &
     940             :                                                                     t1412*t83 + 2._dp*t100*t446*t435 + t100*t91*t1395 + 2._dp*t103 &
     941             :                                                                      *t1372 + 2._dp*t103*t83*t1395 + 6._dp*t105*t83*t1372 + 3._dp* &
     942             :                                                                     t105*t93*t1395)*t114) - (7._dp*t463*t465) + 0.63e2_dp/0.4e1_dp &
     943             :                                                                                  *(t109)*(t857)*(t1372) - 0.7e1_dp/0.2e1_dp*(t109) &
     944             :                                                                              *(t326)*(t1395) - t330*d2Qndrhondrho*t117*t130 - t330 &
     945             :                                                                               *t1455*t117*t130 + (4._dp*t1202*t485) + (2._dp*t875* &
     946             :                                                                            t1215*t484) + 0.2e1_dp*t330*t336*t342*(t472*t480 - t355 &
     947             :                                                                                 *t345*t923*t1465/0.4e1_dp + t355*t345*t356*(t1382* &
     948             :                                                                      t71 - 2._dp*t1242*t476 + 2._dp*t933*t71*t716 - t358*t71*t735) &
     949             :                                                                    /0.2e1_dp))*t134*t139 - (7._dp*t1263*t491) - 0.35e2_dp/0.4e1_dp &
     950             :                                                                                  *(t374)*(t956)*(t1372) - 0.7e1_dp/0.2e1_dp*(t374) &
     951             :                                                                                            *(t376)*(t1395))*E*(t143) - (6._dp*t495 &
     952             :                                                                              *t497) + (12._dp*t142*t968*t1372) - (3._dp*t142*t383* &
     953             :                                                                          t1395) + (t145*(t1510 + t1547*t409*t411*t418 - 2._dp*t513 &
     954             :                                                                            *t1352*t411*t418 - t514*t1055*t1358 + t515*t1362 + t515 &
     955           0 :                                                                                                                             *t1365))
     956           0 :          e_ndrho_ndrho = e_ndrho_ndrho + (-t76*t1561*Clda)*sx0
     957             :       END IF
     958             : 
     959    66968425 :    END SUBROUTINE xwpbe_lda_calc_0
     960             : 
     961             : ! **************************************************************************************************
     962             : !> \brief Evaluates the screened hole averaged PBE exchange functional for lda
     963             : !> \param e_0 ...
     964             : !> \param e_rho ...
     965             : !> \param e_ndrho ...
     966             : !> \param e_rho_rho ...
     967             : !> \param e_ndrho_rho ...
     968             : !> \param e_ndrho_ndrho ...
     969             : !> \param rho , ndrho: density and norm of the density gradient
     970             : !> \param ndrho ...
     971             : !> \param sscale scaling factor to enforce Lieb-Oxford bound
     972             : !> \param sx0 scaling factor
     973             : !> \param order degree of the derivative that should be evaluated,
     974             : !>        if positive all the derivatives up to the given degree are evaluated,
     975             : !>        if negative only the given degree is calculated
     976             : !> \par History
     977             : !>      05.2007 created [Manuel Guidon]
     978             : !> \author Manuel Guidon
     979             : !> \note
     980             : !>      This routine evaluates the functional for omega=0 using a taylor
     981             : !>      expansion for the parameter G.
     982             : ! **************************************************************************************************
     983      235788 :    SUBROUTINE xwpbe_lda_calc_01(e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
     984             :                                 e_ndrho_ndrho, rho, ndrho, sscale, sx0, order)
     985             :       REAL(KIND=dp), INTENT(INOUT)                       :: e_0, e_rho, e_ndrho, e_rho_rho, &
     986             :                                                             e_ndrho_rho, e_ndrho_ndrho
     987             :       REAL(KIND=dp), INTENT(IN)                          :: rho, ndrho, sscale, sx0
     988             :       INTEGER, INTENT(IN)                                :: order
     989             : 
     990             :       REAL(KIND=dp) :: d2Qndrhondrho, d2Qrhondrho, d2Qrhorho, dQndrho, dQrho, Q, t1, t10, t100, &
     991             :          t101, t1019, t103, t104, t1051, t1056, t1062, t1066, t1069, t107, t1073, t1076, t1080, &
     992             :          t109, t1094, t1098, t11, t1101, t111, t112, t113, t114, t115, t1154, t116, t118, t1191, &
     993             :          t12, t1205, t122, t124, t125, t126, t129, t13, t130, t131, t132, t135, t136, t139, t14, &
     994             :          t140, t141, t142, t146, t149, t15, t150, t151, t153, t154, t156, t157, t158, t159, t16, &
     995             :          t165, t166, t167, t168, t169, t173, t175, t18, t181, t184, t185, t186, t188, t189, t19, &
     996             :          t190, t191, t193, t194, t197, t199, t2, t20, t202, t203, t206, t207
     997             :       REAL(KIND=dp) :: t208, t21, t211, t212, t213, t215, t216, t219, t22, t220, t224, t227, t228, &
     998             :          t229, t231, t232, t235, t238, t24, t240, t241, t244, t247, t248, t25, t250, t251, t253, &
     999             :          t254, t256, t257, t26, t260, t263, t266, t267, t270, t272, t273, t276, t277, t28, t280, &
    1000             :          t283, t288, t29, t293, t294, t297, t299, t3, t300, t301, t304, t305, t307, t308, t31, &
    1001             :          t311, t314, t315, t317, t318, t319, t32, t321, t322, t323, t325, t326, t327, t328, t329, &
    1002             :          t33, t330, t331, t332, t333, t334, t335, t34, t340, t342, t343, t346, t347, t349, t350, &
    1003             :          t352, t357, t36, t360, t361, t364, t366, t37, t371, t372, t375
    1004             :       REAL(KIND=dp) :: t376, t379, t380, t383, t385, t388, t389, t39, t392, t393, t395, t396, &
    1005             :          t398, t399, t4, t40, t401, t402, t403, t408, t410, t412, t415, t418, t419, t42, t425, &
    1006             :          t428, t430, t434, t438, t44, t441, t445, t454, t457, t458, t46, t465, t467, t47, t5, &
    1007             :          t504, t508, t509, t515, t516, t52, t520, t53, t535, t54, t543, t552, t56, t567, t574, &
    1008             :          t58, t59, t596, t6, t605, t61, t624, t63, t633, t640, t644, t65, t650, t656, t66, t67, &
    1009             :          t674, t678, t68, t681, t69, t7, t70, t71, t714, t72, t73, t74, t759, t76, t766, t77, &
    1010             :          t773, t777, t78, t79, t8, t80, t806, t81, t811, t812, t820, t828, t83, t84
    1011             :       REAL(KIND=dp) :: t847, t848, t849, t851, t852, t86, t865, t871, t874, t88, t89, t9, t902, &
    1012             :          t906, t909, t92, t93, t94, t95, t97, t98, t989
    1013             : 
    1014      235788 :       IF (order >= 0) THEN
    1015      235788 :          t1 = ndrho**2
    1016      235788 :          t2 = a1*t1
    1017      235788 :          t3 = r2**2
    1018      235788 :          t4 = 0.1e1_dp/t3
    1019      235788 :          t5 = t2*t4
    1020      235788 :          t6 = pi**2
    1021      235788 :          t7 = r3*t6
    1022      235788 :          t8 = t7*rho
    1023      235788 :          t9 = t8**(0.1e1_dp/0.3e1_dp)
    1024      235788 :          t10 = t9**2
    1025      235788 :          t11 = 0.1e1_dp/t10
    1026      235788 :          t12 = rho**2
    1027      235788 :          t13 = 0.1e1_dp/t12
    1028      235788 :          t14 = t11*t13
    1029      235788 :          t15 = sscale**2
    1030      235788 :          t16 = t14*t15
    1031      235788 :          t18 = t1**2
    1032      235788 :          t19 = a2*t18
    1033      235788 :          t20 = t3**2
    1034      235788 :          t21 = 0.1e1_dp/t20
    1035      235788 :          t22 = t19*t21
    1036      235788 :          t24 = 0.1e1_dp/t9/t8
    1037      235788 :          t25 = t12**2
    1038      235788 :          t26 = 0.1e1_dp/t25
    1039      235788 :          t28 = t15**2
    1040      235788 :          t29 = t24*t26*t28
    1041      235788 :          t31 = t5*t16 + t22*t29
    1042      235788 :          t32 = f94*t31
    1043      235788 :          t33 = a3*t18
    1044      235788 :          t34 = t33*t21
    1045      235788 :          t36 = t18*ndrho
    1046      235788 :          t37 = a4*t36
    1047      235788 :          t39 = 0.1e1_dp/t20/r2
    1048      235788 :          t40 = t37*t39
    1049      235788 :          t42 = 0.1e1_dp/t10/t8
    1050      235788 :          t44 = 0.1e1_dp/t25/rho
    1051      235788 :          t46 = t28*sscale
    1052      235788 :          t47 = t42*t44*t46
    1053      235788 :          t52 = 0.1e1_dp/t20/t3
    1054      235788 :          t53 = a5*t18*t1*t52
    1055      235788 :          t54 = r3**2
    1056      235788 :          t56 = t6**2
    1057      235788 :          t58 = 0.1e1_dp/t54/t56
    1058      235788 :          t59 = t25**2
    1059      235788 :          t61 = t28*t15
    1060      235788 :          t63 = t58/t59*t61
    1061      235788 :          t65 = r1 + t34*t29 + t40*t47 + t53*t63
    1062      235788 :          t66 = 0.1e1_dp/t65
    1063      235788 :          t67 = t66*t1
    1064      235788 :          t68 = t32*t67
    1065      235788 :          t69 = t4*t11
    1066      235788 :          t70 = t13*t15
    1067      235788 :          t71 = 0.1e1_dp/A
    1068      235788 :          t72 = t70*t71
    1069      235788 :          t73 = t69*t72
    1070      235788 :          Q = t68*t73
    1071      235788 :          t74 = rho**(0.1e1_dp/0.3e1_dp)
    1072      235788 :          t76 = t74*rho*f89
    1073      235788 :          t77 = B*f12
    1074      235788 :          t78 = t1*t4
    1075      235788 :          t79 = t78*t11
    1076      235788 :          t80 = t31*t66
    1077      235788 :          t81 = t70*t80
    1078      235788 :          t83 = t79*t81 + DD
    1079      235788 :          t84 = 0.1e1_dp/t83
    1080      235788 :          t86 = F2*t31
    1081      235788 :          t88 = F1 + t86*t66
    1082      235788 :          t89 = t70*t88
    1083      235788 :          t92 = f12*(t79*t89 + r1)
    1084      235788 :          t93 = t83**2
    1085      235788 :          t94 = 0.1e1_dp/t93
    1086      235788 :          t95 = C*t94
    1087      235788 :          t97 = g2*t1
    1088      235788 :          t98 = t97*t4
    1089      235788 :          t100 = g3*t18
    1090      235788 :          t101 = t100*t21
    1091      235788 :          t103 = g1 + t98*t16 + t101*t29
    1092      235788 :          t104 = t70*t103
    1093      235788 :          t107 = (t79*t104 + r1)*E
    1094      235788 :          t109 = 0.1e1_dp/t93/t83
    1095      235788 :          t111 = f12*A
    1096      235788 :          t112 = exei(Q)
    1097      235788 :          t113 = t78*t14
    1098      235788 :          t114 = t15*t31
    1099      235788 :          t115 = t66*t84
    1100      235788 :          t116 = t114*t115
    1101      235788 :          t118 = LOG(t113*t116)
    1102             :          t122 = (t77*t84 + t92*t95 + t107*t109 + t111*(t112 + t118)) &
    1103      235788 :                 *Clda
    1104      235788 :          e_0 = e_0 + (-t76*t122)*sx0
    1105             :       END IF
    1106      235788 :       IF (order >= 1 .OR. order == -1) THEN
    1107      231035 :          t124 = t4*t42
    1108      231035 :          t125 = t2*t124
    1109      231035 :          t126 = t70*t7
    1110      231035 :          t129 = t12*rho
    1111      231035 :          t130 = 0.1e1_dp/t129
    1112      231035 :          t131 = t11*t130
    1113      231035 :          t132 = t131*t15
    1114      231035 :          t135 = t54*t56
    1115      231035 :          t136 = t135*t12
    1116      231035 :          t139 = t21/t9/t136
    1117      231035 :          t140 = t19*t139
    1118      231035 :          t141 = t26*t28
    1119      231035 :          t142 = t141*t7
    1120      231035 :          t146 = t24*t44*t28
    1121             :          t149 = -0.2e1_dp/0.3e1_dp*t125*t126 - (2._dp*t5*t132) - 0.4e1_dp/ &
    1122      231035 :                 0.3e1_dp*t140*t142 - (4._dp*t22*t146)
    1123      231035 :          t150 = f94*t149
    1124      231035 :          t151 = t150*t67
    1125      231035 :          t153 = t65**2
    1126      231035 :          t154 = 0.1e1_dp/t153
    1127      231035 :          t156 = t154*t1*t4
    1128      231035 :          t157 = t32*t156
    1129      231035 :          t158 = t15*t71
    1130      231035 :          t159 = t33*t139
    1131      231035 :          t165 = 0.1e1_dp/t10/t136
    1132      231035 :          t166 = t39*t165
    1133      231035 :          t167 = t37*t166
    1134      231035 :          t168 = t44*t46
    1135      231035 :          t169 = t168*t7
    1136      231035 :          t173 = 0.1e1_dp/t25/t12
    1137      231035 :          t175 = t42*t173*t46
    1138      231035 :          t181 = t58/t59/rho*t61
    1139             :          t184 = -0.4e1_dp/0.3e1_dp*t159*t142 - (4._dp*t34*t146) - 0.5e1_dp &
    1140      231035 :                 /0.3e1_dp*t167*t169 - (5._dp*t40*t175) - (8._dp*t53*t181)
    1141      231035 :          t185 = t158*t184
    1142      231035 :          t186 = t14*t185
    1143      231035 :          t188 = t67*t4
    1144      231035 :          t189 = t32*t188
    1145      231035 :          t190 = t42*t13
    1146      231035 :          t191 = t190*t15
    1147      231035 :          t193 = t71*r3*t6
    1148      231035 :          t194 = t191*t193
    1149      231035 :          t197 = t130*t15
    1150      231035 :          t199 = t69*t197*t71
    1151             :          dQrho = t151*t73 - t157*t186 - 0.2e1_dp/0.3e1_dp*t189*t194 - (2._dp &
    1152      231035 :                                                                        *t68*t199)
    1153      231035 :          t202 = a1*ndrho
    1154      231035 :          t203 = t202*t4
    1155      231035 :          t206 = t1*ndrho
    1156      231035 :          t207 = a2*t206
    1157      231035 :          t208 = t207*t21
    1158      231035 :          t211 = 2._dp*t203*t16 + 4._dp*t208*t29
    1159      231035 :          t212 = f94*t211
    1160      231035 :          t213 = t212*t67
    1161      231035 :          t215 = a3*t206
    1162      231035 :          t216 = t215*t21
    1163      231035 :          t219 = a4*t18
    1164      231035 :          t220 = t219*t39
    1165      231035 :          t224 = a5*t36*t52
    1166      231035 :          t227 = 4._dp*t216*t29 + 5._dp*t220*t47 + 6._dp*t224*t63
    1167      231035 :          t228 = t158*t227
    1168      231035 :          t229 = t14*t228
    1169      231035 :          t231 = t66*ndrho
    1170      231035 :          t232 = t32*t231
    1171      231035 :          dQndrho = t213*t73 - t157*t229 + 2._dp*t232*t73
    1172      231035 :          t235 = t74*f89
    1173      231035 :          t238 = t78*t190
    1174      231035 :          t240 = t66*r3*t6
    1175      231035 :          t241 = t114*t240
    1176      231035 :          t244 = t197*t80
    1177      231035 :          t247 = t149*t66
    1178      231035 :          t248 = t70*t247
    1179      231035 :          t250 = t154*t184
    1180      231035 :          t251 = t114*t250
    1181             :          t253 = -0.2e1_dp/0.3e1_dp*t238*t241 - (2._dp*t79*t244) + (t79 &
    1182      231035 :                                                                    *t248) - t113*t251
    1183      231035 :          t254 = t94*t253
    1184      231035 :          t256 = t15*t88
    1185      231035 :          t257 = t256*t7
    1186      231035 :          t260 = t197*t88
    1187      231035 :          t263 = F2*t149
    1188      231035 :          t266 = t263*t66 - t86*t250
    1189      231035 :          t267 = t70*t266
    1190             :          t270 = f12*(-0.2e1_dp/0.3e1_dp*t238*t257 - (2._dp*t79*t260) + &
    1191      231035 :                      (t79*t267))
    1192      231035 :          t272 = C*t109
    1193      231035 :          t273 = t272*t253
    1194      231035 :          t276 = t15*t103
    1195      231035 :          t277 = t276*t7
    1196      231035 :          t280 = t197*t103
    1197      231035 :          t283 = t97*t124
    1198      231035 :          t288 = t100*t139
    1199             :          t293 = -0.2e1_dp/0.3e1_dp*t283*t126 - (2._dp*t98*t132) - 0.4e1_dp &
    1200      231035 :                 /0.3e1_dp*t288*t142 - (4._dp*t101*t146)
    1201      231035 :          t294 = t70*t293
    1202             :          t297 = (-0.2e1_dp/0.3e1_dp*t238*t277 - (2._dp*t79*t280) + (t79 &
    1203      231035 :                                                                     *t294))*E
    1204      231035 :          t299 = t93**2
    1205      231035 :          t300 = 0.1e1_dp/t299
    1206      231035 :          t301 = t300*t253
    1207      231035 :          t304 = dexeirho(Q, dQrho)
    1208      231035 :          t305 = t78*t191
    1209      231035 :          t307 = t84*r3*t6
    1210      231035 :          t308 = t80*t307
    1211      231035 :          t311 = t78*t131
    1212      231035 :          t314 = t15*t149
    1213      231035 :          t315 = t314*t115
    1214      231035 :          t317 = t154*t84
    1215      231035 :          t318 = t317*t184
    1216      231035 :          t319 = t114*t318
    1217      231035 :          t321 = t66*t94
    1218      231035 :          t322 = t321*t253
    1219      231035 :          t323 = t114*t322
    1220             :          t325 = -0.2e1_dp/0.3e1_dp*t305*t308 - (2._dp*t311*t116) + t113 &
    1221      231035 :                 *t315 - t113*t319 - t113*t323
    1222      231035 :          t326 = 0.1e1_dp/t1
    1223      231035 :          t327 = t325*t326
    1224      231035 :          t328 = t3*t10
    1225      231035 :          t329 = t327*t328
    1226      231035 :          t330 = 0.1e1_dp/t15
    1227      231035 :          t331 = t12*t330
    1228      231035 :          t332 = 0.1e1_dp/t31
    1229      231035 :          t333 = t332*t65
    1230      231035 :          t334 = t333*t83
    1231      231035 :          t335 = t331*t334
    1232             :          t340 = (-t77*t254 + t270*t95 - 2._dp*t92*t273 + t297*t109 - 3._dp &
    1233      231035 :                  *t107*t301 + t111*(t304 + t329*t335))*Clda
    1234      231035 :          e_rho = e_rho + (-0.4e1_dp/0.3e1_dp*t235*t122 - t76*t340)*sx0
    1235      231035 :          t342 = ndrho*t4
    1236      231035 :          t343 = t342*t11
    1237      231035 :          t346 = t211*t66
    1238      231035 :          t347 = t70*t346
    1239      231035 :          t349 = t154*t227
    1240      231035 :          t350 = t114*t349
    1241      231035 :          t352 = 2._dp*t343*t81 + t79*t347 - t113*t350
    1242      231035 :          t357 = F2*t211
    1243      231035 :          t360 = t357*t66 - t86*t349
    1244      231035 :          t361 = t70*t360
    1245      231035 :          t364 = f12*(2._dp*t343*t89 + t79*t361)
    1246      231035 :          t366 = t272*t352
    1247      231035 :          t371 = g2*ndrho
    1248      231035 :          t372 = t371*t4
    1249      231035 :          t375 = g3*t206
    1250      231035 :          t376 = t375*t21
    1251      231035 :          t379 = 2._dp*t372*t16 + 4._dp*t376*t29
    1252      231035 :          t380 = t70*t379
    1253      231035 :          t383 = (2._dp*t343*t104 + t79*t380)*E
    1254      231035 :          t385 = t300*t352
    1255      231035 :          t388 = dexeindrho(Q, dQndrho)
    1256      231035 :          t389 = t342*t14
    1257      231035 :          t392 = t15*t211
    1258      231035 :          t393 = t392*t115
    1259      231035 :          t395 = t317*t227
    1260      231035 :          t396 = t114*t395
    1261      231035 :          t398 = t321*t352
    1262      231035 :          t399 = t114*t398
    1263      231035 :          t401 = 2._dp*t389*t116 + t113*t393 - t113*t396 - t113*t399
    1264      231035 :          t402 = t401*t326
    1265      231035 :          t403 = t402*t328
    1266             :          t408 = (-t77*t94*t352 + t364*t95 - 2._dp*t92*t366 + t383*t109 &
    1267      231035 :                  - 3._dp*t107*t385 + t111*(t388 + t403*t335))*Clda
    1268      231035 :          e_ndrho = e_ndrho + (-t76*t408)*sx0
    1269             :       END IF
    1270      235788 :       IF (order >= 2 .OR. order == -2) THEN
    1271           0 :          t410 = t4*t165
    1272           0 :          t412 = t70*t135
    1273           0 :          t415 = t197*t7
    1274           0 :          t418 = t11*t26
    1275           0 :          t419 = t418*t15
    1276           0 :          t425 = t54*r3*t56*t6*t129
    1277           0 :          t428 = t21/t9/t425
    1278           0 :          t430 = t141*t135
    1279           0 :          t434 = t44*t28*t7
    1280           0 :          t438 = t24*t173*t28
    1281             :          t441 = 0.10e2_dp/0.9e1_dp*t2*t410*t412 + 0.8e1_dp/0.3e1_dp*t125*t415 &
    1282             :                 + (6._dp*t5*t419) + 0.28e2_dp/0.9e1_dp*t19*t428*t430 + 0.32e2_dp &
    1283           0 :                 /0.3e1_dp*t140*t434 + (20._dp*t22*t438)
    1284           0 :          t445 = t150*t156
    1285           0 :          t454 = 0.1e1_dp/t153/t65
    1286           0 :          t457 = t32*t454*t1*t4
    1287           0 :          t458 = t184**2
    1288           0 :          t465 = t32*t154*t78*t42
    1289           0 :          t467 = t184*r3*t6
    1290             :          t504 = 0.28e2_dp/0.9e1_dp*t33*t428*t430 + 0.32e2_dp/0.3e1_dp*t159* &
    1291             :                 t434 + (20._dp*t34*t438) + 0.40e2_dp/0.9e1_dp*t37*t39/t10/ &
    1292             :                 t425*t168*t135 + 0.50e2_dp/0.3e1_dp*t167*t173*t46*t7 + 0.30e2_dp &
    1293             :                 *t40*t42/t25/t129*t46 + (72._dp*t53*t58/t59/ &
    1294           0 :                                          t12*t61)
    1295           0 :          t508 = t165*t13
    1296           0 :          t509 = t508*t15
    1297           0 :          t515 = t42*t130
    1298           0 :          t516 = t515*t15
    1299           0 :          t520 = t26*t15
    1300             :          d2Qrhorho = f94*t441*t67*t73 - (2._dp*t445*t186) - 0.4e1_dp/0.3e1_dp &
    1301             :                      *t150*t188*t194 - (4._dp*t151*t199) + (2._dp*t457*t14 &
    1302             :                                                             *t158*t458) + 0.4e1_dp/0.3e1_dp*t465*t72*t467 + (4._dp*t157 &
    1303             :                                                                            *t131*t185) - (t157*t14*t158*t504) + 0.10e2_dp/0.9e1_dp &
    1304             :                      *t189*t509*t71*t54*t56 + 0.8e1_dp/0.3e1_dp*t189*t516* &
    1305           0 :                      t193 + 0.6e1_dp*t68*t69*t520*t71
    1306             :          t535 = -0.4e1_dp/0.3e1_dp*t202*t124*t126 - (4._dp*t203*t132) &
    1307           0 :                 - 0.16e2_dp/0.3e1_dp*t207*t139*t142 - (16._dp*t208*t146)
    1308           0 :          t543 = t212*t156
    1309           0 :          t552 = t32*t154*ndrho*t4
    1310             :          t567 = -0.16e2_dp/0.3e1_dp*t215*t139*t142 - (16._dp*t216*t146) &
    1311             :                 - 0.25e2_dp/0.3e1_dp*t219*t166*t169 - (25._dp*t220*t175) - &
    1312           0 :                 (48._dp*t224*t181)
    1313           0 :          t574 = t7*t227
    1314             :          d2Qrhondrho = (f94*t535*t67*t73) - t445*t229 + (2._dp*t150* &
    1315             :                                                          t231*t73) - (t543*t186) + (2._dp*t457*t16*t71*t184 &
    1316             :                                                                                  *t227) - (2._dp*t552*t186) - (t157*t14*t158*t567) &
    1317             :                        - 0.2e1_dp/0.3e1_dp*t212*t188*t194 + 0.2e1_dp/0.3e1_dp*t465*t72 &
    1318             :                        *t574 - 0.4e1_dp/0.3e1_dp*t32*(t231)*t4*t194 - (2._dp*t213 &
    1319           0 :                                                                        *t199) + (2._dp*t157*t131*t228) - (4._dp*t232*t199)
    1320           0 :          t596 = 2._dp*a1*t4*t16 + 12._dp*a2*t1*t21*t29
    1321           0 :          t605 = t227**2
    1322             :          t624 = 12._dp*a3*t1*t21*t29 + 20._dp*a4*t206*t39*t47 + 30._dp* &
    1323           0 :                 a5*t18*t52*t63
    1324             :          d2Qndrhondrho = f94*t596*t67*t73 - 2._dp*t543*t229 + 4._dp*t212*t231* &
    1325             :                          t73 + 2._dp*t457*t14*t158*t605 - 4._dp*t552*t229 - t157*t14 &
    1326           0 :                          *t158*t624 + 2._dp*t32*t66*t4*t14*t158
    1327           0 :          t633 = t74**2
    1328           0 :          t640 = t253**2
    1329           0 :          t644 = t78*t508
    1330           0 :          t650 = t78*t515
    1331           0 :          t656 = t31*t154
    1332           0 :          t674 = t454*t458
    1333           0 :          t678 = t154*t504
    1334             :          t681 = 0.10e2_dp/0.9e1_dp*t644*t114*t66*t54*t56 + 0.8e1_dp/0.3e1_dp &
    1335             :                 *t650*t241 - 0.4e1_dp/0.3e1_dp*t238*t314*t240 + 0.4e1_dp/0.3e1_dp &
    1336             :                 *t305*t656*t467 + (6._dp*t79*t520*t80) - (4._dp*t79 &
    1337             :                                                           *t197*t247) + (4._dp*t311*t251) + (t79)*t70*t441 &
    1338             :                 *t66 - 0.2e1_dp*t113*t314*t250 + 0.2e1_dp*t113*t114*t674 - &
    1339           0 :                 t113*t114*t678
    1340           0 :          t714 = C*t300
    1341           0 :          t759 = 0.1e1_dp/t299/t83
    1342           0 :          t766 = d2exeirhorho(Q, dQrho, d2Qrhorho)
    1343           0 :          t773 = t656*t84
    1344           0 :          t777 = t80*t94
    1345           0 :          t806 = t454*t84
    1346           0 :          t811 = t78*t16
    1347           0 :          t812 = t94*t184
    1348           0 :          t820 = t66*t109
    1349             :          t828 = 0.8e1_dp/0.3e1_dp*t78*t516*t308 - 0.4e1_dp/0.3e1_dp*t305*t247 &
    1350             :                 *t307 + 0.4e1_dp/0.3e1_dp*t305*t773*t467 + 0.4e1_dp/0.3e1_dp* &
    1351             :                 t305*t777*t7*t253 + 0.10e2_dp/0.9e1_dp*t78*t509*t80*t84 &
    1352             :                 *t54*t56 + 0.6e1_dp*t78*t418*t116 - (4._dp*t311*t315) + &
    1353             :                 (4._dp*t311*t319) + (4._dp*t311*t323) + (t113*t15* &
    1354             :                                                          t441*t115) - (2._dp*t113*t314*t318) - (2._dp*t113*t314 &
    1355             :                                                                          *t322) + (2._dp*t113*t114*t806*t458) + 0.2e1_dp*t811*t656 &
    1356             :                 *t812*t253 - (t113*t114*t317*t504) + (2._dp*t113 &
    1357           0 :                                                       *t114*t820*t640) - (t113*t114*t321*t681)
    1358           0 :          t847 = t328*t12
    1359           0 :          t848 = t327*t847
    1360           0 :          t849 = t31**2
    1361           0 :          t851 = t330/t849
    1362           0 :          t852 = t65*t83
    1363             :          t865 = (2._dp*t77*t109*t640) - (t77*t94*t681) + f12* &
    1364             :                 (0.10e2_dp/0.9e1_dp*t644*t256*t135 + 0.8e1_dp/0.3e1_dp*t650*t257 &
    1365             :                  - 0.4e1_dp/0.3e1_dp*t238*t15*t266*t7 + (6._dp*t79*t520* &
    1366             :                                                          t88) - 0.4e1_dp*(t79)*t197*t266 + (t79*t70*(F2*t441 &
    1367             :                                                                          *t66 - 2._dp*t263*t250 + 2._dp*t86*t674 - t86*t678)))*t95 &
    1368             :                 - (4._dp*t270*t273) + (6._dp*t92*t714*t640) - (2._dp* &
    1369             :                                                                t92*t272*t681) + (0.10e2_dp/0.9e1_dp*t644*t276*t135 + 0.8e1_dp &
    1370             :                                                                  /0.3e1_dp*t650*t277 - 0.4e1_dp/0.3e1_dp*t238*t15*t293*t7 + (6._dp &
    1371             :                                                                                 *t79*t520*t103) - 0.4e1_dp*(t79)*t197*t293 + (t79) &
    1372             :                                                                               *(t70)*(0.10e2_dp/0.9e1_dp*t97*t410*t412 + 0.8e1_dp/ &
    1373             :                                                                    0.3e1_dp*t283*t415 + (6._dp*t98*t419) + 0.28e2_dp/0.9e1_dp*t100 &
    1374             :                                                                          *t428*t430 + 0.32e2_dp/0.3e1_dp*t288*t434 + (20._dp*t101* &
    1375             :                                                                                t438)))*E*(t109) - (6._dp*t297*t301) + (12._dp*t107 &
    1376             :                                                                           *t759*t640) - (3._dp*t107*t300*t681) + t111*(t766 + t828 &
    1377             :                                                                            *t326*t328*t335 + 0.2e1_dp/0.3e1_dp*t327*t3/t9*t12*t330 &
    1378             :                                                                                  *t332*t65*t83*r3*t6 + 0.2e1_dp*t329*rho*t330*t334 &
    1379             :                                                                             - t848*t851*t852*t149 + t329*t331*t332*t184*t83 + t329 &
    1380           0 :                                                                                                                     *t331*t333*t253)
    1381             :          e_rho_rho = e_rho_rho + (-0.4e1_dp/0.9e1_dp/t633*f89*t122 - 0.8e1_dp/0.3e1_dp*t235*t340 &
    1382           0 :                                   - t76*t865*Clda)*sx0
    1383           0 :          t871 = t109*t253*t352
    1384           0 :          t874 = t342*t190
    1385           0 :          t902 = t454*t184*t227
    1386           0 :          t906 = t154*t567
    1387             :          t909 = -0.4e1_dp/0.3e1_dp*t874*t241 - 0.2e1_dp/0.3e1_dp*t238*t392* &
    1388             :                 t240 + 0.2e1_dp/0.3e1_dp*t305*t656*t574 - (4._dp*t343*t244) &
    1389             :                 - (2._dp*t79*t197*t346) + (2._dp*t311*t350) + (2._dp* &
    1390             :                                                                t343*t248) + (t79*t70*t535*t66) - t113*t314*t349 - &
    1391             :                 (2._dp*t389*t251) - t113*t392*t250 + 0.2e1_dp*t113*t114 &
    1392           0 :                 *t902 - t113*t114*t906
    1393           0 :          t989 = d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    1394             :          t1019 = -0.4e1_dp/0.3e1_dp*t342*t191*t308 - 0.2e1_dp/0.3e1_dp*t305 &
    1395             :                  *t346*t307 + 0.2e1_dp/0.3e1_dp*t305*t773*t574 + 0.2e1_dp/0.3e1_dp &
    1396             :                  *t305*t777*t7*t352 - 0.4e1_dp*t342*t131*t116 - (2._dp* &
    1397             :                                                                  t311*t393) + (2._dp*t311*t396) + (2._dp*t311*t399) + (2._dp &
    1398           0 :                                                                                    *t389*t315) + t113*t15*t535*t115 - t113*t314*t395
    1399             :          t1051 = -t113*t314*t398 - 2._dp*t389*t319 - t113*t392*t318 &
    1400             :                  + 2._dp*t811*t31*t454*t84*t184*t227 + t811*t656*t812* &
    1401             :                  t352 - t113*t114*t317*t567 - 2._dp*t389*t323 - t113*t392 &
    1402             :                  *t322 + t811*t656*t254*t227 + 2._dp*t811*t80*t871 - t113 &
    1403           0 :                  *t114*t321*t909
    1404           0 :          t1056 = 0.1e1_dp/t206
    1405           0 :          t1062 = t851*t852*t211
    1406           0 :          t1066 = t331*t332*t227*t83
    1407           0 :          t1069 = t331*t333*t352
    1408             :          t1073 = (2._dp*t77*t871) - (t77*t94*t909) + f12*(-0.4e1_dp &
    1409             :                                                           /0.3e1_dp*t874*t257 - 0.2e1_dp/0.3e1_dp*t238*t15*t360*t7 &
    1410             :                                                           - (4._dp*t343*t260) - 0.2e1_dp*t79*t197*t360 + (2._dp*t343 &
    1411             :                                                                                   *t267) + t79*t70*(F2*t535*t66 - t263*t349 - t357 &
    1412             :                                                                        *t250 + 2._dp*t86*t902 - t86*t906))*t95 - (2._dp*t270*t366) &
    1413             :                  - (2._dp*t364*t273) + (6._dp*t92*C*t301*t352) - (2._dp &
    1414             :                                                                   *t92*t272*t909) + (-0.4e1_dp/0.3e1_dp*t874*t277 - 0.2e1_dp/ &
    1415             :                                                                          0.3e1_dp*t238*t15*t379*t7 - (4._dp*t343*t280) - 0.2e1_dp* &
    1416             :                                                                            t79*t197*t379 + (2._dp*t343*t294) + t79*t70*(-0.4e1_dp/ &
    1417             :                                                                   0.3e1_dp*t371*t124*t126 - (4._dp*t372*t132) - 0.16e2_dp/0.3e1_dp &
    1418             :                                                                             *t375*t139*t142 - (16._dp*t376*t146)))*E*t109 - (3._dp &
    1419             :                                                                                *t297*t385) - (3._dp*t383*t301) + (12._dp*t107*t759 &
    1420             :                                                                                 *t253*t352) - (3._dp*t107*t300*t909) + (t111*(t989 &
    1421             :                                                                           + (t1019 + t1051)*t326*t328*t335 - 2._dp*t325*t1056*t328 &
    1422           0 :                                                                                       *t335 - t848*t1062 + t329*t1066 + t329*t1069))
    1423           0 :          e_ndrho_rho = e_ndrho_rho + (-0.4e1_dp/0.3e1_dp*t235*t408 - t76*t1073*Clda)*sx0
    1424           0 :          t1076 = t352**2
    1425           0 :          t1080 = t69*t13
    1426           0 :          t1094 = t454*t605
    1427           0 :          t1098 = t154*t624
    1428             :          t1101 = 2._dp*t1080*t114*t66 + 4._dp*t343*t347 - 4._dp*t389*t350 &
    1429             :                  + t79*t70*t596*t66 - 2._dp*t113*t392*t349 + 2._dp*t113*t114 &
    1430           0 :                  *t1094 - t113*t114*t1098
    1431           0 :          t1154 = d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
    1432             :          t1191 = 2._dp*t1080*t116 + 4._dp*t389*t393 - 4._dp*t389*t396 - 4._dp* &
    1433             :                  t389*t399 + t113*t15*t596*t115 - 2._dp*t113*t392*t395 - &
    1434             :                  2._dp*t113*t392*t398 + 2._dp*t113*t114*t806*t605 + 2._dp*t811 &
    1435             :                  *t656*t94*t227*t352 - t113*t114*t317*t624 + 2._dp*t113 &
    1436           0 :                  *t114*t820*t1076 - t113*t114*t321*t1101
    1437             :          t1205 = 2._dp*t77*t109*t1076 - t77*t94*t1101 + f12*(2._dp*t69 &
    1438             :                                                              *t89 + 4._dp*t343*t361 + t79*t70*(F2*t596*t66 - 2._dp*t357 &
    1439             :                                                                        *t349 + 2._dp*t86*t1094 - t86*t1098))*t95 - 4._dp*t364*t366 &
    1440             :                  + 6._dp*t92*t714*t1076 - 2._dp*t92*t272*t1101 + (2._dp*t69*t104 &
    1441             :                                                                   + 4._dp*t343*t380 + t79*t70*(2._dp*g2*t4*t16 + 12._dp*g3*t1 &
    1442             :                                                                            *t21*t29))*E*t109 - 6._dp*t383*t385 + 12._dp*t107*t759* &
    1443             :                  t1076 - 3._dp*t107*t300*t1101 + t111*(t1154 + t1191*t326*t328 &
    1444             :                                                        *t335 - 2._dp*t401*t1056*t328*t335 - t402*t847*t1062 &
    1445           0 :                                                        + t403*t1066 + t403*t1069)
    1446           0 :          e_ndrho_ndrho = e_ndrho_ndrho + (-t76*t1205*Clda)*sx0
    1447             :       END IF
    1448             : 
    1449      235788 :    END SUBROUTINE xwpbe_lda_calc_01
    1450             : 
    1451             : ! **************************************************************************************************
    1452             : !> \brief Evaluates the screened hole averaged PBE exchange functional for lda.
    1453             : !> \param e_0 ...
    1454             : !> \param e_rho ...
    1455             : !> \param e_ndrho ...
    1456             : !> \param e_rho_rho ...
    1457             : !> \param e_ndrho_rho ...
    1458             : !> \param e_ndrho_ndrho ...
    1459             : !> \param rho , ndrho: density and norm of the density gradient
    1460             : !> \param ndrho ...
    1461             : !> \param omega scaling factor
    1462             : !> \param sscale scaling factor to enforce Lieb-Oxford bound
    1463             : !> \param sx scaling factor
    1464             : !> \param order degree of the derivative that should be evaluated,
    1465             : !>        if positive all the derivatives up to the given degree are evaluated,
    1466             : !>        if negative only the given degree is calculated
    1467             : !> \par History
    1468             : !>      05.2007 created [Manuel Guidon]
    1469             : !> \author Manuel Guidon
    1470             : !> \note
    1471             : !>      This routine evaluates the exact functional for omega!=0.
    1472             : ! **************************************************************************************************
    1473    16225604 :    SUBROUTINE xwpbe_lda_calc_1(e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
    1474             :                                e_ndrho_ndrho, rho, ndrho, omega, sscale, sx, order)
    1475             :       REAL(KIND=dp), INTENT(INOUT)                       :: e_0, e_rho, e_ndrho, e_rho_rho, &
    1476             :                                                             e_ndrho_rho, e_ndrho_ndrho
    1477             :       REAL(KIND=dp), INTENT(IN)                          :: rho, ndrho, omega, sscale, sx
    1478             :       INTEGER, INTENT(IN)                                :: order
    1479             : 
    1480             :       REAL(KIND=dp) :: d2Qndrhondrho, d2Qrhondrho, d2Qrhorho, dQndrho, dQrho, Q, t1, t10, t1001, &
    1481             :          t1009, t1011, t102, t1024, t1035, t104, t105, t1052, t1066, t1068, t1069, t1071, t1072, &
    1482             :          t1077, t1078, t1079, t108, t1081, t1082, t1085, t1086, t1087, t109, t1090, t1091, t1094, &
    1483             :          t1097, t1098, t11, t110, t1100, t111, t1113, t1115, t1119, t1123, t1126, t1127, t1129, &
    1484             :          t113, t1132, t1134, t1135, t1136, t1139, t115, t116, t1168, t1169, t117, t1171, t1173, &
    1485             :          t1176, t1178, t118, t1181, t1185, t119, t12, t120, t1208, t1209, t121, t1214, t1220, &
    1486             :          t123, t1236, t1237, t124, t1240, t1242, t1243, t125, t1257, t1258
    1487             :       REAL(KIND=dp) :: t126, t1264, t1265, t127, t128, t1281, t1282, t1285, t1287, t129, t1294, &
    1488             :          t1297, t13, t1301, t1304, t1305, t1306, t1309, t131, t1310, t1317, t1318, t132, t1324, &
    1489             :          t1325, t1326, t133, t1355, t136, t1379, t1381, t1382, t1392, t14, t140, t1402, t1409, &
    1490             :          t141, t142, t1433, t1437, t144, t1442, t1445, t145, t1456, t1457, t147, t1473, t1478, &
    1491             :          t1479, t148, t149, t1491, t1492, t1498, t15, t150, t1501, t151, t152, t1520, t1524, t153, &
    1492             :          t1531, t1535, t154, t1543, t1546, t1547, t1548, t155, t1551, t1555, t1559, t156, t1562, &
    1493             :          t1563, t1564, t1568, t157, t1572, t1573, t1579, t158, t1580, t159
    1494             :       REAL(KIND=dp) :: t1592, t1599, t16, t1602, t1609, t1615, t162, t1624, t1625, t163, t1633, &
    1495             :          t1649, t1658, t166, t1663, t167, t1677, t168, t1680, t1681, t1682, t1686, t169, t1693, &
    1496             :          t1697, t17, t170, t1709, t1710, t1714, t1722, t1723, t1726, t1729, t1731, t174, t1740, &
    1497             :          t176, t1767, t1768, t177, t1770, t1781, t1786, t1791, t18, t180, t1802, t1804, t1805, &
    1498             :          t181, t1816, t1827, t1835, t1839, t1846, t185, t1853, t1854, t186, t1860, t1868, t1880, &
    1499             :          t1881, t1885, t189, t1898, t19, t190, t1906, t1907, t192, t1923, t193, t1932, t1938, &
    1500             :          t194, t195, t1951, t1956, t1961, t1967, t197, t1977, t198, t1983, t1984
    1501             :       REAL(KIND=dp) :: t1988, t199, t1995, t2, t200, t202, t2028, t205, t2059, t2072, t2073, t209, &
    1502             :          t2099, t21, t210, t2108, t213, t214, t2142, t2144, t2150, t2173, t2184, t219, t2197, t22, &
    1503             :          t221, t222, t2224, t223, t224, t2240, t2245, t2254, t2258, t2267, t2269, t227, t2271, &
    1504             :          t2274, t228, t2280, t2282, t2285, t2291, t2297, t23, t2305, t2311, t2316, t2323, t2329, &
    1505             :          t233, t2348, t2363, t237, t2371, t2379, t239, t24, t2401, t2405, t241, t2410, t243, &
    1506             :          t2437, t2442, t2449, t2452, t2455, t2457, t246, t247, t2473, t2484, t2499, t25, t250, &
    1507             :          t251, t2512, t252, t2529, t253, t2543, t255, t256, t257, t2573, t258
    1508             :       REAL(KIND=dp) :: t263, t264, t265, t267, t2688, t27, t270, t2707, t271, t2715, t273, t275, &
    1509             :          t276, t2764, t2774, t28, t280, t2808, t2810, t2838, t284, t2841, t2844, t2846, t285, &
    1510             :          t286, t2875, t288, t2880, t2884, t289, t29, t290, t2927, t293, t294, t295, t2963, t2971, &
    1511             :          t2975, t2979, t298, t2994, t3, t3001, t303, t3033, t305, t307, t31, t310, t311, t312, &
    1512             :          t313, t3139, t315, t316, t3167, t318, t319, t32, t321, t326, t329, t330, t332, t333, &
    1513             :          t335, t336, t338, t339, t34, t340, t342, t343, t345, t346, t347, t348, t349, t35, t351, &
    1514             :          t352, t353, t354, t357, t358, t36, t361, t362, t363, t364, t368, t371
    1515             :       REAL(KIND=dp) :: t372, t373, t374, t375, t376, t377, t378, t38, t383, t384, t385, t386, t39, &
    1516             :          t390, t392, t398, t4, t401, t402, t403, t404, t406, t409, t41, t411, t412, t415, t416, &
    1517             :          t419, t42, t420, t421, t424, t425, t426, t428, t429, t432, t433, t437, t44, t440, t441, &
    1518             :          t442, t444, t446, t449, t452, t453, t454, t457, t46, t461, t463, t465, t468, t469, t472, &
    1519             :          t475, t478, t479, t48, t481, t486, t49, t493, t495, t498, t499, t5, t502, t503, t504, &
    1520             :          t507, t508, t509, t510, t511, t513, t514, t515, t517, t518, t522, t525, t529, t530, t531, &
    1521             :          t532, t533, t534, t535, t537, t538, t539, t54, t540, t542, t55
    1522             :       REAL(KIND=dp) :: t550, t551, t552, t553, t554, t556, t557, t558, t56, t562, t563, t567, &
    1523             :          t569, t571, t572, t575, t576, t577, t578, t58, t581, t582, t583, t587, t588, t589, t592, &
    1524             :          t596, t597, t6, t60, t602, t603, t608, t61, t613, t617, t620, t621, t624, t626, t629, &
    1525             :          t63, t631, t634, t638, t639, t644, t645, t65, t653, t655, t656, t657, t658, t659, t663, &
    1526             :          t666, t669, t67, t673, t679, t68, t681, t685, t689, t69, t690, t691, t697, t698, t7, t70, &
    1527             :          t701, t71, t711, t713, t717, t718, t72, t721, t728, t73, t735, t736, t739, t74, t740, &
    1528             :          t746, t747, t748, t75, t752, t753, t754, t755, t759, t761, t763, t765
    1529             :       REAL(KIND=dp) :: t769, t77, t771, t772, t779, t78, t780, t781, t783, t784, t787, t791, t792, &
    1530             :          t799, t8, t80, t800, t801, t803, t804, t808, t81, t810, t812, t815, t816, t817, t82, &
    1531             :          t820, t823, t826, t83, t832, t834, t836, t84, t842, t845, t846, t848, t849, t85, t851, &
    1532             :          t865, t867, t87, t870, t871, t873, t874, t876, t877, t88, t880, t884, t885, t888, t889, &
    1533             :          t891, t892, t893, t897, t898, t9, t90, t902, t904, t907, t908, t909, t91, t910, t916, &
    1534             :          t918, t919, t92, t93, t930, t932, t933, t937, t94, t942, t945, t95, t951, t954, t958, &
    1535             :          t96, t962, t965, t968, t97, t971, t972, t979, t982, t988, t99
    1536             : 
    1537    16225604 :       IF (order >= 0) THEN
    1538    16225604 :          t1 = ndrho**2
    1539    16225604 :          t2 = r2**2
    1540    16225604 :          t3 = 0.1e1_dp/t2
    1541    16225604 :          t4 = t1*t3
    1542    16225604 :          t5 = pi**2
    1543    16225604 :          t6 = r3*t5
    1544    16225604 :          t7 = t6*rho
    1545    16225604 :          t8 = t7**(0.1e1_dp/0.3e1_dp)
    1546    16225604 :          t9 = t8**2
    1547    16225604 :          t10 = 0.1e1_dp/t9
    1548    16225604 :          t11 = t4*t10
    1549    16225604 :          t12 = rho**2
    1550    16225604 :          t13 = 0.1e1_dp/t12
    1551    16225604 :          t14 = sscale**2
    1552    16225604 :          t15 = t13*t14
    1553    16225604 :          t16 = a1*t1
    1554    16225604 :          t17 = t16*t3
    1555    16225604 :          t18 = t10*t13
    1556    16225604 :          t19 = t18*t14
    1557    16225604 :          t21 = t1**2
    1558    16225604 :          t22 = a2*t21
    1559    16225604 :          t23 = t2**2
    1560    16225604 :          t24 = 0.1e1_dp/t23
    1561    16225604 :          t25 = t22*t24
    1562    16225604 :          t27 = 0.1e1_dp/t8/t7
    1563    16225604 :          t28 = t12**2
    1564    16225604 :          t29 = 0.1e1_dp/t28
    1565    16225604 :          t31 = t14**2
    1566    16225604 :          t32 = t27*t29*t31
    1567    16225604 :          t34 = t17*t19 + t25*t32
    1568    16225604 :          t35 = a3*t21
    1569    16225604 :          t36 = t35*t24
    1570    16225604 :          t38 = t21*ndrho
    1571    16225604 :          t39 = a4*t38
    1572    16225604 :          t41 = 0.1e1_dp/t23/r2
    1573    16225604 :          t42 = t39*t41
    1574    16225604 :          t44 = 0.1e1_dp/t9/t7
    1575    16225604 :          t46 = 0.1e1_dp/t28/rho
    1576    16225604 :          t48 = t31*sscale
    1577    16225604 :          t49 = t44*t46*t48
    1578    16225604 :          t54 = 0.1e1_dp/t23/t2
    1579    16225604 :          t55 = a5*t21*t1*t54
    1580    16225604 :          t56 = r3**2
    1581    16225604 :          t58 = t5**2
    1582    16225604 :          t60 = 0.1e1_dp/t56/t58
    1583    16225604 :          t61 = t28**2
    1584    16225604 :          t63 = t31*t14
    1585    16225604 :          t65 = t60/t61*t63
    1586    16225604 :          t67 = r1 + t36*t32 + t42*t49 + t55*t65
    1587    16225604 :          t68 = 0.1e1_dp/t67
    1588    16225604 :          t69 = t34*t68
    1589    16225604 :          t70 = t15*t69
    1590    16225604 :          t71 = t11*t70
    1591    16225604 :          t72 = omega**2
    1592    16225604 :          t73 = beta*t72
    1593    16225604 :          t74 = t73*t10
    1594    16225604 :          t75 = t71 + t74
    1595    16225604 :          t77 = 0.1e1_dp/A
    1596    16225604 :          Q = f94*t75*t77
    1597    16225604 :          t78 = rho**(0.1e1_dp/0.3e1_dp)
    1598    16225604 :          t80 = t78*rho*f89
    1599    16225604 :          t81 = B*f12
    1600    16225604 :          t82 = t71 + DD
    1601    16225604 :          t83 = 0.1e1_dp/t82
    1602    16225604 :          t84 = t81*t83
    1603    16225604 :          t85 = F2*t34
    1604    16225604 :          t87 = F1 + t85*t68
    1605    16225604 :          t88 = t15*t87
    1606    16225604 :          t90 = t11*t88 + r1
    1607    16225604 :          t91 = f12*t90
    1608    16225604 :          t92 = t82**2
    1609    16225604 :          t93 = 0.1e1_dp/t92
    1610    16225604 :          t94 = C*t93
    1611    16225604 :          t95 = t91*t94
    1612    16225604 :          t96 = f34*pi
    1613    16225604 :          t97 = rootpi
    1614    16225604 :          t99 = r6*C
    1615    16225604 :          t102 = r4*B
    1616    16225604 :          t104 = r8*A
    1617    16225604 :          t105 = t92*t82
    1618    16225604 :          t108 = t97*(r15*E + t99*t90*t82 + t102*t92 + t104*t105)
    1619    16225604 :          t109 = 0.1e1_dp/r16
    1620    16225604 :          t110 = SQRT(t82)
    1621    16225604 :          t111 = t110*t105
    1622    16225604 :          t113 = t109/t111
    1623    16225604 :          t115 = SQRT(A)
    1624    16225604 :          t116 = f94*t34
    1625    16225604 :          t117 = t68*t1
    1626    16225604 :          t118 = t116*t117
    1627    16225604 :          t119 = t3*t10
    1628    16225604 :          t120 = t15*t77
    1629    16225604 :          t121 = t119*t120
    1630    16225604 :          t123 = EXP(t118*t121)
    1631    16225604 :          t124 = t115*t123
    1632    16225604 :          t125 = f32*ndrho
    1633    16225604 :          t126 = 0.1e1_dp/r2
    1634    16225604 :          t127 = t125*t126
    1635    16225604 :          t128 = 0.1e1_dp/t8
    1636    16225604 :          t129 = 0.1e1_dp/rho
    1637    16225604 :          t131 = t69*t77
    1638    16225604 :          t132 = SQRT(t131)
    1639    16225604 :          t133 = sscale*t132
    1640    16225604 :          t136 = erfc(t127*t128*t129*t133)
    1641    16225604 :          t140 = 0.1e1_dp/f1516
    1642    16225604 :          t141 = (t96 + t108*t113 - t96*t124*t136)*t140
    1643    16225604 :          t142 = 0.1e1_dp/t97
    1644    16225604 :          t144 = 0.1e1_dp/E
    1645    16225604 :          t145 = t142*t111*t144
    1646    16225604 :          t147 = -t141*t145 + r1
    1647    16225604 :          t148 = t147*E
    1648    16225604 :          t149 = 0.1e1_dp/t105
    1649    16225604 :          t150 = t148*t149
    1650    16225604 :          t151 = f158*E
    1651    16225604 :          t152 = t147*t83
    1652    16225604 :          t153 = t72*t10
    1653    16225604 :          t154 = t71 + DD + t153
    1654    16225604 :          t155 = t154**2
    1655    16225604 :          t156 = t155**2
    1656    16225604 :          t157 = t156*t154
    1657    16225604 :          t158 = SQRT(t157)
    1658    16225604 :          t159 = 0.1e1_dp/t158
    1659    16225604 :          t162 = SQRT(t154)
    1660    16225604 :          t163 = 0.1e1_dp/t162
    1661    16225604 :          t166 = f68*C
    1662    16225604 :          t167 = t90*t83
    1663    16225604 :          t168 = t155*t154
    1664    16225604 :          t169 = SQRT(t168)
    1665    16225604 :          t170 = 0.1e1_dp/t169
    1666             :          t174 = (-t151*t152*t159 - t81*t83*t163 - t166*t167*t170) &
    1667    16225604 :                 *omega
    1668    16225604 :          t176 = f52*E
    1669    16225604 :          t177 = t147*t93
    1670    16225604 :          t180 = f12*C
    1671    16225604 :          t181 = t90*t93
    1672    16225604 :          t185 = t72*omega
    1673    16225604 :          t186 = (-t176*t177*t159 - t180*t181*t170)*t185
    1674    16225604 :          t189 = 0.1e1_dp/r3/t5
    1675    16225604 :          t190 = t189*t129
    1676    16225604 :          t192 = t72**2
    1677    16225604 :          t193 = t192*omega
    1678    16225604 :          t194 = t159*t193
    1679    16225604 :          t195 = t194*t44
    1680    16225604 :          t197 = f12*A
    1681    16225604 :          t198 = exei(Q)
    1682    16225604 :          t199 = t71 + DD + t74
    1683    16225604 :          t200 = 0.1e1_dp/t199
    1684    16225604 :          t202 = LOG(t75*t200)
    1685    16225604 :          t205 = SQRT(t199)
    1686    16225604 :          t209 = t115*f34
    1687    16225604 :          t210 = exer(Q)
    1688    16225604 :          t213 = (t197*t97/t205 - t209*t210)*alpha1
    1689    16225604 :          t214 = omega*t128
    1690    16225604 :          t219 = (t197*t200 - f98*t198)*alpha2
    1691    16225604 :          t221 = A*f14
    1692    16225604 :          t222 = t199**2
    1693    16225604 :          t223 = t222*t199
    1694    16225604 :          t224 = SQRT(t223)
    1695    16225604 :          t227 = SQRT(t75)
    1696    16225604 :          t228 = 0.1e1_dp/t227
    1697    16225604 :          t233 = 0.1e1_dp/t115
    1698             :          t237 = (t97*(t221/t224 - f98*t228) + f2716*t210*t233)*alpha3 &
    1699    16225604 :                 *t185
    1700    16225604 :          t239 = 0.1e1_dp/t75
    1701    16225604 :          t241 = 0.1e1_dp/t222
    1702    16225604 :          t243 = f8132*t77
    1703    16225604 :          t246 = (-f98*t239 + t197*t241 + t243*t198)*alpha4
    1704    16225604 :          t247 = t192*t27
    1705    16225604 :          t250 = t75**2
    1706    16225604 :          t251 = t250*t75
    1707    16225604 :          t252 = SQRT(t251)
    1708    16225604 :          t253 = 0.1e1_dp/t252
    1709    16225604 :          t255 = f38*A
    1710    16225604 :          t256 = t222**2
    1711    16225604 :          t257 = t256*t199
    1712    16225604 :          t258 = SQRT(t257)
    1713    16225604 :          t263 = A**2
    1714    16225604 :          t264 = t263*A
    1715    16225604 :          t265 = SQRT(t264)
    1716    16225604 :          t267 = f24364/t265
    1717             :          t270 = (t97*(t243*t228 - f916*t253 + t255/t258) - t267*t210) &
    1718    16225604 :                 *alpha5
    1719    16225604 :          t271 = t193*t44
    1720    16225604 :          t273 = 0.1e1_dp/t223
    1721    16225604 :          t275 = 0.1e1_dp/t250
    1722    16225604 :          t276 = f98*t275
    1723    16225604 :          t280 = f729128/t263
    1724    16225604 :          t284 = t192*t72
    1725             :          t285 = (A*t273 - t276 + t243*r1*t239 - t280*t198)*alpha6 &
    1726    16225604 :                 *t284
    1727    16225604 :          t286 = t60*t13
    1728    16225604 :          t288 = f1516*A
    1729    16225604 :          t289 = t256*t223
    1730    16225604 :          t290 = SQRT(t289)
    1731    16225604 :          t293 = t250**2
    1732    16225604 :          t294 = t293*t75
    1733    16225604 :          t295 = SQRT(t294)
    1734    16225604 :          t298 = f8164*t77
    1735    16225604 :          t303 = t263**2
    1736    16225604 :          t305 = SQRT(t303*A)
    1737    16225604 :          t307 = f2187256/t305
    1738             :          t310 = (t97*(t288/t290 - f2732/t295 + t298*t253 - t280*t228) &
    1739    16225604 :                  + t307*t210)*alpha7
    1740    16225604 :          t311 = t192*t185
    1741    16225604 :          t312 = t56*t58
    1742    16225604 :          t313 = t312*t12
    1743    16225604 :          t315 = 0.1e1_dp/t8/t313
    1744    16225604 :          t316 = t311*t315
    1745    16225604 :          t318 = r3*A
    1746    16225604 :          t319 = 0.1e1_dp/t256
    1747    16225604 :          t321 = 0.1e1_dp/t251
    1748    16225604 :          t326 = f6561512/t264
    1749             :          t329 = (t318*t319 - f94*t321 + t243*t275 - t280*t239 + t326 &
    1750    16225604 :                  *t198)*alpha8
    1751    16225604 :          t330 = t192**2
    1752    16225604 :          t332 = 0.1e1_dp/t9/t313
    1753    16225604 :          t333 = t330*t332
    1754             :          t335 = t84 + t95 + t150 + t174*t128 + t186*t190 - t150*t195 + &
    1755             :                 t197*(t198 + t202) + t213*t214 + t219*t153 + t237*t190 + &
    1756    16225604 :                 t246*t247 + t270*t271 + t285*t286 + t310*t316 + t329*t333
    1757    16225604 :          t336 = t335*Clda
    1758    16225604 :          e_0 = e_0 + (-t80*t336)*sx
    1759             :       END IF
    1760    16225604 :       IF (order >= 1 .OR. order == -1) THEN
    1761    10963461 :          t338 = t44*t13
    1762    10963461 :          t339 = t4*t338
    1763    10963461 :          t340 = t14*t34
    1764    10963461 :          t342 = t68*r3*t5
    1765    10963461 :          t343 = t340*t342
    1766    10963461 :          t345 = 0.2e1_dp/0.3e1_dp*t339*t343
    1767    10963461 :          t346 = t12*rho
    1768    10963461 :          t347 = 0.1e1_dp/t346
    1769    10963461 :          t348 = t347*t14
    1770    10963461 :          t349 = t348*t69
    1771    10963461 :          t351 = 2._dp*t11*t349
    1772    10963461 :          t352 = t3*t44
    1773    10963461 :          t353 = t16*t352
    1774    10963461 :          t354 = t15*t6
    1775    10963461 :          t357 = t10*t347
    1776    10963461 :          t358 = t357*t14
    1777    10963461 :          t361 = t24*t315
    1778    10963461 :          t362 = t22*t361
    1779    10963461 :          t363 = t29*t31
    1780    10963461 :          t364 = t363*t6
    1781    10963461 :          t368 = t27*t46*t31
    1782             :          t371 = -0.2e1_dp/0.3e1_dp*t353*t354 - (2._dp*t17*t358) - 0.4e1_dp &
    1783    10963461 :                 /0.3e1_dp*t362*t364 - (4._dp*t25*t368)
    1784    10963461 :          t372 = t371*t68
    1785    10963461 :          t373 = t15*t372
    1786    10963461 :          t374 = t11*t373
    1787    10963461 :          t375 = t4*t18
    1788    10963461 :          t376 = t67**2
    1789    10963461 :          t377 = 0.1e1_dp/t376
    1790    10963461 :          t378 = t35*t361
    1791    10963461 :          t383 = t41*t332
    1792    10963461 :          t384 = t39*t383
    1793    10963461 :          t385 = t46*t48
    1794    10963461 :          t386 = t385*t6
    1795    10963461 :          t390 = 0.1e1_dp/t28/t12
    1796    10963461 :          t392 = t44*t390*t48
    1797    10963461 :          t398 = t60/t61/rho*t63
    1798             :          t401 = -0.4e1_dp/0.3e1_dp*t378*t364 - (4._dp*t36*t368) - 0.5e1_dp &
    1799    10963461 :                 /0.3e1_dp*t384*t386 - (5._dp*t42*t392) - (8._dp*t55*t398)
    1800    10963461 :          t402 = t377*t401
    1801    10963461 :          t403 = t340*t402
    1802    10963461 :          t404 = t375*t403
    1803    10963461 :          t406 = t44*r3*t5
    1804    10963461 :          t409 = -t345 - t351 + t374 - t404 - 0.2e1_dp/0.3e1_dp*t73*t406
    1805    10963461 :          dQrho = f94*t409*t77
    1806    10963461 :          t411 = ndrho*t3
    1807    10963461 :          t412 = t411*t10
    1808    10963461 :          t415 = a1*ndrho
    1809    10963461 :          t416 = t415*t3
    1810    10963461 :          t419 = t1*ndrho
    1811    10963461 :          t420 = a2*t419
    1812    10963461 :          t421 = t420*t24
    1813    10963461 :          t424 = 2._dp*t416*t19 + 4._dp*t421*t32
    1814    10963461 :          t425 = t424*t68
    1815    10963461 :          t426 = t15*t425
    1816    10963461 :          t428 = a3*t419
    1817    10963461 :          t429 = t428*t24
    1818    10963461 :          t432 = a4*t21
    1819    10963461 :          t433 = t432*t41
    1820    10963461 :          t437 = a5*t38*t54
    1821    10963461 :          t440 = 4._dp*t429*t32 + 5._dp*t433*t49 + 6._dp*t437*t65
    1822    10963461 :          t441 = t377*t440
    1823    10963461 :          t442 = t340*t441
    1824    10963461 :          t444 = 2._dp*t412*t70 + t11*t426 - t375*t442
    1825    10963461 :          dQndrho = f94*t444*t77
    1826    10963461 :          t446 = t78*f89
    1827    10963461 :          t449 = t60*t347
    1828    10963461 :          t452 = C*t149
    1829    10963461 :          t453 = -t345 - t351 + t374 - t404
    1830    10963461 :          t454 = t452*t453
    1831    10963461 :          t457 = t329*t330
    1832    10963461 :          t461 = t56*r3*t58*t5*t346
    1833    10963461 :          t463 = 0.1e1_dp/t9/t461
    1834    10963461 :          t465 = t463*r3*t5
    1835    10963461 :          t468 = t14*t87
    1836    10963461 :          t469 = t468*t6
    1837    10963461 :          t472 = t348*t87
    1838    10963461 :          t475 = F2*t371
    1839    10963461 :          t478 = t475*t68 - t85*t402
    1840    10963461 :          t479 = t15*t478
    1841             :          t481 = -0.2e1_dp/0.3e1_dp*t339*t469 - (2._dp*t11*t472) + (t11 &
    1842    10963461 :                                                                    *t479)
    1843    10963461 :          t486 = t82*t453
    1844             :          t493 = t97*(t99*t481*t82 + t99*t90*t453 + 2._dp*t102*t486 &
    1845    10963461 :                      + 3._dp*t104*t92*t453)
    1846    10963461 :          t495 = t92**2
    1847    10963461 :          t498 = t109/t110/t495
    1848    10963461 :          t499 = t498*t453
    1849    10963461 :          t502 = t96*t115
    1850    10963461 :          t503 = f94*t371
    1851    10963461 :          t504 = t503*t117
    1852    10963461 :          t507 = t377*t1*t3
    1853    10963461 :          t508 = t116*t507
    1854    10963461 :          t509 = t14*t77
    1855    10963461 :          t510 = t509*t401
    1856    10963461 :          t511 = t18*t510
    1857    10963461 :          t513 = t117*t3
    1858    10963461 :          t514 = t116*t513
    1859    10963461 :          t515 = t338*t14
    1860    10963461 :          t517 = t77*r3*t5
    1861    10963461 :          t518 = t515*t517
    1862    10963461 :          t522 = t119*t348*t77
    1863             :          t525 = t504*t121 - t508*t511 - 0.2e1_dp/0.3e1_dp*t514*t518 - (2._dp &
    1864    10963461 :                                                                        *t118*t522)
    1865    10963461 :          t529 = rootpi
    1866    10963461 :          t530 = 0.1e1_dp/t529
    1867    10963461 :          t531 = t123*t530
    1868    10963461 :          t532 = f32**2
    1869    10963461 :          t533 = t532*t1
    1870    10963461 :          t534 = t533*t119
    1871    10963461 :          t535 = t15*t131
    1872    10963461 :          t537 = EXP(-t534*t535)
    1873    10963461 :          t538 = t126*t27
    1874    10963461 :          t539 = t125*t538
    1875    10963461 :          t540 = t129*sscale
    1876    10963461 :          t542 = t132*r3*t5
    1877    10963461 :          t550 = t125*t126*t128
    1878    10963461 :          t551 = 0.1e1_dp/t132
    1879    10963461 :          t552 = t372*t77
    1880    10963461 :          t553 = t34*t377
    1881    10963461 :          t554 = t77*t401
    1882    10963461 :          t556 = t552 - t553*t554
    1883    10963461 :          t557 = t551*t556
    1884    10963461 :          t558 = t540*t557
    1885             :          t562 = t537*(-t539*t540*t542/0.3e1_dp - t127*t128*t13*t133 &
    1886    10963461 :                       + t550*t558/0.2e1_dp)
    1887    10963461 :          t563 = t531*t562
    1888             :          t567 = (t493*t113 - 0.7e1_dp/0.2e1_dp*t108*t499 - (t502*t525 &
    1889    10963461 :                                                             *t123*t136) + (2._dp*t502*t563))*t140
    1890    10963461 :          t569 = t141*t142
    1891    10963461 :          t571 = t110*t92*t144
    1892    10963461 :          t572 = t571*t453
    1893    10963461 :          t575 = -t567*t145 - 0.7e1_dp/0.2e1_dp*t569*t572
    1894    10963461 :          t576 = t575*E
    1895    10963461 :          t577 = t576*t149
    1896    10963461 :          t578 = t189*t13
    1897    10963461 :          t581 = 0.1e1_dp/t158/t157
    1898    10963461 :          t582 = t149*t581
    1899    10963461 :          t583 = t148*t582
    1900    10963461 :          t587 = -t345 - t351 + t374 - t404 - 0.2e1_dp/0.3e1_dp*t72*t44*t6
    1901    10963461 :          t588 = t156*t587
    1902    10963461 :          t589 = t271*t588
    1903    10963461 :          t592 = t219*t72
    1904    10963461 :          t596 = 0.1e1_dp/t224/t223
    1905    10963461 :          t597 = t596*t222
    1906    10963461 :          t602 = 0.1e1_dp/t227/t75
    1907    10963461 :          t603 = f98*t602
    1908    10963461 :          t608 = dexerrho(Q, dQrho)
    1909             :          t613 = (t97*(-0.3e1_dp/0.2e1_dp*t221*t597*t409 + t603*t409/ &
    1910    10963461 :                       0.2e1_dp) + f2716*t608*t233)*alpha3*t185
    1911    10963461 :          t617 = f12*t481
    1912    10963461 :          t620 = 0.1e1_dp/t495
    1913    10963461 :          t621 = t620*t453
    1914    10963461 :          t624 = t213*omega
    1915    10963461 :          t626 = t27*r3*t5
    1916    10963461 :          t629 = t246*t192
    1917    10963461 :          t631 = t315*r3*t5
    1918    10963461 :          t634 = t602*t409
    1919    10963461 :          t638 = 0.1e1_dp/t252/t251
    1920    10963461 :          t639 = f916*t638
    1921    10963461 :          t644 = 0.1e1_dp/t258/t257
    1922    10963461 :          t645 = t644*t256
    1923             :          t653 = (t97*(-t243*t634/0.2e1_dp + 0.3e1_dp/0.2e1_dp*t639*t250* &
    1924    10963461 :                       t409 - 0.5e1_dp/0.2e1_dp*t255*t645*t409) - t267*t608)*alpha5
    1925             :          t655 = -(2._dp*t285*t449) - (2._dp*t91*t454) - 0.8e1_dp/0.3e1_dp &
    1926             :                 *t457*t465 + t577 - t186*t578 + 0.5e1_dp/0.2e1_dp*t583*t589 &
    1927             :                 - 0.2e1_dp/0.3e1_dp*t592*t406 + t613*t190 - t81*t93*t453 + &
    1928             :                 t617*t94 - t237*t578 - (3._dp*t148*t621) - t624*t626/0.3e1_dp &
    1929    10963461 :                 - 0.4e1_dp/0.3e1_dp*t629*t631 + t653*t271
    1930    10963461 :          t656 = t149*t159
    1931    10963461 :          t657 = t148*t656
    1932    10963461 :          t658 = t193*t332
    1933    10963461 :          t659 = t658*t6
    1934    10963461 :          t663 = t273*t409
    1935    10963461 :          t666 = dexeirho(Q, dQrho)
    1936    10963461 :          t669 = (t276*t409 - 2._dp*t197*t663 + t243*t666)*alpha4
    1937    10963461 :          t673 = t97/t205/t199
    1938    10963461 :          t679 = (-t197*t673*t409/0.2e1_dp - t209*t608)*alpha1
    1939    10963461 :          t681 = t241*t409
    1940    10963461 :          t685 = (-t197*t681 - f98*t666)*alpha2
    1941    10963461 :          t689 = 0.1e1_dp/t290/t289
    1942    10963461 :          t690 = t256*t222
    1943    10963461 :          t691 = t689*t690
    1944    10963461 :          t697 = f2732/t295/t294
    1945    10963461 :          t698 = t293*t409
    1946    10963461 :          t701 = t638*t250
    1947             :          t711 = (t97*(-0.7e1_dp/0.2e1_dp*t288*t691*t409 + 0.5e1_dp/0.2e1_dp &
    1948             :                       *t697*t698 - 0.3e1_dp/0.2e1_dp*t298*t701*t409 + t280*t634/ &
    1949    10963461 :                       0.2e1_dp) + t307*t608)*alpha7
    1950    10963461 :          t713 = 0.1e1_dp/t257
    1951    10963461 :          t717 = 0.1e1_dp/t293
    1952    10963461 :          t718 = f94*t717
    1953    10963461 :          t721 = t321*t409
    1954             :          t728 = (-4._dp*t318*t713*t409 + 3._dp*t718*t409 - 2._dp*t243*t721 &
    1955    10963461 :                  + t280*t275*t409 + t326*t666)*alpha8
    1956    10963461 :          t735 = t176*t147
    1957    10963461 :          t736 = t656*t453
    1958    10963461 :          t739 = t93*t581
    1959    10963461 :          t740 = t739*t588
    1960    10963461 :          t746 = t180*t90
    1961    10963461 :          t747 = t149*t170
    1962    10963461 :          t748 = t747*t453
    1963    10963461 :          t752 = 0.1e1_dp/t169/t168
    1964    10963461 :          t753 = t93*t752
    1965    10963461 :          t754 = t155*t587
    1966    10963461 :          t755 = t753*t754
    1967             :          t759 = (-t176*t575*t93*t159 + (2._dp*t735*t736) + 0.5e1_dp/ &
    1968             :                  0.2e1_dp*(t735)*(t740) - t180*t481*t93*t170 + (2._dp &
    1969    10963461 :                                                                 *t746*t748) + 0.3e1_dp/0.2e1_dp*(t746)*(t755))*t185
    1970    10963461 :          t761 = t310*t311
    1971    10963461 :          t763 = 0.1e1_dp/t8/t461
    1972    10963461 :          t765 = t763*r3*t5
    1973    10963461 :          t769 = t75*t241
    1974    10963461 :          t771 = t409*t200 - t769*t409
    1975    10963461 :          t772 = t771*t239
    1976    10963461 :          t779 = t151*t147
    1977    10963461 :          t780 = t93*t159
    1978    10963461 :          t781 = t780*t453
    1979    10963461 :          t783 = t83*t581
    1980    10963461 :          t784 = t783*t588
    1981    10963461 :          t787 = t93*t163
    1982    10963461 :          t791 = 0.1e1_dp/t162/t154
    1983    10963461 :          t792 = t83*t791
    1984    10963461 :          t799 = t166*t90
    1985    10963461 :          t800 = t93*t170
    1986    10963461 :          t801 = t800*t453
    1987    10963461 :          t803 = t83*t752
    1988    10963461 :          t804 = t803*t754
    1989             :          t808 = (-t151*t575*t83*t159 + t779*t781 + 0.5e1_dp/0.2e1_dp*t779 &
    1990             :                  *t784 + t81*t787*t453 + t81*t792*t587/0.2e1_dp - t166 &
    1991             :                  *t481*t83*t170 + t799*t801 + 0.3e1_dp/0.2e1_dp*t799*t804)* &
    1992    10963461 :                 omega
    1993    10963461 :          t810 = t148*t620
    1994    10963461 :          t812 = t194*t44*t453
    1995    10963461 :          t815 = t270*t193
    1996    10963461 :          t816 = t332*r3
    1997    10963461 :          t817 = t816*t5
    1998    10963461 :          t820 = A*t319
    1999    10963461 :          t823 = f98*t321
    2000    10963461 :          t826 = r1*t275
    2001             :          t832 = (-3._dp*t820*t409 + 2._dp*t823*t409 - t243*t826*t409 - t280 &
    2002    10963461 :                  *t666)*alpha6*t284
    2003             :          t834 = 0.5e1_dp/0.3e1_dp*t657*t659 + t669*t247 + t679*t214 + t685 &
    2004             :                 *t153 - t577*t195 + t711*t316 + t728*t333 - t174*t626 &
    2005             :                 /0.3e1_dp + t759*t190 - 0.7e1_dp/0.3e1_dp*t761*t765 + t197*(t666 &
    2006             :                                                                   + t772*t199) + t808*t128 + (3._dp*t810*t812) - 0.5e1_dp/0.3e1_dp &
    2007    10963461 :                 *t815*t817 + t832*t286
    2008    10963461 :          t836 = (t655 + t834)*Clda
    2009    10963461 :          e_rho = e_rho + (-0.4e1_dp/0.3e1_dp*t446*t336 - t80*t836)*sx
    2010    10963461 :          t842 = F2*t424
    2011    10963461 :          t845 = t842*t68 - t85*t441
    2012    10963461 :          t846 = t15*t845
    2013    10963461 :          t848 = 2._dp*t412*t88 + t11*t846
    2014    10963461 :          t849 = f12*t848
    2015    10963461 :          t851 = t452*t444
    2016             :          t865 = t97*(t99*t848*t82 + t99*t90*t444 + 2._dp*t102*t82 &
    2017    10963461 :                      *t444 + 3._dp*t104*t92*t444)
    2018    10963461 :          t867 = t498*t444
    2019    10963461 :          t870 = f94*t424
    2020    10963461 :          t871 = t870*t117
    2021    10963461 :          t873 = t509*t440
    2022    10963461 :          t874 = t18*t873
    2023    10963461 :          t876 = t68*ndrho
    2024    10963461 :          t877 = t116*t876
    2025    10963461 :          t880 = t871*t121 - t508*t874 + 2._dp*t877*t121
    2026    10963461 :          t884 = f32*t126
    2027    10963461 :          t885 = t884*t128
    2028    10963461 :          t888 = t425*t77
    2029    10963461 :          t889 = t77*t440
    2030    10963461 :          t891 = t888 - t553*t889
    2031    10963461 :          t892 = t551*t891
    2032    10963461 :          t893 = t540*t892
    2033    10963461 :          t897 = t537*(t885*t540*t132 + t550*t893/0.2e1_dp)
    2034    10963461 :          t898 = t531*t897
    2035             :          t902 = (t865*t113 - 0.7e1_dp/0.2e1_dp*t108*t867 - (t502*t880 &
    2036    10963461 :                                                             *t123*t136) + (2._dp*t502*t898))*t140
    2037    10963461 :          t904 = t571*t444
    2038    10963461 :          t907 = -t902*t145 - 0.7e1_dp/0.2e1_dp*t569*t904
    2039    10963461 :          t908 = t907*E
    2040    10963461 :          t909 = t908*t149
    2041    10963461 :          t910 = t620*t444
    2042    10963461 :          t916 = t780*t444
    2043    10963461 :          t918 = t156*t444
    2044    10963461 :          t919 = t783*t918
    2045    10963461 :          t930 = t800*t444
    2046    10963461 :          t932 = t155*t444
    2047    10963461 :          t933 = t803*t932
    2048             :          t937 = (-t151*t907*t83*t159 + t779*t916 + 0.5e1_dp/0.2e1_dp*t779 &
    2049             :                  *t919 + t81*t787*t444 + t81*t792*t444/0.2e1_dp - t166 &
    2050             :                  *t848*t83*t170 + t799*t930 + 0.3e1_dp/0.2e1_dp*t799*t933)* &
    2051    10963461 :                 omega
    2052    10963461 :          t942 = t656*t444
    2053    10963461 :          t945 = t739*t918
    2054    10963461 :          t951 = t747*t444
    2055    10963461 :          t954 = t753*t932
    2056             :          t958 = (-t176*t907*t93*t159 + (2._dp*t735*t942) + 0.5e1_dp/ &
    2057             :                  0.2e1_dp*(t735)*(t945) - t180*t848*t93*t170 + (2._dp &
    2058    10963461 :                                                                 *t746*t951) + 0.3e1_dp/0.2e1_dp*(t746)*(t954))*t185
    2059    10963461 :          t962 = t194*t44*t444
    2060    10963461 :          t965 = t271*t918
    2061    10963461 :          t968 = dexeindrho(Q, dQndrho)
    2062    10963461 :          t971 = t444*t200 - t769*t444
    2063    10963461 :          t972 = t971*t239
    2064    10963461 :          t979 = dexerndrho(Q, dQndrho)
    2065    10963461 :          t982 = (-t197*t673*t444/0.2e1_dp - t209*t979)*alpha1
    2066    10963461 :          t988 = (-t197*t241*t444 - f98*t968)*alpha2
    2067             :          t1001 = (t97*(-0.3e1_dp/0.2e1_dp*t221*t597*t444 + t603*t444/ &
    2068    10963461 :                        0.2e1_dp) + f2716*t979*t233)*alpha3*t185
    2069    10963461 :          t1009 = (t276*t444 - 2._dp*t197*t273*t444 + t243*t968)*alpha4
    2070    10963461 :          t1011 = t602*t444
    2071             :          t1024 = (t97*(-t243*t1011/0.2e1_dp + 0.3e1_dp/0.2e1_dp*t639*t250 &
    2072    10963461 :                        *t444 - 0.5e1_dp/0.2e1_dp*t255*t645*t444) - t267*t979)*alpha5
    2073             :          t1035 = (-3._dp*t820*t444 + 2._dp*t823*t444 - t243*t826*t444 - &
    2074    10963461 :                   t280*t968)*alpha6*t284
    2075             :          t1052 = (t97*(-0.7e1_dp/0.2e1_dp*t288*t691*t444 + 0.5e1_dp/0.2e1_dp &
    2076             :                        *t697*t293*t444 - 0.3e1_dp/0.2e1_dp*t298*t701*t444 + t280 &
    2077    10963461 :                        *t1011/0.2e1_dp) + t307*t979)*alpha7
    2078             :          t1066 = (-4._dp*t318*t713*t444 + 3._dp*t718*t444 - 2._dp*t243*t321 &
    2079    10963461 :                   *t444 + t280*t275*t444 + t326*t968)*alpha8
    2080             :          t1068 = -t81*t93*t444 + t849*t94 - (2._dp*t91*t851) + t909 &
    2081             :                  - (3._dp*t148*t910) + t937*t128 + t958*t190 - t909*t195 &
    2082             :                  + (3._dp*t810*t962) + 0.5e1_dp/0.2e1_dp*t583*t965 + t197*(t968 &
    2083             :                                                                          + t972*t199) + t982*t214 + t988*t153 + t1001*t190 + t1009 &
    2084             :                  *t247 + t1024*t271 + t1035*t286 + t1052*t316 + t1066* &
    2085    10963461 :                  t333
    2086    10963461 :          t1069 = t1068*Clda
    2087    10963461 :          e_ndrho = e_ndrho + (-t80*t1069)*sx
    2088             :       END IF
    2089    16225604 :       IF (order >= 2 .OR. order == -2) THEN
    2090           0 :          t1071 = t332*t13
    2091           0 :          t1072 = t4*t1071
    2092           0 :          t1077 = 0.10e2_dp/0.9e1_dp*t1072*t340*t68*t56*t58
    2093           0 :          t1078 = t44*t347
    2094           0 :          t1079 = t4*t1078
    2095           0 :          t1081 = 0.8e1_dp/0.3e1_dp*t1079*t343
    2096           0 :          t1082 = t14*t371
    2097           0 :          t1085 = 0.4e1_dp/0.3e1_dp*t339*t1082*t342
    2098           0 :          t1086 = t4*t515
    2099           0 :          t1087 = t6*t401
    2100           0 :          t1090 = 0.4e1_dp/0.3e1_dp*t1086*t553*t1087
    2101           0 :          t1091 = t29*t14
    2102           0 :          t1094 = 6._dp*t11*t1091*t69
    2103           0 :          t1097 = 4._dp*t11*t348*t372
    2104           0 :          t1098 = t4*t357
    2105           0 :          t1100 = 4._dp*t1098*t403
    2106           0 :          t1113 = t24*t763
    2107           0 :          t1115 = t363*t312
    2108           0 :          t1119 = t46*t31*t6
    2109           0 :          t1123 = t27*t390*t31
    2110             :          t1126 = 0.10e2_dp/0.9e1_dp*t16*t3*t332*t15*t312 + 0.8e1_dp/0.3e1_dp &
    2111             :                  *t353*t348*t6 + (6._dp*t17*t10*t29*t14) + 0.28e2_dp/ &
    2112             :                  0.9e1_dp*t22*t1113*t1115 + 0.32e2_dp/0.3e1_dp*t362*t1119 + (20._dp &
    2113           0 :                                                                              *t25*t1123)
    2114           0 :          t1127 = t1126*t68
    2115           0 :          t1129 = t11*t15*t1127
    2116           0 :          t1132 = 2._dp*t375*t1082*t402
    2117           0 :          t1134 = 0.1e1_dp/t376/t67
    2118           0 :          t1135 = t401**2
    2119           0 :          t1136 = t1134*t1135
    2120           0 :          t1139 = 2._dp*t375*t340*t1136
    2121             :          t1168 = 0.28e2_dp/0.9e1_dp*t35*t1113*t1115 + 0.32e2_dp/0.3e1_dp*t378 &
    2122             :                  *t1119 + (20._dp*t36*t1123) + 0.40e2_dp/0.9e1_dp*t39*t41* &
    2123             :                  t463*t385*t312 + 0.50e2_dp/0.3e1_dp*t384*t390*t48*t6 + 0.30e2_dp &
    2124             :                  *t42*t44/t28/t346*t48 + (72._dp*t55*t60/t61/t12 &
    2125           0 :                                           *t63)
    2126           0 :          t1169 = t377*t1168
    2127           0 :          t1171 = t375*t340*t1169
    2128           0 :          t1173 = t332*t56*t58
    2129             :          t1176 = t1077 + t1081 - t1085 + t1090 + t1094 - t1097 + t1100 + t1129 &
    2130           0 :                  - t1132 + t1139 - t1171 + 0.10e2_dp/0.9e1_dp*t73*t1173
    2131           0 :          d2Qrhorho = f94*t1176*t77
    2132           0 :          t1178 = t411*t338
    2133           0 :          t1181 = t14*t424
    2134           0 :          t1185 = t6*t440
    2135             :          t1208 = -0.4e1_dp/0.3e1_dp*t415*t352*t354 - (4._dp*t416*t358) &
    2136           0 :                  - 0.16e2_dp/0.3e1_dp*t420*t361*t364 - (16._dp*t421*t368)
    2137           0 :          t1209 = t1208*t68
    2138           0 :          t1214 = t411*t18
    2139           0 :          t1220 = t1134*t401*t440
    2140             :          t1236 = -0.16e2_dp/0.3e1_dp*t428*t361*t364 - (16._dp*t429*t368) &
    2141             :                  - 0.25e2_dp/0.3e1_dp*t432*t383*t386 - (25._dp*t433*t392) &
    2142           0 :                  - (48._dp*t437*t398)
    2143           0 :          t1237 = t377*t1236
    2144             :          t1240 = -0.4e1_dp/0.3e1_dp*t1178*t343 - 0.2e1_dp/0.3e1_dp*t339*t1181 &
    2145             :                  *t342 + 0.2e1_dp/0.3e1_dp*t1086*t553*t1185 - (4._dp*t412* &
    2146             :                                                                t349) - (2._dp*t11*t348*t425) + (2._dp*t1098*t442) + (2._dp &
    2147             :                                                                                    *t412*t373) + (t11*t15*t1209) - t375*t1082*t441 &
    2148             :                  - (2._dp*t1214*t403) - t375*t1181*t402 + 0.2e1_dp*t375*t340 &
    2149           0 :                  *t1220 - t375*t340*t1237
    2150           0 :          d2Qrhondrho = f94*t1240*t77
    2151           0 :          t1242 = t119*t13
    2152           0 :          t1243 = t340*t68
    2153           0 :          t1257 = 2._dp*a1*t3*t19 + 12._dp*a2*t1*t24*t32
    2154           0 :          t1258 = t1257*t68
    2155           0 :          t1264 = t440**2
    2156           0 :          t1265 = t1134*t1264
    2157             :          t1281 = 12._dp*a3*t1*t24*t32 + 20._dp*a4*t419*t41*t49 + 30._dp &
    2158           0 :                  *a5*t21*t54*t65
    2159           0 :          t1282 = t377*t1281
    2160             :          t1285 = 2._dp*t1242*t1243 + 4._dp*t412*t426 - 4._dp*t1214*t442 + t11 &
    2161             :                  *t15*t1258 - 2._dp*t375*t1181*t441 + 2._dp*t375*t340*t1265 &
    2162           0 :                  - t375*t340*t1282
    2163           0 :          d2Qndrhondrho = f94*t1285*t77
    2164           0 :          t1287 = t78**2
    2165           0 :          t1294 = t166*t481
    2166           0 :          t1297 = t453**2
    2167             :          t1301 = t1077 + t1081 - t1085 + t1090 + t1094 - t1097 + t1100 + t1129 &
    2168           0 :                  - t1132 + t1139 - t1171
    2169           0 :          t1304 = t166*t181
    2170           0 :          t1305 = t752*t453
    2171           0 :          t1306 = t1305*t754
    2172           0 :          t1309 = t587**2
    2173           0 :          t1310 = t154*t1309
    2174             :          t1317 = t1077 + t1081 - t1085 + t1090 + t1094 - t1097 + t1100 + t1129 &
    2175           0 :                  - t1132 + t1139 - t1171 + 0.10e2_dp/0.9e1_dp*t72*t332*t312
    2176           0 :          t1318 = t155*t1317
    2177           0 :          t1324 = 0.1e1_dp/t169/t156/t155
    2178           0 :          t1325 = t83*t1324
    2179           0 :          t1326 = t156*t1309
    2180             :          t1355 = 0.10e2_dp/0.9e1_dp*t1072*t468*t312 + 0.8e1_dp/0.3e1_dp*t1079 &
    2181             :                  *t469 - 0.4e1_dp/0.3e1_dp*t339*t14*t478*t6 + (6._dp*t11* &
    2182             :                                                                t1091*t87) - 0.4e1_dp*(t11)*t348*t478 + (t11*t15* &
    2183           0 :                                                                      (F2*t1126*t68 - 2._dp*t475*t402 + 2._dp*t85*t1136 - t85*t1169))
    2184           0 :          t1379 = t495*t82
    2185           0 :          t1381 = 0.1e1_dp/t110/t1379
    2186           0 :          t1382 = t109*t1381
    2187           0 :          t1392 = t503*t507
    2188           0 :          t1402 = t116*t1134*t1*t3
    2189           0 :          t1409 = t116*t377*t4*t44
    2190             :          t1433 = f94*t1126*t117*t121 - (2._dp*t1392*t511) - 0.4e1_dp &
    2191             :                  /0.3e1_dp*t503*t513*t518 - (4._dp*t504*t522) + (2._dp*t1402 &
    2192             :                                                                  *t18*t509*t1135) + 0.4e1_dp/0.3e1_dp*t1409*t120*t1087 + &
    2193             :                  (4._dp*t508*t357*t510) - (t508*t18*t509*t1168) + &
    2194             :                  0.10e2_dp/0.9e1_dp*t514*t1071*t14*t77*t56*t58 + 0.8e1_dp/0.3e1_dp &
    2195           0 :                  *t514*t1078*t14*t517 + 0.6e1_dp*t118*t119*t1091*t77
    2196           0 :          t1437 = t525**2
    2197           0 :          t1442 = t96*t115*t525
    2198           0 :          t1445 = t96*t124
    2199           0 :          t1456 = t533*t1242
    2200           0 :          t1457 = t377*t77
    2201           0 :          t1473 = t13*sscale
    2202           0 :          t1478 = t125*t538*t129
    2203           0 :          t1479 = sscale*t551
    2204           0 :          t1491 = 0.1e1_dp/t132/t131
    2205           0 :          t1492 = t556**2
    2206           0 :          t1498 = t371*t377
    2207           0 :          t1501 = t34*t1134
    2208           0 :          t1520 = t567*t142
    2209           0 :          t1524 = t110*t82*t144
    2210             :          t1531 = -((t97*(t99*t1355*t82 + 2._dp*t99*t481*t453 + t99 &
    2211             :                          *t90*t1301 + 2._dp*t102*t1297 + 2._dp*t102*t82*t1301 + 6._dp* &
    2212             :                          t104*t82*t1297 + 3._dp*t104*t92*t1301)*t113) - (7._dp*t493 &
    2213             :                                                                          *t499) + 0.63e2_dp/0.4e1_dp*(t108)*(t1382)*(t1297) &
    2214             :                    - 0.7e1_dp/0.2e1_dp*(t108)*(t498)*(t1301) - t502 &
    2215             :                    *t1433*t123*t136 - t502*t1437*t123*t136 + (4._dp*t1442 &
    2216             :                                                               *t563) + 0.2e1_dp*t1445*t530*(0.2e1_dp/0.3e1_dp*t533*t352* &
    2217             :                                                                                t13*t1243*t517 + (2._dp*t534*t348*t131) - (t534*t15 &
    2218             :                                                                              *t552) + t1456*t340*t1457*t401)*t562 + 0.2e1_dp*t502* &
    2219             :                    t531*t537*(0.4e1_dp/0.9e1_dp*t125*t126*t315*t540*t132* &
    2220             :                               t56*t58 + 0.2e1_dp/0.3e1_dp*t539*t1473*t542 - t1478*t1479* &
    2221             :                               t6*t556/0.3e1_dp + (2._dp*t127*t128*t347*t133) - t550*t1473 &
    2222             :                               *t557 - t550*t540*t1491*t1492/0.4e1_dp + t550*t540* &
    2223             :                               t551*(t1127*t77 - 2._dp*t1498*t554 + 2._dp*t1501*t77*t1135 &
    2224             :                                     - t553*t77*t1168)/0.2e1_dp))*t140*t145 - (7._dp*t1520 &
    2225             :                                                                               *t572) - 0.35e2_dp/0.4e1_dp*(t569)*(t1524)*(t1297) &
    2226           0 :                  - 0.7e1_dp/0.2e1_dp*(t569)*(t571)*(t1301)
    2227           0 :          t1535 = t151*t575
    2228             :          t1543 = (3._dp*t1294*t804) - (2._dp*t799*t747*t1297) + (t799 &
    2229             :                                                                  *t800*t1301) - (3._dp*t1304*t1306) + (3._dp*t799 &
    2230             :                                                                             *t803*t1310) + 0.3e1_dp/0.2e1_dp*(t799)*(t803)*(t1318) &
    2231             :                  - 0.27e2_dp/0.4e1_dp*(t799)*(t1325)*(t1326) - &
    2232             :                  t151*t1531*t83*t159 + (2._dp*t1535*t781) + (5._dp*t1535 &
    2233           0 :                                                              *t784) - (2._dp*t779*t656*t1297)
    2234           0 :          t1546 = t151*t177
    2235           0 :          t1547 = t581*t453
    2236           0 :          t1548 = t1547*t588
    2237           0 :          t1551 = t156*t1317
    2238           0 :          t1555 = t168*t1309
    2239           0 :          t1559 = t156**2
    2240           0 :          t1562 = 0.1e1_dp/t158/t1559/t155
    2241           0 :          t1563 = t83*t1562
    2242           0 :          t1564 = t1559*t1309
    2243           0 :          t1568 = t149*t163
    2244           0 :          t1572 = t81*t93
    2245           0 :          t1573 = t791*t453
    2246           0 :          t1579 = 0.1e1_dp/t162/t155
    2247           0 :          t1580 = t83*t1579
    2248             :          t1592 = t779*t780*(t1301) - (5._dp*t1546*t1548) + 0.5e1_dp &
    2249             :                  /0.2e1_dp*t779*t783*t1551 + 0.10e2_dp*t779*t783*t1555 - 0.75e2_dp &
    2250             :                  /0.4e1_dp*t779*t1563*t1564 - (2._dp*t81*t1568*t1297) &
    2251             :                  - t1572*t1573*t587 + (t81*t787*t1301) - 0.3e1_dp/0.4e1_dp &
    2252             :                  *(t81)*(t1580)*(t1309) + (t81*t792*t1317) &
    2253           0 :                  /0.2e1_dp - t166*t1355*t83*t170 + (2._dp*t1294*t801)
    2254           0 :          t1599 = t576*t582
    2255           0 :          t1602 = 0.1e1_dp/t1379
    2256           0 :          t1609 = t315*t56*t58
    2257           0 :          t1615 = t189*t347
    2258           0 :          t1624 = 0.1e1_dp/t690
    2259           0 :          t1625 = t409**2
    2260           0 :          t1633 = f94/t294
    2261           0 :          t1649 = d2exeirhorho(Q, dQrho, d2Qrhorho)
    2262           0 :          t1658 = t148*t620*t581
    2263             :          t1663 = (t1543 + t1592)*omega*t128 + (10._dp*t583*t271*t1555) &
    2264             :                  + (5._dp*t1599*t589) + (12._dp*t148*t1602*t1297) - &
    2265             :                  (2._dp*t613*t578) + 0.4e1_dp/0.9e1_dp*t624*t1609 - 0.8e1_dp/0.3e1_dp &
    2266             :                  *t669*t192*t631 + (2._dp*t186*t1615) + 0.10e2_dp/0.3e1_dp &
    2267             :                  *t576*t656*t659 + 0.5e1_dp/0.2e1_dp*(t583)*(t271)*(t1551) &
    2268             :                  + ((20._dp*t318*t1624*t1625 - 4._dp*t318*t713*t1176 &
    2269             :                      - 12._dp*t1633*t1625 + 3._dp*t718*t1176 + 6._dp*t243*t717*t1625 &
    2270             :                      - 2._dp*t243*t321*t1176 - 2._dp*t280*t321*t1625 + t280* &
    2271             :                      t275*t1176 + t326*t1649)*alpha8*t333) - (3._dp*t148*t620 &
    2272           0 :                                                               *t1301) - (15._dp*t1658*t271*t588*t453)
    2273           0 :          t1677 = t256**2
    2274           0 :          t1680 = 0.1e1_dp/t290/t1677/t690
    2275           0 :          t1681 = t1677*t256
    2276           0 :          t1682 = t1680*t1681
    2277           0 :          t1686 = t689*t257
    2278           0 :          t1693 = t293**2
    2279           0 :          t1697 = f2732/t295/t1693/t250
    2280           0 :          t1709 = 0.1e1_dp/t252/t293/t250
    2281           0 :          t1710 = t1709*t293
    2282           0 :          t1714 = t638*t75
    2283           0 :          t1722 = 0.1e1_dp/t227/t250
    2284           0 :          t1723 = t1722*t1625
    2285           0 :          t1726 = t602*t1176
    2286             :          t1729 = 0.147e3_dp/0.4e1_dp*t288*t1682*t1625 - 0.21e2_dp*t288*t1686 &
    2287             :                  *t1625 - 0.7e1_dp/0.2e1_dp*t288*t691*t1176 - 0.75e2_dp/0.4e1_dp &
    2288             :                  *t1697*t1693*t1625 + 0.10e2_dp*t697*t251*t1625 + 0.5e1_dp/ &
    2289             :                  0.2e1_dp*t697*t293*t1176 + 0.27e2_dp/0.4e1_dp*t298*t1710*t1625 &
    2290             :                  - 0.3e1_dp*t298*t1714*t1625 - 0.3e1_dp/0.2e1_dp*t298*t701*t1176 &
    2291           0 :                  - 0.3e1_dp/0.4e1_dp*t280*t1723 + t280*t1726/0.2e1_dp
    2292           0 :          t1731 = d2exerrhorho(Q, dQrho, d2Qrhorho)
    2293           0 :          t1740 = t148*t1602
    2294           0 :          t1767 = t56**2
    2295           0 :          t1768 = t58**2
    2296           0 :          t1770 = t1767*t1768*t28
    2297           0 :          t1781 = A*t713
    2298           0 :          t1786 = f98*t717
    2299           0 :          t1791 = r1*t321
    2300             :          t1802 = ((-2._dp*t823*t1625 + t276*t1176 + 6._dp*t197*t319* &
    2301             :                    t1625 - 2._dp*t197*t273*t1176 + t243*t1649)*alpha4*t247) + &
    2302             :                  (t97*t1729 + t307*t1731)*alpha7*t316 - 0.40e2_dp/0.9e1_dp*t657 &
    2303             :                  *t193*t463*t312 - (12._dp*t1740*t194*t44*t1297) + &
    2304             :                  (6._dp*t285*t60*t29) + ((2._dp*t197*t273*t1625 - t197 &
    2305             :                                           *t241*t1176 - f98*t1649)*alpha2*t153) - (4._dp*t832* &
    2306             :                                                                           t449) - (2._dp*t759*t578) + (2._dp*t237*t1615) - (6._dp* &
    2307             :                                                                      t576*t621) + f12*t1355*t94 + 0.70e2_dp/0.9e1_dp*t761/t8/t1770 &
    2308             :                  *t56*t58 + 0.40e2_dp/0.9e1_dp*t815*t463*t56*t58 + ((12._dp &
    2309             :                                                                   *t1781*t1625 - 3._dp*t820*t1176 - 6._dp*t1786*t1625 + 2._dp*t823 &
    2310             :                                                                      *t1176 + 2._dp*t243*t1791*t1625 - t243*t826*t1176 - t280 &
    2311           0 :                                                                      *t1649)*alpha6*t284*t286)
    2312           0 :          t1804 = t620*t159
    2313           0 :          t1805 = t148*t1804
    2314           0 :          t1816 = t576*t620
    2315           0 :          t1827 = t148*t582*t193
    2316           0 :          t1835 = t148*t149*t1562
    2317           0 :          t1839 = C*t620
    2318           0 :          t1846 = t75*t273
    2319           0 :          t1853 = t771*t275
    2320           0 :          t1854 = t199*t409
    2321           0 :          t1860 = t1531*E*t149
    2322           0 :          t1868 = f916*t1709
    2323           0 :          t1880 = 0.1e1_dp/t258/t1677/t222
    2324           0 :          t1881 = t1880*t1677
    2325           0 :          t1885 = t644*t223
    2326             :          t1898 = -(10._dp*t1805*t658*t6*t453) - 0.14e2_dp/0.3e1_dp*t711 &
    2327             :                  *t311*t765 - 0.16e2_dp/0.3e1_dp*t728*t330*t465 + (6._dp*t1816 &
    2328             :                                                                    *t812) + (2._dp*t81*t149*t1297) + 0.28e2_dp/0.9e1_dp*t629 &
    2329             :                  *t763*t56*t58 - 0.25e2_dp/0.3e1_dp*t1827*t332*t156*t587 &
    2330             :                  *r3*t5 - 0.75e2_dp/0.4e1_dp*t1835*t271*t1564 + (6._dp*t91 &
    2331             :                                                                  *t1839*t1297) + (t197*(t1649 + (t1176*t200 - 2._dp*t1625 &
    2332             :                                                                         *t241 + 2._dp*t1846*t1625 - t769*t1176)*t239*t199 - t1853* &
    2333             :                                                                               t1854 + t772*t409)) - t1860*t195 - (t81*t93*t1301) + &
    2334             :                  (t97*(0.3e1_dp/0.4e1_dp*t243*t1723 - t243*t1726/0.2e1_dp - 0.27e2_dp &
    2335             :                        /0.4e1_dp*(t1868)*(t293)*(t1625) + (3._dp*t639 &
    2336             :                                                            *t75*t1625) + 0.3e1_dp/0.2e1_dp*(t639)*(t250)*(t1176) &
    2337             :                        + 0.75e2_dp/0.4e1_dp*(t255)*(t1881)*(t1625) - &
    2338             :                        (10._dp*t255*t1885*t1625) - 0.5e1_dp/0.2e1_dp*(t255)*(t645) &
    2339           0 :                        *(t1176)) - t267*t1731)*alpha5*t271
    2340           0 :          t1906 = 0.1e1_dp/t205/t222
    2341           0 :          t1907 = t97*t1906
    2342           0 :          t1923 = t176*t575
    2343           0 :          t1932 = t176*t147*t149
    2344           0 :          t1938 = t93*t1562
    2345           0 :          t1951 = t180*t481
    2346           0 :          t1956 = t620*t170
    2347           0 :          t1961 = t180*t90*t149
    2348           0 :          t1967 = t93*t1324
    2349             :          t1977 = -t176*t1531*t93*t159 + (4._dp*t1923*t736) + (5._dp &
    2350             :                                                               *t1923*t740) - (6._dp*t735*t1804*t1297) - (10._dp*t1932 &
    2351             :                                                                      *t1548) + (2._dp*t735*t656*t1301) - 0.75e2_dp/0.4e1_dp*(t735) &
    2352             :                  *(t1938)*(t1564) + (10._dp*t735*t739*t1555) &
    2353             :                  + 0.5e1_dp/0.2e1_dp*(t735)*(t739)*(t1551) - t180 &
    2354             :                  *t1355*t93*t170 + (4._dp*t1951*t748) + (3._dp*t1951*t755) &
    2355             :                  - (6._dp*t746*t1956*t1297) - (6._dp*t1961*t1306) + &
    2356             :                  (2._dp*t746*t747*t1301) - 0.27e2_dp/0.4e1_dp*(t746)*(t1967) &
    2357             :                  *(t1326) + (3._dp*t746*t753*t1310) + 0.3e1_dp/0.2e1_dp &
    2358           0 :                  *(t746)*(t753)*(t1318)
    2359           0 :          t1983 = 0.1e1_dp/t224/t690
    2360           0 :          t1984 = t1983*t256
    2361           0 :          t1988 = t596*t199
    2362           0 :          t1995 = f98*t1722
    2363             :          t2028 = -0.4e1_dp/0.3e1_dp*t685*t72*t406 - 0.2e1_dp/0.3e1_dp*t679* &
    2364             :                  omega*t626 + (0.3e1_dp/0.4e1_dp*t197*t1907*t1625 - t197*t673 &
    2365             :                                *t1176/0.2e1_dp - t209*t1731)*alpha1*t214 + 0.4e1_dp/0.9e1_dp &
    2366             :                  *t174*t1609 + t1977*t185*t190 + 0.10e2_dp/0.9e1_dp*t592*t1173 &
    2367             :                  + (t97*(0.27e2_dp/0.4e1_dp*t221*t1984*t1625 - 0.3e1_dp*t221 &
    2368             :                          *t1988*t1625 - 0.3e1_dp/0.2e1_dp*t221*t597*t1176 - 0.3e1_dp/0.4e1_dp &
    2369             :                          *t1995*t1625 + t603*t1176/0.2e1_dp) + f2716*t1731*t233) &
    2370             :                  *alpha3*t185*t190 + (3._dp*t810*t194*t44*t1301) - (2._dp &
    2371             :                                                                     *t91*t452*t1301) - 0.2e1_dp/0.3e1_dp*t808*t626 - 0.10e2_dp &
    2372             :                  /0.3e1_dp*t653*t193*t817 + t1860 - (4._dp*t617*t454) + 0.88e2_dp &
    2373           0 :                  /0.9e1_dp*t457/t9/t1770*t56*t58
    2374             :          e_rho_rho = e_rho_rho - 0.4e1_dp/0.9e1_dp/t1287*f89*t336 - 0.8e1_dp/0.3e1_dp*t446* &
    2375           0 :                      t836 - t80*(t1663 + t1802 + t1898 + t2028)*Clda
    2376           0 :          t2059 = t156*t1240
    2377           0 :          t2072 = t587*t444
    2378           0 :          t2073 = t581*t156*t2072
    2379             :          t2099 = -0.4e1_dp/0.3e1_dp*t1178*t469 - 0.2e1_dp/0.3e1_dp*t339*t14 &
    2380             :                  *t845*t6 - (4._dp*t412*t472) - 0.2e1_dp*t11*t348*t845 + &
    2381             :                  (2._dp*t412*t479) + t11*t15*(F2*t1208*t68 - t475* &
    2382           0 :                                               t441 - t842*t402 + 2._dp*t85*t1220 - t85*t1237)
    2383           0 :          t2108 = t444*t453
    2384           0 :          t2142 = t870*t507
    2385           0 :          t2144 = t554*t440
    2386           0 :          t2150 = t116*t377*ndrho*t3
    2387             :          t2173 = (f94*t1208*t117*t121) - t1392*t874 + (2._dp*t503 &
    2388             :                                                        *t876*t121) - (t2142*t511) + (2._dp*t1402*t19*t2144) &
    2389             :                  - (2._dp*t2150*t511) - (t508*t18*t509*t1236) - &
    2390             :                  0.2e1_dp/0.3e1_dp*t870*t513*t518 + 0.2e1_dp/0.3e1_dp*t1409*t120 &
    2391             :                  *t1185 - 0.4e1_dp/0.3e1_dp*t116*(t876)*t3*t518 - (2._dp &
    2392           0 :                                                                    *t871*t522) + (2._dp*t508*t357*t873) - (4._dp*t877*t522)
    2393           0 :          t2184 = t96*t115*t880
    2394             :          t2197 = t530*(-2._dp*t532*ndrho*t119*t535 - t534*t15*t888 &
    2395           0 :                        + t1456*t340*t1457*t440)
    2396           0 :          t2224 = t424*t377
    2397             :          t2240 = (t97*(t99*t2099*t82 + t99*t481*t444 + t99*t848 &
    2398             :                        *t453 + t99*t90*t1240 + 2._dp*t102*t2108 + 2._dp*t102*t82 &
    2399             :                        *t1240 + 6._dp*t104*t486*t444 + 3._dp*t104*t92*t1240)*t113) &
    2400             :                  - 0.7e1_dp/0.2e1_dp*t493*t867 - 0.7e1_dp/0.2e1_dp*t865*t499 + 0.63e2_dp &
    2401             :                  /0.4e1_dp*(t108)*(t109)*(t1381)*(t453) &
    2402             :                  *(t444) - 0.7e1_dp/0.2e1_dp*(t108)*(t498)*(t1240) &
    2403             :                  - t502*t2173*t123*t136 - t502*t525*t880*t123*t136 &
    2404             :                  + (2._dp*t1442*t898) + (2._dp*t2184*t563) + (2._dp*t1445 &
    2405             :                                                               *t2197*t562) + 0.2e1_dp*t502*t531*t537*(-t884*t27*t129 &
    2406             :                                                                            *t133*t6/0.3e1_dp - t1478*t1479*t6*t891/0.6e1_dp - t885 &
    2407             :                                                                        *t1473*t132 - t550*t1473*t892/0.2e1_dp + t885*t558/0.2e1_dp &
    2408             :                                                                              - t550*t540*t1491*t556*t891/0.4e1_dp + t550*t540*t551 &
    2409             :                                                                          *(t1209*t77 - t1498*t889 - t2224*t554 + 2._dp*t1501*t2144 &
    2410           0 :                                                                                                         - t553*t77*t1236)/0.2e1_dp)
    2411           0 :          t2245 = t902*t142
    2412             :          t2254 = -t2240*t140*t145 - 0.7e1_dp/0.2e1_dp*t1520*t904 - 0.7e1_dp &
    2413             :                  /0.2e1_dp*t2245*t572 - 0.35e2_dp/0.4e1_dp*t569*t1524*t2108 - &
    2414           0 :                  0.7e1_dp/0.2e1_dp*t569*t571*t1240
    2415           0 :          t2258 = t1547*t918
    2416           0 :          t2267 = t151*t907
    2417           0 :          t2269 = t166*t167
    2418           0 :          t2271 = t752*t154*t2072
    2419             :          t2274 = t81*t792*t1240/0.2e1_dp - t1572*t1573*t444/0.2e1_dp + &
    2420             :                  t81*t787*t1240 + 0.5e1_dp/0.2e1_dp*t779*t783*t2059 - 0.2e1_dp &
    2421             :                  *t81*t149*t163*t453*t444 + t1294*t930 + 0.5e1_dp/0.2e1_dp* &
    2422             :                  t1535*t919 - 0.5e1_dp/0.2e1_dp*t1546*t2073 - t151*t2254*t83 &
    2423             :                  *t159 - 0.5e1_dp/0.2e1_dp*t1546*t2258 + t1535*t916 - 0.2e1_dp*t779 &
    2424             :                  *t656*t2108 + t779*t780*t1240 + t2267*t781 + (3._dp* &
    2425           0 :                                                                t2269*t2271)
    2426           0 :          t2280 = t151*t152
    2427           0 :          t2282 = t1562*t1559*t2072
    2428           0 :          t2285 = t166*t848
    2429           0 :          t2291 = t752*t155*t2072
    2430           0 :          t2297 = t1305*t932
    2431           0 :          t2305 = t581*t168*t2072
    2432           0 :          t2311 = t155*t1240
    2433           0 :          t2316 = t1324*t156*t2072
    2434             :          t2323 = -(2._dp*t799*t747*t2108) + (t799*t800*t1240) &
    2435             :                  - 0.75e2_dp/0.4e1_dp*t2280*t2282 + 0.3e1_dp/0.2e1_dp*t2285*t804 + &
    2436             :                  0.5e1_dp/0.2e1_dp*t2267*t784 - 0.3e1_dp/0.2e1_dp*t1304*t2291 - t166 &
    2437             :                  *t2099*t83*t170 - 0.3e1_dp/0.2e1_dp*t1304*t2297 - t1572*t791 &
    2438             :                  *t587*t444/0.2e1_dp + 0.10e2_dp*t2280*t2305 + 0.3e1_dp/0.2e1_dp &
    2439             :                  *t1294*t933 + t2285*t801 + 0.3e1_dp/0.2e1_dp*(t799)*(t803) &
    2440             :                  *(t2311) - 0.27e2_dp/0.4e1_dp*t2269*t2316 - 0.3e1_dp/0.4e1_dp &
    2441           0 :                  *t84*t1579*t587*t444
    2442           0 :          t2329 = t908*t582
    2443           0 :          t2348 = t176*t907
    2444           0 :          t2363 = t176*t177
    2445             :          t2371 = -t176*t2254*t93*t159 + (2._dp*t1923*t942) + 0.5e1_dp &
    2446             :                  /0.2e1_dp*(t1923)*(t945) + (2._dp*t2348*t736) - (6._dp &
    2447             :                                                                   *t735*t1804*t2108) - (5._dp*t1932*t2258) + (2._dp*t735 &
    2448             :                                                                           *t656*t1240) + 0.5e1_dp/0.2e1_dp*(t2348)*(t740) - (5._dp &
    2449             :                                                                        *t1932*t2073) - 0.75e2_dp/0.4e1_dp*t2363*t2282 + 0.10e2_dp* &
    2450           0 :                  t2363*t2305 + 0.5e1_dp/0.2e1_dp*(t735)*(t739)*(t2059)
    2451           0 :          t2379 = t180*t848
    2452             :          t2401 = -t180*t2099*t93*t170 + (2._dp*t1951*t951) + 0.3e1_dp &
    2453             :                  /0.2e1_dp*(t1951)*(t954) + (2._dp*t2379*t748) - (6._dp &
    2454             :                                                                   *t746*t1956*t2108) - (3._dp*t1961*t2297) + (2._dp*t746 &
    2455             :                                                                           *t747*t1240) + 0.3e1_dp/0.2e1_dp*(t2379)*(t755) - (3._dp &
    2456             :                                                                        *t1961*t2291) - 0.27e2_dp/0.4e1_dp*t95*t2316 + 0.3e1_dp*t95 &
    2457           0 :                  *t2271 + 0.3e1_dp/0.2e1_dp*(t746)*(t753)*(t2311)
    2458             :          t2405 = -0.25e2_dp/0.6e1_dp*t1827*t816*t5*t156*t444 + 0.12e2_dp &
    2459             :                  *t148*t1602*t453*t444 - 0.5e1_dp*t1805*t658*t6*t444 + &
    2460             :                  0.6e1_dp*t746*t621*t444 + (t2274 + t2323)*omega*t128 - (2._dp &
    2461             :                                                                    *t1035*t449) + 0.5e1_dp/0.2e1_dp*t2329*t589 + 0.5e1_dp/0.2e1_dp &
    2462             :                  *t1599*t965 - t81*t93*t1240 - 0.7e1_dp/0.3e1_dp*t1052*t311 &
    2463           0 :                  *t765 - t937*t626/0.3e1_dp + (t2371 + t2401)*t185*t190
    2464           0 :          t2410 = t2254*E*t149
    2465           0 :          t2437 = t698*t444
    2466           0 :          t2442 = t75*t409*t444
    2467           0 :          t2449 = t1722*t409*t444
    2468           0 :          t2452 = t602*t1240
    2469             :          t2455 = 0.147e3_dp/0.4e1_dp*t288*t1680*t1681*t409*t444 - 0.21e2_dp &
    2470             :                  *t288*t689*t257*t409*t444 - 0.7e1_dp/0.2e1_dp*t288*t691 &
    2471             :                  *t1240 - 0.75e2_dp/0.4e1_dp*t1697*t1693*t409*t444 + 0.10e2_dp &
    2472             :                  *t697*t251*t409*t444 + 0.5e1_dp/0.2e1_dp*t697*t293*t1240 &
    2473             :                  + 0.27e2_dp/0.4e1_dp*t298*t1709*t2437 - 0.3e1_dp*t298*t638*t2442 &
    2474             :                  - 0.3e1_dp/0.2e1_dp*t298*t701*t1240 - 0.3e1_dp/0.4e1_dp*t280* &
    2475           0 :                  t2449 + t280*t2452/0.2e1_dp
    2476           0 :          t2457 = d2exerrhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    2477           0 :          t2473 = t409*t444
    2478           0 :          t2484 = d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    2479             :          t2499 = -(3._dp*t908*t621) - t1001*t578 - t2410*t195 + t2410 &
    2480             :                  + (t97*t2455 + t307*t2457)*alpha7*t316 + 0.5e1_dp/0.2e1_dp* &
    2481             :                  t583*t271*t2059 - 0.12e2_dp*t148*t1602*t159*t271*t2108 &
    2482             :                  - t982*omega*t626/0.3e1_dp + ((-2._dp*t823*t2473 + t276* &
    2483             :                                                 t1240 + 6._dp*t197*t319*t409*t444 - 2._dp*t197*t273*t1240 + &
    2484             :                                                 t243*t2484)*alpha4*t247) - 0.15e2_dp/0.2e1_dp*t1658*t271*t588 &
    2485             :                  *(t444) - 0.4e1_dp/0.3e1_dp*t1009*t192*t631 - 0.3e1_dp*t148 &
    2486           0 :                  *t620*(t1240)
    2487           0 :          t2512 = t199*t444
    2488           0 :          t2529 = t721*t444
    2489           0 :          t2543 = t908*t620
    2490             :          t2573 = (3._dp*t1816*t962) + (t197*(t2484 + (t1240*t200 &
    2491             :                                                       - 2._dp*t681*t444 + 2._dp*t1846*t2473 - t769*t1240)*t239*t199 &
    2492             :                                              - t1853*t2512 + t772*t444)) - 0.5e1_dp/0.3e1_dp*t1024*t193 &
    2493             :                  *t817 + ((12._dp*t1781*t2473 - 3._dp*t820*t1240 - 6._dp*t1786* &
    2494             :                            t2473 + 2._dp*t823*t1240 + 2._dp*t243*r1*t2529 - t243*t826* &
    2495             :                            t1240 - t280*t2484)*alpha6*t284*t286) + (2._dp*t81*t149 &
    2496             :                                                                     *t453*t444) + (3._dp*t2543*t812) + f12*t2099*t94 + (10._dp &
    2497             :                                                                                     *t583*t271*t168*t587*t444) + ((2._dp*t197*t663 &
    2498             :                                                                       *t444 - t197*t241*t1240 - f98*t2484)*alpha2*t153) - 0.8e1_dp &
    2499             :                  /0.3e1_dp*t1066*t330*t465 - 0.2e1_dp/0.3e1_dp*t988*t72*t406 &
    2500             :                  - 0.75e2_dp/0.4e1_dp*(t1835)*(t271)*(t1559)*(t587) &
    2501           0 :                  *(t444)
    2502             :          t2688 = -(2._dp*t91*t452*t1240) - (2._dp*t617*t851) + (t97 &
    2503             :                                                                 *(0.3e1_dp/0.4e1_dp*t243*t2449 - t243*t2452/0.2e1_dp - 0.27e2_dp &
    2504             :                                                                   /0.4e1_dp*t1868*t2437 + (3._dp*t639*t2442) + 0.3e1_dp/0.2e1_dp* &
    2505             :                                                                   (t639)*(t250)*(t1240) + 0.75e2_dp/0.4e1_dp*t255*t1880 &
    2506             :                                                                   *t1677*t409*t444 - 0.10e2_dp*t255*t644*t223*t409* &
    2507             :                                                                   t444 - 0.5e1_dp/0.2e1_dp*t255*t645*(t1240)) - t267*t2457) &
    2508             :                  *alpha5*t271 - (3._dp*t576*t910) - (2._dp*t849*t454) - &
    2509             :                  t958*t578 + (0.20e2_dp*t318*t1624*t409*t444 - 0.4e1_dp*t318 &
    2510             :                               *t713*(t1240) - (12._dp*t1633*t2473) + (3._dp*t718* &
    2511             :                                                                       t1240) + 0.6e1_dp*t243*t717*t409*t444 - 0.2e1_dp*t243*t321* &
    2512             :                               (t1240) - (2._dp*t280*t2529) + (t280*t275*t1240) &
    2513             :                               + t326*t2484)*alpha8*t333 + (3._dp*t810*t194*t44*t1240) &
    2514             :                  + (0.3e1_dp/0.4e1_dp*t197*t97*t1906*t409*t444 - t197*t673 &
    2515             :                     *(t1240)/0.2e1_dp - t209*t2457)*alpha1*t214 + 0.5e1_dp &
    2516             :                  /0.3e1_dp*t908*t656*t659 + (t97*(0.27e2_dp/0.4e1_dp*t221*t1983 &
    2517             :                                                   *t256*t409*t444 - 0.3e1_dp*t221*t596*t1854*t444 - 0.3e1_dp &
    2518             :                                                   /0.2e1_dp*t221*t597*(t1240) - 0.3e1_dp/0.4e1_dp*(t1995) &
    2519             :                                                   *(t2473) + (t603*t1240)/0.2e1_dp) + f2716*t2457*t233) &
    2520             :                  *alpha3*t185*t190 - 0.15e2_dp/0.2e1_dp*t1658*t271*t453 &
    2521           0 :                  *t156*t444
    2522             :          e_ndrho_rho = e_ndrho_rho - 0.4e1_dp/0.3e1_dp*t446*t1069 - t80*(t2405 + t2499 + t2573 &
    2523           0 :                                                                          + t2688)*Clda
    2524             :          t2707 = 2._dp*t119*t88 + 4._dp*t412*t846 + t11*t15*(F2*t1257 &
    2525           0 :                                                              *t68 - 2._dp*t842*t441 + 2._dp*t85*t1265 - t85*t1282)
    2526           0 :          t2715 = t444**2
    2527           0 :          t2764 = t880**2
    2528           0 :          t2774 = t891**2
    2529             :          t2808 = -((t97*(t99*t2707*t82 + 2._dp*t99*t848*t444 + t99 &
    2530             :                          *t90*t1285 + 2._dp*t102*t2715 + 2._dp*t102*t82*t1285 + 6._dp* &
    2531             :                          t104*t82*t2715 + 3._dp*t104*t92*t1285)*t113) - (7._dp*t865 &
    2532             :                                                                          *t867) + 0.63e2_dp/0.4e1_dp*(t108)*(t1382)*(t2715) &
    2533             :                    - 0.7e1_dp/0.2e1_dp*(t108)*(t498)*(t1285) - (t502 &
    2534             :                                                                 *(f94*t1257*t117*t121 - 2._dp*t2142*t874 + 4._dp*t870* &
    2535             :                                                                   t876*t121 + 2._dp*t1402*t18*t509*t1264 - 4._dp*t2150*t874 - &
    2536             :                                                                   t508*t18*t509*t1281 + 2._dp*t116*t68*t3*t18*t509)*t123 &
    2537             :                                                                 *t136) - (t502*t2764*t123*t136) + (4._dp*t2184* &
    2538             :                                                                            t898) + (2._dp*t1445*t2197*t897) + 0.2e1_dp*(t502)*t531 &
    2539             :                    *t537*(t885*t893 - t550*t540*t1491*t2774/0.4e1_dp + t550 &
    2540             :                           *t540*t551*(t1258*t77 - 2._dp*t2224*t889 + 2._dp*t1501 &
    2541             :                                       *t77*t1264 - t553*t77*t1281)/0.2e1_dp))*t140*t145 - (7._dp &
    2542             :                                                                           *t2245*t904) - 0.35e2_dp/0.4e1_dp*(t569)*(t1524)*(t2715) &
    2543           0 :                  - 0.7e1_dp/0.2e1_dp*(t569)*(t571)*(t1285)
    2544           0 :          t2810 = t2808*E*t149
    2545           0 :          t2838 = t1722*t2715
    2546           0 :          t2841 = t602*t1285
    2547             :          t2844 = 0.147e3_dp/0.4e1_dp*t288*t1682*t2715 - 0.21e2_dp*t288*t1686 &
    2548             :                  *t2715 - 0.7e1_dp/0.2e1_dp*t288*t691*t1285 - 0.75e2_dp/0.4e1_dp &
    2549             :                  *t1697*t1693*t2715 + 0.10e2_dp*t697*t251*t2715 + 0.5e1_dp/ &
    2550             :                  0.2e1_dp*t697*t293*t1285 + 0.27e2_dp/0.4e1_dp*t298*t1710*t2715 &
    2551             :                  - 0.3e1_dp*t298*t1714*t2715 - 0.3e1_dp/0.2e1_dp*t298*t701*t1285 &
    2552           0 :                  - 0.3e1_dp/0.4e1_dp*t280*t2838 + t280*t2841/0.2e1_dp
    2553           0 :          t2846 = d2exerndrhondrho(Q, dQndrho, d2Qndrhondrho)
    2554           0 :          t2875 = d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
    2555           0 :          t2880 = t2715*t156
    2556           0 :          t2884 = t1559*t2715
    2557           0 :          t2927 = t156*t1285
    2558             :          t2963 = t2810 + (t97*t2844 + t307*t2846)*alpha7*t316 + (3._dp &
    2559             :                                                                  *t810*t194*t44*t1285) - (6._dp*t908*t910) - (3._dp* &
    2560             :                                                                      t148*t620*t1285) + (0.3e1_dp/0.4e1_dp*t197*t1907*t2715 - t197 &
    2561             :                                                                                 *t673*(t1285)/0.2e1_dp - t209*t2846)*alpha1*t214 + &
    2562             :                  (0.2e1_dp*t197*t273*t2715 - t197*t241*(t1285) - f98*t2875) &
    2563             :                  *alpha2*t153 - (15._dp*t1658*t271*t2880) - 0.75e2_dp/ &
    2564             :                  0.4e1_dp*(t1835)*(t271)*(t2884) + (0.20e2_dp*t318* &
    2565             :                                                     t1624*t2715 - 0.4e1_dp*t318*t713*(t1285) - 0.12e2_dp*t1633 &
    2566             :                                                     *t2715 + (3._dp*t718*t1285) + 0.6e1_dp*t243*t717*t2715 - &
    2567             :                                                     0.2e1_dp*t243*t321*(t1285) - 0.2e1_dp*t280*t321*t2715 + &
    2568             :                                                     t280*t275*(t1285) + t326*t2875)*alpha8*t333 + t197 &
    2569             :                  *(t2875 + ((t1285*t200) - 0.2e1_dp*t2715*t241 + 0.2e1_dp*t1846 &
    2570             :                             *t2715 - (t769*t1285))*t239*t199 - t971*t275*t2512 &
    2571             :                    + t972*t444) + 0.5e1_dp/0.2e1_dp*(t583)*(t271)*(t2927) &
    2572             :                  + (t97*(0.3e1_dp/0.4e1_dp*t243*t2838 - t243*t2841/0.2e1_dp &
    2573             :                          - 0.27e2_dp/0.4e1_dp*t1868*t293*t2715 + 0.3e1_dp*t639*t75 &
    2574             :                          *t2715 + 0.3e1_dp/0.2e1_dp*t639*t250*(t1285) + 0.75e2_dp/0.4e1_dp &
    2575             :                          *t255*t1881*t2715 - 0.10e2_dp*t255*t1885*t2715 - 0.5e1_dp &
    2576             :                          /0.2e1_dp*t255*t645*(t1285)) - t267*t2846)*alpha5*(t271) &
    2577           0 :                  + (5._dp*t2329*t965) - (t81*t93*t1285)
    2578           0 :          t2971 = t2715*t155
    2579           0 :          t2975 = t154*t2715
    2580           0 :          t2979 = t155*t1285
    2581           0 :          t2994 = t168*t2715
    2582             :          t3001 = -(2._dp*t799*t747*t2715) + (t799*t800*t1285) &
    2583             :                  - (3._dp*t799*t753*t2971) + (3._dp*t799*t803*t2975) + &
    2584             :                  0.3e1_dp/0.2e1_dp*(t799)*(t803)*(t2979) - 0.27e2_dp/0.4e1_dp &
    2585             :                  *(t799)*(t1325)*(t2880) - (2._dp*t779*t656 &
    2586             :                                             *t2715) + (t779*t780*t1285) - (5._dp*t779*t739*t2880) &
    2587             :                  + (10._dp*t779*t783*t2994) + 0.5e1_dp/0.2e1_dp*(t779) &
    2588           0 :                  *(t783)*(t2927)
    2589             :          t3033 = -0.75e2_dp/0.4e1_dp*t779*t1563*t2884 - (2._dp*t81*t1568 &
    2590             :                                                          *t2715) - (t81*t93*t791*t2715) + (t81*t787*t1285) &
    2591             :                  - 0.3e1_dp/0.4e1_dp*(t81)*(t1580)*(t2715) + (t81 &
    2592             :                                                               *t792*t1285)/0.2e1_dp - t166*t2707*t83*t170 + (2._dp &
    2593             :                                                                                *t2285*t930) + (3._dp*t2285*t933) - t151*t2808*t83* &
    2594           0 :                  t159 + (2._dp*t2267*t916) + (5._dp*t2267*t919)
    2595             :          t3139 = -t176*t2808*t93*t159 + (4._dp*t2348*t942) + (5._dp &
    2596             :                                                               *t2348*t945) - (6._dp*t735*t1804*t2715) - (10._dp*t735 &
    2597             :                                                                        *t582*t2880) + (2._dp*t735*t656*t1285) - 0.75e2_dp/0.4e1_dp &
    2598             :                  *(t735)*(t1938)*(t2884) + (10._dp*t735*t739 &
    2599             :                                             *t2994) + 0.5e1_dp/0.2e1_dp*(t735)*(t739)*(t2927) - &
    2600             :                  t180*t2707*t93*t170 + (4._dp*t2379*t951) + (3._dp*t2379 &
    2601             :                                                              *t954) - (6._dp*t746*t1956*t2715) - (6._dp*t746*t149 &
    2602             :                                                                        *t752*t2971) + (2._dp*t746*t747*t1285) - 0.27e2_dp/0.4e1_dp &
    2603             :                  *(t746)*(t1967)*(t2880) + (3._dp*t746*t753* &
    2604           0 :                                             t2975) + 0.3e1_dp/0.2e1_dp*(t746)*(t753)*(t2979)
    2605             :          t3167 = f12*t2707*t94 + (t3001 + t3033)*omega*t128 + (2._dp &
    2606             :                                                                *t81*t149*t2715) + (6._dp*t2543*t962) - t2810*t195 + (10._dp &
    2607             :                                                                                    *t583*t271*t2994) + (12._dp*t148*t1602*t2715) + &
    2608             :                  (t97*(0.27e2_dp/0.4e1_dp*(t221)*(t1984)*(t2715) - &
    2609             :                        (3._dp*t221*t1988*t2715) - 0.3e1_dp/0.2e1_dp*(t221)*(t597) &
    2610             :                        *(t1285) - 0.3e1_dp/0.4e1_dp*(t1995)*(t2715) + &
    2611             :                        (t603*t1285)/0.2e1_dp) + f2716*t2846*t233)*alpha3*t185 &
    2612             :                  *t190 + ((-2._dp*t823*t2715 + t276*t1285 + 6._dp*t197*t319 &
    2613             :                            *t2715 - 2._dp*t197*t273*t1285 + t243*t2875)*alpha4*t247) &
    2614             :                  - (2._dp*t91*t452*t1285) - (4._dp*t849*t851) + t3139 &
    2615             :                  *t185*t190 + (6._dp*t91*t1839*t2715) + ((12._dp*t1781 &
    2616             :                                                           *t2715 - 3._dp*t820*t1285 - 6._dp*t1786*t2715 + 2._dp*t823*t1285 &
    2617             :                                                           + 2._dp*t243*t1791*t2715 - t243*t826*t1285 - t280*t2875)* &
    2618           0 :                                                          alpha6*t284*t286) - (12._dp*t1740*t194*t44*t2715)
    2619           0 :          e_ndrho_ndrho = e_ndrho_ndrho - t80*(t2963 + t3167)*Clda
    2620             :       END IF
    2621             : 
    2622    16225604 :    END SUBROUTINE xwpbe_lda_calc_1
    2623             : 
    2624             : ! **************************************************************************************************
    2625             : !> \brief Evaluates the screened hole averaged PBE exchange functional for lda.
    2626             : !> \param e_0 ...
    2627             : !> \param e_rho ...
    2628             : !> \param e_ndrho ...
    2629             : !> \param e_rho_rho ...
    2630             : !> \param e_ndrho_rho ...
    2631             : !> \param e_ndrho_ndrho ...
    2632             : !> \param rho , ndrho: density and norm of the density gradient
    2633             : !> \param ndrho ...
    2634             : !> \param omega scaling factor
    2635             : !> \param sscale scaling factor to enforce Lieb-Oxford bound
    2636             : !> \param sx scaling factor
    2637             : !> \param order degree of the derivative that should be evaluated,
    2638             : !>        if positive all the derivatives up to the given degree are evaluated,
    2639             : !>        if negative only the given degree is calculated
    2640             : !> \par History
    2641             : !>      05.2007 created [Manuel Guidon]
    2642             : !> \author Manuel Guidon
    2643             : !> \note
    2644             : !>      This routine evaluates the functional for omega!=0 using a taylor
    2645             : !>      expansion for the parameter G.
    2646             : ! **************************************************************************************************
    2647      206701 :    SUBROUTINE xwpbe_lda_calc_2(e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
    2648             :                                e_ndrho_ndrho, rho, ndrho, omega, sscale, sx, order)
    2649             :       REAL(KIND=dp), INTENT(INOUT)                       :: e_0, e_rho, e_ndrho, e_rho_rho, &
    2650             :                                                             e_ndrho_rho, e_ndrho_ndrho
    2651             :       REAL(KIND=dp), INTENT(IN)                          :: rho, ndrho, omega, sscale, sx
    2652             :       INTEGER, INTENT(IN)                                :: order
    2653             : 
    2654             :       REAL(KIND=dp) :: d2Qndrhondrho, d2Qrhondrho, d2Qrhorho, dQndrho, dQrho, Q, t1, t10, t100, &
    2655             :          t102, t1022, t1024, t1026, t1029, t103, t1031, t1034, t105, t106, t1061, t1067, t1073, &
    2656             :          t108, t109, t1090, t1093, t1095, t11, t110, t111, t1111, t1118, t1119, t112, t113, t1136, &
    2657             :          t1139, t114, t1141, t1149, t115, t1150, t1151, t1157, t1158, t1159, t116, t1162, t1167, &
    2658             :          t1168, t117, t1178, t118, t1181, t1182, t1186, t1195, t12, t121, t122, t1239, t1241, &
    2659             :          t1243, t125, t1251, t1256, t126, t1261, t1262, t1263, t1266, t127, t1270, t1273, t1274, &
    2660             :          t1275, t1276, t128, t1280, t1287, t1288, t129, t13, t1317, t1321
    2661             :       REAL(KIND=dp) :: t1326, t133, t1331, t1332, t1333, t134, t1341, t1342, t1343, t1347, t1351, &
    2662             :          t1355, t136, t1362, t137, t1374, t1379, t1382, t1383, t1385, t1392, t1397, t14, t140, &
    2663             :          t1407, t141, t1417, t1426, t1430, t1434, t1435, t1438, t1442, t1443, t145, t1453, t146, &
    2664             :          t1469, t1473, t1476, t149, t15, t151, t1517, t1519, t153, t1538, t154, t1545, t1546, &
    2665             :          t155, t1552, t1553, t156, t1577, t158, t1584, t1589, t159, t1594, t16, t160, t161, t1613, &
    2666             :          t1614, t1615, t1619, t1626, t163, t1630, t1640, t1644, t1655, t166, t1661, t1666, t1667, &
    2667             :          t167, t1671, t1678, t1691, t1699, t17, t171, t172, t1726, t173
    2668             :       REAL(KIND=dp) :: t1732, t1736, t1737, t1742, t1756, t176, t1768, t177, t1773, t1785, t1788, &
    2669             :          t1791, t1795, t18, t1816, t182, t1824, t184, t1841, t185, t1850, t186, t187, t1885, t19, &
    2670             :          t190, t191, t1938, t1946, t196, t1976, t1978, t2, t200, t2018, t202, t204, t2053, t2056, &
    2671             :          t206, t2060, t2066, t2069, t2071, t2072, t2076, t2084, t2086, t209, t2090, t2099, t21, &
    2672             :          t210, t2105, t2111, t2115, t213, t2133, t2136, t214, t215, t2155, t2158, t216, t218, &
    2673             :          t2180, t219, t2195, t22, t220, t2203, t221, t2211, t2233, t226, t227, t2274, t2279, t228, &
    2674             :          t2280, t2283, t23, t230, t2306, t2316, t2323, t233, t2336, t234
    2675             :       REAL(KIND=dp) :: t236, t2365, t238, t239, t2391, t24, t243, t2432, t2452, t2454, t247, &
    2676             :          t2473, t248, t2486, t249, t25, t2501, t251, t2511, t2515, t2519, t252, t253, t256, t257, &
    2677             :          t2571, t258, t2604, t261, t266, t2668, t268, t27, t270, t273, t274, t275, t276, t278, &
    2678             :          t279, t28, t281, t282, t284, t289, t29, t292, t293, t295, t296, t298, t299, t3, t301, &
    2679             :          t302, t303, t305, t306, t308, t309, t31, t310, t311, t312, t314, t315, t316, t317, t32, &
    2680             :          t320, t321, t324, t325, t326, t327, t331, t334, t335, t336, t337, t338, t339, t34, t340, &
    2681             :          t341, t346, t347, t348, t349, t35, t353, t355, t36, t361, t364, t365
    2682             :       REAL(KIND=dp) :: t366, t367, t369, t372, t374, t375, t378, t379, t38, t382, t383, t384, &
    2683             :          t387, t388, t389, t39, t391, t392, t395, t396, t4, t400, t403, t404, t405, t407, t409, &
    2684             :          t41, t413, t416, t417, t42, t420, t423, t428, t433, t434, t436, t44, t440, t441, t442, &
    2685             :          t443, t447, t448, t452, t453, t454, t457, t458, t46, t461, t464, t467, t468, t470, t474, &
    2686             :          t475, t476, t48, t480, t481, t482, t483, t487, t489, t49, t491, t496, t5, t500, t503, &
    2687             :          t505, t506, t507, t510, t512, t513, t514, t516, t519, t522, t523, t524, t530, t531, t535, &
    2688             :          t536, t54, t541, t542, t549, t55, t551, t552, t558, t559, t56, t561
    2689             :       REAL(KIND=dp) :: t565, t566, t569, t574, t577, t579, t58, t583, t584, t585, t587, t588, &
    2690             :          t591, t595, t596, t6, t60, t603, t604, t605, t607, t608, t61, t612, t615, t620, t622, &
    2691             :          t626, t628, t629, t63, t633, t634, t635, t638, t641, t644, t65, t650, t652, t656, t658, &
    2692             :          t659, t660, t665, t67, t670, t671, t679, t68, t681, t685, t687, t689, t69, t692, t695, &
    2693             :          t697, t699, t7, t70, t702, t705, t709, t71, t710, t714, t72, t723, t725, t727, t73, t733, &
    2694             :          t736, t737, t739, t74, t740, t742, t747, t748, t75, t751, t752, t755, t756, t758, t759, &
    2695             :          t760, t761, t767, t769, t77, t770, t78, t781, t783, t784, t788, t793
    2696             :       REAL(KIND=dp) :: t796, t8, t80, t802, t805, t809, t81, t813, t816, t819, t82, t822, t823, &
    2697             :          t83, t830, t833, t839, t84, t85, t852, t860, t862, t87, t875, t88, t886, t9, t90, t903, &
    2698             :          t91, t917, t919, t92, t920, t923, t928, t93, t930, t932, t933, t936, t938, t939, t94, &
    2699             :          t943, t944, t947, t95, t950, t951, t953, t954, t956, t959, t96, t963, t966, t968, t97, &
    2700             :          t972, t976, t979, t982, t985, t987, t988, t989, t99, t992
    2701             : 
    2702      206701 :       IF (order >= 0) THEN
    2703      206701 :          t1 = ndrho**2
    2704      206701 :          t2 = r2**2
    2705      206701 :          t3 = 0.1e1_dp/t2
    2706      206701 :          t4 = t1*t3
    2707      206701 :          t5 = pi**2
    2708      206701 :          t6 = r3*t5
    2709      206701 :          t7 = t6*rho
    2710      206701 :          t8 = t7**(0.1e1_dp/0.3e1_dp)
    2711      206701 :          t9 = t8**2
    2712      206701 :          t10 = 0.1e1_dp/t9
    2713      206701 :          t11 = t4*t10
    2714      206701 :          t12 = rho**2
    2715      206701 :          t13 = 0.1e1_dp/t12
    2716      206701 :          t14 = sscale**2
    2717      206701 :          t15 = t13*t14
    2718      206701 :          t16 = a1*t1
    2719      206701 :          t17 = t16*t3
    2720      206701 :          t18 = t10*t13
    2721      206701 :          t19 = t18*t14
    2722      206701 :          t21 = t1**2
    2723      206701 :          t22 = a2*t21
    2724      206701 :          t23 = t2**2
    2725      206701 :          t24 = 0.1e1_dp/t23
    2726      206701 :          t25 = t22*t24
    2727      206701 :          t27 = 0.1e1_dp/t8/t7
    2728      206701 :          t28 = t12**2
    2729      206701 :          t29 = 0.1e1_dp/t28
    2730      206701 :          t31 = t14**2
    2731      206701 :          t32 = t27*t29*t31
    2732      206701 :          t34 = t17*t19 + t25*t32
    2733      206701 :          t35 = a3*t21
    2734      206701 :          t36 = t35*t24
    2735      206701 :          t38 = t21*ndrho
    2736      206701 :          t39 = a4*t38
    2737      206701 :          t41 = 0.1e1_dp/t23/r2
    2738      206701 :          t42 = t39*t41
    2739      206701 :          t44 = 0.1e1_dp/t9/t7
    2740      206701 :          t46 = 0.1e1_dp/t28/rho
    2741      206701 :          t48 = t31*sscale
    2742      206701 :          t49 = t44*t46*t48
    2743      206701 :          t54 = 0.1e1_dp/t23/t2
    2744      206701 :          t55 = a5*t21*t1*t54
    2745      206701 :          t56 = r3**2
    2746      206701 :          t58 = t5**2
    2747      206701 :          t60 = 0.1e1_dp/t56/t58
    2748      206701 :          t61 = t28**2
    2749      206701 :          t63 = t31*t14
    2750      206701 :          t65 = t60/t61*t63
    2751      206701 :          t67 = r1 + t36*t32 + t42*t49 + t55*t65
    2752      206701 :          t68 = 0.1e1_dp/t67
    2753      206701 :          t69 = t34*t68
    2754      206701 :          t70 = t15*t69
    2755      206701 :          t71 = t11*t70
    2756      206701 :          t72 = omega**2
    2757      206701 :          t73 = beta*t72
    2758      206701 :          t74 = t73*t10
    2759      206701 :          t75 = t71 + t74
    2760      206701 :          t77 = 0.1e1_dp/A
    2761      206701 :          Q = f94*t75*t77
    2762      206701 :          t78 = rho**(0.1e1_dp/0.3e1_dp)
    2763      206701 :          t80 = t78*rho*f89
    2764      206701 :          t81 = B*f12
    2765      206701 :          t82 = t71 + DD
    2766      206701 :          t83 = 0.1e1_dp/t82
    2767      206701 :          t84 = t81*t83
    2768      206701 :          t85 = F2*t34
    2769      206701 :          t87 = F1 + t85*t68
    2770      206701 :          t88 = t15*t87
    2771      206701 :          t90 = t11*t88 + r1
    2772      206701 :          t91 = f12*t90
    2773      206701 :          t92 = t82**2
    2774      206701 :          t93 = 0.1e1_dp/t92
    2775      206701 :          t94 = C*t93
    2776      206701 :          t95 = t91*t94
    2777      206701 :          t96 = g2*t1
    2778      206701 :          t97 = t96*t3
    2779      206701 :          t99 = g3*t21
    2780      206701 :          t100 = t99*t24
    2781      206701 :          t102 = g1 + t97*t19 + t100*t32
    2782      206701 :          t103 = t15*t102
    2783      206701 :          t105 = t11*t103 + r1
    2784      206701 :          t106 = t105*E
    2785      206701 :          t108 = 0.1e1_dp/t92/t82
    2786      206701 :          t109 = t106*t108
    2787      206701 :          t110 = f158*E
    2788      206701 :          t111 = t105*t83
    2789      206701 :          t112 = t72*t10
    2790      206701 :          t113 = t71 + DD + t112
    2791      206701 :          t114 = t113**2
    2792      206701 :          t115 = t114**2
    2793      206701 :          t116 = t115*t113
    2794      206701 :          t117 = SQRT(t116)
    2795      206701 :          t118 = 0.1e1_dp/t117
    2796      206701 :          t121 = SQRT(t113)
    2797      206701 :          t122 = 0.1e1_dp/t121
    2798      206701 :          t125 = f68*C
    2799      206701 :          t126 = t90*t83
    2800      206701 :          t127 = t114*t113
    2801      206701 :          t128 = SQRT(t127)
    2802      206701 :          t129 = 0.1e1_dp/t128
    2803             :          t133 = (-t110*t111*t118 - t81*t83*t122 - t125*t126*t129) &
    2804      206701 :                 *omega
    2805      206701 :          t134 = 0.1e1_dp/t8
    2806      206701 :          t136 = f52*E
    2807      206701 :          t137 = t105*t93
    2808      206701 :          t140 = f12*C
    2809      206701 :          t141 = t90*t93
    2810      206701 :          t145 = t72*omega
    2811      206701 :          t146 = (-t136*t137*t118 - t140*t141*t129)*t145
    2812      206701 :          t149 = 0.1e1_dp/r3/t5
    2813      206701 :          t151 = t149/rho
    2814      206701 :          t153 = t72**2
    2815      206701 :          t154 = t153*omega
    2816      206701 :          t155 = t118*t154
    2817      206701 :          t156 = t155*t44
    2818      206701 :          t158 = f12*A
    2819      206701 :          t159 = exei(Q)
    2820      206701 :          t160 = t71 + DD + t74
    2821      206701 :          t161 = 0.1e1_dp/t160
    2822      206701 :          t163 = LOG(t75*t161)
    2823      206701 :          t166 = rootpi
    2824      206701 :          t167 = SQRT(t160)
    2825      206701 :          t171 = SQRT(A)
    2826      206701 :          t172 = t171*f34
    2827      206701 :          t173 = exer(Q)
    2828      206701 :          t176 = (t158*t166/t167 - t172*t173)*alpha1
    2829      206701 :          t177 = omega*t134
    2830      206701 :          t182 = (t158*t161 - f98*t159)*alpha2
    2831      206701 :          t184 = A*f14
    2832      206701 :          t185 = t160**2
    2833      206701 :          t186 = t185*t160
    2834      206701 :          t187 = SQRT(t186)
    2835      206701 :          t190 = SQRT(t75)
    2836      206701 :          t191 = 0.1e1_dp/t190
    2837      206701 :          t196 = 0.1e1_dp/t171
    2838             :          t200 = (t166*(t184/t187 - f98*t191) + f2716*t173*t196)* &
    2839      206701 :                 alpha3*t145
    2840      206701 :          t202 = 0.1e1_dp/t75
    2841      206701 :          t204 = 0.1e1_dp/t185
    2842      206701 :          t206 = f8132*t77
    2843      206701 :          t209 = (-f98*t202 + t158*t204 + t206*t159)*alpha4
    2844      206701 :          t210 = t153*t27
    2845      206701 :          t213 = t75**2
    2846      206701 :          t214 = t213*t75
    2847      206701 :          t215 = SQRT(t214)
    2848      206701 :          t216 = 0.1e1_dp/t215
    2849      206701 :          t218 = f38*A
    2850      206701 :          t219 = t185**2
    2851      206701 :          t220 = t219*t160
    2852      206701 :          t221 = SQRT(t220)
    2853      206701 :          t226 = A**2
    2854      206701 :          t227 = t226*A
    2855      206701 :          t228 = SQRT(t227)
    2856      206701 :          t230 = f24364/t228
    2857             :          t233 = (t166*(t206*t191 - f916*t216 + t218/t221) - t230*t173) &
    2858      206701 :                 *alpha5
    2859      206701 :          t234 = t154*t44
    2860      206701 :          t236 = 0.1e1_dp/t186
    2861      206701 :          t238 = 0.1e1_dp/t213
    2862      206701 :          t239 = f98*t238
    2863      206701 :          t243 = f729128/t226
    2864      206701 :          t247 = t153*t72
    2865             :          t248 = (A*t236 - t239 + t206*r1*t202 - t243*t159)*alpha6 &
    2866      206701 :                 *t247
    2867      206701 :          t249 = t60*t13
    2868      206701 :          t251 = f1516*A
    2869      206701 :          t252 = t219*t186
    2870      206701 :          t253 = SQRT(t252)
    2871      206701 :          t256 = t213**2
    2872      206701 :          t257 = t256*t75
    2873      206701 :          t258 = SQRT(t257)
    2874      206701 :          t261 = f8164*t77
    2875      206701 :          t266 = t226**2
    2876      206701 :          t268 = SQRT(t266*A)
    2877      206701 :          t270 = f2187256/t268
    2878             :          t273 = (t166*(t251/t253 - f2732/t258 + t261*t216 - t243*t191) &
    2879      206701 :                  + t270*t173)*alpha7
    2880      206701 :          t274 = t153*t145
    2881      206701 :          t275 = t56*t58
    2882      206701 :          t276 = t275*t12
    2883      206701 :          t278 = 0.1e1_dp/t8/t276
    2884      206701 :          t279 = t274*t278
    2885      206701 :          t281 = r3*A
    2886      206701 :          t282 = 0.1e1_dp/t219
    2887      206701 :          t284 = 0.1e1_dp/t214
    2888      206701 :          t289 = f6561512/t227
    2889             :          t292 = (t281*t282 - f94*t284 + t206*t238 - t243*t202 + t289 &
    2890      206701 :                  *t159)*alpha8
    2891      206701 :          t293 = t153**2
    2892      206701 :          t295 = 0.1e1_dp/t9/t276
    2893      206701 :          t296 = t293*t295
    2894             :          t298 = t84 + t95 + t109 + t133*t134 + t146*t151 - t109*t156 + &
    2895             :                 t158*(t159 + t163) + t176*t177 + t182*t112 + t200*t151 + &
    2896      206701 :                 t209*t210 + t233*t234 + t248*t249 + t273*t279 + t292*t296
    2897      206701 :          t299 = t298*Clda
    2898      206701 :          e_0 = e_0 + (-t80*t299)*sx
    2899             :       END IF
    2900      206701 :       IF (order >= 1 .OR. order == -1) THEN
    2901      204423 :          t301 = t44*t13
    2902      204423 :          t302 = t4*t301
    2903      204423 :          t303 = t14*t34
    2904      204423 :          t305 = t68*r3*t5
    2905      204423 :          t306 = t303*t305
    2906      204423 :          t308 = 0.2e1_dp/0.3e1_dp*t302*t306
    2907      204423 :          t309 = t12*rho
    2908      204423 :          t310 = 0.1e1_dp/t309
    2909      204423 :          t311 = t310*t14
    2910      204423 :          t312 = t311*t69
    2911      204423 :          t314 = 2._dp*t11*t312
    2912      204423 :          t315 = t3*t44
    2913      204423 :          t316 = t16*t315
    2914      204423 :          t317 = t15*t6
    2915      204423 :          t320 = t10*t310
    2916      204423 :          t321 = t320*t14
    2917      204423 :          t324 = t24*t278
    2918      204423 :          t325 = t22*t324
    2919      204423 :          t326 = t29*t31
    2920      204423 :          t327 = t326*t6
    2921      204423 :          t331 = t27*t46*t31
    2922             :          t334 = -0.2e1_dp/0.3e1_dp*t316*t317 - (2._dp*t17*t321) - 0.4e1_dp &
    2923      204423 :                 /0.3e1_dp*t325*t327 - (4._dp*t25*t331)
    2924      204423 :          t335 = t334*t68
    2925      204423 :          t336 = t15*t335
    2926      204423 :          t337 = t11*t336
    2927      204423 :          t338 = t4*t18
    2928      204423 :          t339 = t67**2
    2929      204423 :          t340 = 0.1e1_dp/t339
    2930      204423 :          t341 = t35*t324
    2931      204423 :          t346 = t41*t295
    2932      204423 :          t347 = t39*t346
    2933      204423 :          t348 = t46*t48
    2934      204423 :          t349 = t348*t6
    2935      204423 :          t353 = 0.1e1_dp/t28/t12
    2936      204423 :          t355 = t44*t353*t48
    2937      204423 :          t361 = t60/t61/rho*t63
    2938             :          t364 = -0.4e1_dp/0.3e1_dp*t341*t327 - (4._dp*t36*t331) - 0.5e1_dp &
    2939      204423 :                 /0.3e1_dp*t347*t349 - (5._dp*t42*t355) - (8._dp*t55*t361)
    2940      204423 :          t365 = t340*t364
    2941      204423 :          t366 = t303*t365
    2942      204423 :          t367 = t338*t366
    2943      204423 :          t369 = t44*r3*t5
    2944      204423 :          t372 = -t308 - t314 + t337 - t367 - 0.2e1_dp/0.3e1_dp*t73*t369
    2945      204423 :          dQrho = f94*t372*t77
    2946      204423 :          t374 = ndrho*t3
    2947      204423 :          t375 = t374*t10
    2948      204423 :          t378 = a1*ndrho
    2949      204423 :          t379 = t378*t3
    2950      204423 :          t382 = t1*ndrho
    2951      204423 :          t383 = a2*t382
    2952      204423 :          t384 = t383*t24
    2953      204423 :          t387 = 2._dp*t379*t19 + 4._dp*t384*t32
    2954      204423 :          t388 = t387*t68
    2955      204423 :          t389 = t15*t388
    2956      204423 :          t391 = a3*t382
    2957      204423 :          t392 = t391*t24
    2958      204423 :          t395 = a4*t21
    2959      204423 :          t396 = t395*t41
    2960      204423 :          t400 = a5*t38*t54
    2961      204423 :          t403 = 4._dp*t392*t32 + 5._dp*t396*t49 + 6._dp*t400*t65
    2962      204423 :          t404 = t340*t403
    2963      204423 :          t405 = t303*t404
    2964      204423 :          t407 = 2._dp*t375*t70 + t11*t389 - t338*t405
    2965      204423 :          dQndrho = f94*t407*t77
    2966      204423 :          t409 = t78*f89
    2967      204423 :          t413 = t27*r3*t5
    2968      204423 :          t416 = t14*t102
    2969      204423 :          t417 = t416*t6
    2970      204423 :          t420 = t311*t102
    2971      204423 :          t423 = t96*t315
    2972      204423 :          t428 = t99*t324
    2973             :          t433 = -0.2e1_dp/0.3e1_dp*t423*t317 - (2._dp*t97*t321) - 0.4e1_dp &
    2974      204423 :                 /0.3e1_dp*t428*t327 - (4._dp*t100*t331)
    2975      204423 :          t434 = t15*t433
    2976             :          t436 = -0.2e1_dp/0.3e1_dp*t302*t417 - (2._dp*t11*t420) + (t11 &
    2977      204423 :                                                                    *t434)
    2978      204423 :          t440 = t136*t105
    2979      204423 :          t441 = t108*t118
    2980      204423 :          t442 = -t308 - t314 + t337 - t367
    2981      204423 :          t443 = t441*t442
    2982      204423 :          t447 = 0.1e1_dp/t117/t116
    2983      204423 :          t448 = t93*t447
    2984      204423 :          t452 = -t308 - t314 + t337 - t367 - 0.2e1_dp/0.3e1_dp*t72*t44*t6
    2985      204423 :          t453 = t115*t452
    2986      204423 :          t454 = t448*t453
    2987      204423 :          t457 = t14*t87
    2988      204423 :          t458 = t457*t6
    2989      204423 :          t461 = t311*t87
    2990      204423 :          t464 = F2*t334
    2991      204423 :          t467 = t464*t68 - t85*t365
    2992      204423 :          t468 = t15*t467
    2993             :          t470 = -0.2e1_dp/0.3e1_dp*t302*t458 - (2._dp*t11*t461) + (t11 &
    2994      204423 :                                                                    *t468)
    2995      204423 :          t474 = t140*t90
    2996      204423 :          t475 = t108*t129
    2997      204423 :          t476 = t475*t442
    2998      204423 :          t480 = 0.1e1_dp/t128/t127
    2999      204423 :          t481 = t93*t480
    3000      204423 :          t482 = t114*t452
    3001      204423 :          t483 = t481*t482
    3002             :          t487 = (-t136*t436*t93*t118 + (2._dp*t440*t443) + 0.5e1_dp/ &
    3003             :                  0.2e1_dp*(t440)*(t454) - t140*t470*t93*t129 + (2._dp &
    3004      204423 :                                                                 *t474*t476) + 0.3e1_dp/0.2e1_dp*(t474)*(t483))*t145
    3005      204423 :          t489 = t209*t153
    3006      204423 :          t491 = t278*r3*t5
    3007      204423 :          t496 = t166/t167/t160
    3008      204423 :          t500 = dexerrho(Q, dQrho)
    3009      204423 :          t503 = (-t158*t496*t372/0.2e1_dp - t172*t500)*alpha1
    3010      204423 :          t505 = t106*t441
    3011      204423 :          t506 = t154*t295
    3012      204423 :          t507 = t506*t6
    3013      204423 :          t510 = f12*t470
    3014      204423 :          t512 = t92**2
    3015      204423 :          t513 = 0.1e1_dp/t512
    3016      204423 :          t514 = t106*t513
    3017      204423 :          t516 = t155*t44*t442
    3018      204423 :          t519 = t149*t13
    3019      204423 :          t522 = 0.1e1_dp/t253/t252
    3020      204423 :          t523 = t219*t185
    3021      204423 :          t524 = t522*t523
    3022      204423 :          t530 = f2732/t258/t257
    3023      204423 :          t531 = t256*t372
    3024      204423 :          t535 = 0.1e1_dp/t215/t214
    3025      204423 :          t536 = t535*t213
    3026      204423 :          t541 = 0.1e1_dp/t190/t75
    3027      204423 :          t542 = t541*t372
    3028             :          t549 = (t166*(-0.7e1_dp/0.2e1_dp*t251*t524*t372 + 0.5e1_dp/0.2e1_dp &
    3029             :                        *t530*t531 - 0.3e1_dp/0.2e1_dp*t261*t536*t372 + t243*t542 &
    3030      204423 :                        /0.2e1_dp) + t270*t500)*alpha7
    3031      204423 :          t551 = C*t108
    3032      204423 :          t552 = t551*t442
    3033      204423 :          t558 = t436*E
    3034      204423 :          t559 = t558*t108
    3035      204423 :          t561 = 0.1e1_dp/t220
    3036      204423 :          t565 = 0.1e1_dp/t256
    3037      204423 :          t566 = f94*t565
    3038      204423 :          t569 = t284*t372
    3039      204423 :          t574 = dexeirho(Q, dQrho)
    3040             :          t577 = (-4._dp*t281*t561*t372 + 3._dp*t566*t372 - 2._dp*t206*t569 &
    3041      204423 :                  + t243*t238*t372 + t289*t574)*alpha8
    3042             :          t579 = -t133*t413/0.3e1_dp + t487*t151 - 0.4e1_dp/0.3e1_dp*t489* &
    3043             :                 t491 + t503*t177 + 0.5e1_dp/0.3e1_dp*t505*t507 + t510*t94 + (3._dp &
    3044             :                                                                             *t514*t516) - t146*t519 + t549*t279 - (2._dp*t91*t552) &
    3045             :                 - t81*t93*t442 - t200*t519 - t559*t156 + t577*t296 &
    3046      204423 :                 + t559
    3047      204423 :          t583 = t110*t105
    3048      204423 :          t584 = t93*t118
    3049      204423 :          t585 = t584*t442
    3050      204423 :          t587 = t83*t447
    3051      204423 :          t588 = t587*t453
    3052      204423 :          t591 = t93*t122
    3053      204423 :          t595 = 0.1e1_dp/t121/t113
    3054      204423 :          t596 = t83*t595
    3055      204423 :          t603 = t125*t90
    3056      204423 :          t604 = t93*t129
    3057      204423 :          t605 = t604*t442
    3058      204423 :          t607 = t83*t480
    3059      204423 :          t608 = t607*t482
    3060             :          t612 = (-t110*t436*t83*t118 + t583*t585 + 0.5e1_dp/0.2e1_dp*t583 &
    3061             :                  *t588 + t81*t591*t442 + t81*t596*t452/0.2e1_dp - t125 &
    3062             :                  *t470*t83*t129 + t603*t605 + 0.3e1_dp/0.2e1_dp*t603*t608)* &
    3063      204423 :                 omega
    3064      204423 :          t615 = t236*t372
    3065      204423 :          t620 = (t239*t372 - 2._dp*t158*t615 + t206*t574)*alpha4
    3066      204423 :          t622 = t513*t442
    3067      204423 :          t626 = t75*t204
    3068      204423 :          t628 = t372*t161 - t626*t372
    3069      204423 :          t629 = t628*t202
    3070      204423 :          t633 = t233*t154
    3071      204423 :          t634 = t295*r3
    3072      204423 :          t635 = t634*t5
    3073      204423 :          t638 = A*t282
    3074      204423 :          t641 = f98*t284
    3075      204423 :          t644 = r1*t238
    3076             :          t650 = (-3._dp*t638*t372 + 2._dp*t641*t372 - t206*t644*t372 - t243 &
    3077      204423 :                  *t574)*alpha6*t247
    3078      204423 :          t652 = t204*t372
    3079      204423 :          t656 = (-t158*t652 - f98*t574)*alpha2
    3080      204423 :          t658 = t108*t447
    3081      204423 :          t659 = t106*t658
    3082      204423 :          t660 = t234*t453
    3083      204423 :          t665 = f916*t535
    3084      204423 :          t670 = 0.1e1_dp/t221/t220
    3085      204423 :          t671 = t670*t219
    3086             :          t679 = (t166*(-t206*t542/0.2e1_dp + 0.3e1_dp/0.2e1_dp*t665*t213 &
    3087      204423 :                        *t372 - 0.5e1_dp/0.2e1_dp*t218*t671*t372) - t230*t500)*alpha5
    3088      204423 :          t681 = t292*t293
    3089      204423 :          t685 = t56*r3*t58*t5*t309
    3090      204423 :          t687 = 0.1e1_dp/t9/t685
    3091      204423 :          t689 = t687*r3*t5
    3092      204423 :          t692 = t60*t310
    3093      204423 :          t695 = t273*t274
    3094      204423 :          t697 = 0.1e1_dp/t8/t685
    3095      204423 :          t699 = t697*r3*t5
    3096      204423 :          t702 = t176*omega
    3097      204423 :          t705 = t182*t72
    3098      204423 :          t709 = 0.1e1_dp/t187/t186
    3099      204423 :          t710 = t709*t185
    3100      204423 :          t714 = f98*t541
    3101             :          t723 = (t166*(-0.3e1_dp/0.2e1_dp*t184*t710*t372 + t714*t372/ &
    3102      204423 :                        0.2e1_dp) + f2716*t500*t196)*alpha3*t145
    3103             :          t725 = t612*t134 + t620*t210 - (3._dp*t106*t622) + t158*(t574 &
    3104             :                                                                   + t629*t160) - 0.5e1_dp/0.3e1_dp*t633*t635 + t650*t249 + &
    3105             :                 t656*t112 + 0.5e1_dp/0.2e1_dp*t659*t660 + t679*t234 - 0.8e1_dp/ &
    3106             :                 0.3e1_dp*t681*t689 - (2._dp*t248*t692) - 0.7e1_dp/0.3e1_dp*t695 &
    3107             :                 *t699 - t702*t413/0.3e1_dp - 0.2e1_dp/0.3e1_dp*t705*t369 + t723 &
    3108      204423 :                 *t151
    3109      204423 :          t727 = (t579 + t725)*Clda
    3110      204423 :          e_rho = e_rho + (-0.4e1_dp/0.3e1_dp*t409*t299 - t80*t727)*sx
    3111      204423 :          t733 = F2*t387
    3112      204423 :          t736 = t733*t68 - t85*t404
    3113      204423 :          t737 = t15*t736
    3114      204423 :          t739 = 2._dp*t375*t88 + t11*t737
    3115      204423 :          t740 = f12*t739
    3116      204423 :          t742 = t551*t407
    3117      204423 :          t747 = g2*ndrho
    3118      204423 :          t748 = t747*t3
    3119      204423 :          t751 = g3*t382
    3120      204423 :          t752 = t751*t24
    3121      204423 :          t755 = 2._dp*t748*t19 + 4._dp*t752*t32
    3122      204423 :          t756 = t15*t755
    3123      204423 :          t758 = 2._dp*t375*t103 + t11*t756
    3124      204423 :          t759 = t758*E
    3125      204423 :          t760 = t759*t108
    3126      204423 :          t761 = t513*t407
    3127      204423 :          t767 = t584*t407
    3128      204423 :          t769 = t115*t407
    3129      204423 :          t770 = t587*t769
    3130      204423 :          t781 = t604*t407
    3131      204423 :          t783 = t114*t407
    3132      204423 :          t784 = t607*t783
    3133             :          t788 = (-t110*t758*t83*t118 + t583*t767 + 0.5e1_dp/0.2e1_dp*t583 &
    3134             :                  *t770 + t81*t591*t407 + t81*t596*t407/0.2e1_dp - t125 &
    3135             :                  *t739*t83*t129 + t603*t781 + 0.3e1_dp/0.2e1_dp*t603*t784)* &
    3136      204423 :                 omega
    3137      204423 :          t793 = t441*t407
    3138      204423 :          t796 = t448*t769
    3139      204423 :          t802 = t475*t407
    3140      204423 :          t805 = t481*t783
    3141             :          t809 = (-t136*t758*t93*t118 + (2._dp*t440*t793) + 0.5e1_dp/ &
    3142             :                  0.2e1_dp*(t440)*(t796) - t140*t739*t93*t129 + (2._dp &
    3143      204423 :                                                                 *t474*t802) + 0.3e1_dp/0.2e1_dp*(t474)*(t805))*t145
    3144      204423 :          t813 = t155*t44*t407
    3145      204423 :          t816 = t234*t769
    3146      204423 :          t819 = dexeindrho(Q, dQndrho)
    3147      204423 :          t822 = t407*t161 - t626*t407
    3148      204423 :          t823 = t822*t202
    3149      204423 :          t830 = dexerndrho(Q, dQndrho)
    3150      204423 :          t833 = (-t158*t496*t407/0.2e1_dp - t172*t830)*alpha1
    3151      204423 :          t839 = (-t158*t204*t407 - f98*t819)*alpha2
    3152             :          t852 = (t166*(-0.3e1_dp/0.2e1_dp*t184*t710*t407 + t714*t407/ &
    3153      204423 :                        0.2e1_dp) + f2716*t830*t196)*alpha3*t145
    3154      204423 :          t860 = (t239*t407 - 2._dp*t158*t236*t407 + t206*t819)*alpha4
    3155      204423 :          t862 = t541*t407
    3156             :          t875 = (t166*(-t206*t862/0.2e1_dp + 0.3e1_dp/0.2e1_dp*t665*t213 &
    3157      204423 :                        *t407 - 0.5e1_dp/0.2e1_dp*t218*t671*t407) - t230*t830)*alpha5
    3158             :          t886 = (-3._dp*t638*t407 + 2._dp*t641*t407 - t206*t644*t407 - t243 &
    3159      204423 :                  *t819)*alpha6*t247
    3160             :          t903 = (t166*(-0.7e1_dp/0.2e1_dp*t251*t524*t407 + 0.5e1_dp/0.2e1_dp &
    3161             :                        *t530*t256*t407 - 0.3e1_dp/0.2e1_dp*t261*t536*t407 + t243 &
    3162      204423 :                        *t862/0.2e1_dp) + t270*t830)*alpha7
    3163             :          t917 = (-4._dp*t281*t561*t407 + 3._dp*t566*t407 - 2._dp*t206*t284 &
    3164      204423 :                  *t407 + t243*t238*t407 + t289*t819)*alpha8
    3165             :          t919 = -t81*t93*t407 + t740*t94 - (2._dp*t91*t742) + t760 &
    3166             :                 - (3._dp*t106*t761) + t788*t134 + t809*t151 - t760*t156 &
    3167             :                 + (3._dp*t514*t813) + 0.5e1_dp/0.2e1_dp*t659*t816 + t158*(t819 &
    3168             :                                                                           + t823*t160) + t833*t177 + t839*t112 + t852*t151 + t860 &
    3169      204423 :                 *t210 + t875*t234 + t886*t249 + t903*t279 + t917*t296
    3170      204423 :          t920 = t919*Clda
    3171      204423 :          e_ndrho = e_ndrho + (-t80*t920)*sx
    3172             :       END IF
    3173      206701 :       IF (order >= 2 .OR. order == -2) THEN
    3174           0 :          t923 = t4*t295*t13
    3175           0 :          t928 = 0.10e2_dp/0.9e1_dp*t923*t303*t68*t56*t58
    3176           0 :          t930 = t4*t44*t310
    3177           0 :          t932 = 0.8e1_dp/0.3e1_dp*t930*t306
    3178           0 :          t933 = t14*t334
    3179           0 :          t936 = 0.4e1_dp/0.3e1_dp*t302*t933*t305
    3180           0 :          t938 = t4*t301*t14
    3181           0 :          t939 = t34*t340
    3182           0 :          t943 = 0.4e1_dp/0.3e1_dp*t938*t939*t6*t364
    3183           0 :          t944 = t29*t14
    3184           0 :          t947 = 6._dp*t11*t944*t69
    3185           0 :          t950 = 4._dp*t11*t311*t335
    3186           0 :          t951 = t4*t320
    3187           0 :          t953 = 4._dp*t951*t366
    3188           0 :          t954 = t3*t295
    3189           0 :          t956 = t15*t275
    3190           0 :          t959 = t311*t6
    3191           0 :          t963 = t10*t29*t14
    3192           0 :          t966 = t24*t697
    3193           0 :          t968 = t326*t275
    3194           0 :          t972 = t46*t31*t6
    3195           0 :          t976 = t27*t353*t31
    3196             :          t979 = 0.10e2_dp/0.9e1_dp*t16*t954*t956 + 0.8e1_dp/0.3e1_dp*t316* &
    3197             :                 t959 + (6._dp*t17*t963) + 0.28e2_dp/0.9e1_dp*t22*t966*t968 + &
    3198           0 :                 0.32e2_dp/0.3e1_dp*t325*t972 + (20._dp*t25*t976)
    3199           0 :          t982 = t11*t15*t979*t68
    3200           0 :          t985 = 2._dp*t338*t933*t365
    3201           0 :          t987 = 0.1e1_dp/t339/t67
    3202           0 :          t988 = t364**2
    3203           0 :          t989 = t987*t988
    3204           0 :          t992 = 2._dp*t338*t303*t989
    3205             :          t1022 = t340*(0.28e2_dp/0.9e1_dp*t35*t966*t968 + 0.32e2_dp/0.3e1_dp &
    3206             :                        *t341*t972 + (20._dp*t36*t976) + 0.40e2_dp/0.9e1_dp*t39*t41 &
    3207             :                        *t687*t348*t275 + 0.50e2_dp/0.3e1_dp*t347*t353*t48*t6 + &
    3208             :                        0.30e2_dp*t42*t44/t28/t309*t48 + (72._dp*t55*t60/t61 &
    3209           0 :                                                          /t12*t63))
    3210           0 :          t1024 = t338*t303*t1022
    3211           0 :          t1026 = t295*t56*t58
    3212             :          t1029 = t928 + t932 - t936 + t943 + t947 - t950 + t953 + t982 - t985 &
    3213           0 :                  + t992 - t1024 + 0.10e2_dp/0.9e1_dp*t73*t1026
    3214           0 :          d2Qrhorho = f94*t1029*t77
    3215           0 :          t1031 = t374*t301
    3216           0 :          t1034 = t14*t387
    3217             :          t1061 = -0.4e1_dp/0.3e1_dp*t378*t315*t317 - (4._dp*t379*t321) &
    3218           0 :                  - 0.16e2_dp/0.3e1_dp*t383*t324*t327 - (16._dp*t384*t331)
    3219           0 :          t1067 = t374*t18
    3220           0 :          t1073 = t987*t364*t403
    3221             :          t1090 = t340*(-0.16e2_dp/0.3e1_dp*t391*t324*t327 - (16._dp*t392 &
    3222             :                                                              *t331) - 0.25e2_dp/0.3e1_dp*t395*t346*t349 - (25._dp*t396 &
    3223           0 :                                                                                                         *t355) - (48._dp*t400*t361))
    3224             :          t1093 = -0.4e1_dp/0.3e1_dp*t1031*t306 - 0.2e1_dp/0.3e1_dp*t302*t1034 &
    3225             :                  *t305 + 0.2e1_dp/0.3e1_dp*t938*t939*t6*t403 - (4._dp*t375 &
    3226             :                                                                 *t312) - (2._dp*t11*t311*t388) + (2._dp*t951*t405) + (2._dp &
    3227             :                                                                                      *t375*t336) + (t11*t15*t1061*t68) - t338*t933 &
    3228             :                  *t404 - (2._dp*t1067*t366) - t338*t1034*t365 + 0.2e1_dp*t338 &
    3229           0 :                  *t303*t1073 - t338*t303*t1090
    3230           0 :          d2Qrhondrho = f94*t1093*t77
    3231           0 :          t1095 = t3*t10
    3232           0 :          t1111 = 2._dp*a1*t3*t19 + 12._dp*a2*t1*t24*t32
    3233           0 :          t1118 = t403**2
    3234           0 :          t1119 = t987*t1118
    3235             :          t1136 = t340*(12._dp*a3*t1*t24*t32 + 20._dp*a4*t382*t41*t49 &
    3236           0 :                        + 30._dp*a5*t21*t54*t65)
    3237             :          t1139 = 2._dp*t1095*t13*t303*t68 + 4._dp*t375*t389 - 4._dp*t1067 &
    3238             :                  *t405 + t11*t15*t1111*t68 - 2._dp*t338*t1034*t404 + 2._dp*t338 &
    3239           0 :                  *t303*t1119 - t338*t303*t1136
    3240           0 :          d2Qndrhondrho = f94*t1139*t77
    3241           0 :          t1141 = t78**2
    3242           0 :          t1149 = 0.1e1_dp/t512/t82
    3243           0 :          t1150 = t106*t1149
    3244           0 :          t1151 = t442**2
    3245           0 :          t1157 = 0.1e1_dp/t190/t213
    3246           0 :          t1158 = t372**2
    3247           0 :          t1159 = t1157*t1158
    3248           0 :          t1162 = t541*t1029
    3249           0 :          t1167 = 0.1e1_dp/t215/t256/t213
    3250           0 :          t1168 = f916*t1167
    3251           0 :          t1178 = t219**2
    3252           0 :          t1181 = 0.1e1_dp/t221/t1178/t185
    3253           0 :          t1182 = t1181*t1178
    3254           0 :          t1186 = t670*t186
    3255           0 :          t1195 = d2exerrhorho(Q, dQrho, d2Qrhorho)
    3256             :          t1239 = 0.10e2_dp/0.9e1_dp*t923*t416*t275 + 0.8e1_dp/0.3e1_dp*t930 &
    3257             :                  *t417 - 0.4e1_dp/0.3e1_dp*t302*t14*t433*t6 + (6._dp*t11*t944 &
    3258             :                                                                *t102) - 0.4e1_dp*(t11)*t311*t433 + (t11)*t15* &
    3259             :                  (0.10e2_dp/0.9e1_dp*t96*t954*t956 + 0.8e1_dp/0.3e1_dp*t423*t959 &
    3260             :                   + (6._dp*t97*t963) + 0.28e2_dp/0.9e1_dp*t99*t966*t968 + 0.32e2_dp &
    3261           0 :                   /0.3e1_dp*t428*t972 + (20._dp*t100*t976))
    3262           0 :          t1241 = t1239*E*t108
    3263           0 :          t1243 = t278*t56*t58
    3264           0 :          t1251 = t136*t436
    3265           0 :          t1256 = t513*t118
    3266           0 :          t1261 = t136*t105*t108
    3267           0 :          t1262 = t447*t442
    3268           0 :          t1263 = t1262*t453
    3269             :          t1266 = t928 + t932 - t936 + t943 + t947 - t950 + t953 + t982 - t985 &
    3270           0 :                  + t992 - t1024
    3271           0 :          t1270 = t115**2
    3272           0 :          t1273 = 0.1e1_dp/t117/t1270/t114
    3273           0 :          t1274 = t93*t1273
    3274           0 :          t1275 = t452**2
    3275           0 :          t1276 = t1270*t1275
    3276           0 :          t1280 = t127*t1275
    3277             :          t1287 = t928 + t932 - t936 + t943 + t947 - t950 + t953 + t982 - t985 &
    3278           0 :                  + t992 - t1024 + 0.10e2_dp/0.9e1_dp*t72*t295*t275
    3279           0 :          t1288 = t115*t1287
    3280             :          t1317 = 0.10e2_dp/0.9e1_dp*t923*t457*t275 + 0.8e1_dp/0.3e1_dp*t930 &
    3281             :                  *t458 - 0.4e1_dp/0.3e1_dp*t302*t14*t467*t6 + (6._dp*t11*t944 &
    3282             :                                                                *t87) - 0.4e1_dp*(t11)*t311*t467 + (t11*t15*(F2 &
    3283           0 :                                                                           *t979*t68 - 2._dp*t464*t365 + 2._dp*t85*t989 - t85*t1022))
    3284           0 :          t1321 = t140*t470
    3285           0 :          t1326 = t513*t129
    3286           0 :          t1331 = t140*t90*t108
    3287           0 :          t1332 = t480*t442
    3288           0 :          t1333 = t1332*t482
    3289           0 :          t1341 = 0.1e1_dp/t128/t115/t114
    3290           0 :          t1342 = t93*t1341
    3291           0 :          t1343 = t115*t1275
    3292           0 :          t1347 = t113*t1275
    3293           0 :          t1351 = t114*t1287
    3294             :          t1355 = -t136*t1239*t93*t118 + (4._dp*t1251*t443) + (5._dp &
    3295             :                                                               *t1251*t454) - (6._dp*t440*t1256*t1151) - (10._dp*t1261 &
    3296             :                                                                      *t1263) + (2._dp*t440*t441*t1266) - 0.75e2_dp/0.4e1_dp*(t440) &
    3297             :                  *(t1274)*(t1276) + (10._dp*t440*t448*t1280) &
    3298             :                  + 0.5e1_dp/0.2e1_dp*(t440)*(t448)*(t1288) - t140 &
    3299             :                  *t1317*t93*t129 + (4._dp*t1321*t476) + (3._dp*t1321*t483) &
    3300             :                  - (6._dp*t474*t1326*t1151) - (6._dp*t1331*t1333) + &
    3301             :                  (2._dp*t474*t475*t1266) - 0.27e2_dp/0.4e1_dp*(t474)*(t1342) &
    3302             :                  *(t1343) + (3._dp*t474*t481*t1347) + 0.3e1_dp/0.2e1_dp &
    3303           0 :                  *(t474)*(t481)*(t1351)
    3304           0 :          t1362 = t106*t658*t154
    3305           0 :          t1374 = d2exeirhorho(Q, dQrho, d2Qrhorho)
    3306           0 :          t1379 = t558*t658
    3307           0 :          t1382 = t56**2
    3308           0 :          t1383 = t58**2
    3309           0 :          t1385 = t1382*t1383*t28
    3310             :          t1392 = -(12._dp*t1150*t155*t44*t1151) + (t166*(0.3e1_dp/0.4e1_dp &
    3311             :                                                          *t206*t1159 - t206*t1162/0.2e1_dp - 0.27e2_dp/0.4e1_dp*t1168 &
    3312             :                                                          *t256*t1158 + 0.3e1_dp*t665*t75*t1158 + 0.3e1_dp/0.2e1_dp*t665 &
    3313             :                                                          *t213*t1029 + 0.75e2_dp/0.4e1_dp*t218*t1182*t1158 - 0.10e2_dp &
    3314             :                                                          *t218*t1186*t1158 - 0.5e1_dp/0.2e1_dp*t218*t671*t1029) - t230 &
    3315             :                                                    *t1195)*alpha5*t234 + 0.28e2_dp/0.9e1_dp*t489*t697*t56 &
    3316             :                  *t58 + 0.10e2_dp/0.3e1_dp*t558*t441*t507 + t1241 + 0.4e1_dp/0.9e1_dp &
    3317             :                  *t702*t1243 + 0.4e1_dp/0.9e1_dp*t133*t1243 + t1355*t145*t151 &
    3318             :                  - (2._dp*t91*t551*t1266) - 0.25e2_dp/0.3e1_dp*t1362*t295 &
    3319             :                  *t115*t452*r3*t5 + (0.2e1_dp*t158*t236*t1158 - t158*t204 &
    3320             :                                      *t1029 - f98*t1374)*alpha2*t112 + (5._dp*t1379*t660) &
    3321           0 :                  + 0.70e2_dp/0.9e1_dp*t695/t8/t1385*t56*t58
    3322           0 :          t1397 = t106*t108*t1273
    3323           0 :          t1407 = t110*t436
    3324           0 :          t1417 = t110*t137
    3325           0 :          t1426 = t83*t1273
    3326           0 :          t1430 = t108*t122
    3327           0 :          t1434 = t81*t93
    3328           0 :          t1435 = t595*t442
    3329             :          t1438 = -t110*t1239*t83*t118 + (2._dp*t1407*t585) + (5._dp &
    3330             :                                                               *t1407*t588) - (2._dp*t583*t441*t1151) + (t583*t584 &
    3331             :                                                                           *t1266) - (5._dp*t1417*t1263) + (10._dp*t583*t587*t1280) &
    3332             :                  + 0.5e1_dp/0.2e1_dp*(t583)*(t587)*(t1288) - 0.75e2_dp &
    3333             :                  /0.4e1_dp*(t583)*(t1426)*(t1276) - (2._dp*t81 &
    3334           0 :                                                      *t1430*t1151) - t1434*t1435*t452
    3335           0 :          t1442 = 0.1e1_dp/t121/t114
    3336           0 :          t1443 = t83*t1442
    3337           0 :          t1453 = t125*t470
    3338           0 :          t1469 = t83*t1341
    3339           0 :          t1473 = t125*t141
    3340             :          t1476 = t81*t591*(t1266) - 0.3e1_dp/0.4e1_dp*t81*t1443*t1275 &
    3341             :                  + t81*t596*t1287/0.2e1_dp - t125*t1317*t83*t129 + (2._dp &
    3342             :                                                                     *t1453*t605) + (3._dp*t1453*t608) - (2._dp*t603*t475 &
    3343             :                                                                              *t1151) + (t603*t604*t1266) + (3._dp*t603*t607*t1347) &
    3344             :                  + 0.3e1_dp/0.2e1_dp*(t603)*(t607)*(t1351) - 0.27e2_dp &
    3345             :                  /0.4e1_dp*(t603)*(t1469)*(t1343) - (3._dp*t1473 &
    3346           0 :                                                      *t1333)
    3347             :          t1517 = -0.16e2_dp/0.3e1_dp*t577*t293*t689 - 0.75e2_dp/0.4e1_dp*t1397 &
    3348             :                  *t234*t1276 + 0.5e1_dp/0.2e1_dp*t659*t234*t1288 + (t1438 + &
    3349             :                                                                     t1476)*omega*t134 + f12*t1317*t94 - (4._dp*t650*t692) &
    3350             :                  - 0.14e2_dp/0.3e1_dp*t549*t274*t699 + (12._dp*t106*t1149* &
    3351             :                                                         t1151) - (3._dp*t106*t513*t1266) - 0.40e2_dp/0.9e1_dp*t505*t154 &
    3352             :                  *t687*t275 + ((-2._dp*t641*t1158 + t239*t1029 + 6._dp*t158 &
    3353             :                                 *t282*t1158 - 2._dp*t158*t236*t1029 + t206*t1374)*alpha4 &
    3354             :                                *t210) - (6._dp*t558*t622) + (6._dp*t248*t60*t29) - &
    3355           0 :                  (4._dp*t510*t552)
    3356           0 :          t1519 = t149*t310
    3357           0 :          t1538 = t75*t236
    3358           0 :          t1545 = t628*t238
    3359           0 :          t1546 = t160*t372
    3360           0 :          t1552 = 0.1e1_dp/t167/t185
    3361           0 :          t1553 = t166*t1552
    3362             :          t1577 = (2._dp*t146*t1519) - (2._dp*t723*t519) + 0.10e2_dp/0.9e1_dp &
    3363             :                  *t705*t1026 - t1241*t156 - 0.10e2_dp/0.3e1_dp*t679*t154 &
    3364             :                  *t635 - 0.2e1_dp/0.3e1_dp*t503*omega*t413 + (2._dp*t200*t1519) &
    3365             :                  + (t158*(t1374 + (t1029*t161 - 2._dp*t1158*t204 + 2._dp* &
    3366             :                                    t1538*t1158 - t626*t1029)*t202*t160 - t1545*t1546 + t629 &
    3367             :                           *t372)) + (0.3e1_dp/0.4e1_dp*(t158)*(t1553)*(t1158) &
    3368             :                                      - (t158*t496*t1029)/0.2e1_dp - t172*t1195)*alpha1*t177 &
    3369             :                  - 0.8e1_dp/0.3e1_dp*t620*t153*t491 - t81*t93*t1266 - 0.2e1_dp &
    3370             :                  /0.3e1_dp*t612*t413 + 0.88e2_dp/0.9e1_dp*t681/t9/t1385*t56 &
    3371           0 :                  *t58
    3372           0 :          t1584 = A*t561
    3373           0 :          t1589 = f98*t565
    3374           0 :          t1594 = r1*t284
    3375           0 :          t1613 = 0.1e1_dp/t253/t1178/t523
    3376           0 :          t1614 = t1178*t219
    3377           0 :          t1615 = t1613*t1614
    3378           0 :          t1619 = t522*t220
    3379           0 :          t1626 = t256**2
    3380           0 :          t1630 = f2732/t258/t1626/t213
    3381           0 :          t1640 = t1167*t256
    3382           0 :          t1644 = t535*t75
    3383             :          t1655 = 0.147e3_dp/0.4e1_dp*t251*t1615*t1158 - 0.21e2_dp*t251*t1619 &
    3384             :                  *t1158 - 0.7e1_dp/0.2e1_dp*t251*t524*t1029 - 0.75e2_dp/0.4e1_dp &
    3385             :                  *t1630*t1626*t1158 + 0.10e2_dp*t530*t214*t1158 + 0.5e1_dp/ &
    3386             :                  0.2e1_dp*t530*t256*t1029 + 0.27e2_dp/0.4e1_dp*t261*t1640*t1158 &
    3387             :                  - 0.3e1_dp*t261*t1644*t1158 - 0.3e1_dp/0.2e1_dp*t261*t536*t1029 &
    3388           0 :                  - 0.3e1_dp/0.4e1_dp*t243*t1159 + t243*t1162/0.2e1_dp
    3389           0 :          t1661 = C*t513
    3390           0 :          t1666 = 0.1e1_dp/t187/t523
    3391           0 :          t1667 = t1666*t219
    3392           0 :          t1671 = t709*t160
    3393           0 :          t1678 = f98*t1157
    3394           0 :          t1691 = 0.1e1_dp/t523
    3395           0 :          t1699 = f94/t257
    3396           0 :          t1726 = t106*t1256
    3397           0 :          t1732 = t558*t513
    3398           0 :          t1736 = t106*t513*t447
    3399           0 :          t1737 = t442*t115
    3400             :          t1742 = -(2._dp*t487*t519) + 0.40e2_dp/0.9e1_dp*t633*t687*t56 &
    3401             :                  *t58 + ((12._dp*t1584*t1158 - 3._dp*t638*t1029 - 6._dp*t1589* &
    3402             :                           t1158 + 2._dp*t641*t1029 + 2._dp*t206*t1594*t1158 - t206*t644 &
    3403             :                           *t1029 - t243*t1374)*alpha6*t247*t249) - 0.4e1_dp/0.3e1_dp* &
    3404             :                  t656*t72*t369 + (2._dp*t81*t108*t1151) + (t166*t1655 &
    3405             :                                                            + t270*t1195)*alpha7*t279 + (6._dp*t91*t1661*t1151) + &
    3406             :                  (t166*(0.27e2_dp/0.4e1_dp*(t184)*(t1667)*(t1158) - &
    3407             :                         (3._dp*t184*t1671*t1158) - 0.3e1_dp/0.2e1_dp*(t184)*(t710) &
    3408             :                         *(t1029) - 0.3e1_dp/0.4e1_dp*(t1678)*(t1158) &
    3409             :                         + (t714*t1029)/0.2e1_dp) + f2716*t1195*t196)*alpha3*t145 &
    3410             :                  *t151 + ((20._dp*t281*t1691*t1158 - 4._dp*t281*t561*t1029 &
    3411             :                            - 12._dp*t1699*t1158 + 3._dp*t566*t1029 + 6._dp*t206*t565*t1158 &
    3412             :                            - 2._dp*t206*t284*t1029 - 2._dp*t243*t284*t1158 + t243* &
    3413             :                            t238*t1029 + t289*t1374)*alpha8*t296) + (10._dp*t659*t234 &
    3414             :                                                                     *t1280) + (3._dp*t514*t155*t44*t1266) - (10._dp*t1726 &
    3415             :                                                                             *t506*t442*r3*t5) + (6._dp*t1732*t516) - (15._dp*t1736 &
    3416           0 :                                                                                                                    *t234*t1737*t452)
    3417             :          e_rho_rho = e_rho_rho + (-0.4e1_dp/0.9e1_dp/t1141*f89*t299 - 0.8e1_dp/0.3e1_dp*t409* &
    3418           0 :                                   t727 - t80*(t1392 + t1517 + t1577 + t1742)*Clda)*sx
    3419           0 :          t1756 = t372*t407
    3420           0 :          t1768 = t569*t407
    3421           0 :          t1773 = d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    3422           0 :          t1785 = t1157*t372*t407
    3423           0 :          t1788 = t541*t1093
    3424           0 :          t1791 = t531*t407
    3425           0 :          t1795 = t75*t372*t407
    3426           0 :          t1816 = d2exerrhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    3427           0 :          t1824 = t759*t658
    3428           0 :          t1841 = t442*t407
    3429             :          t1850 = ((20._dp*t281*t1691*t372*t407 - 4._dp*t281*t561*t1093 &
    3430             :                    - 12._dp*t1699*t1756 + 3._dp*t566*t1093 + 6._dp*t206*t565*t372 &
    3431             :                    *t407 - 2._dp*t206*t284*t1093 - 2._dp*t243*t1768 + t243*t238 &
    3432             :                    *t1093 + t289*t1773)*alpha8*t296) - t833*omega*t413 &
    3433             :                  /0.3e1_dp - 0.2e1_dp/0.3e1_dp*t839*t72*t369 + (t166*(0.3e1_dp/0.4e1_dp &
    3434             :                                                                       *(t206)*(t1785) - (t206*t1788)/0.2e1_dp - 0.27e2_dp &
    3435             :                                                                     /0.4e1_dp*t1168*t1791 + (3._dp*t665*t1795) + 0.3e1_dp/0.2e1_dp &
    3436             :                                                                       *(t665)*(t213)*(t1093) + 0.75e2_dp/0.4e1_dp*(t218) &
    3437             :                                                                       *(t1181)*(t1178)*(t372)*(t407) - (10._dp &
    3438             :                                                                              *t218*t670*t186*t372*t407) - 0.5e1_dp/0.2e1_dp*(t218) &
    3439             :                                                                       *(t671)*(t1093)) - t230*t1816)*alpha5*t234 - (3._dp &
    3440             :                                                                          *t106*t513*t1093) + 0.5e1_dp/0.2e1_dp*t1824*t660 - (2._dp &
    3441             :                                                                 *t740*t552) - 0.8e1_dp/0.3e1_dp*t917*t293*t689 - 0.7e1_dp/0.3e1_dp &
    3442             :                  *t903*t274*t699 - 0.15e2_dp/0.2e1_dp*t1736*t234*t453* &
    3443             :                  (t407) - 0.12e2_dp*(t106)*t1149*t118*t234*t1841 + &
    3444           0 :                  0.10e2_dp*t659*t234*t127*t452*(t407)
    3445           0 :          t1885 = t160*t407
    3446             :          t1938 = -0.5e1_dp/0.3e1_dp*t875*t154*t635 + ((12._dp*t1584*t1756 &
    3447             :                                                        - 3._dp*t638*t1093 - 6._dp*t1589*t1756 + 2._dp*t641*t1093 + 2._dp &
    3448             :                                                        *t206*r1*t1768 - t206*t644*t1093 - t243*t1773)*alpha6 &
    3449             :                                                       *t247*t249) - (2._dp*t510*t742) - (t81*t93*t1093) &
    3450             :                  + (t158*(t1773 + (t1093*t161 - 2._dp*t652*t407 + 2._dp*t1538 &
    3451             :                                    *t1756 - t626*t1093)*t202*t160 - t1545*t1885 + t629*t407)) &
    3452             :                  + (0.3e1_dp/0.4e1_dp*(t158)*(t166)*(t1552)*(t372) &
    3453             :                     *(t407) - (t158*t496*t1093)/0.2e1_dp - t172* &
    3454             :                     t1816)*alpha1*t177 - (3._dp*t759*t622) - 0.15e2_dp/0.2e1_dp* &
    3455             :                  (t1736)*(t234)*(t1737)*(t407) + (3._dp*t514 &
    3456             :                                                   *t155*t44*t1093) + ((2._dp*t158*t615*t407 - t158*t204 &
    3457             :                                                                        *t1093 - f98*t1773)*alpha2*t112) + ((-2._dp*t641*t1756 &
    3458             :                                                                         + t239*t1093 + 6._dp*t158*t282*t372*t407 - 2._dp*t158*t236 &
    3459             :                                                                               *t1093 + t206*t1773)*alpha4*t210) + (6._dp*t474*t622 &
    3460           0 :                                                                                                                               *t407)
    3461           0 :          t1946 = t115*t1093
    3462             :          t1976 = -0.4e1_dp/0.3e1_dp*t1031*t417 - 0.2e1_dp/0.3e1_dp*t302*t14 &
    3463             :                  *t755*t6 - (4._dp*t375*t420) - 0.2e1_dp*t11*t311*t755 + &
    3464             :                  (2._dp*t375*t434) + t11*t15*(-0.4e1_dp/0.3e1_dp*t747*t315 &
    3465             :                                               *t317 - (4._dp*t748*t321) - 0.16e2_dp/0.3e1_dp*t751*t324*t327 &
    3466           0 :                                               - (16._dp*t752*t331))
    3467           0 :          t1978 = t1976*E*t108
    3468             :          t2018 = 0.147e3_dp/0.4e1_dp*t251*t1613*t1614*t372*t407 - 0.21e2_dp &
    3469             :                  *t251*t522*t220*t372*t407 - 0.7e1_dp/0.2e1_dp*t251*t524 &
    3470             :                  *t1093 - 0.75e2_dp/0.4e1_dp*t1630*t1626*t372*t407 + 0.10e2_dp &
    3471             :                  *t530*t214*t372*t407 + 0.5e1_dp/0.2e1_dp*t530*t256*t1093 &
    3472             :                  + 0.27e2_dp/0.4e1_dp*t261*t1167*t1791 - 0.3e1_dp*t261*t535*t1795 &
    3473             :                  - 0.3e1_dp/0.2e1_dp*t261*t536*t1093 - 0.3e1_dp/0.4e1_dp*t243* &
    3474           0 :                  t1785 + t243*t1788/0.2e1_dp
    3475             :          t2053 = -0.4e1_dp/0.3e1_dp*t1031*t458 - 0.2e1_dp/0.3e1_dp*t302*t14 &
    3476             :                  *t736*t6 - (4._dp*t375*t461) - 0.2e1_dp*t11*t311*t736 + &
    3477             :                  (2._dp*t375*t468) + t11*t15*(F2*t1061*t68 - t464* &
    3478           0 :                                               t404 - t733*t365 + 2._dp*t85*t1073 - t85*t1090)
    3479             :          t2056 = -(3._dp*t558*t761) - (2._dp*t91*t551*t1093) - t809 &
    3480             :                  *t519 + 0.5e1_dp/0.2e1_dp*t659*t234*t1946 + t1978 + 0.5e1_dp/0.2e1_dp &
    3481             :                  *t1379*t816 + (t166*t2018 + t270*t1816)*alpha7*t279 &
    3482             :                  - (2._dp*t886*t692) + (3._dp*t1732*t813) - t1978*t156 &
    3483           0 :                  - t852*t519 + f12*t2053*t94
    3484           0 :          t2060 = t759*t513
    3485           0 :          t2066 = t1262*t769
    3486           0 :          t2069 = t125*t126
    3487           0 :          t2071 = t452*t407
    3488           0 :          t2072 = t480*t113*t2071
    3489           0 :          t2076 = t447*t115*t2071
    3490           0 :          t2084 = t110*t111
    3491           0 :          t2086 = t1273*t1270*t2071
    3492           0 :          t2090 = t480*t114*t2071
    3493           0 :          t2099 = t447*t127*t2071
    3494           0 :          t2105 = t125*t739
    3495           0 :          t2111 = t114*t1093
    3496             :          t2115 = -0.5e1_dp/0.2e1_dp*t1417*t2066 + (3._dp*t2069*t2072) - &
    3497             :                  0.5e1_dp/0.2e1_dp*t1417*t2076 - (2._dp*t603*t475*t1841) + (t603 &
    3498             :                                                                          *t604*t1093) - 0.75e2_dp/0.4e1_dp*t2084*t2086 - 0.3e1_dp/ &
    3499             :                  0.2e1_dp*t1473*t2090 - (2._dp*t583*t441*t1841) + (t583 &
    3500             :                                                                    *t584*t1093) + 0.10e2_dp*t2084*t2099 + 0.5e1_dp/0.2e1_dp*(t583) &
    3501             :                  *(t587)*(t1946) + 0.3e1_dp/0.2e1_dp*t2105*t608 + 0.3e1_dp &
    3502             :                  /0.2e1_dp*t1453*t784 + t2105*t605 + 0.3e1_dp/0.2e1_dp*(t603) &
    3503           0 :                  *(t607)*(t2111)
    3504           0 :          t2133 = t110*t758
    3505           0 :          t2136 = t1332*t783
    3506           0 :          t2155 = t1341*t115*t2071
    3507             :          t2158 = -t1434*t595*t452*t407/0.2e1_dp - t110*t1976*t83* &
    3508             :                  t118 + t1407*t767 - 0.2e1_dp*t81*t108*t122*t442*t407 - t125 &
    3509             :                  *t2053*t83*t129 + t1453*t781 + 0.5e1_dp/0.2e1_dp*t2133*t588 &
    3510             :                  - 0.3e1_dp/0.2e1_dp*t1473*t2136 - t1434*t1435*t407/0.2e1_dp &
    3511             :                  + t81*t591*t1093 + t81*t596*t1093/0.2e1_dp - 0.3e1_dp/0.4e1_dp &
    3512             :                  *t84*t1442*t452*t407 + 0.5e1_dp/0.2e1_dp*t1407*t770 + t2133 &
    3513           0 :                  *t585 - 0.27e2_dp/0.4e1_dp*t2069*t2155
    3514           0 :          t2180 = t136*t758
    3515           0 :          t2195 = t136*t137
    3516             :          t2203 = -t136*t1976*t93*t118 + (2._dp*t1251*t793) + 0.5e1_dp &
    3517             :                  /0.2e1_dp*(t1251)*(t796) + (2._dp*t2180*t443) - (6._dp &
    3518             :                                                                   *t440*t1256*t1841) - (5._dp*t1261*t2066) + (2._dp*t440 &
    3519             :                                                                           *t441*t1093) + 0.5e1_dp/0.2e1_dp*(t2180)*(t454) - (5._dp &
    3520             :                                                                        *t1261*t2076) - 0.75e2_dp/0.4e1_dp*t2195*t2086 + 0.10e2_dp* &
    3521           0 :                  t2195*t2099 + 0.5e1_dp/0.2e1_dp*(t440)*(t448)*(t1946)
    3522           0 :          t2211 = t140*t739
    3523             :          t2233 = -t140*t2053*t93*t129 + (2._dp*t1321*t802) + 0.3e1_dp &
    3524             :                  /0.2e1_dp*(t1321)*(t805) + (2._dp*t2211*t476) - (6._dp &
    3525             :                                                                   *t474*t1326*t1841) - (3._dp*t1331*t2136) + (2._dp*t474 &
    3526             :                                                                           *t475*t1093) + 0.3e1_dp/0.2e1_dp*(t2211)*(t483) - (3._dp &
    3527             :                                                                        *t1331*t2090) - 0.27e2_dp/0.4e1_dp*t95*t2155 + 0.3e1_dp*t95 &
    3528           0 :                  *t2072 + 0.3e1_dp/0.2e1_dp*(t474)*(t481)*(t2111)
    3529             :          t2274 = -0.4e1_dp/0.3e1_dp*t860*t153*t491 + (3._dp*t2060*t516) &
    3530             :                  + 0.5e1_dp/0.3e1_dp*t759*t441*t507 + (t2115 + t2158)*omega* &
    3531             :                  t134 + (12._dp*t106*t1149*t442*t407) - 0.75e2_dp/0.4e1_dp*(t1397) &
    3532             :                  *(t234)*(t1270)*(t452)*(t407) - &
    3533             :                  t788*t413/0.3e1_dp + (t2203 + t2233)*t145*t151 + (t166*(0.27e2_dp &
    3534             :                                                                          /0.4e1_dp*(t184)*(t1666)*(t219)*(t372)* &
    3535             :                                                                          (t407) - (3._dp*t184*t709*t1546*t407) - 0.3e1_dp/0.2e1_dp &
    3536             :                                                                          *(t184)*(t710)*(t1093) - 0.3e1_dp/0.4e1_dp*t1678* &
    3537             :                                                                          t1756 + (t714*t1093)/0.2e1_dp) + f2716*t1816*t196)*alpha3 &
    3538             :                  *t145*t151 - 0.25e2_dp/0.6e1_dp*(t1362)*(t634)*(t5) &
    3539             :                  *(t115)*(t407) + (2._dp*t81*t108*t442*t407) &
    3540           0 :                  - (5._dp*t1726*t506*t6*t407)
    3541             :          e_ndrho_rho = e_ndrho_rho + (-0.4e1_dp/0.3e1_dp*t409*t920 - t80*(t1850 + t1938 + t2056 + &
    3542           0 :                                                                           t2274)*Clda)*sx
    3543           0 :          t2279 = t407**2
    3544           0 :          t2280 = t1157*t2279
    3545           0 :          t2283 = t541*t1139
    3546           0 :          t2306 = d2exerndrhondrho(Q, dQndrho, d2Qndrhondrho)
    3547           0 :          t2316 = t127*t2279
    3548           0 :          t2323 = t1270*t2279
    3549           0 :          t2336 = d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
    3550             :          t2365 = 2._dp*t1095*t88 + 4._dp*t375*t737 + t11*t15*(F2*t1111 &
    3551           0 :                                                               *t68 - 2._dp*t733*t404 + 2._dp*t85*t1119 - t85*t1136)
    3552             :          t2391 = (t166*(0.3e1_dp/0.4e1_dp*t206*t2280 - t206*t2283/0.2e1_dp &
    3553             :                         - 0.27e2_dp/0.4e1_dp*t1168*t256*t2279 + 0.3e1_dp*t665*t75*t2279 &
    3554             :                         + 0.3e1_dp/0.2e1_dp*t665*t213*t1139 + 0.75e2_dp/0.4e1_dp*t218 &
    3555             :                         *t1182*t2279 - 0.10e2_dp*t218*t1186*t2279 - 0.5e1_dp/0.2e1_dp* &
    3556             :                         t218*t671*t1139) - t230*t2306)*alpha5*t234 + (6._dp*t2060 &
    3557             :                                                                       *t813) - 0.2e1_dp*t91*t551*t1139 + 0.10e2_dp*t659*t234* &
    3558             :                  t2316 + 0.6e1_dp*t91*t1661*t2279 - 0.75e2_dp/0.4e1_dp*t1397*t234 &
    3559             :                  *t2323 + (-0.2e1_dp*t641*t2279 + t239*t1139 + 0.6e1_dp*t158 &
    3560             :                            *t282*t2279 - 0.2e1_dp*t158*t236*t1139 + t206*t2336)*alpha4 &
    3561             :                  *t210 + 0.3e1_dp*t514*t155*t44*t1139 + (5._dp*t1824* &
    3562             :                                                          t816) - (4._dp*t740*t742) - t81*t93*t1139 + f12*t2365* &
    3563             :                  t94 - (6._dp*t759*t761) + 0.2e1_dp*t81*t108*t2279 + (0.12e2_dp &
    3564             :                                                                       *t1584*t2279 - 0.3e1_dp*t638*t1139 - 0.6e1_dp*t1589*t2279 + &
    3565             :                                                                       0.2e1_dp*t641*t1139 + 0.2e1_dp*t206*t1594*t2279 - t206*t644 &
    3566           0 :                                                                       *t1139 - t243*t2336)*alpha6*t247*t249
    3567             :          t2432 = 0.147e3_dp/0.4e1_dp*t251*t1615*t2279 - 0.21e2_dp*t251*t1619 &
    3568             :                  *t2279 - 0.7e1_dp/0.2e1_dp*t251*t524*t1139 - 0.75e2_dp/0.4e1_dp &
    3569             :                  *t1630*t1626*t2279 + 0.10e2_dp*t530*t214*t2279 + 0.5e1_dp/ &
    3570             :                  0.2e1_dp*t530*t256*t1139 + 0.27e2_dp/0.4e1_dp*t261*t1640*t2279 &
    3571             :                  - 0.3e1_dp*t261*t1644*t2279 - 0.3e1_dp/0.2e1_dp*t261*t536*t1139 &
    3572           0 :                  - 0.3e1_dp/0.4e1_dp*t243*t2280 + t243*t2283/0.2e1_dp
    3573             :          t2452 = 2._dp*t1095*t103 + 4._dp*t375*t756 + t11*t15*(2._dp*g2* &
    3574           0 :                                                                t3*t19 + 12._dp*g3*t1*t24*t32)
    3575           0 :          t2454 = t2452*E*t108
    3576           0 :          t2473 = t2279*t115
    3577           0 :          t2486 = t115*t1139
    3578           0 :          t2501 = t2279*t114
    3579           0 :          t2511 = t113*t2279
    3580           0 :          t2515 = t114*t1139
    3581             :          t2519 = -t136*t2452*t93*t118 + (4._dp*t2180*t793) + (5._dp &
    3582             :                                                               *t2180*t796) - (6._dp*t440*t1256*t2279) - (10._dp*t440 &
    3583             :                                                                        *t658*t2473) + (2._dp*t440*t441*t1139) - 0.75e2_dp/0.4e1_dp &
    3584             :                  *(t440)*(t1274)*(t2323) + (10._dp*t440*t448 &
    3585             :                                             *t2316) + 0.5e1_dp/0.2e1_dp*(t440)*(t448)*(t2486) - &
    3586             :                  t140*t2365*t93*t129 + (4._dp*t2211*t802) + (3._dp*t2211 &
    3587             :                                                              *t805) - (6._dp*t474*t1326*t2279) - (6._dp*t474*t108 &
    3588             :                                                                        *t480*t2501) + (2._dp*t474*t475*t1139) - 0.27e2_dp/0.4e1_dp &
    3589             :                  *(t474)*(t1342)*(t2473) + (3._dp*t474*t481* &
    3590           0 :                                             t2511) + 0.3e1_dp/0.2e1_dp*(t474)*(t481)*(t2515)
    3591             :          t2571 = -t110*t2452*t83*t118 + (2._dp*t2133*t767) + (5._dp &
    3592             :                                                               *t2133*t770) - (2._dp*t583*t441*t2279) + (t583*t584 &
    3593             :                                                                              *t1139) - (5._dp*t583*t448*t2473) + (10._dp*t583*t587 &
    3594             :                                                                                  *t2316) + 0.5e1_dp/0.2e1_dp*(t583)*(t587)*(t2486) &
    3595             :                  - 0.75e2_dp/0.4e1_dp*(t583)*(t1426)*(t2323) - (2._dp &
    3596           0 :                                                                 *t81*t1430*t2279) - (t81*t93*t595*t2279)
    3597             :          t2604 = t81*t591*t1139 - 0.3e1_dp/0.4e1_dp*t81*t1443*t2279 + &
    3598             :                  t81*t596*t1139/0.2e1_dp - t125*t2365*t83*t129 + (2._dp* &
    3599             :                                                                   t2105*t781) + (3._dp*t2105*t784) - 0.2e1_dp*t603*t475*t2279 &
    3600             :                  + t603*t604*t1139 - 0.3e1_dp*t603*t481*t2501 + 0.3e1_dp*t603 &
    3601             :                  *t607*t2511 + 0.3e1_dp/0.2e1_dp*t603*t607*t2515 - 0.27e2_dp &
    3602           0 :                  /0.4e1_dp*t603*t1469*t2473
    3603             :          t2668 = ((2._dp*t158*t236*t2279 - t158*t204*t1139 - f98* &
    3604             :                    t2336)*alpha2*t112) + (t166*t2432 + t270*t2306)*alpha7 &
    3605             :                  *t279 - t2454*t156 - (12._dp*t1150*t155*t44*t2279) + (12._dp &
    3606             :                                                                        *t106*t1149*t2279) + t2519*t145*t151 + 0.5e1_dp/0.2e1_dp &
    3607             :                  *t659*t234*t2486 - 0.15e2_dp*t1736*t234*t2473 - (3._dp* &
    3608             :                                                                   t106*t513*t1139) + (0.3e1_dp/0.4e1_dp*(t158)*(t1553) &
    3609             :                                                                                *(t2279) - (t158*t496*t1139)/0.2e1_dp - t172*t2306) &
    3610             :                  *alpha1*t177 + t2454 + (t2571 + t2604)*omega*t134 + (t166* &
    3611             :                                                                       (0.27e2_dp/0.4e1_dp*(t184)*(t1667)*(t2279) - (3._dp &
    3612             :                                                                               *t184*t1671*t2279) - 0.3e1_dp/0.2e1_dp*(t184)*(t710) &
    3613             :                                                                        *(t1139) - 0.3e1_dp/0.4e1_dp*(t1678)*(t2279) + (t714 &
    3614             :                                                                             *t1139)/0.2e1_dp) + f2716*t2306*t196)*alpha3*t145*t151 &
    3615             :                  + (t158*(t2336 + (t1139*t161 - 2._dp*t2279*t204 + 2._dp* &
    3616             :                                    t1538*t2279 - t626*t1139)*t202*t160 - t822*t238*t1885 &
    3617             :                           + t823*t407)) + ((20._dp*t281*t1691*t2279 - 4._dp*t281*t561 &
    3618             :                                             *t1139 - 12._dp*t1699*t2279 + 3._dp*t566*t1139 + 6._dp*t206*t565 &
    3619             :                                             *t2279 - 2._dp*t206*t284*t1139 - 2._dp*t243*t284*t2279 + t243 &
    3620           0 :                                             *t238*t1139 + t289*t2336)*alpha8*t296)
    3621           0 :          e_ndrho_ndrho = e_ndrho_ndrho + (-t80*(t2391 + t2668)*Clda)*sx
    3622             :       END IF
    3623             : 
    3624      206701 :    END SUBROUTINE xwpbe_lda_calc_2
    3625             : 
    3626             : ! **************************************************************************************************
    3627             : !> \brief Evaluates the screened hole averaged PBE exchange functional for lda.
    3628             : !> \param e_0 ...
    3629             : !> \param e_rho ...
    3630             : !> \param e_ndrho ...
    3631             : !> \param e_rho_rho ...
    3632             : !> \param e_ndrho_rho ...
    3633             : !> \param e_ndrho_ndrho ...
    3634             : !> \param rho , ndrho: density and norm of the density gradient
    3635             : !> \param ndrho ...
    3636             : !> \param omega screening parameter
    3637             : !> \param sscale scaling factor to enforce Lieb-Oxford bound
    3638             : !> \param sx scaling factor
    3639             : !> \param order degree of the derivative that should be evaluated,
    3640             : !>        if positive all the derivatives up to the given degree are evaluated,
    3641             : !>        if negative only the given degree is calculated
    3642             : !> \par History
    3643             : !>      05.2007 created [Manuel Guidon]
    3644             : !> \author Manuel Guidon
    3645             : !> \note
    3646             : !>      This routine evaluates the functional for omega!=0 using a simple
    3647             : !>      gaussian expansion for large ww.
    3648             : ! **************************************************************************************************
    3649     4952896 :    SUBROUTINE xwpbe_lda_calc_3(e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
    3650             :                                e_ndrho_ndrho, rho, ndrho, omega, sscale, sx, order)
    3651             :       REAL(KIND=dp), INTENT(INOUT)                       :: e_0, e_rho, e_ndrho, e_rho_rho, &
    3652             :                                                             e_ndrho_rho, e_ndrho_ndrho
    3653             :       REAL(KIND=dp), INTENT(IN)                          :: rho, ndrho, omega, sscale, sx
    3654             :       INTEGER, INTENT(IN)                                :: order
    3655             : 
    3656             :       REAL(KIND=dp) :: d2Qndrhondrho, d2Qrhondrho, d2Qrhorho, dQndrho, dQrho, Q, t1, t10, t1004, &
    3657             :          t1005, t1015, t102, t1025, t1032, t104, t105, t1056, t1060, t1065, t1068, t1079, t108, &
    3658             :          t1080, t109, t1096, t11, t110, t1101, t1102, t111, t1114, t1115, t1121, t1124, t113, &
    3659             :          t1143, t1147, t115, t1154, t1156, t116, t1162, t1169, t117, t1170, t1178, t1179, t118, &
    3660             :          t1189, t119, t1193, t12, t120, t1202, t1203, t1204, t121, t1210, t1213, t1214, t1215, &
    3661             :          t1216, t1220, t123, t1230, t1235, t124, t1240, t1241, t1242, t125, t1250, t1251, t1252, &
    3662             :          t1256, t126, t1260, t1264, t127, t1273, t128, t1288, t129, t1295, t13
    3663             :       REAL(KIND=dp) :: t1300, t1304, t1308, t1309, t131, t1315, t1316, t132, t1326, t133, t1331, &
    3664             :          t1337, t1346, t1350, t136, t1363, t1372, t1382, t1386, t1388, t1393, t14, t140, t1400, &
    3665             :          t1401, t1402, t1408, t141, t142, t1437, t144, t1446, t145, t147, t148, t1480, t1482, &
    3666             :          t1488, t149, t15, t150, t151, t1511, t152, t1522, t1535, t154, t155, t156, t1562, t157, &
    3667             :          t1578, t158, t1583, t159, t1592, t1594, t16, t1608, t162, t1620, t1627, t163, t1632, &
    3668             :          t1645, t1652, t166, t167, t1675, t1678, t168, t1685, t1687, t1688, t169, t1692, t1695, &
    3669             :          t17, t170, t1712, t1719, t1731, t1737, t1739, t174, t1747, t1753, t176
    3670             :       REAL(KIND=dp) :: t1762, t1765, t177, t1781, t1796, t18, t180, t1804, t181, t1812, t1834, &
    3671             :          t185, t186, t1860, t1878, t1886, t189, t19, t190, t192, t193, t1935, t194, t1945, t195, &
    3672             :          t197, t1979, t198, t1981, t1989, t199, t1999, t2, t200, t2003, t2007, t2013, t202, t2050, &
    3673             :          t206, t2060, t2064, t2068, t208, t209, t21, t210, t2107, t212, t213, t2140, t215, t2159, &
    3674             :          t216, t217, t2174, t218, t219, t22, t221, t222, t223, t224, t227, t228, t23, t231, t232, &
    3675             :          t234, t235, t236, t237, t238, t24, t242, t245, t246, t247, t248, t249, t25, t250, t251, &
    3676             :          t252, t258, t259, t260, t261, t262, t266, t268, t27, t274, t277
    3677             :       REAL(KIND=dp) :: t278, t279, t28, t280, t285, t287, t288, t29, t291, t292, t295, t296, t297, &
    3678             :          t3, t300, t301, t302, t304, t305, t308, t309, t31, t313, t316, t317, t318, t32, t320, &
    3679             :          t322, t325, t328, t329, t332, t335, t338, t339, t34, t341, t342, t344, t345, t35, t352, &
    3680             :          t359, t36, t361, t364, t365, t368, t369, t370, t373, t374, t375, t376, t377, t379, t38, &
    3681             :          t380, t381, t383, t384, t388, t39, t391, t395, t396, t397, t398, t399, t4, t400, t401, &
    3682             :          t403, t404, t405, t406, t408, t41, t416, t417, t418, t419, t42, t420, t422, t423, t424, &
    3683             :          t428, t429, t433, t435, t437, t438, t44, t441, t442, t443, t444
    3684             :       REAL(KIND=dp) :: t445, t451, t452, t453, t456, t457, t46, t461, t462, t463, t466, t470, &
    3685             :          t471, t478, t479, t48, t480, t483, t484, t485, t486, t49, t490, t493, t499, t5, t500, &
    3686             :          t501, t504, t505, t511, t512, t513, t516, t517, t521, t523, t526, t528, t531, t532, t533, &
    3687             :          t534, t537, t538, t539, t54, t542, t544, t545, t546, t548, t549, t55, t550, t554, t555, &
    3688             :          t56, t561, t564, t565, t567, t568, t570, t58, t584, t586, t589, t590, t592, t593, t595, &
    3689             :          t596, t599, t6, t60, t603, t604, t607, t608, t61, t610, t611, t612, t616, t617, t621, &
    3690             :          t623, t626, t627, t628, t629, t63, t635, t637, t638, t649, t65, t651
    3691             :       REAL(KIND=dp) :: t652, t656, t661, t664, t67, t670, t673, t677, t68, t681, t684, t687, t69, &
    3692             :          t690, t691, t695, t696, t698, t699, t7, t70, t704, t705, t706, t708, t709, t71, t712, &
    3693             :          t713, t714, t717, t718, t72, t721, t724, t725, t727, t73, t74, t743, t746, t748, t75, &
    3694             :          t752, t756, t759, t760, t762, t765, t767, t768, t769, t77, t772, t78, t781, t8, t80, &
    3695             :          t803, t804, t806, t81, t811, t813, t816, t82, t820, t83, t84, t843, t844, t849, t85, &
    3696             :          t855, t87, t871, t872, t875, t877, t878, t88, t892, t893, t899, t9, t90, t900, t91, t916, &
    3697             :          t917, t92, t920, t922, t93, t932, t933, t94, t95, t96, t964, t967, t968
    3698             :       REAL(KIND=dp) :: t969, t97, t973, t976, t99
    3699             : 
    3700     4952896 :       IF (order >= 0) THEN
    3701     4952896 :          t1 = ndrho**2
    3702     4952896 :          t2 = r2**2
    3703     4952896 :          t3 = 0.1e1_dp/t2
    3704     4952896 :          t4 = t1*t3
    3705     4952896 :          t5 = pi**2
    3706     4952896 :          t6 = r3*t5
    3707     4952896 :          t7 = t6*rho
    3708     4952896 :          t8 = t7**(0.1e1_dp/0.3e1_dp)
    3709     4952896 :          t9 = t8**2
    3710     4952896 :          t10 = 0.1e1_dp/t9
    3711     4952896 :          t11 = t4*t10
    3712     4952896 :          t12 = rho**2
    3713     4952896 :          t13 = 0.1e1_dp/t12
    3714     4952896 :          t14 = sscale**2
    3715     4952896 :          t15 = t13*t14
    3716     4952896 :          t16 = a1*t1
    3717     4952896 :          t17 = t16*t3
    3718     4952896 :          t18 = t10*t13
    3719     4952896 :          t19 = t18*t14
    3720     4952896 :          t21 = t1**2
    3721     4952896 :          t22 = a2*t21
    3722     4952896 :          t23 = t2**2
    3723     4952896 :          t24 = 0.1e1_dp/t23
    3724     4952896 :          t25 = t22*t24
    3725     4952896 :          t27 = 0.1e1_dp/t8/t7
    3726     4952896 :          t28 = t12**2
    3727     4952896 :          t29 = 0.1e1_dp/t28
    3728     4952896 :          t31 = t14**2
    3729     4952896 :          t32 = t27*t29*t31
    3730     4952896 :          t34 = t17*t19 + t25*t32
    3731     4952896 :          t35 = a3*t21
    3732     4952896 :          t36 = t35*t24
    3733     4952896 :          t38 = t21*ndrho
    3734     4952896 :          t39 = a4*t38
    3735     4952896 :          t41 = 0.1e1_dp/t23/r2
    3736     4952896 :          t42 = t39*t41
    3737     4952896 :          t44 = 0.1e1_dp/t9/t7
    3738     4952896 :          t46 = 0.1e1_dp/t28/rho
    3739     4952896 :          t48 = t31*sscale
    3740     4952896 :          t49 = t44*t46*t48
    3741     4952896 :          t54 = 0.1e1_dp/t23/t2
    3742     4952896 :          t55 = a5*t21*t1*t54
    3743     4952896 :          t56 = r3**2
    3744     4952896 :          t58 = t5**2
    3745     4952896 :          t60 = 0.1e1_dp/t56/t58
    3746     4952896 :          t61 = t28**2
    3747     4952896 :          t63 = t31*t14
    3748     4952896 :          t65 = t60/t61*t63
    3749     4952896 :          t67 = r1 + t36*t32 + t42*t49 + t55*t65
    3750     4952896 :          t68 = 0.1e1_dp/t67
    3751     4952896 :          t69 = t34*t68
    3752     4952896 :          t70 = t15*t69
    3753     4952896 :          t71 = t11*t70
    3754     4952896 :          t72 = omega**2
    3755     4952896 :          t73 = beta2*t72
    3756     4952896 :          t74 = t73*t10
    3757     4952896 :          t75 = t71 + t74
    3758     4952896 :          t77 = 0.1e1_dp/A
    3759     4952896 :          Q = f94*t75*t77
    3760     4952896 :          t78 = rho**(0.1e1_dp/0.3e1_dp)
    3761     4952896 :          t80 = t78*rho*f89
    3762     4952896 :          t81 = B*f12
    3763     4952896 :          t82 = t71 + DD
    3764     4952896 :          t83 = 0.1e1_dp/t82
    3765     4952896 :          t84 = t81*t83
    3766     4952896 :          t85 = F2*t34
    3767     4952896 :          t87 = F1 + t85*t68
    3768     4952896 :          t88 = t15*t87
    3769     4952896 :          t90 = t11*t88 + r1
    3770     4952896 :          t91 = f12*t90
    3771     4952896 :          t92 = t82**2
    3772     4952896 :          t93 = 0.1e1_dp/t92
    3773     4952896 :          t94 = C*t93
    3774     4952896 :          t95 = t91*t94
    3775     4952896 :          t96 = f34*pi
    3776     4952896 :          t97 = rootpi
    3777     4952896 :          t99 = r6*C
    3778     4952896 :          t102 = r4*B
    3779     4952896 :          t104 = r8*A
    3780     4952896 :          t105 = t92*t82
    3781     4952896 :          t108 = t97*(r15*E + t99*t90*t82 + t102*t92 + t104*t105)
    3782     4952896 :          t109 = 0.1e1_dp/r16
    3783     4952896 :          t110 = SQRT(t82)
    3784     4952896 :          t111 = t110*t105
    3785     4952896 :          t113 = t109/t111
    3786     4952896 :          t115 = SQRT(A)
    3787     4952896 :          t116 = f94*t34
    3788     4952896 :          t117 = t68*t1
    3789     4952896 :          t118 = t116*t117
    3790     4952896 :          t119 = t3*t10
    3791     4952896 :          t120 = t15*t77
    3792     4952896 :          t121 = t119*t120
    3793     4952896 :          t123 = EXP(t118*t121)
    3794     4952896 :          t124 = t115*t123
    3795     4952896 :          t125 = f32*ndrho
    3796     4952896 :          t126 = 0.1e1_dp/r2
    3797     4952896 :          t127 = t125*t126
    3798     4952896 :          t128 = 0.1e1_dp/t8
    3799     4952896 :          t129 = 0.1e1_dp/rho
    3800     4952896 :          t131 = t69*t77
    3801     4952896 :          t132 = SQRT(t131)
    3802     4952896 :          t133 = sscale*t132
    3803     4952896 :          t136 = erfc(t127*t128*t129*t133)
    3804     4952896 :          t140 = 0.1e1_dp/f1516
    3805     4952896 :          t141 = (t96 + t108*t113 - t96*t124*t136)*t140
    3806     4952896 :          t142 = 0.1e1_dp/t97
    3807     4952896 :          t144 = 0.1e1_dp/E
    3808     4952896 :          t145 = t142*t111*t144
    3809     4952896 :          t147 = -t141*t145 + r1
    3810     4952896 :          t148 = t147*E
    3811     4952896 :          t149 = 0.1e1_dp/t105
    3812     4952896 :          t150 = t148*t149
    3813     4952896 :          t151 = f158*E
    3814     4952896 :          t152 = t147*t83
    3815     4952896 :          t154 = t71 + DD + t72*t10
    3816     4952896 :          t155 = t154**2
    3817     4952896 :          t156 = t155**2
    3818     4952896 :          t157 = t156*t154
    3819     4952896 :          t158 = SQRT(t157)
    3820     4952896 :          t159 = 0.1e1_dp/t158
    3821     4952896 :          t162 = SQRT(t154)
    3822     4952896 :          t163 = 0.1e1_dp/t162
    3823     4952896 :          t166 = f68*C
    3824     4952896 :          t167 = t90*t83
    3825     4952896 :          t168 = t155*t154
    3826     4952896 :          t169 = SQRT(t168)
    3827     4952896 :          t170 = 0.1e1_dp/t169
    3828             :          t174 = (-t151*t152*t159 - t81*t83*t163 - t166*t167*t170) &
    3829     4952896 :                 *omega
    3830     4952896 :          t176 = f52*E
    3831     4952896 :          t177 = t147*t93
    3832     4952896 :          t180 = f12*C
    3833     4952896 :          t181 = t90*t93
    3834     4952896 :          t185 = t72*omega
    3835     4952896 :          t186 = (-t176*t177*t159 - t180*t181*t170)*t185
    3836     4952896 :          t189 = 0.1e1_dp/r3/t5
    3837     4952896 :          t190 = t189*t129
    3838     4952896 :          t192 = t72**2
    3839     4952896 :          t193 = t192*omega
    3840     4952896 :          t194 = t159*t193
    3841     4952896 :          t195 = t194*t44
    3842     4952896 :          t197 = f12*A
    3843     4952896 :          t198 = exei(Q)
    3844     4952896 :          t199 = t71 + DD + t74
    3845     4952896 :          t200 = 0.1e1_dp/t199
    3846     4952896 :          t202 = LOG(t75*t200)
    3847             :          t206 = (t84 + t95 + t150 + t174*t128 + t186*t190 - t150*t195 &
    3848     4952896 :                  + t197*(t198 + t202))*Clda
    3849     4952896 :          e_0 = e_0 + (-t80*t206)*sx
    3850             :       END IF
    3851     4952896 :       IF (order >= 1 .OR. order == -1) THEN
    3852     3335074 :          t208 = t44*t13
    3853     3335074 :          t209 = t4*t208
    3854     3335074 :          t210 = t14*t34
    3855     3335074 :          t212 = t68*r3*t5
    3856     3335074 :          t213 = t210*t212
    3857     3335074 :          t215 = 0.2e1_dp/0.3e1_dp*t209*t213
    3858     3335074 :          t216 = t12*rho
    3859     3335074 :          t217 = 0.1e1_dp/t216
    3860     3335074 :          t218 = t217*t14
    3861     3335074 :          t219 = t218*t69
    3862     3335074 :          t221 = 2._dp*t11*t219
    3863     3335074 :          t222 = t3*t44
    3864     3335074 :          t223 = t16*t222
    3865     3335074 :          t224 = t15*t6
    3866     3335074 :          t227 = t10*t217
    3867     3335074 :          t228 = t227*t14
    3868     3335074 :          t231 = t56*t58
    3869     3335074 :          t232 = t231*t12
    3870     3335074 :          t234 = 0.1e1_dp/t8/t232
    3871     3335074 :          t235 = t24*t234
    3872     3335074 :          t236 = t22*t235
    3873     3335074 :          t237 = t29*t31
    3874     3335074 :          t238 = t237*t6
    3875     3335074 :          t242 = t27*t46*t31
    3876             :          t245 = -0.2e1_dp/0.3e1_dp*t223*t224 - (2._dp*t17*t228) - 0.4e1_dp &
    3877     3335074 :                 /0.3e1_dp*t236*t238 - (4._dp*t25*t242)
    3878     3335074 :          t246 = t245*t68
    3879     3335074 :          t247 = t15*t246
    3880     3335074 :          t248 = t11*t247
    3881     3335074 :          t249 = t4*t18
    3882     3335074 :          t250 = t67**2
    3883     3335074 :          t251 = 0.1e1_dp/t250
    3884     3335074 :          t252 = t35*t235
    3885     3335074 :          t258 = 0.1e1_dp/t9/t232
    3886     3335074 :          t259 = t41*t258
    3887     3335074 :          t260 = t39*t259
    3888     3335074 :          t261 = t46*t48
    3889     3335074 :          t262 = t261*t6
    3890     3335074 :          t266 = 0.1e1_dp/t28/t12
    3891     3335074 :          t268 = t44*t266*t48
    3892     3335074 :          t274 = t60/t61/rho*t63
    3893             :          t277 = -0.4e1_dp/0.3e1_dp*t252*t238 - (4._dp*t36*t242) - 0.5e1_dp &
    3894     3335074 :                 /0.3e1_dp*t260*t262 - (5._dp*t42*t268) - (8._dp*t55*t274)
    3895     3335074 :          t278 = t251*t277
    3896     3335074 :          t279 = t210*t278
    3897     3335074 :          t280 = t249*t279
    3898             :          t285 = -t215 - t221 + t248 - t280 - 0.2e1_dp/0.3e1_dp*t73*t44*r3 &
    3899     3335074 :                 *t5
    3900     3335074 :          dQrho = f94*t285*t77
    3901     3335074 :          t287 = ndrho*t3
    3902     3335074 :          t288 = t287*t10
    3903     3335074 :          t291 = a1*ndrho
    3904     3335074 :          t292 = t291*t3
    3905     3335074 :          t295 = t1*ndrho
    3906     3335074 :          t296 = a2*t295
    3907     3335074 :          t297 = t296*t24
    3908     3335074 :          t300 = 2._dp*t292*t19 + 4._dp*t297*t32
    3909     3335074 :          t301 = t300*t68
    3910     3335074 :          t302 = t15*t301
    3911     3335074 :          t304 = a3*t295
    3912     3335074 :          t305 = t304*t24
    3913     3335074 :          t308 = a4*t21
    3914     3335074 :          t309 = t308*t41
    3915     3335074 :          t313 = a5*t38*t54
    3916     3335074 :          t316 = 4._dp*t305*t32 + 5._dp*t309*t49 + 6._dp*t313*t65
    3917     3335074 :          t317 = t251*t316
    3918     3335074 :          t318 = t210*t317
    3919     3335074 :          t320 = 2._dp*t288*t70 + t11*t302 - t249*t318
    3920     3335074 :          dQndrho = f94*t320*t77
    3921     3335074 :          t322 = t78*f89
    3922     3335074 :          t325 = -t215 - t221 + t248 - t280
    3923     3335074 :          t328 = t14*t87
    3924     3335074 :          t329 = t328*t6
    3925     3335074 :          t332 = t218*t87
    3926     3335074 :          t335 = F2*t245
    3927     3335074 :          t338 = t335*t68 - t85*t278
    3928     3335074 :          t339 = t15*t338
    3929             :          t341 = -0.2e1_dp/0.3e1_dp*t209*t329 - (2._dp*t11*t332) + (t11 &
    3930     3335074 :                                                                    *t339)
    3931     3335074 :          t342 = f12*t341
    3932     3335074 :          t344 = C*t149
    3933     3335074 :          t345 = t344*t325
    3934     3335074 :          t352 = t82*t325
    3935             :          t359 = t97*(t99*t341*t82 + t99*t90*t325 + 2._dp*t102*t352 &
    3936     3335074 :                      + 3._dp*t104*t92*t325)
    3937     3335074 :          t361 = t92**2
    3938     3335074 :          t364 = t109/t110/t361
    3939     3335074 :          t365 = t364*t325
    3940     3335074 :          t368 = t96*t115
    3941     3335074 :          t369 = f94*t245
    3942     3335074 :          t370 = t369*t117
    3943     3335074 :          t373 = t251*t1*t3
    3944     3335074 :          t374 = t116*t373
    3945     3335074 :          t375 = t14*t77
    3946     3335074 :          t376 = t375*t277
    3947     3335074 :          t377 = t18*t376
    3948     3335074 :          t379 = t117*t3
    3949     3335074 :          t380 = t116*t379
    3950     3335074 :          t381 = t208*t14
    3951     3335074 :          t383 = t77*r3*t5
    3952     3335074 :          t384 = t381*t383
    3953     3335074 :          t388 = t119*t218*t77
    3954             :          t391 = t370*t121 - t374*t377 - 0.2e1_dp/0.3e1_dp*t380*t384 - (2._dp &
    3955     3335074 :                                                                        *t118*t388)
    3956     3335074 :          t395 = rootpi
    3957     3335074 :          t396 = 0.1e1_dp/t395
    3958     3335074 :          t397 = t123*t396
    3959     3335074 :          t398 = f32**2
    3960     3335074 :          t399 = t398*t1
    3961     3335074 :          t400 = t399*t119
    3962     3335074 :          t401 = t15*t131
    3963     3335074 :          t403 = EXP(-t400*t401)
    3964     3335074 :          t404 = t126*t27
    3965     3335074 :          t405 = t125*t404
    3966     3335074 :          t406 = t129*sscale
    3967     3335074 :          t408 = t132*r3*t5
    3968     3335074 :          t416 = t125*t126*t128
    3969     3335074 :          t417 = 0.1e1_dp/t132
    3970     3335074 :          t418 = t246*t77
    3971     3335074 :          t419 = t34*t251
    3972     3335074 :          t420 = t77*t277
    3973     3335074 :          t422 = t418 - t419*t420
    3974     3335074 :          t423 = t417*t422
    3975     3335074 :          t424 = t406*t423
    3976             :          t428 = t403*(-t405*t406*t408/0.3e1_dp - t127*t128*t13*t133 &
    3977     3335074 :                       + t416*t424/0.2e1_dp)
    3978     3335074 :          t429 = t397*t428
    3979             :          t433 = (t359*t113 - 0.7e1_dp/0.2e1_dp*t108*t365 - (t368*t391 &
    3980     3335074 :                                                             *t123*t136) + (2._dp*t368*t429))*t140
    3981     3335074 :          t435 = t141*t142
    3982     3335074 :          t437 = t110*t92*t144
    3983     3335074 :          t438 = t437*t325
    3984     3335074 :          t441 = -t433*t145 - 0.7e1_dp/0.2e1_dp*t435*t438
    3985     3335074 :          t442 = t441*E
    3986     3335074 :          t443 = t442*t149
    3987     3335074 :          t444 = 0.1e1_dp/t361
    3988     3335074 :          t445 = t444*t325
    3989     3335074 :          t451 = t151*t147
    3990     3335074 :          t452 = t93*t159
    3991     3335074 :          t453 = t452*t325
    3992     3335074 :          t456 = 0.1e1_dp/t158/t157
    3993     3335074 :          t457 = t83*t456
    3994     3335074 :          t461 = -t215 - t221 + t248 - t280 - 0.2e1_dp/0.3e1_dp*t72*t44*t6
    3995     3335074 :          t462 = t156*t461
    3996     3335074 :          t463 = t457*t462
    3997     3335074 :          t466 = t93*t163
    3998     3335074 :          t470 = 0.1e1_dp/t162/t154
    3999     3335074 :          t471 = t83*t470
    4000     3335074 :          t478 = t166*t90
    4001     3335074 :          t479 = t93*t170
    4002     3335074 :          t480 = t479*t325
    4003     3335074 :          t483 = 0.1e1_dp/t169/t168
    4004     3335074 :          t484 = t83*t483
    4005     3335074 :          t485 = t155*t461
    4006     3335074 :          t486 = t484*t485
    4007             :          t490 = (-t151*t441*t83*t159 + t451*t453 + 0.5e1_dp/0.2e1_dp*t451 &
    4008             :                  *t463 + t81*t466*t325 + t81*t471*t461/0.2e1_dp - t166 &
    4009             :                  *t341*t83*t170 + t478*t480 + 0.3e1_dp/0.2e1_dp*t478*t486)* &
    4010     3335074 :                 omega
    4011     3335074 :          t493 = t27*r3*t5
    4012     3335074 :          t499 = t176*t147
    4013     3335074 :          t500 = t149*t159
    4014     3335074 :          t501 = t500*t325
    4015     3335074 :          t504 = t93*t456
    4016     3335074 :          t505 = t504*t462
    4017     3335074 :          t511 = t180*t90
    4018     3335074 :          t512 = t149*t170
    4019     3335074 :          t513 = t512*t325
    4020     3335074 :          t516 = t93*t483
    4021     3335074 :          t517 = t516*t485
    4022             :          t521 = (-t176*t441*t93*t159 + (2._dp*t499*t501) + 0.5e1_dp/ &
    4023             :                  0.2e1_dp*(t499)*(t505) - t180*t341*t93*t170 + (2._dp &
    4024     3335074 :                                                                 *t511*t513) + 0.3e1_dp/0.2e1_dp*(t511)*(t517))*t185
    4025     3335074 :          t523 = t189*t13
    4026     3335074 :          t526 = t148*t444
    4027     3335074 :          t528 = t194*t44*t325
    4028     3335074 :          t531 = t149*t456
    4029     3335074 :          t532 = t148*t531
    4030     3335074 :          t533 = t193*t44
    4031     3335074 :          t534 = t533*t462
    4032     3335074 :          t537 = t148*t500
    4033     3335074 :          t538 = t193*t258
    4034     3335074 :          t539 = t538*t6
    4035     3335074 :          t542 = dexeirho(Q, dQrho)
    4036     3335074 :          t544 = t199**2
    4037     3335074 :          t545 = 0.1e1_dp/t544
    4038     3335074 :          t546 = t75*t545
    4039     3335074 :          t548 = t285*t200 - t546*t285
    4040     3335074 :          t549 = 0.1e1_dp/t75
    4041     3335074 :          t550 = t548*t549
    4042             :          t554 = -t81*t93*t325 + t342*t94 - (2._dp*t91*t345) + t443 &
    4043             :                 - (3._dp*t148*t445) + t490*t128 - t174*t493/0.3e1_dp + t521 &
    4044             :                 *t190 - t186*t523 - t443*t195 + (3._dp*t526*t528) + 0.5e1_dp &
    4045             :                 /0.2e1_dp*t532*t534 + 0.5e1_dp/0.3e1_dp*t537*t539 + t197*(t542 &
    4046     3335074 :                                                                           + t550*t199)
    4047     3335074 :          t555 = t554*Clda
    4048     3335074 :          e_rho = e_rho + (-0.4e1_dp/0.3e1_dp*t322*t206 - t80*t555)*sx
    4049     3335074 :          t561 = F2*t300
    4050     3335074 :          t564 = t561*t68 - t85*t317
    4051     3335074 :          t565 = t15*t564
    4052     3335074 :          t567 = 2._dp*t288*t88 + t11*t565
    4053     3335074 :          t568 = f12*t567
    4054     3335074 :          t570 = t344*t320
    4055             :          t584 = t97*(t99*t567*t82 + t99*t90*t320 + 2._dp*t102*t82 &
    4056     3335074 :                      *t320 + 3._dp*t104*t92*t320)
    4057     3335074 :          t586 = t364*t320
    4058     3335074 :          t589 = f94*t300
    4059     3335074 :          t590 = t589*t117
    4060     3335074 :          t592 = t375*t316
    4061     3335074 :          t593 = t18*t592
    4062     3335074 :          t595 = t68*ndrho
    4063     3335074 :          t596 = t116*t595
    4064     3335074 :          t599 = t590*t121 - t374*t593 + 2._dp*t596*t121
    4065     3335074 :          t603 = f32*t126
    4066     3335074 :          t604 = t603*t128
    4067     3335074 :          t607 = t301*t77
    4068     3335074 :          t608 = t77*t316
    4069     3335074 :          t610 = t607 - t419*t608
    4070     3335074 :          t611 = t417*t610
    4071     3335074 :          t612 = t406*t611
    4072     3335074 :          t616 = t403*(t604*t406*t132 + t416*t612/0.2e1_dp)
    4073     3335074 :          t617 = t397*t616
    4074             :          t621 = (t584*t113 - 0.7e1_dp/0.2e1_dp*t108*t586 - (t368*t599 &
    4075     3335074 :                                                             *t123*t136) + (2._dp*t368*t617))*t140
    4076     3335074 :          t623 = t437*t320
    4077     3335074 :          t626 = -t621*t145 - 0.7e1_dp/0.2e1_dp*t435*t623
    4078     3335074 :          t627 = t626*E
    4079     3335074 :          t628 = t627*t149
    4080     3335074 :          t629 = t444*t320
    4081     3335074 :          t635 = t452*t320
    4082     3335074 :          t637 = t156*t320
    4083     3335074 :          t638 = t457*t637
    4084     3335074 :          t649 = t479*t320
    4085     3335074 :          t651 = t155*t320
    4086     3335074 :          t652 = t484*t651
    4087             :          t656 = (-t151*t626*t83*t159 + t451*t635 + 0.5e1_dp/0.2e1_dp*t451 &
    4088             :                  *t638 + t81*t466*t320 + t81*t471*t320/0.2e1_dp - t166 &
    4089             :                  *t567*t83*t170 + t478*t649 + 0.3e1_dp/0.2e1_dp*t478*t652)* &
    4090     3335074 :                 omega
    4091     3335074 :          t661 = t500*t320
    4092     3335074 :          t664 = t504*t637
    4093     3335074 :          t670 = t512*t320
    4094     3335074 :          t673 = t516*t651
    4095             :          t677 = (-t176*t626*t93*t159 + (2._dp*t499*t661) + 0.5e1_dp/ &
    4096             :                  0.2e1_dp*(t499)*(t664) - t180*t567*t93*t170 + (2._dp &
    4097     3335074 :                                                                 *t511*t670) + 0.3e1_dp/0.2e1_dp*(t511)*(t673))*t185
    4098     3335074 :          t681 = t194*t44*t320
    4099     3335074 :          t684 = t533*t637
    4100     3335074 :          t687 = dexeindrho(Q, dQndrho)
    4101     3335074 :          t690 = t320*t200 - t546*t320
    4102     3335074 :          t691 = t690*t549
    4103             :          t695 = -t81*t93*t320 + t568*t94 - (2._dp*t91*t570) + t628 &
    4104             :                 - (3._dp*t148*t629) + t656*t128 + t677*t190 - t628*t195 &
    4105             :                 + (3._dp*t526*t681) + 0.5e1_dp/0.2e1_dp*t532*t684 + t197*(t687 &
    4106     3335074 :                                                                           + t691*t199)
    4107     3335074 :          t696 = t695*Clda
    4108     3335074 :          e_ndrho = e_ndrho + (-t80*t696)*sx
    4109             :       END IF
    4110     4952896 :       IF (order >= 2 .OR. order == -2) THEN
    4111           0 :          t698 = t258*t13
    4112           0 :          t699 = t4*t698
    4113           0 :          t704 = 0.10e2_dp/0.9e1_dp*t699*t210*t68*t56*t58
    4114           0 :          t705 = t44*t217
    4115           0 :          t706 = t4*t705
    4116           0 :          t708 = 0.8e1_dp/0.3e1_dp*t706*t213
    4117           0 :          t709 = t14*t245
    4118           0 :          t712 = 0.4e1_dp/0.3e1_dp*t209*t709*t212
    4119           0 :          t713 = t4*t381
    4120           0 :          t714 = t6*t277
    4121           0 :          t717 = 0.4e1_dp/0.3e1_dp*t713*t419*t714
    4122           0 :          t718 = t29*t14
    4123           0 :          t721 = 6._dp*t11*t718*t69
    4124           0 :          t724 = 4._dp*t11*t218*t246
    4125           0 :          t725 = t4*t227
    4126           0 :          t727 = 4._dp*t725*t279
    4127           0 :          t743 = t56*r3*t58*t5*t216
    4128           0 :          t746 = t24/t8/t743
    4129           0 :          t748 = t237*t231
    4130           0 :          t752 = t46*t31*t6
    4131           0 :          t756 = t27*t266*t31
    4132             :          t759 = 0.10e2_dp/0.9e1_dp*t16*t3*t258*t15*t231 + 0.8e1_dp/0.3e1_dp &
    4133             :                 *t223*t218*t6 + (6._dp*t17*t10*t29*t14) + 0.28e2_dp/ &
    4134             :                 0.9e1_dp*t22*t746*t748 + 0.32e2_dp/0.3e1_dp*t236*t752 + (20._dp &
    4135           0 :                                                                          *t25*t756)
    4136           0 :          t760 = t759*t68
    4137           0 :          t762 = t11*t15*t760
    4138           0 :          t765 = 2._dp*t249*t709*t278
    4139           0 :          t767 = 0.1e1_dp/t250/t67
    4140           0 :          t768 = t277**2
    4141           0 :          t769 = t767*t768
    4142           0 :          t772 = 2._dp*t249*t210*t769
    4143           0 :          t781 = 0.1e1_dp/t9/t743
    4144             :          t803 = 0.28e2_dp/0.9e1_dp*t35*t746*t748 + 0.32e2_dp/0.3e1_dp*t252* &
    4145             :                 t752 + (20._dp*t36*t756) + 0.40e2_dp/0.9e1_dp*t39*t41*t781 &
    4146             :                 *t261*t231 + 0.50e2_dp/0.3e1_dp*t260*t266*t48*t6 + 0.30e2_dp* &
    4147             :                 t42*t44/t28/t216*t48 + (72._dp*t55*t60/t61/t12* &
    4148           0 :                                         t63)
    4149           0 :          t804 = t251*t803
    4150           0 :          t806 = t249*t210*t804
    4151             :          t811 = t704 + t708 - t712 + t717 + t721 - t724 + t727 + t762 - t765 &
    4152           0 :                 + t772 - t806 + 0.10e2_dp/0.9e1_dp*t73*t258*t56*t58
    4153           0 :          d2Qrhorho = f94*t811*t77
    4154           0 :          t813 = t287*t208
    4155           0 :          t816 = t14*t300
    4156           0 :          t820 = t6*t316
    4157             :          t843 = -0.4e1_dp/0.3e1_dp*t291*t222*t224 - (4._dp*t292*t228) &
    4158           0 :                 - 0.16e2_dp/0.3e1_dp*t296*t235*t238 - (16._dp*t297*t242)
    4159           0 :          t844 = t843*t68
    4160           0 :          t849 = t287*t18
    4161           0 :          t855 = t767*t277*t316
    4162             :          t871 = -0.16e2_dp/0.3e1_dp*t304*t235*t238 - (16._dp*t305*t242) &
    4163             :                 - 0.25e2_dp/0.3e1_dp*t308*t259*t262 - (25._dp*t309*t268) - &
    4164           0 :                 (48._dp*t313*t274)
    4165           0 :          t872 = t251*t871
    4166             :          t875 = -0.4e1_dp/0.3e1_dp*t813*t213 - 0.2e1_dp/0.3e1_dp*t209*t816* &
    4167             :                 t212 + 0.2e1_dp/0.3e1_dp*t713*t419*t820 - (4._dp*t288*t219) &
    4168             :                 - (2._dp*t11*t218*t301) + (2._dp*t725*t318) + (2._dp* &
    4169             :                                                                t288*t247) + (t11*t15*t844) - t249*t709*t317 - (2._dp &
    4170             :                                                                             *t849*t279) - t249*t816*t278 + 0.2e1_dp*t249*t210*t855 &
    4171           0 :                 - t249*t210*t872
    4172           0 :          d2Qrhondrho = f94*t875*t77
    4173           0 :          t877 = t119*t13
    4174           0 :          t878 = t210*t68
    4175           0 :          t892 = 2._dp*a1*t3*t19 + 12._dp*a2*t1*t24*t32
    4176           0 :          t893 = t892*t68
    4177           0 :          t899 = t316**2
    4178           0 :          t900 = t767*t899
    4179             :          t916 = 12._dp*a3*t1*t24*t32 + 20._dp*a4*t295*t41*t49 + 30._dp* &
    4180           0 :                 a5*t21*t54*t65
    4181           0 :          t917 = t251*t916
    4182             :          t920 = 2._dp*t877*t878 + 4._dp*t288*t302 - 4._dp*t849*t318 + t11* &
    4183             :                 t15*t893 - 2._dp*t249*t816*t317 + 2._dp*t249*t210*t900 - t249 &
    4184           0 :                 *t210*t917
    4185           0 :          d2Qndrhondrho = f94*t920*t77
    4186           0 :          t922 = t78**2
    4187             :          t932 = t704 + t708 - t712 + t717 + t721 - t724 + t727 + t762 - t765 &
    4188           0 :                 + t772 - t806 + 0.10e2_dp/0.9e1_dp*t72*t258*t231
    4189           0 :          t933 = t156*t932
    4190             :          t964 = 0.10e2_dp/0.9e1_dp*t699*t328*t231 + 0.8e1_dp/0.3e1_dp*t706* &
    4191             :                 t329 - 0.4e1_dp/0.3e1_dp*t209*t14*t338*t6 + (6._dp*t11*t718 &
    4192             :                                                              *t87) - 0.4e1_dp*(t11)*t218*t338 + (t11*t15*(F2 &
    4193           0 :                                                                            *t759*t68 - 2._dp*t335*t278 + 2._dp*t85*t769 - t85*t804))
    4194           0 :          t967 = t361*t82
    4195           0 :          t968 = 0.1e1_dp/t967
    4196           0 :          t969 = t325**2
    4197           0 :          t973 = t442*t444
    4198             :          t976 = t704 + t708 - t712 + t717 + t721 - t724 + t727 + t762 - t765 &
    4199           0 :                 + t772 - t806
    4200           0 :          t1004 = 0.1e1_dp/t110/t967
    4201           0 :          t1005 = t109*t1004
    4202           0 :          t1015 = t369*t373
    4203           0 :          t1025 = t116*t767*t1*t3
    4204           0 :          t1032 = t116*t251*t4*t44
    4205             :          t1056 = f94*t759*t117*t121 - (2._dp*t1015*t377) - 0.4e1_dp/ &
    4206             :                  0.3e1_dp*t369*t379*t384 - (4._dp*t370*t388) + (2._dp*t1025 &
    4207             :                                                                 *t18*t375*t768) + 0.4e1_dp/0.3e1_dp*t1032*t120*t714 + (4._dp &
    4208             :                                                                                *t374*t227*t376) - (t374*t18*t375*t803) + 0.10e2_dp &
    4209             :                  /0.9e1_dp*t380*t698*t14*t77*t56*t58 + 0.8e1_dp/0.3e1_dp* &
    4210           0 :                  t380*t705*t14*t383 + 0.6e1_dp*t118*t119*t718*t77
    4211           0 :          t1060 = t391**2
    4212           0 :          t1065 = t96*t115*t391
    4213           0 :          t1068 = t96*t124
    4214           0 :          t1079 = t399*t877
    4215           0 :          t1080 = t251*t77
    4216           0 :          t1096 = t13*sscale
    4217           0 :          t1101 = t125*t404*t129
    4218           0 :          t1102 = sscale*t417
    4219           0 :          t1114 = 0.1e1_dp/t132/t131
    4220           0 :          t1115 = t422**2
    4221           0 :          t1121 = t245*t251
    4222           0 :          t1124 = t34*t767
    4223           0 :          t1143 = t433*t142
    4224           0 :          t1147 = t110*t82*t144
    4225             :          t1154 = -((t97*(t99*t964*t82 + 2._dp*t99*t341*t325 + t99 &
    4226             :                          *t90*t976 + 2._dp*t102*t969 + 2._dp*t102*t82*t976 + 6._dp*t104 &
    4227             :                          *t82*t969 + 3._dp*t104*t92*t976)*t113) - (7._dp*t359* &
    4228             :                                                                    t365) + 0.63e2_dp/0.4e1_dp*(t108)*(t1005)*(t969) - 0.7e1_dp &
    4229             :                    /0.2e1_dp*(t108)*(t364)*(t976) - t368*t1056 &
    4230             :                    *t123*t136 - t368*t1060*t123*t136 + (4._dp*t1065*t429) &
    4231             :                    + 0.2e1_dp*t1068*t396*(0.2e1_dp/0.3e1_dp*t399*t222*t13*t878 &
    4232             :                                           *t383 + (2._dp*t400*t218*t131) - (t400*t15*t418) &
    4233             :                                           + t1079*t210*t1080*t277)*t428 + 0.2e1_dp*t368*t397*t403 &
    4234             :                    *(0.4e1_dp/0.9e1_dp*t125*t126*t234*t406*t132*t56*t58 &
    4235             :                      + 0.2e1_dp/0.3e1_dp*t405*t1096*t408 - t1101*t1102*t6*t422 &
    4236             :                      /0.3e1_dp + (2._dp*t127*t128*t217*t133) - t416*t1096*t423 &
    4237             :                      - t416*t406*t1114*t1115/0.4e1_dp + t416*t406*t417*(t760 &
    4238             :                                                                         *t77 - 2._dp*t1121*t420 + 2._dp*t1124*t77*t768 - t419* &
    4239             :                                                                    t77*t803)/0.2e1_dp))*t140*t145 - (7._dp*t1143*t438) - 0.35e2_dp &
    4240             :                  /0.4e1_dp*(t435)*(t1147)*(t969) - 0.7e1_dp/0.2e1_dp &
    4241           0 :                  *(t435)*(t437)*(t976)
    4242           0 :          t1156 = t1154*E*t149
    4243           0 :          t1162 = t442*t531
    4244           0 :          t1169 = t148*t444*t456
    4245           0 :          t1170 = t325*t156
    4246           0 :          t1178 = t444*t159
    4247           0 :          t1179 = t148*t1178
    4248             :          t1189 = 0.5e1_dp/0.2e1_dp*t532*t533*t933 - (6._dp*t442*t445) &
    4249             :                  + f12*t964*t94 + (12._dp*t148*t968*t969) + (6._dp*t973 &
    4250             :                                                              *t528) - (3._dp*t148*t444*t976) + t1156 - (t81*t93* &
    4251             :                                                                     t976) + (2._dp*t81*t149*t969) + (5._dp*t1162*t534) + 0.10e2_dp &
    4252             :                  /0.3e1_dp*(t442)*(t500)*(t539) - 0.15e2_dp*t1169 &
    4253             :                  *t533*t1170*t461 - (2._dp*t91*t344*t976) - (10._dp* &
    4254             :                                                              t1179*t538*t325*r3*t5) + 0.4e1_dp/0.9e1_dp*t174*t234*t56 &
    4255           0 :                  *t58
    4256           0 :          t1193 = t176*t441
    4257           0 :          t1202 = t176*t147*t149
    4258           0 :          t1203 = t456*t325
    4259           0 :          t1204 = t1203*t462
    4260           0 :          t1210 = t156**2
    4261           0 :          t1213 = 0.1e1_dp/t158/t1210/t155
    4262           0 :          t1214 = t93*t1213
    4263           0 :          t1215 = t461**2
    4264           0 :          t1216 = t1210*t1215
    4265           0 :          t1220 = t168*t1215
    4266           0 :          t1230 = t180*t341
    4267           0 :          t1235 = t444*t170
    4268           0 :          t1240 = t180*t90*t149
    4269           0 :          t1241 = t483*t325
    4270           0 :          t1242 = t1241*t485
    4271           0 :          t1250 = 0.1e1_dp/t169/t156/t155
    4272           0 :          t1251 = t93*t1250
    4273           0 :          t1252 = t156*t1215
    4274           0 :          t1256 = t154*t1215
    4275           0 :          t1260 = t155*t932
    4276             :          t1264 = -t176*t1154*t93*t159 + (4._dp*t1193*t501) + (5._dp &
    4277             :                                                               *t1193*t505) - (6._dp*t499*t1178*t969) - (10._dp*t1202 &
    4278             :                                                                       *t1204) + (2._dp*t499*t500*t976) - 0.75e2_dp/0.4e1_dp*(t499) &
    4279             :                  *(t1214)*(t1216) + (10._dp*t499*t504*t1220) &
    4280             :                  + 0.5e1_dp/0.2e1_dp*(t499)*(t504)*(t933) - t180*t964 &
    4281             :                  *t93*t170 + (4._dp*t1230*t513) + (3._dp*t1230*t517) &
    4282             :                  - (6._dp*t511*t1235*t969) - (6._dp*t1240*t1242) + (2._dp &
    4283             :                                                                     *t511*t512*t976) - 0.27e2_dp/0.4e1_dp*(t511)*(t1251) &
    4284             :                  *(t1252) + (3._dp*t511*t516*t1256) + 0.3e1_dp/0.2e1_dp* &
    4285           0 :                  (t511)*(t516)*(t1260)
    4286           0 :          t1273 = t148*t149*t1213
    4287           0 :          t1288 = t148*t531*t193
    4288           0 :          t1295 = t148*t968
    4289           0 :          t1300 = t83*t1213
    4290           0 :          t1304 = t149*t163
    4291           0 :          t1308 = t81*t93
    4292           0 :          t1309 = t470*t325
    4293           0 :          t1315 = 0.1e1_dp/t162/t155
    4294           0 :          t1316 = t83*t1315
    4295           0 :          t1326 = t166*t341
    4296           0 :          t1331 = t166*t181
    4297             :          t1337 = -0.75e2_dp/0.4e1_dp*t451*t1300*t1216 - (2._dp*t81*t1304 &
    4298             :                                                          *t969) - t1308*t1309*t461 + (t81*t466*t976) - 0.3e1_dp &
    4299             :                  /0.4e1_dp*(t81)*(t1316)*(t1215) + (t81*t471 &
    4300             :                                                     *t932)/0.2e1_dp - t166*t964*t83*t170 + (2._dp*t1326*t480) &
    4301             :                  + (3._dp*t1326*t486) - (3._dp*t1331*t1242) - (2._dp* &
    4302           0 :                                                                t478*t512*t969)
    4303           0 :          t1346 = t83*t1250
    4304           0 :          t1350 = t151*t441
    4305           0 :          t1363 = t151*t177
    4306             :          t1372 = (t478*t479*t976) + (3._dp*t478*t484*t1256) + &
    4307             :                  0.3e1_dp/0.2e1_dp*(t478)*(t484)*(t1260) - 0.27e2_dp/0.4e1_dp &
    4308             :                  *(t478)*(t1346)*(t1252) + (2._dp*t1350*t453) &
    4309             :                  - t151*t1154*t83*t159 + (5._dp*t1350*t463) - (2._dp &
    4310             :                                                                *t451*t500*t969) + (t451*t452*t976) - (5._dp*t1363 &
    4311             :                                                                      *t1204) + (10._dp*t451*t457*t1220) + 0.5e1_dp/0.2e1_dp*(t451) &
    4312           0 :                  *(t457)*(t933)
    4313           0 :          t1382 = C*t444
    4314           0 :          t1386 = d2exeirhorho(Q, dQrho, d2Qrhorho)
    4315           0 :          t1388 = t285**2
    4316           0 :          t1393 = t75/t544/t199
    4317           0 :          t1400 = t75**2
    4318           0 :          t1401 = 0.1e1_dp/t1400
    4319           0 :          t1402 = t548*t1401
    4320             :          t1408 = t1264*t185*t190 + (10._dp*t532*t533*t1220) - (2._dp &
    4321             :                                                                *t521*t523) - 0.75e2_dp/0.4e1_dp*(t1273)*(t533)*(t1216) &
    4322             :                  + (3._dp*t526*t194*t44*t976) - t1156*t195 - 0.2e1_dp &
    4323             :                  /0.3e1_dp*t490*t493 + (2._dp*t186*t189*t217) - 0.25e2_dp &
    4324             :                  /0.3e1_dp*t1288*t258*t156*t461*r3*t5 - (12._dp*t1295* &
    4325             :                                                          t194*t44*t969) + (t1337 + t1372)*omega*t128 - 0.40e2_dp/0.9e1_dp &
    4326             :                  *t537*t193*t781*t231 - (4._dp*t342*t345) + (6._dp* &
    4327             :                                                              t91*t1382*t969) + (t197*(t1386 + (t811*t200 - 2._dp*t1388 &
    4328             :                                                                           *t545 + 2._dp*t1393*t1388 - t546*t811)*t549*t199 - t1402 &
    4329           0 :                                                                                       *t199*t285 + t550*t285))
    4330             :          e_rho_rho = e_rho_rho + (-0.4e1_dp/0.9e1_dp/t922*f89*t206 - 0.8e1_dp/0.3e1_dp*t322*t555 &
    4331           0 :                                   - t80*(t1189 + t1408)*Clda)*sx
    4332             :          t1437 = -0.4e1_dp/0.3e1_dp*t813*t329 - 0.2e1_dp/0.3e1_dp*t209*t14* &
    4333             :                  t564*t6 - (4._dp*t288*t332) - 0.2e1_dp*t11*t218*t564 + (2._dp &
    4334             :                                                                          *t288*t339) + t11*t15*(F2*t843*t68 - t335*t317 &
    4335           0 :                                                                                             - t561*t278 + 2._dp*t85*t855 - t85*t872)
    4336           0 :          t1446 = t320*t325
    4337           0 :          t1480 = t589*t373
    4338           0 :          t1482 = t420*t316
    4339           0 :          t1488 = t116*t251*ndrho*t3
    4340             :          t1511 = (f94*t843*t117*t121) - t1015*t593 + (2._dp*t369 &
    4341             :                                                       *t595*t121) - (t1480*t377) + (2._dp*t1025*t19*t1482) &
    4342             :                  - (2._dp*t1488*t377) - (t374*t18*t375*t871) - 0.2e1_dp &
    4343             :                  /0.3e1_dp*t589*t379*t384 + 0.2e1_dp/0.3e1_dp*t1032*t120* &
    4344             :                  t820 - 0.4e1_dp/0.3e1_dp*t116*(t595)*t3*t384 - (2._dp*t590 &
    4345           0 :                                                                  *t388) + (2._dp*t374*t227*t592) - (4._dp*t596*t388)
    4346           0 :          t1522 = t96*t115*t599
    4347             :          t1535 = t396*(-2._dp*t398*ndrho*t119*t401 - t400*t15*t607 &
    4348           0 :                        + t1079*t210*t1080*t316)
    4349           0 :          t1562 = t300*t251
    4350             :          t1578 = (t97*(t99*t1437*t82 + t99*t341*t320 + t99*t567 &
    4351             :                        *t325 + t99*t90*t875 + 2._dp*t102*t1446 + 2._dp*t102*t82 &
    4352             :                        *t875 + 6._dp*t104*t352*t320 + 3._dp*t104*t92*t875)*t113) - &
    4353             :                  0.7e1_dp/0.2e1_dp*t359*t586 - 0.7e1_dp/0.2e1_dp*t584*t365 + 0.63e2_dp &
    4354             :                  /0.4e1_dp*(t108)*(t109)*(t1004)*(t325)*(t320) &
    4355             :                  - 0.7e1_dp/0.2e1_dp*(t108)*(t364)*(t875) - &
    4356             :                  t368*t1511*t123*t136 - t368*t391*t599*t123*t136 + (2._dp &
    4357             :                                                                     *t1065*t617) + (2._dp*t1522*t429) + (2._dp*t1068* &
    4358             :                                                                             t1535*t428) + 0.2e1_dp*t368*t397*t403*(-t603*t27*t129* &
    4359             :                                                                       t133*t6/0.3e1_dp - t1101*t1102*t6*t610/0.6e1_dp - t604*t1096 &
    4360             :                                                                       *t132 - t416*t1096*t611/0.2e1_dp + t604*t424/0.2e1_dp - t416 &
    4361             :                                                                              *t406*t1114*t422*t610/0.4e1_dp + t416*t406*t417*(t844 &
    4362             :                                                                               *t77 - t1121*t608 - t1562*t420 + 2._dp*t1124*t1482 - &
    4363           0 :                                                                                                             t419*t77*t871)/0.2e1_dp)
    4364           0 :          t1583 = t621*t142
    4365             :          t1592 = -t1578*t140*t145 - 0.7e1_dp/0.2e1_dp*t1143*t623 - 0.7e1_dp &
    4366             :                  /0.2e1_dp*t1583*t438 - 0.35e2_dp/0.4e1_dp*t435*t1147*t1446 - &
    4367           0 :                  0.7e1_dp/0.2e1_dp*t435*t437*t875
    4368           0 :          t1594 = t1592*E*t149
    4369           0 :          t1608 = d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    4370           0 :          t1620 = t199*t320
    4371           0 :          t1627 = t627*t444
    4372           0 :          t1632 = t156*t875
    4373           0 :          t1645 = t627*t531
    4374             :          t1652 = -t1594*t195 - t656*t493/0.3e1_dp - (3._dp*t442*t629) &
    4375             :                  - 0.25e2_dp/0.6e1_dp*t1288*t258*r3*t5*t156*t320 - (3._dp &
    4376             :                                                                     *t627*t445) + t197*(t1608 + (t875*t200 - 0.2e1_dp*t285*t545 &
    4377             :                                                                            *t320 + 0.2e1_dp*t1393*t285*t320 - t546*t875)*t549*t199 &
    4378             :                                                                        - t1402*t1620 + t550*t320) + 0.5e1_dp/0.2e1_dp*t1162*t684 + &
    4379             :                  (3._dp*t1627*t528) + (3._dp*t973*t681) + t1594 + 0.5e1_dp/0.2e1_dp &
    4380             :                  *t532*t533*t1632 - t677*t523 + 0.5e1_dp/0.3e1_dp*(t627) &
    4381             :                  *(t500)*(t539) - 0.12e2_dp*t148*t968*t159*t533 &
    4382             :                  *t1446 + 0.5e1_dp/0.2e1_dp*t1645*t534 + 0.2e1_dp*t81*t149*t325 &
    4383           0 :                  *t320
    4384           0 :          t1675 = t1241*t651
    4385           0 :          t1678 = t151*t626
    4386           0 :          t1685 = t151*t152
    4387           0 :          t1687 = t461*t320
    4388           0 :          t1688 = t1213*t1210*t1687
    4389           0 :          t1692 = t483*t155*t1687
    4390           0 :          t1695 = t1203*t637
    4391           0 :          t1712 = t155*t875
    4392             :          t1719 = 0.3e1_dp/0.2e1_dp*t1326*t652 - 0.3e1_dp/0.2e1_dp*t1331*t1675 &
    4393             :                  + t1678*t453 - (2._dp*t451*t500*t1446) + (t451*t452 &
    4394             :                                                            *t875) - 0.75e2_dp/0.4e1_dp*t1685*t1688 - 0.3e1_dp/0.2e1_dp*t1331 &
    4395             :                  *t1692 - 0.5e1_dp/0.2e1_dp*t1363*t1695 + t1350*t635 - 0.3e1_dp/ &
    4396             :                  0.4e1_dp*t84*t1315*t461*t320 + 0.5e1_dp/0.2e1_dp*t1678*t463 - &
    4397             :                  t1308*t470*t461*t320/0.2e1_dp - t1308*t1309*t320/0.2e1_dp &
    4398           0 :                  + 0.3e1_dp/0.2e1_dp*t478*t484*t1712 - 0.2e1_dp*t478*t512*(t1446)
    4399           0 :          t1731 = t166*t567
    4400           0 :          t1737 = t166*t167
    4401           0 :          t1739 = t483*t154*t1687
    4402           0 :          t1747 = t1250*t156*t1687
    4403           0 :          t1753 = t456*t156*t1687
    4404           0 :          t1762 = t456*t168*t1687
    4405             :          t1765 = (t478*t479*t875) - t166*t1437*t83*t170 + t1326 &
    4406             :                  *t649 - (2._dp*t81*t149*t163*t325*t320) + 0.3e1_dp/0.2e1_dp &
    4407             :                  *t1731*t486 + 0.5e1_dp/0.2e1_dp*t451*t457*t1632 + (3._dp* &
    4408             :                                                                     t1737*t1739) - t151*t1592*t83*t159 + t1731*t480 - 0.27e2_dp &
    4409             :                  /0.4e1_dp*(t1737)*(t1747) + (t81*t466*t875) - &
    4410             :                  0.5e1_dp/0.2e1_dp*t1363*t1753 + 0.5e1_dp/0.2e1_dp*t1350*t638 + (t81 &
    4411           0 :                                                                                  *t471*t875)/0.2e1_dp + (10._dp*t1685*t1762)
    4412           0 :          t1781 = t176*t626
    4413           0 :          t1796 = t176*t177
    4414             :          t1804 = -t176*t1592*t93*t159 + (2._dp*t1193*t661) + 0.5e1_dp &
    4415             :                  /0.2e1_dp*(t1193)*(t664) + (2._dp*t1781*t501) - (6._dp &
    4416             :                                                                   *t499*t1178*t1446) - (5._dp*t1202*t1695) + (2._dp*t499 &
    4417             :                                                                            *t500*t875) + 0.5e1_dp/0.2e1_dp*(t1781)*(t505) - (5._dp &
    4418             :                                                                        *t1202*t1753) - 0.75e2_dp/0.4e1_dp*t1796*t1688 + 0.10e2_dp* &
    4419           0 :                  t1796*t1762 + 0.5e1_dp/0.2e1_dp*(t499)*(t504)*(t1632)
    4420           0 :          t1812 = t180*t567
    4421             :          t1834 = -t180*t1437*t93*t170 + (2._dp*t1230*t670) + 0.3e1_dp &
    4422             :                  /0.2e1_dp*(t1230)*(t673) + (2._dp*t1812*t513) - (6._dp &
    4423             :                                                                   *t511*t1235*t1446) - (3._dp*t1240*t1675) + (2._dp*t511 &
    4424             :                                                                            *t512*t875) + 0.3e1_dp/0.2e1_dp*(t1812)*(t517) - (3._dp &
    4425             :                                                                        *t1240*t1692) - 0.27e2_dp/0.4e1_dp*t95*t1747 + 0.3e1_dp*t95 &
    4426           0 :                  *t1739 + 0.3e1_dp/0.2e1_dp*(t511)*(t516)*(t1712)
    4427             :          t1860 = (6._dp*t511*t445*t320) + (3._dp*t526*t194*t44* &
    4428             :                                            t875) - (t81*t93*t875) - (3._dp*t148*t444*t875) - (2._dp &
    4429             :                                                                                   *t568*t345) + f12*t1437*t94 - (5._dp*t1179*t538* &
    4430             :                                                                 t6*t320) + (t1719 + t1765)*omega*t128 - 0.75e2_dp/0.4e1_dp*(t1273) &
    4431             :                  *(t533)*(t1210)*(t461)*(t320) + (t1804 &
    4432             :                                                   + t1834)*t185*t190 - 0.15e2_dp/0.2e1_dp*(t1169)*(t533) &
    4433             :                  *(t462)*(t320) + (12._dp*t148*t968*t325* &
    4434             :                                    t320) - (2._dp*t342*t570) - 0.15e2_dp/0.2e1_dp*(t1169)*(t533) &
    4435             :                  *(t1170)*(t320) + (10._dp*t532*t533*t168 &
    4436           0 :                                     *t461*t320) - (2._dp*t91*t344*t875)
    4437           0 :          e_ndrho_rho = e_ndrho_rho + (-0.4e1_dp/0.3e1_dp*t322*t696 - t80*(t1652 + t1860)*Clda)*sx
    4438             :          t1878 = 2._dp*t119*t88 + 4._dp*t288*t565 + t11*t15*(F2*t892* &
    4439           0 :                                                              t68 - 2._dp*t561*t317 + 2._dp*t85*t900 - t85*t917)
    4440           0 :          t1886 = t320**2
    4441           0 :          t1935 = t599**2
    4442           0 :          t1945 = t610**2
    4443             :          t1979 = -((t97*(t99*t1878*t82 + 2._dp*t99*t567*t320 + t99 &
    4444             :                          *t90*t920 + 2._dp*t102*t1886 + 2._dp*t102*t82*t920 + 6._dp*t104 &
    4445             :                          *t82*t1886 + 3._dp*t104*t92*t920)*t113) - (7._dp*t584 &
    4446             :                                                                     *t586) + 0.63e2_dp/0.4e1_dp*(t108)*(t1005)*(t1886) &
    4447             :                    - 0.7e1_dp/0.2e1_dp*(t108)*(t364)*(t920) - (t368 &
    4448             :                                                                *(f94*t892*t117*t121 - 2._dp*t1480*t593 + 4._dp*t589*t595 &
    4449             :                                                                  *t121 + 2._dp*t1025*t18*t375*t899 - 4._dp*t1488*t593 - t374 &
    4450             :                                                                  *t18*t375*t916 + 2._dp*t116*t68*t3*t18*t375)*t123*t136) &
    4451             :                    - (t368*t1935*t123*t136) + (4._dp*t1522*t617) + &
    4452             :                    (2._dp*t1068*t1535*t616) + 0.2e1_dp*(t368)*t397*t403 &
    4453             :                    *(t604*t612 - t416*t406*t1114*t1945/0.4e1_dp + t416*t406 &
    4454             :                      *t417*(t893*t77 - 2._dp*t1562*t608 + 2._dp*t1124*t77* &
    4455             :                             t899 - t419*t77*t916)/0.2e1_dp))*t140*t145 - (7._dp*t1583 &
    4456             :                                                                           *t623) - 0.35e2_dp/0.4e1_dp*(t435)*(t1147)*(t1886) &
    4457           0 :                  - 0.7e1_dp/0.2e1_dp*(t435)*(t437)*(t920)
    4458           0 :          t1981 = t1979*E*t149
    4459           0 :          t1989 = t1886*t156
    4460           0 :          t1999 = t168*t1886
    4461           0 :          t2003 = t156*t920
    4462           0 :          t2007 = t1210*t1886
    4463             :          t2013 = -t1981*t195 + t1981 + (6._dp*t1627*t681) + (3._dp*t526 &
    4464             :                                                              *t194*t44*t920) - (15._dp*t1169*t533*t1989) + (5._dp &
    4465             :                                                                             *t1645*t684) - (12._dp*t1295*t194*t44*t1886) + (10._dp &
    4466             :                                                                                *t532*t533*t1999) + 0.5e1_dp/0.2e1_dp*(t532)*(t533) &
    4467             :                  *(t2003) - 0.75e2_dp/0.4e1_dp*(t1273)*(t533)*(t2007) &
    4468           0 :                  - (4._dp*t568*t570)
    4469           0 :          t2050 = t1886*t155
    4470           0 :          t2060 = t154*t1886
    4471           0 :          t2064 = t155*t920
    4472             :          t2068 = -t176*t1979*t93*t159 + (4._dp*t1781*t661) + (5._dp &
    4473             :                                                               *t1781*t664) - (6._dp*t499*t1178*t1886) - (10._dp*t499 &
    4474             :                                                                         *t531*t1989) + (2._dp*t499*t500*t920) - 0.75e2_dp/0.4e1_dp &
    4475             :                  *(t499)*(t1214)*(t2007) + (10._dp*t499*t504* &
    4476             :                                             t1999) + 0.5e1_dp/0.2e1_dp*(t499)*(t504)*(t2003) - &
    4477             :                  t180*t1878*t93*t170 + (4._dp*t1812*t670) + (3._dp*t1812 &
    4478             :                                                              *t673) - (6._dp*t511*t1235*t1886) - (6._dp*t511*t149 &
    4479             :                                                                        *t483*t2050) + (2._dp*t511*t512*t920) - 0.27e2_dp/0.4e1_dp* &
    4480             :                  (t511)*(t1251)*(t1989) + (3._dp*t511*t516*t2060) &
    4481           0 :                  + 0.3e1_dp/0.2e1_dp*(t511)*(t516)*(t2064)
    4482             :          t2107 = -(2._dp*t451*t500*t1886) + (t451*t452*t920) - &
    4483             :                  (5._dp*t451*t504*t1989) + (5._dp*t1678*t638) + (10._dp &
    4484             :                                                                  *t451*t457*t1999) + 0.5e1_dp/0.2e1_dp*(t451)*(t457)* &
    4485             :                  (t2003) - 0.75e2_dp/0.4e1_dp*(t451)*(t1300)*(t2007) &
    4486             :                  - (2._dp*t81*t1304*t1886) - (t81*t93*t470*t1886) &
    4487             :                  + (t81*t466*t920) - 0.3e1_dp/0.4e1_dp*(t81)*(t1316) &
    4488           0 :                  *(t1886)
    4489             :          t2140 = t81*t471*t920/0.2e1_dp - t166*t1878*t83*t170 + (2._dp &
    4490             :                                                                  *t1731*t649) + (3._dp*t1731*t652) - (2._dp*t478*t512 &
    4491             :                                                                               *t1886) + (t478)*t479*t920 - (3._dp*t478*t516*t2050) &
    4492             :                  + (3._dp*t478*t484*t2060) + 0.3e1_dp/0.2e1_dp*(t478)* &
    4493             :                  (t484)*(t2064) - 0.27e2_dp/0.4e1_dp*(t478)*(t1346) &
    4494           0 :                  *(t1989) - t151*t1979*t83*t159 + (2._dp*t1678*t635)
    4495           0 :          t2159 = d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
    4496             :          t2174 = t2068*t185*t190 + 6._dp*t91*t1382*t1886 - 2._dp*t91*t344 &
    4497             :                  *t920 + (t2107 + t2140)*omega*t128 + f12*t1878*t94 - &
    4498             :                  t81*t93*t920 - 6._dp*t627*t629 - 3._dp*t148*t444*t920 + 2._dp* &
    4499             :                  t81*t149*t1886 + 12._dp*t148*t968*t1886 + t197*(t2159 + (t920 &
    4500             :                                                                         *t200 - 2._dp*t1886*t545 + 2._dp*t1393*t1886 - t546*t920)* &
    4501           0 :                                                                  t549*t199 - t690*t1401*t1620 + t691*t320)
    4502           0 :          e_ndrho_ndrho = e_ndrho_ndrho + (-t80*(t2013 + t2174)*Clda)*sx
    4503             :       END IF
    4504             : 
    4505     4952896 :    END SUBROUTINE xwpbe_lda_calc_3
    4506             : 
    4507             : ! **************************************************************************************************
    4508             : !> \brief Evaluates the screened hole averaged PBE exchange functional for lda.
    4509             : !> \param e_0 ...
    4510             : !> \param e_rho ...
    4511             : !> \param e_ndrho ...
    4512             : !> \param e_rho_rho ...
    4513             : !> \param e_ndrho_rho ...
    4514             : !> \param e_ndrho_ndrho ...
    4515             : !> \param rho , ndrho: density and norm of the density gradient
    4516             : !> \param ndrho ...
    4517             : !> \param omega screening parameter
    4518             : !> \param sscale scaling factor to enforce Lieb-Oxford bound
    4519             : !> \param sx scaling factor
    4520             : !> \param order degree of the derivative that should be evaluated,
    4521             : !>        if positive all the derivatives up to the given degree are evaluated,
    4522             : !>        if negative only the given degree is calculated
    4523             : !> \par History
    4524             : !>      05.2007 created [Manuel Guidon]
    4525             : !> \author Manuel Guidon
    4526             : !> \note
    4527             : !>      This routine evaluates the functional for omega!=0 using a simple
    4528             : !>      gaussian expansion for large ww and a taylor expansion for the
    4529             : !>      parameter G.
    4530             : ! **************************************************************************************************
    4531           0 :    SUBROUTINE xwpbe_lda_calc_4(e_0, e_rho, e_ndrho, e_rho_rho, e_ndrho_rho, &
    4532             :                                e_ndrho_ndrho, rho, ndrho, omega, sscale, sx, order)
    4533             :       REAL(KIND=dp), INTENT(INOUT)                       :: e_0, e_rho, e_ndrho, e_rho_rho, &
    4534             :                                                             e_ndrho_rho, e_ndrho_ndrho
    4535             :       REAL(KIND=dp), INTENT(IN)                          :: rho, ndrho, omega, sscale, sx
    4536             :       INTEGER, INTENT(IN)                                :: order
    4537             : 
    4538             :       REAL(KIND=dp) :: d2Qndrhondrho, d2Qrhondrho, d2Qrhorho, dQndrho, dQrho, Q, t1, t10, t100, &
    4539             :          t1001, t1011, t1017, t102, t1026, t103, t1033, t1035, t1040, t1047, t1048, t1049, t105, &
    4540             :          t106, t1065, t1066, t1071, t1074, t108, t1082, t1089, t109, t1098, t11, t110, t111, &
    4541             :          t1111, t1118, t113, t114, t115, t1155, t1157, t116, t117, t1174, t118, t1181, t1184, &
    4542             :          t1189, t1190, t1198, t12, t1205, t1208, t121, t1210, t1218, t122, t1224, t1231, t125, &
    4543             :          t1255, t126, t1261, t1264, t1266, t127, t1270, t1277, t128, t1288, t129, t1299, t13, &
    4544             :          t1319, t1324, t133, t1336, t134, t1351, t136, t137, t1382, t1397, t14, t140
    4545             :       REAL(KIND=dp) :: t1405, t141, t1413, t1435, t1443, t1447, t1448, t145, t1452, t146, t1481, &
    4546             :          t1483, t149, t15, t1500, t151, t1529, t153, t1533, t1537, t154, t155, t1552, t156, t1562, &
    4547             :          t1566, t1570, t1576, t158, t159, t16, t160, t161, t1618, t163, t1652, t167, t1672, t169, &
    4548             :          t17, t170, t171, t173, t174, t176, t177, t178, t179, t18, t180, t182, t183, t184, t185, &
    4549             :          t188, t189, t19, t192, t193, t195, t196, t197, t198, t199, t2, t203, t206, t207, t208, &
    4550             :          t209, t21, t210, t211, t212, t213, t219, t22, t220, t221, t222, t223, t227, t229, t23, &
    4551             :          t235, t238, t239, t24, t240, t241, t246, t248, t249, t25, t252
    4552             :       REAL(KIND=dp) :: t253, t256, t257, t258, t261, t262, t263, t265, t266, t269, t27, t270, &
    4553             :          t274, t277, t278, t279, t28, t281, t283, t286, t289, t29, t290, t293, t296, t299, t3, &
    4554             :          t300, t302, t303, t305, t306, t309, t31, t310, t313, t316, t32, t321, t326, t327, t329, &
    4555             :          t330, t331, t332, t333, t334, t34, t340, t341, t342, t345, t346, t35, t350, t351, t352, &
    4556             :          t355, t359, t36, t360, t367, t368, t369, t372, t373, t374, t375, t379, t38, t382, t388, &
    4557             :          t389, t39, t390, t393, t394, t4, t400, t401, t402, t405, t406, t41, t410, t412, t415, &
    4558             :          t417, t42, t420, t421, t422, t423, t426, t427, t428, t431, t433, t434
    4559             :       REAL(KIND=dp) :: t435, t437, t438, t439, t44, t443, t444, t450, t453, t454, t456, t457, &
    4560             :          t459, t46, t464, t465, t468, t469, t472, t473, t475, t476, t477, t478, t48, t484, t486, &
    4561             :          t487, t49, t498, t5, t500, t501, t505, t510, t513, t519, t522, t526, t530, t533, t536, &
    4562             :          t539, t54, t540, t544, t545, t548, t55, t553, t555, t557, t558, t56, t561, t563, t564, &
    4563             :          t568, t569, t572, t575, t576, t578, t579, t58, t581, t584, t588, t594, t597, t599, t6, &
    4564             :          t60, t603, t607, t61, t610, t613, t616, t618, t619, t620, t623, t63, t632, t65, t655, &
    4565             :          t657, t662, t664, t667, t67, t68, t69, t694, t7, t70, t700, t706, t71
    4566             :       REAL(KIND=dp) :: t72, t723, t726, t728, t73, t74, t744, t75, t751, t752, t769, t77, t772, &
    4567             :          t774, t78, t782, t783, t784, t789, t792, t793, t794, t795, t799, t8, t80, t803, t804, &
    4568             :          t807, t81, t811, t812, t819, t82, t83, t84, t848, t85, t852, t862, t863, t864, t865, &
    4569             :          t868, t87, t872, t878, t879, t88, t880, t9, t90, t91, t916, t92, t920, t93, t930, t931, &
    4570             :          t932, t935, t939, t94, t943, t95, t956, t96, t961, t966, t97, t972, t985, t99, t990, t995
    4571             : 
    4572           0 :       IF (order >= 0) THEN
    4573           0 :          t1 = ndrho**2
    4574           0 :          t2 = r2**2
    4575           0 :          t3 = 0.1e1_dp/t2
    4576           0 :          t4 = t1*t3
    4577           0 :          t5 = pi**2
    4578           0 :          t6 = r3*t5
    4579           0 :          t7 = t6*rho
    4580           0 :          t8 = t7**(0.1e1_dp/0.3e1_dp)
    4581           0 :          t9 = t8**2
    4582           0 :          t10 = 0.1e1_dp/t9
    4583           0 :          t11 = t4*t10
    4584           0 :          t12 = rho**2
    4585           0 :          t13 = 0.1e1_dp/t12
    4586           0 :          t14 = sscale**2
    4587           0 :          t15 = t13*t14
    4588           0 :          t16 = a1*t1
    4589           0 :          t17 = t16*t3
    4590           0 :          t18 = t10*t13
    4591           0 :          t19 = t18*t14
    4592           0 :          t21 = t1**2
    4593           0 :          t22 = a2*t21
    4594           0 :          t23 = t2**2
    4595           0 :          t24 = 0.1e1_dp/t23
    4596           0 :          t25 = t22*t24
    4597           0 :          t27 = 0.1e1_dp/t8/t7
    4598           0 :          t28 = t12**2
    4599           0 :          t29 = 0.1e1_dp/t28
    4600           0 :          t31 = t14**2
    4601           0 :          t32 = t27*t29*t31
    4602           0 :          t34 = t17*t19 + t25*t32
    4603           0 :          t35 = a3*t21
    4604           0 :          t36 = t35*t24
    4605           0 :          t38 = t21*ndrho
    4606           0 :          t39 = a4*t38
    4607           0 :          t41 = 0.1e1_dp/t23/r2
    4608           0 :          t42 = t39*t41
    4609           0 :          t44 = 0.1e1_dp/t9/t7
    4610           0 :          t46 = 0.1e1_dp/t28/rho
    4611           0 :          t48 = t31*sscale
    4612           0 :          t49 = t44*t46*t48
    4613           0 :          t54 = 0.1e1_dp/t23/t2
    4614           0 :          t55 = a5*t21*t1*t54
    4615           0 :          t56 = r3**2
    4616           0 :          t58 = t5**2
    4617           0 :          t60 = 0.1e1_dp/t56/t58
    4618           0 :          t61 = t28**2
    4619           0 :          t63 = t31*t14
    4620           0 :          t65 = t60/t61*t63
    4621           0 :          t67 = r1 + t36*t32 + t42*t49 + t55*t65
    4622           0 :          t68 = 0.1e1_dp/t67
    4623           0 :          t69 = t34*t68
    4624           0 :          t70 = t15*t69
    4625           0 :          t71 = t11*t70
    4626           0 :          t72 = omega**2
    4627           0 :          t73 = beta2*t72
    4628           0 :          t74 = t73*t10
    4629           0 :          t75 = t71 + t74
    4630           0 :          t77 = 0.1e1_dp/A
    4631           0 :          Q = f94*t75*t77
    4632           0 :          t78 = rho**(0.1e1_dp/0.3e1_dp)
    4633           0 :          t80 = t78*rho*f89
    4634           0 :          t81 = B*f12
    4635           0 :          t82 = t71 + DD
    4636           0 :          t83 = 0.1e1_dp/t82
    4637           0 :          t84 = t81*t83
    4638           0 :          t85 = F2*t34
    4639           0 :          t87 = F1 + t85*t68
    4640           0 :          t88 = t15*t87
    4641           0 :          t90 = t11*t88 + r1
    4642           0 :          t91 = f12*t90
    4643           0 :          t92 = t82**2
    4644           0 :          t93 = 0.1e1_dp/t92
    4645           0 :          t94 = C*t93
    4646           0 :          t95 = t91*t94
    4647           0 :          t96 = g2*t1
    4648           0 :          t97 = t96*t3
    4649           0 :          t99 = g3*t21
    4650           0 :          t100 = t99*t24
    4651           0 :          t102 = g1 + t97*t19 + t100*t32
    4652           0 :          t103 = t15*t102
    4653           0 :          t105 = t11*t103 + r1
    4654           0 :          t106 = t105*E
    4655           0 :          t108 = 0.1e1_dp/t92/t82
    4656           0 :          t109 = t106*t108
    4657           0 :          t110 = f158*E
    4658           0 :          t111 = t105*t83
    4659           0 :          t113 = t71 + DD + t72*t10
    4660           0 :          t114 = t113**2
    4661           0 :          t115 = t114**2
    4662           0 :          t116 = t115*t113
    4663           0 :          t117 = SQRT(t116)
    4664           0 :          t118 = 0.1e1_dp/t117
    4665           0 :          t121 = SQRT(t113)
    4666           0 :          t122 = 0.1e1_dp/t121
    4667           0 :          t125 = f68*C
    4668           0 :          t126 = t90*t83
    4669           0 :          t127 = t114*t113
    4670           0 :          t128 = SQRT(t127)
    4671           0 :          t129 = 0.1e1_dp/t128
    4672             :          t133 = (-t110*t111*t118 - t81*t83*t122 - t125*t126*t129) &
    4673           0 :                 *omega
    4674           0 :          t134 = 0.1e1_dp/t8
    4675           0 :          t136 = f52*E
    4676           0 :          t137 = t105*t93
    4677           0 :          t140 = f12*C
    4678           0 :          t141 = t90*t93
    4679           0 :          t145 = t72*omega
    4680           0 :          t146 = (-t136*t137*t118 - t140*t141*t129)*t145
    4681           0 :          t149 = 0.1e1_dp/r3/t5
    4682           0 :          t151 = t149/rho
    4683           0 :          t153 = t72**2
    4684           0 :          t154 = t153*omega
    4685           0 :          t155 = t118*t154
    4686           0 :          t156 = t155*t44
    4687           0 :          t158 = f12*A
    4688           0 :          t159 = exei(Q)
    4689           0 :          t160 = t71 + DD + t74
    4690           0 :          t161 = 0.1e1_dp/t160
    4691           0 :          t163 = LOG(t75*t161)
    4692             :          t167 = (t84 + t95 + t109 + t133*t134 + t146*t151 - t109*t156 &
    4693           0 :                  + t158*(t159 + t163))*Clda
    4694           0 :          e_0 = e_0 + (-t80*t167)*sx
    4695             :       END IF
    4696           0 :       IF (order >= 1 .OR. order == -1) THEN
    4697           0 :          t169 = t44*t13
    4698           0 :          t170 = t4*t169
    4699           0 :          t171 = t14*t34
    4700           0 :          t173 = t68*r3*t5
    4701           0 :          t174 = t171*t173
    4702           0 :          t176 = 0.2e1_dp/0.3e1_dp*t170*t174
    4703           0 :          t177 = t12*rho
    4704           0 :          t178 = 0.1e1_dp/t177
    4705           0 :          t179 = t178*t14
    4706           0 :          t180 = t179*t69
    4707           0 :          t182 = 2._dp*t11*t180
    4708           0 :          t183 = t3*t44
    4709           0 :          t184 = t16*t183
    4710           0 :          t185 = t15*t6
    4711           0 :          t188 = t10*t178
    4712           0 :          t189 = t188*t14
    4713           0 :          t192 = t56*t58
    4714           0 :          t193 = t192*t12
    4715           0 :          t195 = 0.1e1_dp/t8/t193
    4716           0 :          t196 = t24*t195
    4717           0 :          t197 = t22*t196
    4718           0 :          t198 = t29*t31
    4719           0 :          t199 = t198*t6
    4720           0 :          t203 = t27*t46*t31
    4721             :          t206 = -0.2e1_dp/0.3e1_dp*t184*t185 - (2._dp*t17*t189) - 0.4e1_dp &
    4722           0 :                 /0.3e1_dp*t197*t199 - (4._dp*t25*t203)
    4723           0 :          t207 = t206*t68
    4724           0 :          t208 = t15*t207
    4725           0 :          t209 = t11*t208
    4726           0 :          t210 = t4*t18
    4727           0 :          t211 = t67**2
    4728           0 :          t212 = 0.1e1_dp/t211
    4729           0 :          t213 = t35*t196
    4730           0 :          t219 = 0.1e1_dp/t9/t193
    4731           0 :          t220 = t41*t219
    4732           0 :          t221 = t39*t220
    4733           0 :          t222 = t46*t48
    4734           0 :          t223 = t222*t6
    4735           0 :          t227 = 0.1e1_dp/t28/t12
    4736           0 :          t229 = t44*t227*t48
    4737           0 :          t235 = t60/t61/rho*t63
    4738             :          t238 = -0.4e1_dp/0.3e1_dp*t213*t199 - (4._dp*t36*t203) - 0.5e1_dp &
    4739           0 :                 /0.3e1_dp*t221*t223 - (5._dp*t42*t229) - (8._dp*t55*t235)
    4740           0 :          t239 = t212*t238
    4741           0 :          t240 = t171*t239
    4742           0 :          t241 = t210*t240
    4743             :          t246 = -t176 - t182 + t209 - t241 - 0.2e1_dp/0.3e1_dp*t73*t44*r3 &
    4744           0 :                 *t5
    4745           0 :          dQrho = f94*t246*t77
    4746           0 :          t248 = ndrho*t3
    4747           0 :          t249 = t248*t10
    4748           0 :          t252 = a1*ndrho
    4749           0 :          t253 = t252*t3
    4750           0 :          t256 = t1*ndrho
    4751           0 :          t257 = a2*t256
    4752           0 :          t258 = t257*t24
    4753           0 :          t261 = 2._dp*t253*t19 + 4._dp*t258*t32
    4754           0 :          t262 = t261*t68
    4755           0 :          t263 = t15*t262
    4756           0 :          t265 = a3*t256
    4757           0 :          t266 = t265*t24
    4758           0 :          t269 = a4*t21
    4759           0 :          t270 = t269*t41
    4760           0 :          t274 = a5*t38*t54
    4761           0 :          t277 = 4._dp*t266*t32 + 5._dp*t270*t49 + 6._dp*t274*t65
    4762           0 :          t278 = t212*t277
    4763           0 :          t279 = t171*t278
    4764           0 :          t281 = 2._dp*t249*t70 + t11*t263 - t210*t279
    4765           0 :          dQndrho = f94*t281*t77
    4766           0 :          t283 = t78*f89
    4767           0 :          t286 = -t176 - t182 + t209 - t241
    4768           0 :          t289 = t14*t87
    4769           0 :          t290 = t289*t6
    4770           0 :          t293 = t179*t87
    4771           0 :          t296 = F2*t206
    4772           0 :          t299 = t296*t68 - t85*t239
    4773           0 :          t300 = t15*t299
    4774             :          t302 = -0.2e1_dp/0.3e1_dp*t170*t290 - (2._dp*t11*t293) + (t11 &
    4775           0 :                                                                    *t300)
    4776           0 :          t303 = f12*t302
    4777           0 :          t305 = C*t108
    4778           0 :          t306 = t305*t286
    4779           0 :          t309 = t14*t102
    4780           0 :          t310 = t309*t6
    4781           0 :          t313 = t179*t102
    4782           0 :          t316 = t96*t183
    4783           0 :          t321 = t99*t196
    4784             :          t326 = -0.2e1_dp/0.3e1_dp*t316*t185 - (2._dp*t97*t189) - 0.4e1_dp &
    4785           0 :                 /0.3e1_dp*t321*t199 - (4._dp*t100*t203)
    4786           0 :          t327 = t15*t326
    4787             :          t329 = -0.2e1_dp/0.3e1_dp*t170*t310 - (2._dp*t11*t313) + (t11 &
    4788           0 :                                                                    *t327)
    4789           0 :          t330 = t329*E
    4790           0 :          t331 = t330*t108
    4791           0 :          t332 = t92**2
    4792           0 :          t333 = 0.1e1_dp/t332
    4793           0 :          t334 = t333*t286
    4794           0 :          t340 = t110*t105
    4795           0 :          t341 = t93*t118
    4796           0 :          t342 = t341*t286
    4797           0 :          t345 = 0.1e1_dp/t117/t116
    4798           0 :          t346 = t83*t345
    4799           0 :          t350 = -t176 - t182 + t209 - t241 - 0.2e1_dp/0.3e1_dp*t72*t44*t6
    4800           0 :          t351 = t115*t350
    4801           0 :          t352 = t346*t351
    4802           0 :          t355 = t93*t122
    4803           0 :          t359 = 0.1e1_dp/t121/t113
    4804           0 :          t360 = t83*t359
    4805           0 :          t367 = t125*t90
    4806           0 :          t368 = t93*t129
    4807           0 :          t369 = t368*t286
    4808           0 :          t372 = 0.1e1_dp/t128/t127
    4809           0 :          t373 = t83*t372
    4810           0 :          t374 = t114*t350
    4811           0 :          t375 = t373*t374
    4812             :          t379 = (-t110*t329*t83*t118 + t340*t342 + 0.5e1_dp/0.2e1_dp*t340 &
    4813             :                  *t352 + t81*t355*t286 + t81*t360*t350/0.2e1_dp - t125 &
    4814             :                  *t302*t83*t129 + t367*t369 + 0.3e1_dp/0.2e1_dp*t367*t375)* &
    4815           0 :                 omega
    4816           0 :          t382 = t27*r3*t5
    4817           0 :          t388 = t136*t105
    4818           0 :          t389 = t108*t118
    4819           0 :          t390 = t389*t286
    4820           0 :          t393 = t93*t345
    4821           0 :          t394 = t393*t351
    4822           0 :          t400 = t140*t90
    4823           0 :          t401 = t108*t129
    4824           0 :          t402 = t401*t286
    4825           0 :          t405 = t93*t372
    4826           0 :          t406 = t405*t374
    4827             :          t410 = (-t136*t329*t93*t118 + (2._dp*t388*t390) + 0.5e1_dp/ &
    4828             :                  0.2e1_dp*(t388)*(t394) - t140*t302*t93*t129 + (2._dp &
    4829           0 :                                                                 *t400*t402) + 0.3e1_dp/0.2e1_dp*(t400)*(t406))*t145
    4830           0 :          t412 = t149*t13
    4831           0 :          t415 = t106*t333
    4832           0 :          t417 = t155*t44*t286
    4833           0 :          t420 = t108*t345
    4834           0 :          t421 = t106*t420
    4835           0 :          t422 = t154*t44
    4836           0 :          t423 = t422*t351
    4837           0 :          t426 = t106*t389
    4838           0 :          t427 = t154*t219
    4839           0 :          t428 = t427*t6
    4840           0 :          t431 = dexeirho(Q, dQrho)
    4841           0 :          t433 = t160**2
    4842           0 :          t434 = 0.1e1_dp/t433
    4843           0 :          t435 = t75*t434
    4844           0 :          t437 = t246*t161 - t435*t246
    4845           0 :          t438 = 0.1e1_dp/t75
    4846           0 :          t439 = t437*t438
    4847             :          t443 = -t81*t93*t286 + t303*t94 - (2._dp*t91*t306) + t331 &
    4848             :                 - (3._dp*t106*t334) + t379*t134 - t133*t382/0.3e1_dp + t410 &
    4849             :                 *t151 - t146*t412 - t331*t156 + (3._dp*t415*t417) + 0.5e1_dp &
    4850             :                 /0.2e1_dp*t421*t423 + 0.5e1_dp/0.3e1_dp*t426*t428 + t158*(t431 &
    4851           0 :                                                                           + t439*t160)
    4852           0 :          t444 = t443*Clda
    4853           0 :          e_rho = e_rho + (-0.4e1_dp/0.3e1_dp*t283*t167 - t80*t444)*sx
    4854           0 :          t450 = F2*t261
    4855           0 :          t453 = t450*t68 - t85*t278
    4856           0 :          t454 = t15*t453
    4857           0 :          t456 = 2._dp*t249*t88 + t11*t454
    4858           0 :          t457 = f12*t456
    4859           0 :          t459 = t305*t281
    4860           0 :          t464 = g2*ndrho
    4861           0 :          t465 = t464*t3
    4862           0 :          t468 = g3*t256
    4863           0 :          t469 = t468*t24
    4864           0 :          t472 = 2._dp*t465*t19 + 4._dp*t469*t32
    4865           0 :          t473 = t15*t472
    4866           0 :          t475 = 2._dp*t249*t103 + t11*t473
    4867           0 :          t476 = t475*E
    4868           0 :          t477 = t476*t108
    4869           0 :          t478 = t333*t281
    4870           0 :          t484 = t341*t281
    4871           0 :          t486 = t115*t281
    4872           0 :          t487 = t346*t486
    4873           0 :          t498 = t368*t281
    4874           0 :          t500 = t114*t281
    4875           0 :          t501 = t373*t500
    4876             :          t505 = (-t110*t475*t83*t118 + t340*t484 + 0.5e1_dp/0.2e1_dp*t340 &
    4877             :                  *t487 + t81*t355*t281 + t81*t360*t281/0.2e1_dp - t125 &
    4878             :                  *t456*t83*t129 + t367*t498 + 0.3e1_dp/0.2e1_dp*t367*t501)* &
    4879           0 :                 omega
    4880           0 :          t510 = t389*t281
    4881           0 :          t513 = t393*t486
    4882           0 :          t519 = t401*t281
    4883           0 :          t522 = t405*t500
    4884             :          t526 = (-t136*t475*t93*t118 + (2._dp*t388*t510) + 0.5e1_dp/ &
    4885             :                  0.2e1_dp*(t388)*(t513) - t140*t456*t93*t129 + (2._dp &
    4886           0 :                                                                 *t400*t519) + 0.3e1_dp/0.2e1_dp*(t400)*(t522))*t145
    4887           0 :          t530 = t155*t44*t281
    4888           0 :          t533 = t422*t486
    4889           0 :          t536 = dexeindrho(Q, dQndrho)
    4890           0 :          t539 = t281*t161 - t435*t281
    4891           0 :          t540 = t539*t438
    4892             :          t544 = -t81*t93*t281 + t457*t94 - (2._dp*t91*t459) + t477 &
    4893             :                 - (3._dp*t106*t478) + t505*t134 + t526*t151 - t477*t156 &
    4894             :                 + (3._dp*t415*t530) + 0.5e1_dp/0.2e1_dp*t421*t533 + t158*(t536 &
    4895           0 :                                                                           + t540*t160)
    4896           0 :          t545 = t544*Clda
    4897           0 :          e_ndrho = e_ndrho + (-t80*t545)*sx
    4898             :       END IF
    4899           0 :       IF (order >= 2 .OR. order == -2) THEN
    4900           0 :          t548 = t4*t219*t13
    4901           0 :          t553 = 0.10e2_dp/0.9e1_dp*t548*t171*t68*t56*t58
    4902           0 :          t555 = t4*t44*t178
    4903           0 :          t557 = 0.8e1_dp/0.3e1_dp*t555*t174
    4904           0 :          t558 = t14*t206
    4905           0 :          t561 = 0.4e1_dp/0.3e1_dp*t170*t558*t173
    4906           0 :          t563 = t4*t169*t14
    4907           0 :          t564 = t34*t212
    4908           0 :          t568 = 0.4e1_dp/0.3e1_dp*t563*t564*t6*t238
    4909           0 :          t569 = t29*t14
    4910           0 :          t572 = 6._dp*t11*t569*t69
    4911           0 :          t575 = 4._dp*t11*t179*t207
    4912           0 :          t576 = t4*t188
    4913           0 :          t578 = 4._dp*t576*t240
    4914           0 :          t579 = t3*t219
    4915           0 :          t581 = t15*t192
    4916           0 :          t584 = t179*t6
    4917           0 :          t588 = t10*t29*t14
    4918           0 :          t594 = t56*r3*t58*t5*t177
    4919           0 :          t597 = t24/t8/t594
    4920           0 :          t599 = t198*t192
    4921           0 :          t603 = t46*t31*t6
    4922           0 :          t607 = t27*t227*t31
    4923             :          t610 = 0.10e2_dp/0.9e1_dp*t16*t579*t581 + 0.8e1_dp/0.3e1_dp*t184* &
    4924             :                 t584 + (6._dp*t17*t588) + 0.28e2_dp/0.9e1_dp*t22*t597*t599 + &
    4925           0 :                 0.32e2_dp/0.3e1_dp*t197*t603 + (20._dp*t25*t607)
    4926           0 :          t613 = t11*t15*t610*t68
    4927           0 :          t616 = 2._dp*t210*t558*t239
    4928           0 :          t618 = 0.1e1_dp/t211/t67
    4929           0 :          t619 = t238**2
    4930           0 :          t620 = t618*t619
    4931           0 :          t623 = 2._dp*t210*t171*t620
    4932           0 :          t632 = 0.1e1_dp/t9/t594
    4933             :          t655 = t212*(0.28e2_dp/0.9e1_dp*t35*t597*t599 + 0.32e2_dp/0.3e1_dp &
    4934             :                       *t213*t603 + (20._dp*t36*t607) + 0.40e2_dp/0.9e1_dp*t39*t41 &
    4935             :                       *t632*t222*t192 + 0.50e2_dp/0.3e1_dp*t221*t227*t48*t6 + &
    4936             :                       0.30e2_dp*t42*t44/t28/t177*t48 + (72._dp*t55*t60/t61 &
    4937           0 :                                                         /t12*t63))
    4938           0 :          t657 = t210*t171*t655
    4939             :          t662 = t553 + t557 - t561 + t568 + t572 - t575 + t578 + t613 - t616 &
    4940           0 :                 + t623 - t657 + 0.10e2_dp/0.9e1_dp*t73*t219*t56*t58
    4941           0 :          d2Qrhorho = f94*t662*t77
    4942           0 :          t664 = t248*t169
    4943           0 :          t667 = t14*t261
    4944             :          t694 = -0.4e1_dp/0.3e1_dp*t252*t183*t185 - (4._dp*t253*t189) &
    4945           0 :                 - 0.16e2_dp/0.3e1_dp*t257*t196*t199 - (16._dp*t258*t203)
    4946           0 :          t700 = t248*t18
    4947           0 :          t706 = t618*t238*t277
    4948             :          t723 = t212*(-0.16e2_dp/0.3e1_dp*t265*t196*t199 - (16._dp*t266 &
    4949             :                                                             *t203) - 0.25e2_dp/0.3e1_dp*t269*t220*t223 - (25._dp*t270* &
    4950           0 :                                                                                                          t229) - (48._dp*t274*t235))
    4951             :          t726 = -0.4e1_dp/0.3e1_dp*t664*t174 - 0.2e1_dp/0.3e1_dp*t170*t667* &
    4952             :                 t173 + 0.2e1_dp/0.3e1_dp*t563*t564*t6*t277 - (4._dp*t249* &
    4953             :                                                               t180) - (2._dp*t11*t179*t262) + (2._dp*t576*t279) + (2._dp &
    4954             :                                                                                  *t249*t208) + (t11*t15*t694*t68) - t210*t558*t278 &
    4955             :                 - (2._dp*t700*t240) - t210*t667*t239 + 0.2e1_dp*t210* &
    4956           0 :                 t171*t706 - t210*t171*t723
    4957           0 :          d2Qrhondrho = f94*t726*t77
    4958           0 :          t728 = t3*t10
    4959           0 :          t744 = 2._dp*a1*t3*t19 + 12._dp*a2*t1*t24*t32
    4960           0 :          t751 = t277**2
    4961           0 :          t752 = t618*t751
    4962             :          t769 = t212*(12._dp*a3*t1*t24*t32 + 20._dp*a4*t256*t41*t49 &
    4963           0 :                       + 30._dp*a5*t21*t54*t65)
    4964             :          t772 = 2._dp*t728*t13*t171*t68 + 4._dp*t249*t263 - 4._dp*t700*t279 &
    4965             :                 + t11*t15*t744*t68 - 2._dp*t210*t667*t278 + 2._dp*t210* &
    4966           0 :                 t171*t752 - t210*t171*t769
    4967           0 :          d2Qndrhondrho = f94*t772*t77
    4968           0 :          t774 = t78**2
    4969           0 :          t782 = 0.1e1_dp/t332/t82
    4970           0 :          t783 = t106*t782
    4971           0 :          t784 = t286**2
    4972           0 :          t789 = t115**2
    4973           0 :          t792 = 0.1e1_dp/t117/t789/t114
    4974           0 :          t793 = t83*t792
    4975           0 :          t794 = t350**2
    4976           0 :          t795 = t789*t794
    4977           0 :          t799 = t108*t122
    4978           0 :          t803 = t81*t93
    4979           0 :          t804 = t359*t286
    4980             :          t807 = t553 + t557 - t561 + t568 + t572 - t575 + t578 + t613 - t616 &
    4981           0 :                 + t623 - t657
    4982           0 :          t811 = 0.1e1_dp/t121/t114
    4983           0 :          t812 = t83*t811
    4984             :          t819 = t553 + t557 - t561 + t568 + t572 - t575 + t578 + t613 - t616 &
    4985           0 :                 + t623 - t657 + 0.10e2_dp/0.9e1_dp*t72*t219*t192
    4986             :          t848 = 0.10e2_dp/0.9e1_dp*t548*t289*t192 + 0.8e1_dp/0.3e1_dp*t555* &
    4987             :                 t290 - 0.4e1_dp/0.3e1_dp*t170*t14*t299*t6 + (6._dp*t11*t569 &
    4988             :                                                              *t87) - 0.4e1_dp*(t11)*t179*t299 + (t11*t15*(F2 &
    4989           0 :                                                                            *t610*t68 - 2._dp*t296*t239 + 2._dp*t85*t620 - t85*t655))
    4990           0 :          t852 = t125*t302
    4991             :          t862 = -0.75e2_dp/0.4e1_dp*t340*t793*t795 - (2._dp*t81*t799* &
    4992             :                                                       t784) - t803*t804*t350 + (t81*t355*t807) - 0.3e1_dp/0.4e1_dp &
    4993             :                 *(t81)*(t812)*(t794) + (t81*t360*t819) &
    4994             :                 /0.2e1_dp - t125*t848*t83*t129 + (2._dp*t852*t369) + (3._dp &
    4995             :                                                                       *t852*t375) - (2._dp*t367*t401*t784) + (t367*t368 &
    4996           0 :                                                                                                               *t807)
    4997           0 :          t863 = t125*t141
    4998           0 :          t864 = t372*t286
    4999           0 :          t865 = t864*t374
    5000           0 :          t868 = t113*t794
    5001           0 :          t872 = t114*t819
    5002           0 :          t878 = 0.1e1_dp/t128/t115/t114
    5003           0 :          t879 = t83*t878
    5004           0 :          t880 = t115*t794
    5005             :          t916 = 0.10e2_dp/0.9e1_dp*t548*t309*t192 + 0.8e1_dp/0.3e1_dp*t555* &
    5006             :                 t310 - 0.4e1_dp/0.3e1_dp*t170*t14*t326*t6 + (6._dp*t11*t569 &
    5007             :                                                              *t102) - 0.4e1_dp*(t11)*t179*t326 + (t11)*t15*(0.10e2_dp &
    5008             :                                                                            /0.9e1_dp*t96*t579*t581 + 0.8e1_dp/0.3e1_dp*t316*t584 + &
    5009             :                                                                    (6._dp*t97*t588) + 0.28e2_dp/0.9e1_dp*t99*t597*t599 + 0.32e2_dp &
    5010           0 :                                                                                            /0.3e1_dp*t321*t603 + (20._dp*t100*t607))
    5011           0 :          t920 = t110*t329
    5012           0 :          t930 = t110*t137
    5013           0 :          t931 = t345*t286
    5014           0 :          t932 = t931*t351
    5015           0 :          t935 = t127*t794
    5016           0 :          t939 = t115*t819
    5017             :          t943 = -(3._dp*t863*t865) + (3._dp*t367*t373*t868) + 0.3e1_dp &
    5018             :                 /0.2e1_dp*(t367)*(t373)*(t872) - 0.27e2_dp/0.4e1_dp &
    5019             :                 *(t367)*(t879)*(t880) - t110*t916*t83*t118 &
    5020             :                 + (2._dp*t920*t342) + (5._dp*t920*t352) - (2._dp*t340* &
    5021             :                                                            t389*t784) + (t340*t341*t807) - (5._dp*t930*t932) + &
    5022             :                 (10._dp*t340*t346*t935) + 0.5e1_dp/0.2e1_dp*(t340)*(t346) &
    5023           0 :                 *(t939)
    5024           0 :          t956 = t136*t329
    5025           0 :          t961 = t333*t118
    5026           0 :          t966 = t136*t105*t108
    5027           0 :          t972 = t93*t792
    5028           0 :          t985 = t140*t302
    5029           0 :          t990 = t333*t129
    5030           0 :          t995 = t140*t90*t108
    5031           0 :          t1001 = t93*t878
    5032             :          t1011 = -t136*t916*t93*t118 + (4._dp*t956*t390) + (5._dp &
    5033             :                                                             *t956*t394) - (6._dp*t388*t961*t784) - (10._dp*t966*t932) &
    5034             :                  + (2._dp*t388*t389*t807) - 0.75e2_dp/0.4e1_dp*(t388) &
    5035             :                  *(t972)*(t795) + (10._dp*t388*t393*t935) + 0.5e1_dp &
    5036             :                  /0.2e1_dp*(t388)*(t393)*(t939) - t140*t848*t93 &
    5037             :                  *t129 + (4._dp*t985*t402) + (3._dp*t985*t406) - (6._dp* &
    5038             :                                                                   t400*t990*t784) - (6._dp*t995*t865) + (2._dp*t400*t401 &
    5039             :                                                                                  *t807) - 0.27e2_dp/0.4e1_dp*(t400)*(t1001)*(t880) &
    5040             :                  + (3._dp*t400*t405*t868) + 0.3e1_dp/0.2e1_dp*(t400)*(t405) &
    5041           0 :                  *(t872)
    5042           0 :          t1017 = t106*t961
    5043           0 :          t1026 = t106*t420*t154
    5044           0 :          t1033 = d2exeirhorho(Q, dQrho, d2Qrhorho)
    5045           0 :          t1035 = t246**2
    5046           0 :          t1040 = t75/t433/t160
    5047           0 :          t1047 = t75**2
    5048           0 :          t1048 = 0.1e1_dp/t1047
    5049           0 :          t1049 = t437*t1048
    5050           0 :          t1065 = t106*t333*t345
    5051           0 :          t1066 = t286*t115
    5052           0 :          t1071 = t330*t420
    5053             :          t1074 = -(12._dp*t783*t155*t44*t784) + (t862 + t943)*omega &
    5054             :                  *t134 + f12*t848*t94 + 0.4e1_dp/0.9e1_dp*t133*t195*t56* &
    5055             :                  t58 + t1011*t145*t151 + (12._dp*t106*t782*t784) - (10._dp &
    5056             :                                                                     *t1017*t427*t286*r3*t5) - (t81*t93*t807) - 0.25e2_dp &
    5057             :                  /0.3e1_dp*(t1026)*(t219)*(t115)*(t350)* &
    5058             :                  (r3)*(t5) + (t158*(t1033 + (t662*t161 - 2._dp*t1035 &
    5059             :                                              *t434 + 2._dp*t1040*t1035 - t435*t662)*t438*t160 - t1049 &
    5060             :                                     *t160*t246 + t439*t246)) + (3._dp*t415*t155*t44*t807) &
    5061             :                  + (2._dp*t81*t108*t784) - (4._dp*t303*t306) - (15._dp* &
    5062           0 :                                                                 t1065*t422*t1066*t350) + (5._dp*t1071*t423)
    5063           0 :          t1082 = t106*t108*t792
    5064           0 :          t1089 = t330*t333
    5065           0 :          t1098 = t916*E*t108
    5066           0 :          t1111 = C*t333
    5067             :          t1118 = 0.5e1_dp/0.2e1_dp*t421*t422*t939 + (2._dp*t146*t149* &
    5068             :                                                      t178) - 0.75e2_dp/0.4e1_dp*t1082*t422*t795 - (3._dp*t106*t333 &
    5069             :                                                                             *t807) + (6._dp*t1089*t417) + 0.10e2_dp*t421*t422*t935 &
    5070             :                  - 0.2e1_dp/0.3e1_dp*t379*t382 + t1098 - 0.40e2_dp/0.9e1_dp*t426*t154 &
    5071             :                  *t632*t192 - (2._dp*t410*t412) - (2._dp*t91*t305*t807) &
    5072             :                  - (6._dp*t330*t334) - t1098*t156 + (6._dp*t91*t1111 &
    5073           0 :                                                      *t784) + 0.10e2_dp/0.3e1_dp*(t330)*(t389)*(t428)
    5074             :          e_rho_rho = e_rho_rho + (-0.4e1_dp/0.9e1_dp/t774*f89*t167 - 0.8e1_dp/0.3e1_dp*t283*t444 &
    5075           0 :                                   - t80*(t1074 + t1118)*Clda)*sx
    5076             :          t1155 = -0.4e1_dp/0.3e1_dp*t664*t310 - 0.2e1_dp/0.3e1_dp*t170*t14* &
    5077             :                  t472*t6 - (4._dp*t249*t313) - 0.2e1_dp*t11*t179*t472 + (2._dp &
    5078             :                                                                          *t249*t327) + t11*t15*(-0.4e1_dp/0.3e1_dp*t464*t183* &
    5079             :                                                                       t185 - (4._dp*t465*t189) - 0.16e2_dp/0.3e1_dp*t468*t196*t199 &
    5080           0 :                                                                                                 - (16._dp*t469*t203))
    5081           0 :          t1157 = t1155*E*t108
    5082           0 :          t1174 = t476*t333
    5083           0 :          t1181 = t931*t486
    5084           0 :          t1184 = t114*t726
    5085           0 :          t1189 = t350*t281
    5086           0 :          t1190 = t372*t114*t1189
    5087           0 :          t1198 = t115*t726
    5088           0 :          t1205 = t110*t475
    5089           0 :          t1208 = t110*t111
    5090           0 :          t1210 = t792*t789*t1189
    5091           0 :          t1218 = t286*t281
    5092           0 :          t1224 = t125*t456
    5093             :          t1231 = -0.5e1_dp/0.2e1_dp*t930*t1181 + 0.3e1_dp/0.2e1_dp*t367*t373 &
    5094             :                  *t1184 - 0.3e1_dp/0.2e1_dp*t863*t1190 - t803*t804*t281/0.2e1_dp &
    5095             :                  + t81*t355*t726 + 0.5e1_dp/0.2e1_dp*t340*t346*t1198 + t81 &
    5096             :                  *t360*t726/0.2e1_dp + 0.5e1_dp/0.2e1_dp*t1205*t352 - 0.75e2_dp/0.4e1_dp &
    5097             :                  *t1208*t1210 - 0.2e1_dp*t81*t108*t122*t286*t281 - 0.2e1_dp &
    5098             :                  *t340*t389*t1218 + t340*t341*t726 + 0.3e1_dp/0.2e1_dp* &
    5099           0 :                  t1224*t375 - t110*t1155*t83*t118 + t920*t484
    5100             :          t1255 = -0.4e1_dp/0.3e1_dp*t664*t290 - 0.2e1_dp/0.3e1_dp*t170*t14* &
    5101             :                  t453*t6 - (4._dp*t249*t293) - 0.2e1_dp*t11*t179*t453 + (2._dp &
    5102             :                                                                          *t249*t300) + t11*t15*(F2*t694*t68 - t296*t278 &
    5103           0 :                                                                                             - t450*t239 + 2._dp*t85*t706 - t85*t723)
    5104           0 :          t1261 = t345*t115*t1189
    5105           0 :          t1264 = t125*t126
    5106           0 :          t1266 = t878*t115*t1189
    5107           0 :          t1270 = t345*t127*t1189
    5108           0 :          t1277 = t372*t113*t1189
    5109           0 :          t1288 = t864*t500
    5110             :          t1299 = -t125*t1255*t83*t129 + t852*t498 - 0.5e1_dp/0.2e1_dp* &
    5111             :                  t930*t1261 - 0.27e2_dp/0.4e1_dp*t1264*t1266 + (10._dp*t1208* &
    5112             :                                                                 t1270) + 0.3e1_dp/0.2e1_dp*t852*t501 + t1224*t369 + 0.3e1_dp*t1264 &
    5113             :                  *t1277 - 0.3e1_dp/0.4e1_dp*t84*t811*t350*t281 - t803*t359 &
    5114             :                  *t350*t281/0.2e1_dp - 0.3e1_dp/0.2e1_dp*t863*t1288 - (2._dp*t367 &
    5115             :                                                                        *t401*t1218) + (t367*t368*t726) + 0.5e1_dp/0.2e1_dp*t920 &
    5116           0 :                  *t487 + t1205*t342
    5117             :          t1319 = -0.75e2_dp/0.4e1_dp*t1082*t422*t789*t350*t281 - t1157 &
    5118             :                  *t156 - 0.15e2_dp/0.2e1_dp*t1065*t422*t1066*t281 + t1157 - (2._dp &
    5119             :                                                                         *t303*t459) + 0.5e1_dp/0.3e1_dp*t476*t389*t428 - 0.25e2_dp &
    5120             :                  /0.6e1_dp*t1026*t219*r3*t5*t115*t281 + (3._dp*t1174* &
    5121             :                                                          t417) - t526*t412 - (2._dp*t91*t305*t726) + (t1231 + t1299) &
    5122             :                  *omega*t134 + 0.6e1_dp*t400*t334*t281 - 0.5e1_dp*t1017*t427 &
    5123             :                  *t6*t281 + 0.10e2_dp*t421*t422*t127*t350*t281 - (2._dp &
    5124           0 :                                                                   *t457*t306) + 0.5e1_dp/0.2e1_dp*t1071*t533
    5125           0 :          t1324 = d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    5126           0 :          t1336 = t160*t281
    5127           0 :          t1351 = t476*t420
    5128           0 :          t1382 = t136*t475
    5129           0 :          t1397 = t136*t137
    5130             :          t1405 = -t136*t1155*t93*t118 + (2._dp*t956*t510) + 0.5e1_dp &
    5131             :                  /0.2e1_dp*(t956)*(t513) + (2._dp*t1382*t390) - (6._dp &
    5132             :                                                                  *t388*t961*t1218) - (5._dp*t966*t1181) + (2._dp*t388 &
    5133             :                                                                            *t389*t726) + 0.5e1_dp/0.2e1_dp*(t1382)*(t394) - (5._dp &
    5134             :                                                                    *t966*t1261) - 0.75e2_dp/0.4e1_dp*t1397*t1210 + 0.10e2_dp*t1397 &
    5135           0 :                  *t1270 + 0.5e1_dp/0.2e1_dp*(t388)*(t393)*(t1198)
    5136           0 :          t1413 = t140*t456
    5137             :          t1435 = -t140*t1255*t93*t129 + (2._dp*t985*t519) + 0.3e1_dp &
    5138             :                  /0.2e1_dp*(t985)*(t522) + (2._dp*t1413*t402) - (6._dp &
    5139             :                                                                  *t400*t990*t1218) - (3._dp*t995*t1288) + (2._dp*t400 &
    5140             :                                                                            *t401*t726) + 0.3e1_dp/0.2e1_dp*(t1413)*(t406) - (3._dp &
    5141             :                                                                   *t995*t1190) - 0.27e2_dp/0.4e1_dp*t95*t1266 + 0.3e1_dp*t95*t1277 &
    5142           0 :                  + 0.3e1_dp/0.2e1_dp*(t400)*(t405)*(t1184)
    5143             :          t1443 = -0.15e2_dp/0.2e1_dp*t1065*t422*t351*t281 + t158*(t1324 &
    5144             :                                                                   + (t726*t161 - 0.2e1_dp*t246*t434*t281 + 0.2e1_dp*t1040*t246 &
    5145             :                                                                      *t281 - t435*t726)*t438*t160 - t1049*t1336 + t439*t281) &
    5146             :                  - 0.12e2_dp*t106*t782*t118*t422*t1218 + 0.5e1_dp/0.2e1_dp* &
    5147             :                  t421*t422*t1198 - (3._dp*t330*t478) + 0.5e1_dp/0.2e1_dp*t1351 &
    5148             :                  *t423 + 0.12e2_dp*t106*t782*t286*t281 - 0.3e1_dp*t106*t333 &
    5149             :                  *t726 - t81*t93*t726 + f12*t1255*t94 + (3._dp*t1089 &
    5150             :                                                          *t530) - (3._dp*t476*t334) + 0.2e1_dp*t81*t108*t286*t281 &
    5151             :                  - t505*t382/0.3e1_dp + (t1405 + t1435)*t145*t151 + 0.3e1_dp*t415 &
    5152           0 :                  *t155*t44*t726
    5153           0 :          e_ndrho_rho = e_ndrho_rho + (-0.4e1_dp/0.3e1_dp*t283*t545 - t80*(t1319 + t1443)*Clda)*sx
    5154           0 :          t1447 = t281**2
    5155           0 :          t1448 = t1447*t115
    5156           0 :          t1452 = d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
    5157             :          t1481 = 2._dp*t728*t103 + 4._dp*t249*t473 + t11*t15*(2._dp*g2*t3 &
    5158           0 :                                                               *t19 + 12._dp*g3*t1*t24*t32)
    5159           0 :          t1483 = t1481*E*t108
    5160             :          t1500 = 2._dp*t728*t88 + 4._dp*t249*t454 + t11*t15*(F2*t744* &
    5161           0 :                                                              t68 - 2._dp*t450*t278 + 2._dp*t85*t752 - t85*t769)
    5162           0 :          t1529 = t789*t1447
    5163           0 :          t1533 = t127*t1447
    5164           0 :          t1537 = t115*t772
    5165           0 :          t1552 = t1447*t114
    5166           0 :          t1562 = t113*t1447
    5167           0 :          t1566 = t114*t772
    5168             :          t1570 = -t136*t1481*t93*t118 + (4._dp*t1382*t510) + (5._dp &
    5169             :                                                               *t1382*t513) - (6._dp*t388*t961*t1447) - (10._dp*t388 &
    5170             :                                                                        *t420*t1448) + (2._dp*t388*t389*t772) - 0.75e2_dp/0.4e1_dp* &
    5171             :                  (t388)*(t972)*(t1529) + (10._dp*t388*t393*t1533) &
    5172             :                  + 0.5e1_dp/0.2e1_dp*(t388)*(t393)*(t1537) - t140 &
    5173             :                  *t1500*t93*t129 + (4._dp*t1413*t519) + (3._dp*t1413 &
    5174             :                                                          *t522) - (6._dp*t400*t990*t1447) - (6._dp*t400*t108*t372 &
    5175             :                                                                       *t1552) + (2._dp*t400*t401*t772) - 0.27e2_dp/0.4e1_dp*(t400) &
    5176             :                  *(t1001)*(t1448) + (3._dp*t400*t405*t1562) &
    5177           0 :                  + 0.3e1_dp/0.2e1_dp*(t400)*(t405)*(t1566)
    5178             :          t1576 = -15._dp*t1065*t422*t1448 + t158*(t1452 + (t772*t161 - &
    5179             :                                                            2._dp*t1447*t434 + 2._dp*t1040*t1447 - t435*t772)*t438*t160 &
    5180             :                                                   - t539*t1048*t1336 + t540*t281) + t1483 - t81*t93*t772 &
    5181             :                  + f12*t1500*t94 + 2._dp*t81*t108*t1447 - 6._dp*t476*t478 - 3._dp &
    5182             :                  *t106*t333*t772 - 4._dp*t457*t459 + t1570*t145*t151 + 10._dp &
    5183           0 :                  *t421*t422*t1533
    5184             :          t1618 = -(2._dp*t81*t799*t1447) - (t81*t93*t359*t1447) &
    5185             :                  + (t81*t355*t772) - 0.3e1_dp/0.4e1_dp*(t81)*(t812) &
    5186             :                  *(t1447) + (t81*t360*t772)/0.2e1_dp - t125*t1500 &
    5187             :                  *t83*t129 + (2._dp*t1224*t498) + (3._dp*t1224*t501) - &
    5188             :                  (2._dp*t367*t401*t1447) + (t367*t368*t772) - (3._dp &
    5189           0 :                                                                *t367*t405*t1552)
    5190             :          t1652 = (3._dp*t367*t373*t1562) + 0.3e1_dp/0.2e1_dp*(t367) &
    5191             :                  *(t373)*(t1566) - 0.27e2_dp/0.4e1_dp*(t367)*(t879) &
    5192             :                  *(t1448) - t110*t1481*t83*t118 + (2._dp*t1205*t484) &
    5193             :                  + (5._dp*t1205*t487) - (2._dp*t340*t389*t1447) + (t340 &
    5194             :                                                                    *t341*t772) - (5._dp*t340*t393*t1448) + (10._dp* &
    5195             :                                                                                t340*t346*t1533) + 0.5e1_dp/0.2e1_dp*(t340)*(t346)* &
    5196           0 :                  (t1537) - 0.75e2_dp/0.4e1_dp*(t340)*(t793)*(t1529)
    5197             :          t1672 = 0.5e1_dp/0.2e1_dp*t421*t422*t1537 - 0.75e2_dp/0.4e1_dp*t1082 &
    5198             :                  *t422*t1529 + (6._dp*t91*t1111*t1447) - (2._dp*t91* &
    5199             :                                                           t305*t772) + (t1618 + t1652)*omega*t134 + (12._dp*t106*t782 &
    5200             :                                                                           *t1447) - t1483*t156 + (6._dp*t1174*t530) + (5._dp*t1351 &
    5201             :                                                                                *t533) - (12._dp*t783*t155*t44*t1447) + (3._dp*t415 &
    5202           0 :                                                                                                                      *t155*t44*t772)
    5203           0 :          e_ndrho_ndrho = e_ndrho_ndrho + (-t80*(t1576 + t1672)*Clda)*sx
    5204             :       END IF
    5205             : 
    5206           0 :    END SUBROUTINE xwpbe_lda_calc_4
    5207             : 
    5208             : ! **************************************************************************************************
    5209             : !> \brief return various information on the functional
    5210             : !> \param reference string with the reference of the actual functional
    5211             : !> \param shortform string with the shortform of the functional name
    5212             : !> \param needs the components needed by this functional are set to
    5213             : !>        true (does not set the unneeded components to false)
    5214             : !> \param max_deriv ...
    5215             : !> \par History
    5216             : !>      05.2007 created [Manuel Guidon]
    5217             : !> \author Manuel Guidon
    5218             : ! **************************************************************************************************
    5219         710 :    SUBROUTINE xwpbe_lsd_info(reference, shortform, needs, max_deriv)
    5220             :       CHARACTER(LEN=*), INTENT(OUT), OPTIONAL            :: reference, shortform
    5221             :       TYPE(xc_rho_cflags_type), INTENT(inout), OPTIONAL  :: needs
    5222             :       INTEGER, INTENT(out), OPTIONAL                     :: max_deriv
    5223             : 
    5224         710 :       IF (PRESENT(reference)) THEN
    5225           2 :          reference = "Jochen Heyd and Gustavo E. Scuseria, J. Chem. Phys., 120, 7274 {LSD version}"
    5226             :       END IF
    5227         710 :       IF (PRESENT(shortform)) THEN
    5228           2 :          shortform = "shortrange part of PBE exchange {LSD}"
    5229             :       END IF
    5230         710 :       IF (PRESENT(needs)) THEN
    5231         708 :          needs%rho_spin = .TRUE.
    5232         708 :          needs%norm_drho_spin = .TRUE.
    5233             :       END IF
    5234         710 :       IF (PRESENT(max_deriv)) max_deriv = 2
    5235         710 :    END SUBROUTINE xwpbe_lsd_info
    5236             : 
    5237             : ! **************************************************************************************************
    5238             : !> \brief evaluates the screened hole averaged PBE exchange functional for lsd
    5239             : !> \param rho_set the density where you want to evaluate the functional
    5240             : !> \param deriv_set place where to store the functional derivatives (they are
    5241             : !>        added to the derivatives)
    5242             : !> \param order degree of the derivative that should be evaluated,
    5243             : !>        if positive all the derivatives up to the given degree are evaluated,
    5244             : !>        if negative only the given degree is calculated
    5245             : !> \param xwpbe_params input parameters (scaling,omega)
    5246             : !> \par History
    5247             : !>      05.2007 created [Manuel Guidon]
    5248             : !> \author Manuel Guidon
    5249             : !> \note
    5250             : !>      The current version provides code for derivatives up to second order.
    5251             : !>      Using the maple sheet in cp2k/doc it is straightforward to produce routines
    5252             : !>      for higher derivatives.
    5253             : ! **************************************************************************************************
    5254        3750 :    SUBROUTINE xwpbe_lsd_eval(rho_set, deriv_set, order, xwpbe_params)
    5255             : 
    5256             :       TYPE(xc_rho_set_type), INTENT(IN)                  :: rho_set
    5257             :       TYPE(xc_derivative_set_type), INTENT(IN)           :: deriv_set
    5258             :       INTEGER, INTENT(IN)                                :: order
    5259             :       TYPE(section_vals_type), POINTER                   :: xwpbe_params
    5260             : 
    5261             :       CHARACTER(len=*), PARAMETER                        :: routineN = 'xwpbe_lsd_eval'
    5262             : 
    5263             :       INTEGER                                            :: handle, npoints
    5264             :       INTEGER, DIMENSION(2, 3)                           :: bo
    5265             :       REAL(kind=dp)                                      :: epsilon_norm_drho, epsilon_rho, omega, &
    5266             :                                                             sx, sx0
    5267         750 :       REAL(kind=dp), CONTIGUOUS, DIMENSION(:, :, :), POINTER :: dummy, e_0, e_ndrhoa, &
    5268         750 :          e_ndrhoa_ndrhoa, e_ndrhoa_rhoa, e_ndrhob, e_ndrhob_ndrhob, e_ndrhob_rhob, e_rhoa, &
    5269         750 :          e_rhoa_rhoa, e_rhob, e_rhob_rhob, norm_drhoa, norm_drhob, rhoa, rhob
    5270             :       TYPE(xc_derivative_type), POINTER                  :: deriv
    5271             : 
    5272         750 :       CALL timeset(routineN, handle)
    5273             : 
    5274         750 :       CALL cite_reference(Heyd2004)
    5275             : 
    5276         750 :       CALL section_vals_val_get(xwpbe_params, "SCALE_X", r_val=sx)
    5277         750 :       CALL section_vals_val_get(xwpbe_params, "SCALE_X0", r_val=sx0)
    5278         750 :       CALL section_vals_val_get(xwpbe_params, "OMEGA", r_val=omega)
    5279             : 
    5280             :       CALL xc_rho_set_get(rho_set, rhoa=rhoa, rhob=rhob, norm_drhoa=norm_drhoa, &
    5281             :                           norm_drhob=norm_drhob, local_bounds=bo, rho_cutoff=epsilon_rho, &
    5282         750 :                           drho_cutoff=epsilon_norm_drho)
    5283         750 :       npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
    5284             : 
    5285         750 :       dummy => rhoa
    5286             : 
    5287         750 :       e_0 => dummy
    5288         750 :       e_rhoa => dummy
    5289         750 :       e_rhob => dummy
    5290         750 :       e_ndrhoa => dummy
    5291         750 :       e_ndrhob => dummy
    5292         750 :       e_rhoa_rhoa => dummy
    5293         750 :       e_rhob_rhob => dummy
    5294         750 :       e_ndrhoa_rhoa => dummy
    5295         750 :       e_ndrhob_rhob => dummy
    5296         750 :       e_ndrhoa_ndrhoa => dummy
    5297         750 :       e_ndrhob_ndrhob => dummy
    5298             : 
    5299         750 :       IF (order >= 0) THEN
    5300             :          deriv => xc_dset_get_derivative(deriv_set, [INTEGER::], &
    5301         750 :                                          allocate_deriv=.TRUE.)
    5302         750 :          CALL xc_derivative_get(deriv, deriv_data=e_0)
    5303             :       END IF
    5304         750 :       IF (order >= 1 .OR. order == -1) THEN
    5305             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhoa], &
    5306         606 :                                          allocate_deriv=.TRUE.)
    5307         606 :          CALL xc_derivative_get(deriv, deriv_data=e_rhoa)
    5308             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhob], &
    5309         606 :                                          allocate_deriv=.TRUE.)
    5310         606 :          CALL xc_derivative_get(deriv, deriv_data=e_rhob)
    5311             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhoa], &
    5312         606 :                                          allocate_deriv=.TRUE.)
    5313         606 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrhoa)
    5314             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhob], &
    5315         606 :                                          allocate_deriv=.TRUE.)
    5316         606 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrhob)
    5317             :       END IF
    5318         750 :       IF (order >= 2 .OR. order == -2) THEN
    5319             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhoa, deriv_rhoa], &
    5320           0 :                                          allocate_deriv=.TRUE.)
    5321           0 :          CALL xc_derivative_get(deriv, deriv_data=e_rhoa_rhoa)
    5322             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_rhob, deriv_rhob], &
    5323           0 :                                          allocate_deriv=.TRUE.)
    5324           0 :          CALL xc_derivative_get(deriv, deriv_data=e_rhob_rhob)
    5325             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhoa, deriv_rhoa], &
    5326           0 :                                          allocate_deriv=.TRUE.)
    5327           0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrhoa_rhoa)
    5328             :          deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drhob, deriv_rhob], &
    5329           0 :                                          allocate_deriv=.TRUE.)
    5330           0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrhob_rhob)
    5331             :          deriv => xc_dset_get_derivative(deriv_set, &
    5332           0 :                                          [deriv_norm_drhoa, deriv_norm_drhoa], allocate_deriv=.TRUE.)
    5333           0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrhoa_ndrhoa)
    5334             :          deriv => xc_dset_get_derivative(deriv_set, &
    5335           0 :                                          [deriv_norm_drhob, deriv_norm_drhob], allocate_deriv=.TRUE.)
    5336           0 :          CALL xc_derivative_get(deriv, deriv_data=e_ndrhob_ndrhob)
    5337             :       END IF
    5338         750 :       IF (order > 2 .OR. order < -2) THEN
    5339           0 :          CPABORT("derivatives bigger than 2 not implemented")
    5340             :       END IF
    5341             : 
    5342             : !$OMP     PARALLEL DEFAULT(NONE) &
    5343             : !$OMP     SHARED(npoints, order, rhoa, norm_drhoa, e_0, e_rhoa, e_ndrhoa) &
    5344             : !$OMP     SHARED(e_rhoa_rhoa, e_ndrhoa_rhoa, e_ndrhoa_ndrhoa, epsilon_rho) &
    5345             : !$OMP     SHARED(sx, sx0, omega) &
    5346             : !$OMP     SHARED(rhob, norm_drhob, e_rhob, e_ndrhob, e_rhob_rhob) &
    5347         750 : !$OMP     SHARED(e_ndrhob_rhob, e_ndrhob_ndrhob)
    5348             : 
    5349             :       !Call lsd_calc for alpha - and beta - spins
    5350             : 
    5351             :       CALL xwpbe_lsd_calc(npoints, order, rho=rhoa, norm_drho=norm_drhoa, &
    5352             :                           e_0=e_0, e_rho=e_rhoa, e_ndrho=e_ndrhoa, e_rho_rho=e_rhoa_rhoa, &
    5353             :                           e_ndrho_rho=e_ndrhoa_rhoa, e_ndrho_ndrho=e_ndrhoa_ndrhoa, &
    5354             :                           epsilon_rho=epsilon_rho, &
    5355             :                           sx=sx, sx0=sx0, omega=omega)
    5356             :       CALL xwpbe_lsd_calc(npoints, order, rho=rhob, norm_drho=norm_drhob, &
    5357             :                           e_0=e_0, e_rho=e_rhob, e_ndrho=e_ndrhob, e_rho_rho=e_rhob_rhob, &
    5358             :                           e_ndrho_rho=e_ndrhob_rhob, e_ndrho_ndrho=e_ndrhob_ndrhob, &
    5359             :                           epsilon_rho=epsilon_rho, &
    5360             :                           sx=sx, sx0=sx0, omega=omega)
    5361             : 
    5362             : !$OMP     END PARALLEL
    5363             : 
    5364         750 :       CALL timestop(handle)
    5365             : 
    5366         750 :    END SUBROUTINE xwpbe_lsd_eval
    5367             : 
    5368             : ! **************************************************************************************************
    5369             : !> \brief evaluates the screened hole averaged PBE exchange functional for lsd.
    5370             : !> \param npoints ...
    5371             : !> \param order degree of the derivative that should be evaluated,
    5372             : !>        if positive all the derivatives up to the given degree are evaluated,
    5373             : !>        if negative only the given degree is calculated
    5374             : !> \param rho , ndrho: density and norm of the density gradient
    5375             : !> \param norm_drho ...
    5376             : !> \param e_0 ...
    5377             : !> \param e_rho ...
    5378             : !> \param e_ndrho ...
    5379             : !> \param e_rho_rho ...
    5380             : !> \param e_ndrho_rho ...
    5381             : !> \param e_ndrho_ndrho ...
    5382             : !> \param epsilon_rho ...
    5383             : !> \param sx , sx0: scaling factor for omega!=0 and omega=0
    5384             : !> \param sx0 ...
    5385             : !> \param omega screening parameter
    5386             : !> \par History
    5387             : !>      05.2007 created [Manuel Guidon]
    5388             : !> \author Manuel Guidon
    5389             : !> \note
    5390             : !>      - The lsd part is calculated using the spin-scaling relations for the
    5391             : !>        exchange energy:
    5392             : !>
    5393             : !>               Ex[na,nb] = 0.5 * Ex[2*na] + 0.5 * Ex[2*nb].
    5394             : !>
    5395             : !>      - In order to avoid numerical instabilities, this routine calls different
    5396             : !>        subroutines. There are 4 routines for the case omega!=0 and 2 routines
    5397             : !>        for omega=0.
    5398             : ! **************************************************************************************************
    5399        1500 :    SUBROUTINE xwpbe_lsd_calc(npoints, order, rho, norm_drho, e_0, e_rho, e_ndrho, &
    5400        1500 :                              e_rho_rho, e_ndrho_rho, e_ndrho_ndrho, &
    5401             :                              epsilon_rho, sx, sx0, omega)
    5402             : 
    5403             :       INTEGER, INTENT(in)                                :: npoints, order
    5404             :       REAL(kind=dp), DIMENSION(1:npoints), INTENT(inout) :: rho, norm_drho, e_0, e_rho, e_ndrho, &
    5405             :                                                             e_rho_rho, e_ndrho_rho, e_ndrho_ndrho
    5406             :       REAL(kind=dp), INTENT(in)                          :: epsilon_rho, sx, sx0, omega
    5407             : 
    5408             :       INTEGER                                            :: ip
    5409             :       REAL(dp)                                           :: e_0_temp, my_ndrho, my_rho
    5410             :       REAL(KIND=dp)                                      :: ss, ss2, sscale, t1, t2, t3, t4, t5, t6, &
    5411             :                                                             t7, t8, ww
    5412             : 
    5413             : !$OMP     DO
    5414             : 
    5415             :       DO ip = 1, npoints
    5416             :          !According to spin-scaling relation, we need twice the density and its gradient
    5417    26154468 :          my_rho = 2.0_dp*MAX(rho(ip), 0.0_dp)
    5418    26154468 :          IF (my_rho > epsilon_rho) THEN
    5419    25994192 :             my_ndrho = 2.0_dp*MAX(norm_drho(ip), 0.0_dp)
    5420             : 
    5421             :             !Do some precalculation in order to catch the correct branch afterwards
    5422    25994192 :             sscale = 1.0_dp
    5423    25994192 :             t1 = pi**2
    5424    25994192 :             t2 = t1*my_rho
    5425    25994192 :             t3 = t2**(0.1e1_dp/0.3e1_dp)
    5426    25994192 :             t4 = 0.1e1_dp/t3
    5427    25994192 :             t5 = omega*t4
    5428    25994192 :             ww = 0.6933612743506347048433524e0_dp*t5
    5429    25994192 :             t6 = my_ndrho*t4
    5430    25994192 :             t7 = 0.1e1_dp/my_rho
    5431    25994192 :             t8 = t7*sscale
    5432    25994192 :             ss = 0.3466806371753173524216762e0_dp*t6*t8
    5433    25994192 :             IF (ss > scutoff) THEN
    5434    13376640 :                ss2 = ss*ss
    5435    13376640 :                sscale = ((smax)*ss2 - (sconst))/(ss2*ss)
    5436             :             END IF
    5437    25994192 :             e_0_temp = 0.0_dp
    5438    25994192 :             IF (sx0 /= 0.0_dp) THEN
    5439             :                !original PBE hole
    5440    22562851 :                IF (ss*sscale > gcutoff) THEN
    5441             :                   CALL xwpbe_lda_calc_0(e_0_temp, e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
    5442             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
    5443    22551511 :                                         my_ndrho, sscale, sx0, order)
    5444             :                ELSE
    5445             :                   CALL xwpbe_lda_calc_01(e_0_temp, e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
    5446             :                                          e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
    5447       11340 :                                          my_ndrho, sscale, sx0, order)
    5448             :                END IF
    5449             :                !According to spin-scaling relation, we need only half of the energy
    5450    22562851 :                e_0(ip) = e_0(ip) + 0.5_dp*e_0_temp
    5451             :             END IF
    5452    25994192 :             e_0_temp = 0.0_dp
    5453    25994192 :             IF (sx /= 0.0_dp) THEN
    5454     4820145 :                IF (ww < wcutoff .AND. ss*sscale > gcutoff) THEN
    5455             :                   CALL xwpbe_lda_calc_1(e_0_temp, e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
    5456             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
    5457     4201888 :                                         my_ndrho, omega, sscale, sx, order)
    5458        6011 :                ELSE IF (ww < wcutoff .AND. ss*sscale <= gcutoff) THEN
    5459             :                   CALL xwpbe_lda_calc_2(e_0_temp, e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
    5460             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
    5461        6011 :                                         my_ndrho, omega, sscale, sx, order)
    5462      612246 :                ELSE IF (ww >= wcutoff .AND. ss*sscale > gcutoff) THEN
    5463             :                   CALL xwpbe_lda_calc_3(e_0_temp, e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
    5464             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
    5465      612246 :                                         my_ndrho, omega, sscale, sx, order)
    5466             :                ELSE
    5467             :                   CALL xwpbe_lda_calc_4(e_0_temp, e_rho(ip), e_ndrho(ip), e_rho_rho(ip), &
    5468             :                                         e_ndrho_rho(ip), e_ndrho_ndrho(ip), my_rho, &
    5469           0 :                                         my_ndrho, omega, sscale, sx, order)
    5470             :                END IF
    5471             :                !According to spin-scaling relation, we need only half of the energy
    5472             :             END IF
    5473    25994192 :             e_0(ip) = e_0(ip) + 0.5_dp*e_0_temp
    5474             :          END IF
    5475             :       END DO
    5476             : 
    5477             : !$OMP     END DO
    5478             : 
    5479        1500 :    END SUBROUTINE xwpbe_lsd_calc
    5480             : 
    5481             : ! **************************************************************************************************
    5482             : !> \brief These functions evaluate products exp(x)*Ei(x) and pi*exp(x)*erfc(sqrt(x)),
    5483             : !>      as well as their derivatives with respect to various combinations of
    5484             : !>      rho and norm_drho.
    5485             : !> \param Q , dQrho, dQndrho, d2Qrhondrho :
    5486             : !>        Argument Q and derivatives with respect to various combinations of
    5487             : !>        rho and norm_drho
    5488             : !> \return ...
    5489             : !> \par History
    5490             : !>      05.2007 created [Manuel Guidon]
    5491             : !> \author Manuel Guidon
    5492             : !> \note
    5493             : !>     - In order to avoid numerical instabilities, these routines use Taylor-
    5494             : !>       expansions for the above core-products for large arguments.
    5495             : !>     - When adapting this module for higher order derivatives, appropriate
    5496             : !>       functions have to be provided!
    5497             : ! **************************************************************************************************
    5498   217985638 :    FUNCTION exei(Q)
    5499             :       REAL(dp), INTENT(IN)                               :: Q
    5500             :       REAL(dp)                                           :: exei
    5501             : 
    5502   217985638 :       exei = 0.0_dp
    5503   217985638 :       IF (Q < expcutoff) THEN
    5504             :          !Use exact product
    5505   206362594 :          exei = EXP(Q)*expint(1, Q)
    5506             :       ELSE
    5507             :          !Use approximation
    5508    11623044 :          exei = (1._dp/Q)*(Q*Q + exei1*Q + exei2)/(Q*Q + exei3*Q + exei4)
    5509             :       END IF
    5510   217985638 :    END FUNCTION exei
    5511             : 
    5512             : ! **************************************************************************************************
    5513             : !> \brief ...
    5514             : !> \param Q ...
    5515             : !> \return ...
    5516             : ! **************************************************************************************************
    5517    38768073 :    FUNCTION exer(Q)
    5518             :       REAL(dp), INTENT(IN)                               :: Q
    5519             :       REAL(dp)                                           :: exer
    5520             : 
    5521             :       REAL(dp)                                           :: Q3, Q5
    5522             : 
    5523    38768073 :       exer = 0.0_dp
    5524    38768073 :       IF (Q < expcutoff) THEN
    5525             :          !Use exact expression
    5526    38768073 :          exer = pi*EXP(Q)*erfc(SQRT(Q))
    5527             :       ELSE
    5528             :          !Use approximation
    5529           0 :          Q3 = Q*Q*Q
    5530           0 :          Q5 = Q3*Q*Q
    5531           0 :          exer = pi*(1.0_dp/SQRT(Q*pi) - 1.0_dp/(2.0_dp*SQRT(pi*Q3)) + 3.0_dp/(4.0_dp*(SQRT(pi*Q5))))
    5532             :       END IF
    5533    38768073 :    END FUNCTION exer
    5534             : 
    5535             : ! **************************************************************************************************
    5536             : !> \brief ...
    5537             : !> \param Q ...
    5538             : !> \param dQrho ...
    5539             : !> \return ...
    5540             : ! **************************************************************************************************
    5541    64698112 :    FUNCTION dexeirho(Q, dQrho)
    5542             :       REAL(dp), INTENT(IN)                               :: Q, dQrho
    5543             :       REAL(dp)                                           :: dexeirho
    5544             : 
    5545    64698112 :       dexeirho = dQrho*(exei(Q) - 1.0_dp/Q)
    5546    64698112 :    END FUNCTION dexeirho
    5547             : 
    5548             : ! **************************************************************************************************
    5549             : !> \brief ...
    5550             : !> \param Q ...
    5551             : !> \param dQndrho ...
    5552             : !> \return ...
    5553             : ! **************************************************************************************************
    5554    64698112 :    FUNCTION dexeindrho(Q, dQndrho)
    5555             :       REAL(dp), INTENT(IN)                               :: Q, dQndrho
    5556             :       REAL(dp)                                           :: dexeindrho
    5557             : 
    5558    64698112 :       dexeindrho = dQndrho*(exei(Q) - 1.0_dp/Q)
    5559    64698112 :    END FUNCTION dexeindrho
    5560             : 
    5561             : ! **************************************************************************************************
    5562             : !> \brief ...
    5563             : !> \param Q ...
    5564             : !> \param dQrho ...
    5565             : !> \return ...
    5566             : ! **************************************************************************************************
    5567    11167884 :    FUNCTION dexerrho(Q, dQrho)
    5568             :       REAL(dp), INTENT(IN)                               :: Q, dQrho
    5569             :       REAL(dp)                                           :: dexerrho
    5570             : 
    5571    11167884 :       dexerrho = dQrho*exer(Q) - dQrho*rootpi/SQRT(Q)
    5572    11167884 :    END FUNCTION dexerrho
    5573             : 
    5574             : ! **************************************************************************************************
    5575             : !> \brief ...
    5576             : !> \param Q ...
    5577             : !> \param dQndrho ...
    5578             : !> \return ...
    5579             : ! **************************************************************************************************
    5580    11167884 :    FUNCTION dexerndrho(Q, dQndrho)
    5581             :       REAL(dp), INTENT(IN)                               :: Q, dQndrho
    5582             :       REAL(dp)                                           :: dexerndrho
    5583             : 
    5584    11167884 :       dexerndrho = dQndrho*exer(Q) - dQndrho*rootpi/SQRT(Q)
    5585    11167884 :    END FUNCTION dexerndrho
    5586             : 
    5587             : ! **************************************************************************************************
    5588             : !> \brief ...
    5589             : !> \param Q ...
    5590             : !> \param dQrho ...
    5591             : !> \param d2Qrhorho ...
    5592             : !> \return ...
    5593             : ! **************************************************************************************************
    5594           0 :    FUNCTION d2exeirhorho(Q, dQrho, d2Qrhorho)
    5595             :       REAL(dp), INTENT(IN)                               :: Q, dQrho, d2Qrhorho
    5596             :       REAL(dp)                                           :: d2exeirhorho
    5597             : 
    5598             :       d2exeirhorho = exei(Q)*(d2Qrhorho + dQrho*dQrho) + &
    5599           0 :                      1.0_dp/(Q*Q)*(-Q*dQrho*dQrho - Q*d2Qrhorho + dQrho*dQrho)
    5600           0 :    END FUNCTION d2exeirhorho
    5601             : 
    5602             : ! **************************************************************************************************
    5603             : !> \brief ...
    5604             : !> \param Q ...
    5605             : !> \param dQrho ...
    5606             : !> \param d2Qrhorho ...
    5607             : !> \return ...
    5608             : ! **************************************************************************************************
    5609           0 :    FUNCTION d2exerrhorho(Q, dQrho, d2Qrhorho)
    5610             :       REAL(dp), INTENT(IN)                               :: Q, dQrho, d2Qrhorho
    5611             :       REAL(dp)                                           :: d2exerrhorho
    5612             : 
    5613             :       REAL(dp)                                           :: pi12, Q12
    5614             : 
    5615           0 :       Q12 = SQRT(Q)
    5616           0 :       pi12 = rootpi
    5617             : 
    5618             :       d2exerrhorho = exer(Q)*(d2Qrhorho + dQrho*dQrho) - dQrho*dQrho/(pi12*Q12) + &
    5619           0 :                      0.5_dp*dQrho*dQrho/(pi12*Q*Q12) - d2Qrhorho/(pi12*Q12)
    5620           0 :    END FUNCTION d2exerrhorho
    5621             : 
    5622             : ! **************************************************************************************************
    5623             : !> \brief ...
    5624             : !> \param Q ...
    5625             : !> \param dQrho ...
    5626             : !> \param dQndrho ...
    5627             : !> \param d2Qrhondrho ...
    5628             : !> \return ...
    5629             : ! **************************************************************************************************
    5630           0 :    FUNCTION d2exeirhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    5631             :       REAL(dp), INTENT(IN)                               :: Q, dQrho, dQndrho, d2Qrhondrho
    5632             :       REAL(dp)                                           :: d2exeirhondrho
    5633             : 
    5634             :       d2exeirhondrho = exei(Q)*(d2Qrhondrho + dQrho*dQndrho) - &
    5635           0 :                        1.0_dp/Q*(dQrho*dQndrho + d2Qrhondrho) + 1.0_dp/(Q*Q)*dQrho*dQndrho
    5636           0 :    END FUNCTION d2exeirhondrho
    5637             : 
    5638             : ! **************************************************************************************************
    5639             : !> \brief ...
    5640             : !> \param Q ...
    5641             : !> \param dQrho ...
    5642             : !> \param dQndrho ...
    5643             : !> \param d2Qrhondrho ...
    5644             : !> \return ...
    5645             : ! **************************************************************************************************
    5646           0 :    FUNCTION d2exerrhondrho(Q, dQrho, dQndrho, d2Qrhondrho)
    5647             :       REAL(dp), INTENT(IN)                               :: Q, dQrho, dQndrho, d2Qrhondrho
    5648             :       REAL(dp)                                           :: d2exerrhondrho
    5649             : 
    5650             :       REAL(dp)                                           :: pi12, Q12
    5651             : 
    5652           0 :       Q12 = SQRT(Q)
    5653           0 :       pi12 = rootpi
    5654             : 
    5655             :       d2exerrhondrho = exer(Q)*(d2Qrhondrho + dQrho*dQndrho) - 1.0_dp/(pi12*Q12)*dQrho*dQndrho &
    5656           0 :                        + 0.5_dp/(pi12*Q12*Q)*dQrho*dQndrho - 1.0_dp/(pi12*Q12)*d2Qrhondrho
    5657           0 :    END FUNCTION d2exerrhondrho
    5658             : 
    5659             : ! **************************************************************************************************
    5660             : !> \brief ...
    5661             : !> \param Q ...
    5662             : !> \param dQndrho ...
    5663             : !> \param d2Qndrhondrho ...
    5664             : !> \return ...
    5665             : ! **************************************************************************************************
    5666           0 :    FUNCTION d2exeindrhondrho(Q, dQndrho, d2Qndrhondrho)
    5667             :       REAL(dp), INTENT(IN)                               :: Q, dQndrho, d2Qndrhondrho
    5668             :       REAL(dp)                                           :: d2exeindrhondrho
    5669             : 
    5670             :       d2exeindrhondrho = exei(Q)*(d2Qndrhondrho + dQndrho*dQndrho) + &
    5671           0 :                          1.0_dp/(Q*Q)*(-Q*dQndrho*dQndrho - Q*d2Qndrhondrho + dQndrho*dQndrho)
    5672           0 :    END FUNCTION d2exeindrhondrho
    5673             : 
    5674             : ! **************************************************************************************************
    5675             : !> \brief ...
    5676             : !> \param Q ...
    5677             : !> \param dQndrho ...
    5678             : !> \param d2Qndrhondrho ...
    5679             : !> \return ...
    5680             : ! **************************************************************************************************
    5681           0 :    FUNCTION d2exerndrhondrho(Q, dQndrho, d2Qndrhondrho)
    5682             :       REAL(dp), INTENT(IN)                               :: Q, dQndrho, d2Qndrhondrho
    5683             :       REAL(dp)                                           :: d2exerndrhondrho
    5684             : 
    5685             :       REAL(dp)                                           :: pi12, Q12
    5686             : 
    5687           0 :       Q12 = SQRT(Q)
    5688           0 :       pi12 = rootpi
    5689             : 
    5690             :       d2exerndrhondrho = exer(Q)*(d2Qndrhondrho + dQndrho*dQndrho) - dQndrho*dQndrho/(pi12*Q12) &
    5691           0 :                          + 0.5_dp*dQndrho*dQndrho/(pi12*Q*Q12) - d2Qndrhondrho/(pi12*Q12)
    5692           0 :    END FUNCTION d2exerndrhondrho
    5693             : 
    5694             : END MODULE xc_xwpbe
    5695             : 

Generated by: LCOV version 1.15