!===============================================================================
!
! hmc_sum.F90
!
!-------------------------------------------------------------------------------
!
! Copyright (C) 2008 Yoshifumi Nakamura 
!
! This file is part of BQCD -- Berlin Quantum ChromoDynamics program
!
! BQCD is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! BQCD is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with BQCD.  If not, see <http://www.gnu.org/licenses/>.
!
!-------------------------------------------------------------------------------
# include "defs.h"

!-------------------------------------------------------------------------------
subroutine hmc_sum_sf3(sf1, sf2, sf3)

  use module_sf
  implicit none

  REAL, intent(out) :: sf1, sf2, sf3
  integer :: i

  if (size(sf) /= 0) then
     sf1=sf(1)
     if (size(sf) > 1) then
        sf2=sf(2)
        if (size(sf) > 2) then
           do i=3, size(sf)
              sf3=sf3+sf(i)
           enddo
        endif
     endif
  else
     sf1 = ZERO
     sf2 = ZERO
     sf3 = ZERO
  endif

end

!===============================================================================
