********************************************************************************
*                                                                              *
*  2DHF version 1-2003                                                         *
*  Copyright (C) 1996  Jacek Kobus, Leif Laaksonen, Dage Sundholm              *
*                                                                              *
*  This software may be used and distributed according to the terms            *
*  of the GNU General Public License, see README and COPYING.                  *
*                                                                              *
********************************************************************************
c ### es ###
c
c     This routine has been taken from GRASP2 package (ver. 1.00, 17 jan 1992, 
c     Copyright (C) 1992 by F.A. Parpia, I.P. Grant, and C.F. Fischer)
c
************************************************************************
*                                                                      *
      SUBROUTINE ES (F,S2F,S3F)
*                                                                      *
*   ----------------   SECTION 01   SUBPROGRAM 14   ----------------   *
*   EVALUATE THE SUM OF THE SERIES                                     *
*                                                                      *
*                       INFINITY      N              K                 *
*              S  (F) =   SUM     (-1)  EXP (N*F) / N                  *
*               K        N = 0                                         *
*                                                                      *
*   FOR K = 2, 3 TO MACHINE PRECISION. THIS IS A UTILITY SUBROUTINE,   *
*   CALLED BY SUBROUTINES NUCPOT AND NCHARG.                           *
*                                                                      *
*   NO SUBROUTINES CALLED                                              *
*                                                                      *
*   WRITTEN BY FARID A PARPIA, AT OXFORD  LAST REVISION: 25 JAN 1988   *
*                                                                      *
************************************************************************
*
      implicit real*8 (a-h, o-z)
*   
      common/cons/zero,half,tenth,one,two,three,ten
*   
      n = 0
      s2f = zero
      s3f = zero
      fase = one
    1 n = n+1
         en = dble (n)
         obn = one/en
         fase = -fase
         enf = exp (en*f)
         term2 = fase*enf*obn*obn 
         term3 = term2*obn                                              
         s2last = s2f
         s2f = s2f+term2
         s3f = s3f+term3  
         if (abs (s2f) .ne. abs (s2last)) goto 1                        
*
      return
      end
