LCOV - code coverage report
Current view: top level - src/common - t_c_g0.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:262480d) Lines: 885 912 97.0 %
Date: 2024-11-22 07:00:40 Functions: 5 5 100.0 %

          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             : !   Copyright (c) 2008, 2009, Joost VandeVondele and Manuel Guidon                                 !
      10             : !   All rights reserved.                                                                           !
      11             : !                                                                                                  !
      12             : !   Redistribution and use in source and binary forms, with or without                             !
      13             : !   modification, are permitted provided that the following conditions are met:                    !
      14             : !       * Redistributions of source code must retain the above copyright                           !
      15             : !         notice, this list of conditions and the following disclaimer.                            !
      16             : !       * Redistributions in binary form must reproduce the above copyright                        !
      17             : !         notice, this list of conditions and the following disclaimer in the                      !
      18             : !         documentation and/or other materials provided with the distribution.                     !
      19             : !                                                                                                  !
      20             : !   THIS SOFTWARE IS PROVIDED BY Joost VandeVondele and Manuel Guidon AS IS AND ANY                !
      21             : !   EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED                      !
      22             : !   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE                         !
      23             : !   DISCLAIMED. IN NO EVENT SHALL Joost VandeVondele or Manuel Guidon BE LIABLE FOR ANY            !
      24             : !   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES                     !
      25             : !   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;                   !
      26             : !   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND                    !
      27             : !   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT                     !
      28             : !   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS                  !
      29             : !   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                   !
      30             : !--------------------------------------------------------------------------------------------------!
      31             : 
      32             : ! **************************************************************************************************
      33             : !> \brief This module computes the basic integrals for the truncated coulomb operator
      34             : !>
      35             : !>          res(1) =G_0(R,T)= ((2*erf(sqrt(t))+erf(R-sqrt(t))-erf(R+sqrt(t)))/sqrt(t))
      36             : !>
      37             : !>        and up to 21 derivatives with respect to T
      38             : !>
      39             : !>          res(n+1)=(-1)**n d^n/dT^n G_0(R,T)
      40             : !>
      41             : !>        The function is only computed for values of R,T which fulfil
      42             : !>
      43             : !>          R**2 - 11.0_dp*R + 0.0_dp < T < R**2 + 11.0_dp*R + 50.0_dp where R>=0 T>=0
      44             : !>
      45             : !>        for T larger than the upper bound, 0 is returned
      46             : !>        (which is accurate at least up to 1.0E-16)
      47             : !>        while for T smaller than the lower bound, the caller is instructed
      48             : !>        to use the conventional gamma function instead
      49             : !>        (i.e. the limit of above expression for R to Infinity)
      50             : !>
      51             : !> \author Joost VandeVondele and Manuel Guidon
      52             : !> \par History
      53             : !>      Nov 2008, 2009 Joost VandeVondele and Manuel Guidon
      54             : !>      May 2019 A. Bussy: Added a get_maxl_init function to get current status of nderiv_init and
      55             : !>                moved the file to common (made it accessible from aobasis, same place as gamma.F).
      56             : ! **************************************************************************************************
      57             : MODULE t_c_g0
      58             :    USE kinds,                           ONLY: dp
      59             :    USE message_passing,                 ONLY: mp_comm_type
      60             : #include "../base/base_uses.f90"
      61             : 
      62             :    IMPLICIT NONE
      63             :    PRIVATE
      64             : 
      65             :    PUBLIC :: t_c_g0_n, init, free_C0, get_lmax_init
      66             :    REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE, SAVE :: C0
      67             :    INTEGER, PARAMETER :: degree = 13
      68             :    REAL(KIND=dp), PARAMETER :: target_error = 0.100000E-08
      69             :    INTEGER, PARAMETER :: nderiv_max = 21
      70             :    INTEGER, SAVE      :: nderiv_init = -1
      71             :    INTEGER, SAVE      :: patches = -1
      72             : 
      73             : CONTAINS
      74             : 
      75             : ! **************************************************************************************************
      76             : !> \brief ...
      77             : !> \param RES ...
      78             : !> \param use_gamma ...
      79             : !> \param R ...
      80             : !> \param T ...
      81             : !> \param NDERIV ...
      82             : ! **************************************************************************************************
      83   140143764 :    SUBROUTINE t_c_g0_n(RES, use_gamma, R, T, NDERIV)
      84             :       REAL(KIND=dp), INTENT(OUT)                         :: RES(*)
      85             :       LOGICAL, INTENT(OUT)                               :: use_gamma
      86             :       REAL(KIND=dp), INTENT(IN)                          :: R, T
      87             :       INTEGER, INTENT(IN)                                :: NDERIV
      88             : 
      89             :       REAL(KIND=dp)                                      :: lower, TG1, TG2, upper, X1, X2
      90             : 
      91   140143764 :       use_gamma = .FALSE.
      92   140143764 :       upper = R**2 + 11.0_dp*R + 50.0_dp
      93   140143764 :       lower = R**2 - 11.0_dp*R + 0.0_dp
      94   140143764 :       IF (T > upper) THEN
      95     3077640 :          RES(1:NDERIV + 1) = 0.0_dp
      96     3118544 :          RETURN
      97             :       END IF
      98   139430188 :       IF (R <= 11.0_dp) THEN
      99   136658399 :          X2 = R/11.0_dp
     100   136658399 :          upper = R**2 + 11.0_dp*R + 50.0_dp
     101   136658399 :          lower = 0.0_dp
     102   136658399 :          X1 = (T - lower)/(upper - lower)
     103   136658399 :          IF (X1 <= 0.500000000000000000E+00_dp) THEN
     104    99844954 :             IF (X2 <= 0.500000000000000000E+00_dp) THEN
     105    92880210 :                IF (X2 <= 0.250000000000000000E+00_dp) THEN
     106    75000414 :                   IF (X2 <= 0.125000000000000000E+00_dp) THEN
     107    19682274 :                      IF (X1 <= 0.250000000000000000E+00_dp) THEN
     108     9164027 :                         IF (X2 <= 0.625000000000000000E-01_dp) THEN
     109     1189932 :                            IF (X1 <= 0.125000000000000000E+00_dp) THEN
     110      611851 :                               IF (X2 <= 0.312500000000000000E-01_dp) THEN
     111       41576 :                                  IF (X1 <= 0.625000000000000000E-01_dp) THEN
     112       16399 :                                     IF (X2 <= 0.156250000000000000E-01_dp) THEN
     113           0 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     114           0 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     115           0 :                                           TG2 = (2*X2 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
     116           0 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 1))
     117             :                                        ELSE
     118           0 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     119           0 :                                           TG2 = (2*X2 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
     120           0 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 2))
     121             :                                        END IF
     122             :                                     ELSE
     123       16399 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     124        8045 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     125        8045 :                                           TG2 = (2*X2 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     126        8045 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 3))
     127             :                                        ELSE
     128        8354 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     129        8354 :                                           TG2 = (2*X2 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     130        8354 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 4))
     131             :                                        END IF
     132             :                                     END IF
     133             :                                  ELSE
     134       25177 :                                     IF (X2 <= 0.156250000000000000E-01_dp) THEN
     135           0 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     136           0 :                                        TG2 = (2*X2 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
     137           0 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 5))
     138             :                                     ELSE
     139       25177 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     140       25177 :                                        TG2 = (2*X2 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     141       25177 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 6))
     142             :                                     END IF
     143             :                                  END IF
     144             :                               ELSE
     145      570275 :                                  IF (X1 <= 0.625000000000000000E-01_dp) THEN
     146      301711 :                                     IF (X2 <= 0.468750000000000000E-01_dp) THEN
     147      132102 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     148       67752 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     149       67752 :                                           TG2 = (2*X2 - 0.781250000000000000E-01_dp)*0.640000000000000000E+02_dp
     150       67752 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 7))
     151             :                                        ELSE
     152       64350 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     153       64350 :                                           TG2 = (2*X2 - 0.781250000000000000E-01_dp)*0.640000000000000000E+02_dp
     154       64350 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 8))
     155             :                                        END IF
     156             :                                     ELSE
     157      169609 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     158      129780 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     159      129780 :                                           TG2 = (2*X2 - 0.109375000000000000E+00_dp)*0.640000000000000000E+02_dp
     160      129780 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 9))
     161             :                                        ELSE
     162       39829 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     163       39829 :                                           TG2 = (2*X2 - 0.109375000000000000E+00_dp)*0.640000000000000000E+02_dp
     164       39829 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 10))
     165             :                                        END IF
     166             :                                     END IF
     167             :                                  ELSE
     168      268564 :                                     IF (X2 <= 0.468750000000000000E-01_dp) THEN
     169      205389 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     170      205389 :                                        TG2 = (2*X2 - 0.781250000000000000E-01_dp)*0.640000000000000000E+02_dp
     171      205389 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 11))
     172             :                                     ELSE
     173       63175 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     174       63175 :                                        TG2 = (2*X2 - 0.109375000000000000E+00_dp)*0.640000000000000000E+02_dp
     175       63175 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 12))
     176             :                                     END IF
     177             :                                  END IF
     178             :                               END IF
     179             :                            ELSE
     180      578081 :                               IF (X2 <= 0.312500000000000000E-01_dp) THEN
     181       50892 :                                  IF (X1 <= 0.187500000000000000E+00_dp) THEN
     182       16164 :                                     TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     183       16164 :                                     TG2 = (2*X2 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     184       16164 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 13))
     185             :                                  ELSE
     186       34728 :                                     TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     187       34728 :                                     TG2 = (2*X2 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     188       34728 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 14))
     189             :                                  END IF
     190             :                               ELSE
     191      527189 :                                  IF (X1 <= 0.187500000000000000E+00_dp) THEN
     192      283055 :                                     TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     193      283055 :                                     TG2 = (2*X2 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     194      283055 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 15))
     195             :                                  ELSE
     196      244134 :                                     TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     197      244134 :                                     TG2 = (2*X2 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     198      244134 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 16))
     199             :                                  END IF
     200             :                               END IF
     201             :                            END IF
     202             :                         ELSE
     203     7974095 :                            IF (X1 <= 0.125000000000000000E+00_dp) THEN
     204     3868007 :                               IF (X2 <= 0.937500000000000000E-01_dp) THEN
     205      928836 :                                  IF (X1 <= 0.625000000000000000E-01_dp) THEN
     206      599820 :                                     IF (X2 <= 0.781250000000000000E-01_dp) THEN
     207      272623 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     208      239449 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     209      239449 :                                           TG2 = (2*X2 - 0.140625000000000000E+00_dp)*0.640000000000000000E+02_dp
     210      239449 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 17))
     211             :                                        ELSE
     212       33174 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     213       33174 :                                           TG2 = (2*X2 - 0.140625000000000000E+00_dp)*0.640000000000000000E+02_dp
     214       33174 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 18))
     215             :                                        END IF
     216             :                                     ELSE
     217      327197 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     218      237010 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     219      237010 :                                           TG2 = (2*X2 - 0.171875000000000000E+00_dp)*0.640000000000000000E+02_dp
     220      237010 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 19))
     221             :                                        ELSE
     222       90187 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     223       90187 :                                           TG2 = (2*X2 - 0.171875000000000000E+00_dp)*0.640000000000000000E+02_dp
     224       90187 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 20))
     225             :                                        END IF
     226             :                                     END IF
     227             :                                  ELSE
     228      329016 :                                     IF (X2 <= 0.781250000000000000E-01_dp) THEN
     229       65752 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     230       65752 :                                        TG2 = (2*X2 - 0.140625000000000000E+00_dp)*0.640000000000000000E+02_dp
     231       65752 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 21))
     232             :                                     ELSE
     233      263264 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     234      263264 :                                        TG2 = (2*X2 - 0.171875000000000000E+00_dp)*0.640000000000000000E+02_dp
     235      263264 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 22))
     236             :                                     END IF
     237             :                                  END IF
     238             :                               ELSE
     239     2939171 :                                  IF (X1 <= 0.625000000000000000E-01_dp) THEN
     240     1511516 :                                     IF (X2 <= 0.109375000000000000E+00_dp) THEN
     241      705282 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     242      504791 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     243      504791 :                                           TG2 = (2*X2 - 0.203125000000000000E+00_dp)*0.640000000000000000E+02_dp
     244      504791 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 23))
     245             :                                        ELSE
     246      200491 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     247      200491 :                                           TG2 = (2*X2 - 0.203125000000000000E+00_dp)*0.640000000000000000E+02_dp
     248      200491 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 24))
     249             :                                        END IF
     250             :                                     ELSE
     251      806234 :                                        IF (X1 <= 0.312500000000000000E-01_dp) THEN
     252      588490 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     253      588490 :                                           TG2 = (2*X2 - 0.234375000000000000E+00_dp)*0.640000000000000000E+02_dp
     254      588490 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 25))
     255             :                                        ELSE
     256      217744 :                                           TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     257      217744 :                                           TG2 = (2*X2 - 0.234375000000000000E+00_dp)*0.640000000000000000E+02_dp
     258      217744 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 26))
     259             :                                        END IF
     260             :                                     END IF
     261             :                                  ELSE
     262     1427655 :                                     IF (X2 <= 0.109375000000000000E+00_dp) THEN
     263      593686 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     264      593686 :                                        TG2 = (2*X2 - 0.203125000000000000E+00_dp)*0.640000000000000000E+02_dp
     265      593686 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 27))
     266             :                                     ELSE
     267      833969 :                                        TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     268      833969 :                                        TG2 = (2*X2 - 0.234375000000000000E+00_dp)*0.640000000000000000E+02_dp
     269      833969 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 28))
     270             :                                     END IF
     271             :                                  END IF
     272             :                               END IF
     273             :                            ELSE
     274     4106088 :                               IF (X1 <= 0.187500000000000000E+00_dp) THEN
     275     1987201 :                                  IF (X2 <= 0.937500000000000000E-01_dp) THEN
     276      342681 :                                     TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     277      342681 :                                     TG2 = (2*X2 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     278      342681 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 29))
     279             :                                  ELSE
     280     1644520 :                                     TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     281     1644520 :                                     TG2 = (2*X2 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     282     1644520 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 30))
     283             :                                  END IF
     284             :                               ELSE
     285     2118887 :                                  TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     286     2118887 :                                  TG2 = (2*X2 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     287     2118887 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 31))
     288             :                               END IF
     289             :                            END IF
     290             :                         END IF
     291             :                      ELSE
     292    10518247 :                         IF (X1 <= 0.375000000000000000E+00_dp) THEN
     293     5580336 :                            TG1 = (2*X1 - 0.625000000000000000E+00_dp)*0.800000000000000000E+01_dp
     294     5580336 :                            TG2 = (2*X2 - 0.125000000000000000E+00_dp)*0.800000000000000000E+01_dp
     295     5580336 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 32))
     296             :                         ELSE
     297     4937911 :                            TG1 = (2*X1 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     298     4937911 :                            TG2 = (2*X2 - 0.125000000000000000E+00_dp)*0.800000000000000000E+01_dp
     299     4937911 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 33))
     300             :                         END IF
     301             :                      END IF
     302             :                   ELSE
     303    55318140 :                      IF (X1 <= 0.250000000000000000E+00_dp) THEN
     304    25641329 :                         IF (X2 <= 0.187500000000000000E+00_dp) THEN
     305    15777583 :                            IF (X1 <= 0.125000000000000000E+00_dp) THEN
     306     8153080 :                               IF (X2 <= 0.156250000000000000E+00_dp) THEN
     307     3856529 :                                  IF (X1 <= 0.625000000000000000E-01_dp) THEN
     308     1896987 :                                     IF (X1 <= 0.312500000000000000E-01_dp) THEN
     309     1291824 :                                        IF (X2 <= 0.140625000000000000E+00_dp) THEN
     310      568180 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     311      568180 :                                           TG2 = (2*X2 - 0.265625000000000000E+00_dp)*0.640000000000000000E+02_dp
     312      568180 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 34))
     313             :                                        ELSE
     314      723644 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     315      723644 :                                           TG2 = (2*X2 - 0.296875000000000000E+00_dp)*0.640000000000000000E+02_dp
     316      723644 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 35))
     317             :                                        END IF
     318             :                                     ELSE
     319      605163 :                                        TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     320      605163 :                                        TG2 = (2*X2 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     321      605163 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 36))
     322             :                                     END IF
     323             :                                  ELSE
     324     1959542 :                                     IF (X1 <= 0.937500000000000000E-01_dp) THEN
     325      859517 :                                        TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     326      859517 :                                        TG2 = (2*X2 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     327      859517 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 37))
     328             :                                     ELSE
     329     1100025 :                                        TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     330     1100025 :                                        TG2 = (2*X2 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     331     1100025 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 38))
     332             :                                     END IF
     333             :                                  END IF
     334             :                               ELSE
     335     4296551 :                                  IF (X1 <= 0.625000000000000000E-01_dp) THEN
     336     2775194 :                                     IF (X1 <= 0.312500000000000000E-01_dp) THEN
     337     1917074 :                                        IF (X2 <= 0.171875000000000000E+00_dp) THEN
     338      793452 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     339      793452 :                                           TG2 = (2*X2 - 0.328125000000000000E+00_dp)*0.640000000000000000E+02_dp
     340      793452 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 39))
     341             :                                        ELSE
     342     1123622 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     343     1123622 :                                           TG2 = (2*X2 - 0.359375000000000000E+00_dp)*0.640000000000000000E+02_dp
     344     1123622 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 40))
     345             :                                        END IF
     346             :                                     ELSE
     347      858120 :                                        TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     348      858120 :                                        TG2 = (2*X2 - 0.343750000000000000E+00_dp)*0.320000000000000000E+02_dp
     349      858120 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 41))
     350             :                                     END IF
     351             :                                  ELSE
     352     1521357 :                                     TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     353     1521357 :                                     TG2 = (2*X2 - 0.343750000000000000E+00_dp)*0.320000000000000000E+02_dp
     354     1521357 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 42))
     355             :                                  END IF
     356             :                               END IF
     357             :                            ELSE
     358     7624503 :                               IF (X1 <= 0.187500000000000000E+00_dp) THEN
     359     3717235 :                                  TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     360     3717235 :                                  TG2 = (2*X2 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     361     3717235 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 43))
     362             :                               ELSE
     363     3907268 :                                  TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     364     3907268 :                                  TG2 = (2*X2 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     365     3907268 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 44))
     366             :                               END IF
     367             :                            END IF
     368             :                         ELSE
     369     9863746 :                            IF (X1 <= 0.125000000000000000E+00_dp) THEN
     370     6754124 :                               IF (X1 <= 0.625000000000000000E-01_dp) THEN
     371     5115767 :                                  IF (X2 <= 0.218750000000000000E+00_dp) THEN
     372     2699207 :                                     IF (X1 <= 0.312500000000000000E-01_dp) THEN
     373     1890921 :                                        IF (X2 <= 0.203125000000000000E+00_dp) THEN
     374      960025 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     375      960025 :                                           TG2 = (2*X2 - 0.390625000000000000E+00_dp)*0.640000000000000000E+02_dp
     376      960025 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 45))
     377             :                                        ELSE
     378      930896 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     379      930896 :                                           TG2 = (2*X2 - 0.421875000000000000E+00_dp)*0.640000000000000000E+02_dp
     380      930896 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 46))
     381             :                                        END IF
     382             :                                     ELSE
     383      808286 :                                        TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     384      808286 :                                        TG2 = (2*X2 - 0.406250000000000000E+00_dp)*0.320000000000000000E+02_dp
     385      808286 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 47))
     386             :                                     END IF
     387             :                                  ELSE
     388     2416560 :                                     IF (X1 <= 0.312500000000000000E-01_dp) THEN
     389     1821037 :                                        IF (X2 <= 0.234375000000000000E+00_dp) THEN
     390      841475 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     391      841475 :                                           TG2 = (2*X2 - 0.453125000000000000E+00_dp)*0.640000000000000000E+02_dp
     392      841475 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 48))
     393             :                                        ELSE
     394      979562 :                                           TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     395      979562 :                                           TG2 = (2*X2 - 0.484375000000000000E+00_dp)*0.640000000000000000E+02_dp
     396      979562 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 49))
     397             :                                        END IF
     398             :                                     ELSE
     399      595523 :                                        TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     400      595523 :                                        TG2 = (2*X2 - 0.468750000000000000E+00_dp)*0.320000000000000000E+02_dp
     401      595523 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 50))
     402             :                                     END IF
     403             :                                  END IF
     404             :                               ELSE
     405     1638357 :                                  IF (X2 <= 0.218750000000000000E+00_dp) THEN
     406     1014386 :                                     TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     407     1014386 :                                     TG2 = (2*X2 - 0.406250000000000000E+00_dp)*0.320000000000000000E+02_dp
     408     1014386 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 51))
     409             :                                  ELSE
     410      623971 :                                     TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
     411      623971 :                                     TG2 = (2*X2 - 0.468750000000000000E+00_dp)*0.320000000000000000E+02_dp
     412      623971 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 52))
     413             :                                  END IF
     414             :                               END IF
     415             :                            ELSE
     416     3109622 :                               IF (X1 <= 0.187500000000000000E+00_dp) THEN
     417     1522775 :                                  TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     418     1522775 :                                  TG2 = (2*X2 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     419     1522775 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 53))
     420             :                               ELSE
     421     1586847 :                                  TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     422     1586847 :                                  TG2 = (2*X2 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     423     1586847 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 54))
     424             :                               END IF
     425             :                            END IF
     426             :                         END IF
     427             :                      ELSE
     428    29676811 :                         IF (X1 <= 0.375000000000000000E+00_dp) THEN
     429    13270212 :                            IF (X1 <= 0.312500000000000000E+00_dp) THEN
     430     6107421 :                               TG1 = (2*X1 - 0.562500000000000000E+00_dp)*0.160000000000000000E+02_dp
     431     6107421 :                               TG2 = (2*X2 - 0.375000000000000000E+00_dp)*0.800000000000000000E+01_dp
     432     6107421 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 55))
     433             :                            ELSE
     434     7162791 :                               TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     435     7162791 :                               TG2 = (2*X2 - 0.375000000000000000E+00_dp)*0.800000000000000000E+01_dp
     436     7162791 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 56))
     437             :                            END IF
     438             :                         ELSE
     439    16406599 :                            TG1 = (2*X1 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     440    16406599 :                            TG2 = (2*X2 - 0.375000000000000000E+00_dp)*0.800000000000000000E+01_dp
     441    16406599 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 57))
     442             :                         END IF
     443             :                      END IF
     444             :                   END IF
     445             :                ELSE
     446    17879796 :                   IF (X1 <= 0.250000000000000000E+00_dp) THEN
     447    13728713 :                      IF (X1 <= 0.125000000000000000E+00_dp) THEN
     448    12308711 :                         IF (X1 <= 0.625000000000000000E-01_dp) THEN
     449    10506654 :                            IF (X2 <= 0.375000000000000000E+00_dp) THEN
     450     6812767 :                               IF (X2 <= 0.312500000000000000E+00_dp) THEN
     451     4057654 :                                  IF (X1 <= 0.312500000000000000E-01_dp) THEN
     452     3179791 :                                     IF (X2 <= 0.281250000000000000E+00_dp) THEN
     453     1681994 :                                        TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     454     1681994 :                                        TG2 = (2*X2 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     455     1681994 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 58))
     456             :                                     ELSE
     457     1497797 :                                        TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     458     1497797 :                                        TG2 = (2*X2 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     459     1497797 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 59))
     460             :                                     END IF
     461             :                                  ELSE
     462      877863 :                                     IF (X2 <= 0.281250000000000000E+00_dp) THEN
     463      497624 :                                        TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     464      497624 :                                        TG2 = (2*X2 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     465      497624 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 60))
     466             :                                     ELSE
     467      380239 :                                        TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     468      380239 :                                        TG2 = (2*X2 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     469      380239 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 61))
     470             :                                     END IF
     471             :                                  END IF
     472             :                               ELSE
     473     2755113 :                                  IF (X1 <= 0.312500000000000000E-01_dp) THEN
     474     2242316 :                                     IF (X2 <= 0.343750000000000000E+00_dp) THEN
     475     1186455 :                                        TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     476     1186455 :                                        TG2 = (2*X2 - 0.656250000000000000E+00_dp)*0.320000000000000000E+02_dp
     477     1186455 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 62))
     478             :                                     ELSE
     479     1055861 :                                        TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
     480     1055861 :                                        TG2 = (2*X2 - 0.718750000000000000E+00_dp)*0.320000000000000000E+02_dp
     481     1055861 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 63))
     482             :                                     END IF
     483             :                                  ELSE
     484      512797 :                                     TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     485      512797 :                                     TG2 = (2*X2 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     486      512797 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 64))
     487             :                                  END IF
     488             :                               END IF
     489             :                            ELSE
     490     3693887 :                               IF (X1 <= 0.312500000000000000E-01_dp) THEN
     491     3221268 :                                  IF (X2 <= 0.437500000000000000E+00_dp) THEN
     492     2027451 :                                     IF (X1 <= 0.156250000000000000E-01_dp) THEN
     493     1822600 :                                        TG1 = (2*X1 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
     494     1822600 :                                        TG2 = (2*X2 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     495     1822600 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 65))
     496             :                                     ELSE
     497      204851 :                                        TG1 = (2*X1 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     498      204851 :                                        TG2 = (2*X2 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     499      204851 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 66))
     500             :                                     END IF
     501             :                                  ELSE
     502     1193817 :                                     IF (X1 <= 0.156250000000000000E-01_dp) THEN
     503     1078632 :                                        TG1 = (2*X1 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
     504     1078632 :                                        TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     505     1078632 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 67))
     506             :                                     ELSE
     507      115185 :                                        TG1 = (2*X1 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     508      115185 :                                        TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     509      115185 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 68))
     510             :                                     END IF
     511             :                                  END IF
     512             :                               ELSE
     513      472619 :                                  IF (X2 <= 0.437500000000000000E+00_dp) THEN
     514      293306 :                                     TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     515      293306 :                                     TG2 = (2*X2 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     516      293306 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 69))
     517             :                                  ELSE
     518      179313 :                                     TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     519      179313 :                                     TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     520      179313 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 70))
     521             :                                  END IF
     522             :                               END IF
     523             :                            END IF
     524             :                         ELSE
     525     1802057 :                            IF (X2 <= 0.375000000000000000E+00_dp) THEN
     526     1368068 :                               IF (X2 <= 0.312500000000000000E+00_dp) THEN
     527      902623 :                                  IF (X1 <= 0.937500000000000000E-01_dp) THEN
     528      604796 :                                     TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     529      604796 :                                     TG2 = (2*X2 - 0.562500000000000000E+00_dp)*0.160000000000000000E+02_dp
     530      604796 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 71))
     531             :                                  ELSE
     532      297827 :                                     TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     533      297827 :                                     TG2 = (2*X2 - 0.562500000000000000E+00_dp)*0.160000000000000000E+02_dp
     534      297827 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 72))
     535             :                                  END IF
     536             :                               ELSE
     537      465445 :                                  IF (X1 <= 0.937500000000000000E-01_dp) THEN
     538      260538 :                                     TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     539      260538 :                                     TG2 = (2*X2 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     540      260538 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 73))
     541             :                                  ELSE
     542      204907 :                                     TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     543      204907 :                                     TG2 = (2*X2 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     544      204907 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 74))
     545             :                                  END IF
     546             :                               END IF
     547             :                            ELSE
     548      433989 :                               IF (X1 <= 0.937500000000000000E-01_dp) THEN
     549      232139 :                                  IF (X2 <= 0.437500000000000000E+00_dp) THEN
     550      153076 :                                     TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     551      153076 :                                     TG2 = (2*X2 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     552      153076 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 75))
     553             :                                  ELSE
     554       79063 :                                     TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     555       79063 :                                     TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     556       79063 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 76))
     557             :                                  END IF
     558             :                               ELSE
     559      201850 :                                  IF (X2 <= 0.437500000000000000E+00_dp) THEN
     560      127844 :                                     TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     561      127844 :                                     TG2 = (2*X2 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     562      127844 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 77))
     563             :                                  ELSE
     564       74006 :                                     TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     565       74006 :                                     TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     566       74006 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 78))
     567             :                                  END IF
     568             :                               END IF
     569             :                            END IF
     570             :                         END IF
     571             :                      ELSE
     572     1420002 :                         IF (X2 <= 0.375000000000000000E+00_dp) THEN
     573     1163336 :                            IF (X1 <= 0.187500000000000000E+00_dp) THEN
     574      525076 :                               IF (X2 <= 0.312500000000000000E+00_dp) THEN
     575      283156 :                                  TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     576      283156 :                                  TG2 = (2*X2 - 0.562500000000000000E+00_dp)*0.160000000000000000E+02_dp
     577      283156 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 79))
     578             :                               ELSE
     579      241920 :                                  IF (X1 <= 0.156250000000000000E+00_dp) THEN
     580      169892 :                                     TG1 = (2*X1 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     581      169892 :                                     TG2 = (2*X2 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     582      169892 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 80))
     583             :                                  ELSE
     584       72028 :                                     TG1 = (2*X1 - 0.343750000000000000E+00_dp)*0.320000000000000000E+02_dp
     585       72028 :                                     TG2 = (2*X2 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     586       72028 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 81))
     587             :                                  END IF
     588             :                               END IF
     589             :                            ELSE
     590      638260 :                               IF (X2 <= 0.312500000000000000E+00_dp) THEN
     591      532972 :                                  TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     592      532972 :                                  TG2 = (2*X2 - 0.562500000000000000E+00_dp)*0.160000000000000000E+02_dp
     593      532972 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 82))
     594             :                               ELSE
     595      105288 :                                  TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     596      105288 :                                  TG2 = (2*X2 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     597      105288 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 83))
     598             :                               END IF
     599             :                            END IF
     600             :                         ELSE
     601      256666 :                            IF (X1 <= 0.187500000000000000E+00_dp) THEN
     602      187756 :                               IF (X2 <= 0.437500000000000000E+00_dp) THEN
     603      114630 :                                  TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     604      114630 :                                  TG2 = (2*X2 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     605      114630 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 84))
     606             :                               ELSE
     607       73126 :                                  IF (X1 <= 0.156250000000000000E+00_dp) THEN
     608       45330 :                                     TG1 = (2*X1 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     609       45330 :                                     TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     610       45330 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 85))
     611             :                                  ELSE
     612       27796 :                                     TG1 = (2*X1 - 0.343750000000000000E+00_dp)*0.320000000000000000E+02_dp
     613       27796 :                                     TG2 = (2*X2 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     614       27796 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 86))
     615             :                                  END IF
     616             :                               END IF
     617             :                            ELSE
     618       68910 :                               IF (X1 <= 0.218750000000000000E+00_dp) THEN
     619       41734 :                                  TG1 = (2*X1 - 0.406250000000000000E+00_dp)*0.320000000000000000E+02_dp
     620       41734 :                                  TG2 = (2*X2 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     621       41734 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 87))
     622             :                               ELSE
     623       27176 :                                  TG1 = (2*X1 - 0.468750000000000000E+00_dp)*0.320000000000000000E+02_dp
     624       27176 :                                  TG2 = (2*X2 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     625       27176 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 88))
     626             :                               END IF
     627             :                            END IF
     628             :                         END IF
     629             :                      END IF
     630             :                   ELSE
     631     4151083 :                      IF (X1 <= 0.375000000000000000E+00_dp) THEN
     632     1256544 :                         IF (X2 <= 0.375000000000000000E+00_dp) THEN
     633     1118492 :                            IF (X1 <= 0.312500000000000000E+00_dp) THEN
     634      522797 :                               TG1 = (2*X1 - 0.562500000000000000E+00_dp)*0.160000000000000000E+02_dp
     635      522797 :                               TG2 = (2*X2 - 0.625000000000000000E+00_dp)*0.800000000000000000E+01_dp
     636      522797 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 89))
     637             :                            ELSE
     638      595695 :                               TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     639      595695 :                               TG2 = (2*X2 - 0.625000000000000000E+00_dp)*0.800000000000000000E+01_dp
     640      595695 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 90))
     641             :                            END IF
     642             :                         ELSE
     643      138052 :                            IF (X1 <= 0.312500000000000000E+00_dp) THEN
     644       69111 :                               IF (X1 <= 0.281250000000000000E+00_dp) THEN
     645       33484 :                                  TG1 = (2*X1 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     646       33484 :                                  TG2 = (2*X2 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     647       33484 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 91))
     648             :                               ELSE
     649       35627 :                                  TG1 = (2*X1 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     650       35627 :                                  TG2 = (2*X2 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     651       35627 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 92))
     652             :                               END IF
     653             :                            ELSE
     654       68941 :                               TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     655       68941 :                               TG2 = (2*X2 - 0.875000000000000000E+00_dp)*0.800000000000000000E+01_dp
     656       68941 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 93))
     657             :                            END IF
     658             :                         END IF
     659             :                      ELSE
     660     2894539 :                         IF (X1 <= 0.437500000000000000E+00_dp) THEN
     661     1247310 :                            TG1 = (2*X1 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     662     1247310 :                            TG2 = (2*X2 - 0.750000000000000000E+00_dp)*0.400000000000000000E+01_dp
     663     1247310 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 94))
     664             :                         ELSE
     665     1647229 :                            TG1 = (2*X1 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     666     1647229 :                            TG2 = (2*X2 - 0.750000000000000000E+00_dp)*0.400000000000000000E+01_dp
     667     1647229 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 95))
     668             :                         END IF
     669             :                      END IF
     670             :                   END IF
     671             :                END IF
     672             :             ELSE
     673     6964744 :                IF (X1 <= 0.250000000000000000E+00_dp) THEN
     674     6689198 :                   IF (X1 <= 0.125000000000000000E+00_dp) THEN
     675     6428154 :                      IF (X1 <= 0.625000000000000000E-01_dp) THEN
     676     6043965 :                         IF (X1 <= 0.312500000000000000E-01_dp) THEN
     677     5767986 :                            IF (X1 <= 0.156250000000000000E-01_dp) THEN
     678     5563080 :                               IF (X1 <= 0.781250000000000000E-02_dp) THEN
     679     5410030 :                                  IF (X2 <= 0.750000000000000000E+00_dp) THEN
     680     4046740 :                                     TG1 = (2*X1 - 0.781250000000000000E-02_dp)*0.128000000000000000E+03_dp
     681     4046740 :                                     TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
     682     4046740 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 96))
     683             :                                  ELSE
     684     1363290 :                                     TG1 = (2*X1 - 0.781250000000000000E-02_dp)*0.128000000000000000E+03_dp
     685     1363290 :                                     TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     686     1363290 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 97))
     687             :                                  END IF
     688             :                               ELSE
     689      153050 :                                  IF (X2 <= 0.750000000000000000E+00_dp) THEN
     690      101190 :                                     TG1 = (2*X1 - 0.234375000000000000E-01_dp)*0.128000000000000000E+03_dp
     691      101190 :                                     TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
     692      101190 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 98))
     693             :                                  ELSE
     694       51860 :                                     TG1 = (2*X1 - 0.234375000000000000E-01_dp)*0.128000000000000000E+03_dp
     695       51860 :                                     TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     696       51860 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 99))
     697             :                                  END IF
     698             :                               END IF
     699             :                            ELSE
     700      204906 :                               IF (X2 <= 0.750000000000000000E+00_dp) THEN
     701      132693 :                                  TG1 = (2*X1 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     702      132693 :                                  TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
     703      132693 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 100))
     704             :                               ELSE
     705       72213 :                                  TG1 = (2*X1 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
     706       72213 :                                  TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     707       72213 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 101))
     708             :                               END IF
     709             :                            END IF
     710             :                         ELSE
     711      275979 :                            IF (X2 <= 0.750000000000000000E+00_dp) THEN
     712      247242 :                               IF (X2 <= 0.625000000000000000E+00_dp) THEN
     713      188596 :                                  TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     714      188596 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     715      188596 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 102))
     716             :                               ELSE
     717       58646 :                                  TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
     718       58646 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     719       58646 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 103))
     720             :                               END IF
     721             :                            ELSE
     722       28737 :                               IF (X1 <= 0.468750000000000000E-01_dp) THEN
     723       16406 :                                  TG1 = (2*X1 - 0.781250000000000000E-01_dp)*0.640000000000000000E+02_dp
     724       16406 :                                  TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     725       16406 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 104))
     726             :                               ELSE
     727       12331 :                                  TG1 = (2*X1 - 0.109375000000000000E+00_dp)*0.640000000000000000E+02_dp
     728       12331 :                                  TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     729       12331 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 105))
     730             :                               END IF
     731             :                            END IF
     732             :                         END IF
     733             :                      ELSE
     734      384189 :                         IF (X2 <= 0.750000000000000000E+00_dp) THEN
     735      343677 :                            IF (X2 <= 0.625000000000000000E+00_dp) THEN
     736      224383 :                               IF (X1 <= 0.937500000000000000E-01_dp) THEN
     737      136730 :                                  TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     738      136730 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     739      136730 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 106))
     740             :                               ELSE
     741       87653 :                                  TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     742       87653 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     743       87653 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 107))
     744             :                               END IF
     745             :                            ELSE
     746      119294 :                               IF (X1 <= 0.937500000000000000E-01_dp) THEN
     747       97759 :                                  TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     748       97759 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     749       97759 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 108))
     750             :                               ELSE
     751       21535 :                                  TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     752       21535 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     753       21535 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 109))
     754             :                               END IF
     755             :                            END IF
     756             :                         ELSE
     757       40512 :                            IF (X1 <= 0.937500000000000000E-01_dp) THEN
     758       26872 :                               TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
     759       26872 :                               TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     760       26872 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 110))
     761             :                            ELSE
     762       13640 :                               TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
     763       13640 :                               TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
     764       13640 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 111))
     765             :                            END IF
     766             :                         END IF
     767             :                      END IF
     768             :                   ELSE
     769      261044 :                      IF (X2 <= 0.750000000000000000E+00_dp) THEN
     770      244960 :                         IF (X2 <= 0.625000000000000000E+00_dp) THEN
     771      197353 :                            IF (X1 <= 0.187500000000000000E+00_dp) THEN
     772       80964 :                               IF (X1 <= 0.156250000000000000E+00_dp) THEN
     773       36908 :                                  TG1 = (2*X1 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     774       36908 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     775       36908 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 112))
     776             :                               ELSE
     777       44056 :                                  TG1 = (2*X1 - 0.343750000000000000E+00_dp)*0.320000000000000000E+02_dp
     778       44056 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     779       44056 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 113))
     780             :                               END IF
     781             :                            ELSE
     782      116389 :                               IF (X1 <= 0.218750000000000000E+00_dp) THEN
     783       80933 :                                  TG1 = (2*X1 - 0.406250000000000000E+00_dp)*0.320000000000000000E+02_dp
     784       80933 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     785       80933 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 114))
     786             :                               ELSE
     787       35456 :                                  TG1 = (2*X1 - 0.468750000000000000E+00_dp)*0.320000000000000000E+02_dp
     788       35456 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     789       35456 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 115))
     790             :                               END IF
     791             :                            END IF
     792             :                         ELSE
     793       47607 :                            IF (X1 <= 0.187500000000000000E+00_dp) THEN
     794       24059 :                               IF (X1 <= 0.156250000000000000E+00_dp) THEN
     795        6722 :                                  TG1 = (2*X1 - 0.281250000000000000E+00_dp)*0.320000000000000000E+02_dp
     796        6722 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     797        6722 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 116))
     798             :                               ELSE
     799       17337 :                                  TG1 = (2*X1 - 0.343750000000000000E+00_dp)*0.320000000000000000E+02_dp
     800       17337 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     801       17337 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 117))
     802             :                               END IF
     803             :                            ELSE
     804       23548 :                               IF (X1 <= 0.218750000000000000E+00_dp) THEN
     805        8592 :                                  TG1 = (2*X1 - 0.406250000000000000E+00_dp)*0.320000000000000000E+02_dp
     806        8592 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     807        8592 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 118))
     808             :                               ELSE
     809       14956 :                                  TG1 = (2*X1 - 0.468750000000000000E+00_dp)*0.320000000000000000E+02_dp
     810       14956 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     811       14956 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 119))
     812             :                               END IF
     813             :                            END IF
     814             :                         END IF
     815             :                      ELSE
     816       16084 :                         IF (X1 <= 0.187500000000000000E+00_dp) THEN
     817        8247 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
     818        6439 :                               TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     819        6439 :                               TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     820        6439 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 120))
     821             :                            ELSE
     822        1808 :                               TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
     823        1808 :                               TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     824        1808 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 121))
     825             :                            END IF
     826             :                         ELSE
     827        7837 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
     828        6923 :                               IF (X1 <= 0.218750000000000000E+00_dp) THEN
     829        3477 :                                  TG1 = (2*X1 - 0.406250000000000000E+00_dp)*0.320000000000000000E+02_dp
     830        3477 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     831        3477 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 122))
     832             :                               ELSE
     833        3446 :                                  TG1 = (2*X1 - 0.468750000000000000E+00_dp)*0.320000000000000000E+02_dp
     834        3446 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     835        3446 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 123))
     836             :                               END IF
     837             :                            ELSE
     838         914 :                               TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
     839         914 :                               TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     840         914 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 124))
     841             :                            END IF
     842             :                         END IF
     843             :                      END IF
     844             :                   END IF
     845             :                ELSE
     846      275546 :                   IF (X1 <= 0.375000000000000000E+00_dp) THEN
     847      186011 :                      IF (X2 <= 0.750000000000000000E+00_dp) THEN
     848      119929 :                         IF (X1 <= 0.312500000000000000E+00_dp) THEN
     849       63517 :                            IF (X2 <= 0.625000000000000000E+00_dp) THEN
     850       51124 :                               IF (X1 <= 0.281250000000000000E+00_dp) THEN
     851       17887 :                                  TG1 = (2*X1 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     852       17887 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     853       17887 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 125))
     854             :                               ELSE
     855       33237 :                                  TG1 = (2*X1 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     856       33237 :                                  TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     857       33237 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 126))
     858             :                               END IF
     859             :                            ELSE
     860       12393 :                               IF (X1 <= 0.281250000000000000E+00_dp) THEN
     861        4860 :                                  TG1 = (2*X1 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     862        4860 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     863        4860 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 127))
     864             :                               ELSE
     865        7533 :                                  TG1 = (2*X1 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     866        7533 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     867        7533 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 128))
     868             :                               END IF
     869             :                            END IF
     870             :                         ELSE
     871       56412 :                            IF (X2 <= 0.625000000000000000E+00_dp) THEN
     872       48029 :                               TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     873       48029 :                               TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     874       48029 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 129))
     875             :                            ELSE
     876        8383 :                               IF (X1 <= 0.343750000000000000E+00_dp) THEN
     877        2663 :                                  TG1 = (2*X1 - 0.656250000000000000E+00_dp)*0.320000000000000000E+02_dp
     878        2663 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     879        2663 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 130))
     880             :                               ELSE
     881        5720 :                                  TG1 = (2*X1 - 0.718750000000000000E+00_dp)*0.320000000000000000E+02_dp
     882        5720 :                                  TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     883        5720 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 131))
     884             :                               END IF
     885             :                            END IF
     886             :                         END IF
     887             :                      ELSE
     888       66082 :                         IF (X1 <= 0.312500000000000000E+00_dp) THEN
     889       49950 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
     890       40692 :                               IF (X1 <= 0.281250000000000000E+00_dp) THEN
     891       25569 :                                  TG1 = (2*X1 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     892       25569 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     893       25569 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 132))
     894             :                               ELSE
     895       15123 :                                  TG1 = (2*X1 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     896       15123 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     897       15123 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 133))
     898             :                               END IF
     899             :                            ELSE
     900        9258 :                               IF (X1 <= 0.281250000000000000E+00_dp) THEN
     901        3973 :                                  TG1 = (2*X1 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
     902        3973 :                                  TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     903        3973 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 134))
     904             :                               ELSE
     905        5285 :                                  TG1 = (2*X1 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
     906        5285 :                                  TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     907        5285 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 135))
     908             :                               END IF
     909             :                            END IF
     910             :                         ELSE
     911       16132 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
     912       12209 :                               IF (X1 <= 0.343750000000000000E+00_dp) THEN
     913        2284 :                                  TG1 = (2*X1 - 0.656250000000000000E+00_dp)*0.320000000000000000E+02_dp
     914        2284 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     915        2284 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 136))
     916             :                               ELSE
     917        9925 :                                  TG1 = (2*X1 - 0.718750000000000000E+00_dp)*0.320000000000000000E+02_dp
     918        9925 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     919        9925 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 137))
     920             :                               END IF
     921             :                            ELSE
     922        3923 :                               TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
     923        3923 :                               TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     924        3923 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 138))
     925             :                            END IF
     926             :                         END IF
     927             :                      END IF
     928             :                   ELSE
     929       89535 :                      IF (X2 <= 0.750000000000000000E+00_dp) THEN
     930       54499 :                         IF (X1 <= 0.437500000000000000E+00_dp) THEN
     931       21731 :                            IF (X2 <= 0.625000000000000000E+00_dp) THEN
     932       15223 :                               TG1 = (2*X1 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     933       15223 :                               TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     934       15223 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 139))
     935             :                            ELSE
     936        6508 :                               TG1 = (2*X1 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     937        6508 :                               TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     938        6508 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 140))
     939             :                            END IF
     940             :                         ELSE
     941       32768 :                            TG1 = (2*X1 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     942       32768 :                            TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
     943       32768 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 141))
     944             :                         END IF
     945             :                      ELSE
     946       35036 :                         IF (X1 <= 0.437500000000000000E+00_dp) THEN
     947       32835 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
     948        4184 :                               TG1 = (2*X1 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     949        4184 :                               TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     950        4184 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 142))
     951             :                            ELSE
     952       28651 :                               TG1 = (2*X1 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
     953       28651 :                               TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     954       28651 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 143))
     955             :                            END IF
     956             :                         ELSE
     957        2201 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
     958         934 :                               TG1 = (2*X1 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     959         934 :                               TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
     960         934 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 144))
     961             :                            ELSE
     962        1267 :                               TG1 = (2*X1 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
     963        1267 :                               TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
     964        1267 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 145))
     965             :                            END IF
     966             :                         END IF
     967             :                      END IF
     968             :                   END IF
     969             :                END IF
     970             :             END IF
     971             :          ELSE
     972    36813445 :             IF (X1 <= 0.750000000000000000E+00_dp) THEN
     973    31104319 :                IF (X2 <= 0.500000000000000000E+00_dp) THEN
     974    30948838 :                   IF (X1 <= 0.625000000000000000E+00_dp) THEN
     975    19638300 :                      IF (X2 <= 0.250000000000000000E+00_dp) THEN
     976    15707734 :                         TG1 = (2*X1 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     977    15707734 :                         TG2 = (2*X2 - 0.250000000000000000E+00_dp)*0.400000000000000000E+01_dp
     978    15707734 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 146))
     979             :                      ELSE
     980     3930566 :                         TG1 = (2*X1 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
     981     3930566 :                         TG2 = (2*X2 - 0.750000000000000000E+00_dp)*0.400000000000000000E+01_dp
     982     3930566 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 147))
     983             :                      END IF
     984             :                   ELSE
     985    11310538 :                      TG1 = (2*X1 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
     986    11310538 :                      TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
     987    11310538 :                      CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 148))
     988             :                   END IF
     989             :                ELSE
     990      155481 :                   IF (X1 <= 0.625000000000000000E+00_dp) THEN
     991       85635 :                      IF (X2 <= 0.750000000000000000E+00_dp) THEN
     992       60360 :                         IF (X1 <= 0.562500000000000000E+00_dp) THEN
     993       29962 :                            TG1 = (2*X1 - 0.106250000000000000E+01_dp)*0.160000000000000000E+02_dp
     994       29962 :                            TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
     995       29962 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 149))
     996             :                         ELSE
     997       30398 :                            TG1 = (2*X1 - 0.118750000000000000E+01_dp)*0.160000000000000000E+02_dp
     998       30398 :                            TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
     999       30398 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 150))
    1000             :                         END IF
    1001             :                      ELSE
    1002       25275 :                         IF (X1 <= 0.562500000000000000E+00_dp) THEN
    1003       13103 :                            TG1 = (2*X1 - 0.106250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1004       13103 :                            TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
    1005       13103 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 151))
    1006             :                         ELSE
    1007       12172 :                            TG1 = (2*X1 - 0.118750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1008       12172 :                            TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
    1009       12172 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 152))
    1010             :                         END IF
    1011             :                      END IF
    1012             :                   ELSE
    1013       69846 :                      IF (X1 <= 0.687500000000000000E+00_dp) THEN
    1014       38402 :                         TG1 = (2*X1 - 0.131250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1015       38402 :                         TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1016       38402 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 153))
    1017             :                      ELSE
    1018       31444 :                         TG1 = (2*X1 - 0.143750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1019       31444 :                         TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1020       31444 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 154))
    1021             :                      END IF
    1022             :                   END IF
    1023             :                END IF
    1024             :             ELSE
    1025     5709126 :                TG1 = (2*X1 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
    1026     5709126 :                TG2 = (2*X2 - 0.100000000000000000E+01_dp)*0.100000000000000000E+01_dp
    1027     5709126 :                CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 155))
    1028             :             END IF
    1029             :          END IF
    1030             :       ELSE
    1031     2771789 :          IF (T < lower) THEN
    1032     2404968 :             use_gamma = .TRUE.
    1033     2404968 :             RETURN
    1034             :          END IF
    1035      366821 :          X2 = 11.0_dp/R
    1036      366821 :          X1 = (T - lower)/(upper - lower)
    1037      366821 :          IF (X1 <= 0.500000000000000000E+00_dp) THEN
    1038      322787 :             IF (X1 <= 0.250000000000000000E+00_dp) THEN
    1039       48933 :                IF (X2 <= 0.500000000000000000E+00_dp) THEN
    1040           0 :                   IF (X1 <= 0.125000000000000000E+00_dp) THEN
    1041           0 :                      IF (X2 <= 0.250000000000000000E+00_dp) THEN
    1042           0 :                         TG1 = (2*X1 - 0.125000000000000000E+00_dp)*0.800000000000000000E+01_dp
    1043           0 :                         TG2 = (2*X2 - 0.250000000000000000E+00_dp)*0.400000000000000000E+01_dp
    1044           0 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 156))
    1045             :                      ELSE
    1046           0 :                         TG1 = (2*X1 - 0.125000000000000000E+00_dp)*0.800000000000000000E+01_dp
    1047           0 :                         TG2 = (2*X2 - 0.750000000000000000E+00_dp)*0.400000000000000000E+01_dp
    1048           0 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 157))
    1049             :                      END IF
    1050             :                   ELSE
    1051           0 :                      TG1 = (2*X1 - 0.375000000000000000E+00_dp)*0.800000000000000000E+01_dp
    1052           0 :                      TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1053           0 :                      CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 158))
    1054             :                   END IF
    1055             :                ELSE
    1056       48933 :                   IF (X1 <= 0.125000000000000000E+00_dp) THEN
    1057       46166 :                      IF (X2 <= 0.750000000000000000E+00_dp) THEN
    1058        4688 :                         IF (X2 <= 0.625000000000000000E+00_dp) THEN
    1059           0 :                            TG1 = (2*X1 - 0.125000000000000000E+00_dp)*0.800000000000000000E+01_dp
    1060           0 :                            TG2 = (2*X2 - 0.112500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1061           0 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 159))
    1062             :                         ELSE
    1063        4688 :                            IF (X1 <= 0.625000000000000000E-01_dp) THEN
    1064        3868 :                               TG1 = (2*X1 - 0.625000000000000000E-01_dp)*0.160000000000000000E+02_dp
    1065        3868 :                               TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1066        3868 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 160))
    1067             :                            ELSE
    1068         820 :                               TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1069         820 :                               TG2 = (2*X2 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1070         820 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 161))
    1071             :                            END IF
    1072             :                         END IF
    1073             :                      ELSE
    1074       41478 :                         IF (X1 <= 0.625000000000000000E-01_dp) THEN
    1075       33098 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
    1076        3902 :                               IF (X1 <= 0.312500000000000000E-01_dp) THEN
    1077        2145 :                                  IF (X2 <= 0.812500000000000000E+00_dp) THEN
    1078         622 :                                     TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
    1079         622 :                                     TG2 = (2*X2 - 0.156250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1080         622 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 162))
    1081             :                                  ELSE
    1082        1523 :                                     TG1 = (2*X1 - 0.312500000000000000E-01_dp)*0.320000000000000000E+02_dp
    1083        1523 :                                     TG2 = (2*X2 - 0.168750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1084        1523 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 163))
    1085             :                                  END IF
    1086             :                               ELSE
    1087        1757 :                                  TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
    1088        1757 :                                  TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1089        1757 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 164))
    1090             :                               END IF
    1091             :                            ELSE
    1092       29196 :                               IF (X1 <= 0.312500000000000000E-01_dp) THEN
    1093       23340 :                                  IF (X2 <= 0.937500000000000000E+00_dp) THEN
    1094        2652 :                                     IF (X1 <= 0.156250000000000000E-01_dp) THEN
    1095        2322 :                                        IF (X2 <= 0.906250000000000000E+00_dp) THEN
    1096         212 :                                           TG1 = (2*X1 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
    1097         212 :                                           TG2 = (2*X2 - 0.178125000000000000E+01_dp)*0.320000000000000000E+02_dp
    1098         212 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 165))
    1099             :                                        ELSE
    1100        2110 :                                           TG1 = (2*X1 - 0.156250000000000000E-01_dp)*0.640000000000000000E+02_dp
    1101        2110 :                                           TG2 = (2*X2 - 0.184375000000000000E+01_dp)*0.320000000000000000E+02_dp
    1102        2110 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 166))
    1103             :                                        END IF
    1104             :                                     ELSE
    1105         330 :                                        TG1 = (2*X1 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
    1106         330 :                                        TG2 = (2*X2 - 0.181250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1107         330 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 167))
    1108             :                                     END IF
    1109             :                                  ELSE
    1110       20688 :                                     IF (X1 <= 0.156250000000000000E-01_dp) THEN
    1111        8862 :                                        IF (X2 <= 0.968750000000000000E+00_dp) THEN
    1112        4581 :                                           IF (X1 <= 0.781250000000000000E-02_dp) THEN
    1113        1872 :                                              IF (X2 <= 0.953125000000000000E+00_dp) THEN
    1114        1010 :                                                 TG1 = (2*X1 - 0.781250000000000000E-02_dp)*0.128000000000000000E+03_dp
    1115        1010 :                                                 TG2 = (2*X2 - 0.189062500000000000E+01_dp)*0.640000000000000000E+02_dp
    1116        1010 :                                                 CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 168))
    1117             :                                              ELSE
    1118         862 :                                                 TG1 = (2*X1 - 0.781250000000000000E-02_dp)*0.128000000000000000E+03_dp
    1119         862 :                                                 TG2 = (2*X2 - 0.192187500000000000E+01_dp)*0.640000000000000000E+02_dp
    1120         862 :                                                 CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 169))
    1121             :                                              END IF
    1122             :                                           ELSE
    1123        2709 :                                              TG1 = (2*X1 - 0.234375000000000000E-01_dp)*0.128000000000000000E+03_dp
    1124        2709 :                                              TG2 = (2*X2 - 0.190625000000000000E+01_dp)*0.320000000000000000E+02_dp
    1125        2709 :                                              CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 170))
    1126             :                                           END IF
    1127             :                                        ELSE
    1128        4281 :                                           IF (X1 <= 0.781250000000000000E-02_dp) THEN
    1129        1722 :                                              IF (X2 <= 0.984375000000000000E+00_dp) THEN
    1130         663 :                                                 TG1 = (2*X1 - 0.781250000000000000E-02_dp)*0.128000000000000000E+03_dp
    1131         663 :                                                 TG2 = (2*X2 - 0.195312500000000000E+01_dp)*0.640000000000000000E+02_dp
    1132         663 :                                                 CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 171))
    1133             :                                              ELSE
    1134        1059 :                                                 TG1 = (2*X1 - 0.781250000000000000E-02_dp)*0.128000000000000000E+03_dp
    1135        1059 :                                                 TG2 = (2*X2 - 0.198437500000000000E+01_dp)*0.640000000000000000E+02_dp
    1136        1059 :                                                 CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 172))
    1137             :                                              END IF
    1138             :                                           ELSE
    1139        2559 :                                              IF (X2 <= 0.984375000000000000E+00_dp) THEN
    1140         633 :                                                 TG1 = (2*X1 - 0.234375000000000000E-01_dp)*0.128000000000000000E+03_dp
    1141         633 :                                                 TG2 = (2*X2 - 0.195312500000000000E+01_dp)*0.640000000000000000E+02_dp
    1142         633 :                                                 CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 173))
    1143             :                                              ELSE
    1144        1926 :                                                 TG1 = (2*X1 - 0.234375000000000000E-01_dp)*0.128000000000000000E+03_dp
    1145        1926 :                                                 TG2 = (2*X2 - 0.198437500000000000E+01_dp)*0.640000000000000000E+02_dp
    1146        1926 :                                                 CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 174))
    1147             :                                              END IF
    1148             :                                           END IF
    1149             :                                        END IF
    1150             :                                     ELSE
    1151       11826 :                                        IF (X2 <= 0.968750000000000000E+00_dp) THEN
    1152        2051 :                                           TG1 = (2*X1 - 0.468750000000000000E-01_dp)*0.640000000000000000E+02_dp
    1153        2051 :                                           TG2 = (2*X2 - 0.190625000000000000E+01_dp)*0.320000000000000000E+02_dp
    1154        2051 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 175))
    1155             :                                        ELSE
    1156        9775 :                                           IF (X1 <= 0.234375000000000000E-01_dp) THEN
    1157        4072 :                                              TG1 = (2*X1 - 0.390625000000000000E-01_dp)*0.128000000000000000E+03_dp
    1158        4072 :                                              TG2 = (2*X2 - 0.196875000000000000E+01_dp)*0.320000000000000000E+02_dp
    1159        4072 :                                              CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 176))
    1160             :                                           ELSE
    1161        5703 :                                              TG1 = (2*X1 - 0.546875000000000000E-01_dp)*0.128000000000000000E+03_dp
    1162        5703 :                                              TG2 = (2*X2 - 0.196875000000000000E+01_dp)*0.320000000000000000E+02_dp
    1163        5703 :                                              CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 177))
    1164             :                                           END IF
    1165             :                                        END IF
    1166             :                                     END IF
    1167             :                                  END IF
    1168             :                               ELSE
    1169        5856 :                                  IF (X2 <= 0.937500000000000000E+00_dp) THEN
    1170        1079 :                                     TG1 = (2*X1 - 0.937500000000000000E-01_dp)*0.320000000000000000E+02_dp
    1171        1079 :                                     TG2 = (2*X2 - 0.181250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1172        1079 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 178))
    1173             :                                  ELSE
    1174        4777 :                                     IF (X1 <= 0.468750000000000000E-01_dp) THEN
    1175        2778 :                                        IF (X2 <= 0.968750000000000000E+00_dp) THEN
    1176         489 :                                           TG1 = (2*X1 - 0.781250000000000000E-01_dp)*0.640000000000000000E+02_dp
    1177         489 :                                           TG2 = (2*X2 - 0.190625000000000000E+01_dp)*0.320000000000000000E+02_dp
    1178         489 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 179))
    1179             :                                        ELSE
    1180        2289 :                                           TG1 = (2*X1 - 0.781250000000000000E-01_dp)*0.640000000000000000E+02_dp
    1181        2289 :                                           TG2 = (2*X2 - 0.196875000000000000E+01_dp)*0.320000000000000000E+02_dp
    1182        2289 :                                           CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 180))
    1183             :                                        END IF
    1184             :                                     ELSE
    1185        1999 :                                        TG1 = (2*X1 - 0.109375000000000000E+00_dp)*0.640000000000000000E+02_dp
    1186        1999 :                                        TG2 = (2*X2 - 0.193750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1187        1999 :                                        CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 181))
    1188             :                                     END IF
    1189             :                                  END IF
    1190             :                               END IF
    1191             :                            END IF
    1192             :                         ELSE
    1193        8380 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
    1194        2879 :                               TG1 = (2*X1 - 0.187500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1195        2879 :                               TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1196        2879 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 182))
    1197             :                            ELSE
    1198        5501 :                               IF (X1 <= 0.937500000000000000E-01_dp) THEN
    1199        4174 :                                  IF (X2 <= 0.937500000000000000E+00_dp) THEN
    1200         925 :                                     TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
    1201         925 :                                     TG2 = (2*X2 - 0.181250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1202         925 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 183))
    1203             :                                  ELSE
    1204        3249 :                                     TG1 = (2*X1 - 0.156250000000000000E+00_dp)*0.320000000000000000E+02_dp
    1205        3249 :                                     TG2 = (2*X2 - 0.193750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1206        3249 :                                     CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 184))
    1207             :                                  END IF
    1208             :                               ELSE
    1209        1327 :                                  TG1 = (2*X1 - 0.218750000000000000E+00_dp)*0.320000000000000000E+02_dp
    1210        1327 :                                  TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1211        1327 :                                  CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 185))
    1212             :                               END IF
    1213             :                            END IF
    1214             :                         END IF
    1215             :                      END IF
    1216             :                   ELSE
    1217        2767 :                      IF (X2 <= 0.750000000000000000E+00_dp) THEN
    1218           4 :                         TG1 = (2*X1 - 0.375000000000000000E+00_dp)*0.800000000000000000E+01_dp
    1219           4 :                         TG2 = (2*X2 - 0.125000000000000000E+01_dp)*0.400000000000000000E+01_dp
    1220           4 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 186))
    1221             :                      ELSE
    1222        2763 :                         IF (X1 <= 0.187500000000000000E+00_dp) THEN
    1223        1478 :                            IF (X2 <= 0.875000000000000000E+00_dp) THEN
    1224          55 :                               TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1225          55 :                               TG2 = (2*X2 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1226          55 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 187))
    1227             :                            ELSE
    1228        1423 :                               TG1 = (2*X1 - 0.312500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1229        1423 :                               TG2 = (2*X2 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1230        1423 :                               CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 188))
    1231             :                            END IF
    1232             :                         ELSE
    1233        1285 :                            TG1 = (2*X1 - 0.437500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1234        1285 :                            TG2 = (2*X2 - 0.175000000000000000E+01_dp)*0.400000000000000000E+01_dp
    1235        1285 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 189))
    1236             :                         END IF
    1237             :                      END IF
    1238             :                   END IF
    1239             :                END IF
    1240             :             ELSE
    1241      273854 :                IF (X1 <= 0.375000000000000000E+00_dp) THEN
    1242        3491 :                   IF (X1 <= 0.312500000000000000E+00_dp) THEN
    1243          93 :                      IF (X1 <= 0.281250000000000000E+00_dp) THEN
    1244          67 :                         TG1 = (2*X1 - 0.531250000000000000E+00_dp)*0.320000000000000000E+02_dp
    1245          67 :                         TG2 = (2*X2 - 0.100000000000000000E+01_dp)*0.100000000000000000E+01_dp
    1246          67 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 190))
    1247             :                      ELSE
    1248          26 :                         TG1 = (2*X1 - 0.593750000000000000E+00_dp)*0.320000000000000000E+02_dp
    1249          26 :                         TG2 = (2*X2 - 0.100000000000000000E+01_dp)*0.100000000000000000E+01_dp
    1250          26 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 191))
    1251             :                      END IF
    1252             :                   ELSE
    1253        3398 :                      IF (X2 <= 0.500000000000000000E+00_dp) THEN
    1254           0 :                         TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1255           0 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1256           0 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 192))
    1257             :                      ELSE
    1258        3398 :                         TG1 = (2*X1 - 0.687500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1259        3398 :                         TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1260        3398 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 193))
    1261             :                      END IF
    1262             :                   END IF
    1263             :                ELSE
    1264      270363 :                   IF (X1 <= 0.437500000000000000E+00_dp) THEN
    1265       49377 :                      IF (X2 <= 0.500000000000000000E+00_dp) THEN
    1266        1992 :                         TG1 = (2*X1 - 0.812500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1267        1992 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1268        1992 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 194))
    1269             :                      ELSE
    1270       47385 :                         IF (X1 <= 0.406250000000000000E+00_dp) THEN
    1271       14907 :                            TG1 = (2*X1 - 0.781250000000000000E+00_dp)*0.320000000000000000E+02_dp
    1272       14907 :                            TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1273       14907 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 195))
    1274             :                         ELSE
    1275       32478 :                            TG1 = (2*X1 - 0.843750000000000000E+00_dp)*0.320000000000000000E+02_dp
    1276       32478 :                            TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1277       32478 :                            CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 196))
    1278             :                         END IF
    1279             :                      END IF
    1280             :                   ELSE
    1281      220986 :                      IF (X2 <= 0.500000000000000000E+00_dp) THEN
    1282      132588 :                         TG1 = (2*X1 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1283      132588 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1284      132588 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 197))
    1285             :                      ELSE
    1286       88398 :                         TG1 = (2*X1 - 0.937500000000000000E+00_dp)*0.160000000000000000E+02_dp
    1287       88398 :                         TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1288       88398 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 198))
    1289             :                      END IF
    1290             :                   END IF
    1291             :                END IF
    1292             :             END IF
    1293             :          ELSE
    1294       44034 :             IF (X1 <= 0.750000000000000000E+00_dp) THEN
    1295       26633 :                IF (X1 <= 0.625000000000000000E+00_dp) THEN
    1296       17715 :                   IF (X2 <= 0.500000000000000000E+00_dp) THEN
    1297        3816 :                      IF (X1 <= 0.562500000000000000E+00_dp) THEN
    1298        3772 :                         TG1 = (2*X1 - 0.106250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1299        3772 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1300        3772 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 199))
    1301             :                      ELSE
    1302          44 :                         TG1 = (2*X1 - 0.118750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1303          44 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1304          44 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 200))
    1305             :                      END IF
    1306             :                   ELSE
    1307       13899 :                      IF (X1 <= 0.562500000000000000E+00_dp) THEN
    1308        7772 :                         TG1 = (2*X1 - 0.106250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1309        7772 :                         TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1310        7772 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 201))
    1311             :                      ELSE
    1312        6127 :                         TG1 = (2*X1 - 0.118750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1313        6127 :                         TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1314        6127 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 202))
    1315             :                      END IF
    1316             :                   END IF
    1317             :                ELSE
    1318        8918 :                   IF (X2 <= 0.500000000000000000E+00_dp) THEN
    1319          40 :                      IF (X1 <= 0.687500000000000000E+00_dp) THEN
    1320          28 :                         TG1 = (2*X1 - 0.131250000000000000E+01_dp)*0.160000000000000000E+02_dp
    1321          28 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1322          28 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 203))
    1323             :                      ELSE
    1324          12 :                         TG1 = (2*X1 - 0.143750000000000000E+01_dp)*0.160000000000000000E+02_dp
    1325          12 :                         TG2 = (2*X2 - 0.500000000000000000E+00_dp)*0.200000000000000000E+01_dp
    1326          12 :                         CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 204))
    1327             :                      END IF
    1328             :                   ELSE
    1329        8878 :                      TG1 = (2*X1 - 0.137500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1330        8878 :                      TG2 = (2*X2 - 0.150000000000000000E+01_dp)*0.200000000000000000E+01_dp
    1331        8878 :                      CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 205))
    1332             :                   END IF
    1333             :                END IF
    1334             :             ELSE
    1335       17401 :                IF (X1 <= 0.875000000000000000E+00_dp) THEN
    1336        6480 :                   TG1 = (2*X1 - 0.162500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1337        6480 :                   TG2 = (2*X2 - 0.100000000000000000E+01_dp)*0.100000000000000000E+01_dp
    1338        6480 :                   CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 206))
    1339             :                ELSE
    1340       10921 :                   TG1 = (2*X1 - 0.187500000000000000E+01_dp)*0.800000000000000000E+01_dp
    1341       10921 :                   TG2 = (2*X2 - 0.100000000000000000E+01_dp)*0.100000000000000000E+01_dp
    1342       10921 :                   CALL PD2VAL(RES, NDERIV, TG1, TG2, C0(1, 207))
    1343             :                END IF
    1344             :             END IF
    1345             :          END IF
    1346             :       END IF
    1347             :    END SUBROUTINE t_c_g0_n
    1348             : 
    1349             : ! **************************************************************************************************
    1350             : !> \brief ...
    1351             : !> \param Nder the number of derivatives that will actually be used
    1352             : !> \param iunit contains the data file to initialize the table
    1353             : !> \param mepos ...
    1354             : !> \param group ...
    1355             : ! **************************************************************************************************
    1356         716 :    SUBROUTINE init(Nder, iunit, mepos, group)
    1357             :       INTEGER, INTENT(IN)                                :: Nder, iunit, mepos
    1358             : 
    1359             :       CLASS(mp_comm_type), INTENT(IN)                     :: group
    1360             : 
    1361             :       INTEGER                                            :: I
    1362         716 :       REAL(KIND=dp), ALLOCATABLE, DIMENSION(:)           :: chunk
    1363             : 
    1364         716 :       patches = 207
    1365         716 :       IF (Nder > nderiv_max) CPABORT("T_C_G0 init failed")
    1366         716 :       nderiv_init = Nder
    1367         716 :       IF (ALLOCATED(C0)) DEALLOCATE (C0)
    1368             :       ! round up to a multiple of 32 to give some generous alignment for each C0
    1369        2864 :       ALLOCATE (C0(32*((31 + (Nder + 1)*(degree + 1)*(degree + 2)/2)/32), patches))
    1370             :       ! init mpi'ed buffers to silence warnings under valgrind
    1371   110266304 :       C0 = 1.0E99_dp
    1372         716 :       IF (mepos == 0) THEN
    1373         358 :          ALLOCATE (chunk((nderiv_max + 1)*(degree + 1)*(degree + 2)/2))
    1374       74464 :          DO I = 1, patches
    1375       74106 :             READ (iunit, *) chunk
    1376    54129409 :             C0(1:(Nder + 1)*(degree + 1)*(degree + 2)/2, I) = chunk(1:(Nder + 1)*(degree + 1)*(degree + 2)/2)
    1377             :          END DO
    1378         358 :          DEALLOCATE (chunk)
    1379             :       END IF
    1380         716 :       CALL group%bcast(C0, 0)
    1381             : 
    1382         716 :    END SUBROUTINE init
    1383             : 
    1384             : ! **************************************************************************************************
    1385             : !> \brief ...
    1386             : ! **************************************************************************************************
    1387         344 :    SUBROUTINE free_C0()
    1388         344 :       IF (ALLOCATED(C0)) DEALLOCATE (C0)
    1389         344 :       nderiv_init = -1
    1390         344 :    END SUBROUTINE free_C0
    1391             : 
    1392             : ! **************************************************************************************************
    1393             : !> \brief ...
    1394             : !> \param RES ...
    1395             : !> \param NDERIV ...
    1396             : !> \param TG1 ...
    1397             : !> \param TG2 ...
    1398             : !> \param C0 ...
    1399             : ! **************************************************************************************************
    1400   137025220 :    SUBROUTINE PD2VAL(RES, NDERIV, TG1, TG2, C0)
    1401             :       REAL(KIND=dp), INTENT(OUT)                         :: res(*)
    1402             :       INTEGER, INTENT(IN)                                :: NDERIV
    1403             :       REAL(KIND=dp), INTENT(IN)                          :: TG1, TG2, C0(105, *)
    1404             : 
    1405             :       REAL(KIND=dp), PARAMETER :: SQRT2 = 1.4142135623730950488016887242096980785696718753_dp
    1406             : 
    1407             :       INTEGER                                            :: K
    1408             :       REAL(KIND=dp)                                      :: T1(0:13), T2(0:13)
    1409             : 
    1410   137025220 :       T1(0) = 1.0_dp
    1411   137025220 :       T2(0) = 1.0_dp
    1412   137025220 :       T1(1) = SQRT2*TG1
    1413   137025220 :       T2(1) = SQRT2*TG2
    1414   137025220 :       T1(2) = 2*TG1*T1(1) - SQRT2
    1415   137025220 :       T2(2) = 2*TG2*T2(1) - SQRT2
    1416   137025220 :       T1(3) = 2*TG1*T1(2) - T1(1)
    1417   137025220 :       T2(3) = 2*TG2*T2(2) - T2(1)
    1418   137025220 :       T1(4) = 2*TG1*T1(3) - T1(2)
    1419   137025220 :       T2(4) = 2*TG2*T2(3) - T2(2)
    1420   137025220 :       T1(5) = 2*TG1*T1(4) - T1(3)
    1421   137025220 :       T2(5) = 2*TG2*T2(4) - T2(3)
    1422   137025220 :       T1(6) = 2*TG1*T1(5) - T1(4)
    1423   137025220 :       T2(6) = 2*TG2*T2(5) - T2(4)
    1424   137025220 :       T1(7) = 2*TG1*T1(6) - T1(5)
    1425   137025220 :       T2(7) = 2*TG2*T2(6) - T2(5)
    1426   137025220 :       T1(8) = 2*TG1*T1(7) - T1(6)
    1427   137025220 :       T2(8) = 2*TG2*T2(7) - T2(6)
    1428   137025220 :       T1(9) = 2*TG1*T1(8) - T1(7)
    1429   137025220 :       T2(9) = 2*TG2*T2(8) - T2(7)
    1430   137025220 :       T1(10) = 2*TG1*T1(9) - T1(8)
    1431   137025220 :       T2(10) = 2*TG2*T2(9) - T2(8)
    1432   137025220 :       T1(11) = 2*TG1*T1(10) - T1(9)
    1433   137025220 :       T2(11) = 2*TG2*T2(10) - T2(9)
    1434   137025220 :       T1(12) = 2*TG1*T1(11) - T1(10)
    1435   137025220 :       T2(12) = 2*TG2*T2(11) - T2(10)
    1436   137025220 :       T1(13) = 2*TG1*T1(12) - T1(11)
    1437   137025220 :       T2(13) = 2*TG2*T2(12) - T2(11)
    1438   503834479 :       DO K = 1, NDERIV + 1
    1439   366809259 :          RES(K) = 0.0_dp
    1440  5502138885 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:13), C0(1:14, K))*T2(0)
    1441  5135329626 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:12), C0(15:27, K))*T2(1)
    1442  4768520367 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:11), C0(28:39, K))*T2(2)
    1443  4401711108 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:10), C0(40:50, K))*T2(3)
    1444  4034901849 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:9), C0(51:60, K))*T2(4)
    1445  3668092590 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:8), C0(61:69, K))*T2(5)
    1446  3301283331 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:7), C0(70:77, K))*T2(6)
    1447  2934474072 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:6), C0(78:84, K))*T2(7)
    1448  2567664813 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:5), C0(85:90, K))*T2(8)
    1449  2200855554 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:4), C0(91:95, K))*T2(9)
    1450  1834046295 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:3), C0(96:99, K))*T2(10)
    1451  1467237036 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:2), C0(100:102, K))*T2(11)
    1452  1100427777 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:1), C0(103:104, K))*T2(12)
    1453   870643738 :          RES(K) = RES(K) + DOT_PRODUCT(T1(0:0), C0(105:105, K))*T2(13)
    1454             :       END DO
    1455   137025220 :    END SUBROUTINE PD2VAL
    1456             : 
    1457             : ! **************************************************************************************************
    1458             : !> \brief Returns the value of nderiv_init so that one can check if opening the potential file is
    1459             : !>        worhtwhile
    1460             : !> \return ...
    1461             : !> \author A. Bussy, 05.2019
    1462             : ! **************************************************************************************************
    1463     5619466 :    FUNCTION get_lmax_init() RESULT(lmax_init)
    1464             : 
    1465             :       INTEGER                                            :: lmax_init
    1466             : 
    1467     5619466 :       lmax_init = nderiv_init
    1468             : 
    1469     5619466 :    END FUNCTION get_lmax_init
    1470             : 
    1471             : END MODULE t_c_g0

Generated by: LCOV version 1.15