!===============================================================================
!
! init_schr_weight.F90  ---  weight of actio for Schroedinger function
!
!-------------------------------------------------------------------------------
!
! Copyright (C) 2007 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 init_schr_weight()
  use module_schr_weight
  use module_schr_bc
  use module_vol
  implicit none
  integer :: mu, nu, eo, i, count

  cps = 0.5_8
  cpt = ONE
  crt = 1.5_8

  allocate(cp(volh_tot, EVEN:ODD, DIM, DIM))
  allocate(cr1(volh_tot, EVEN:ODD, DIM, DIM))
  allocate(cr2(volh_tot, EVEN:ODD, DIM, DIM))

  cp = ONE
  cr1 = ONE ! horizontally long
  cr2 = ONE ! vetically long

  do mu = 1, DIM
     do nu = 1, DIM
        if (mu /= nu) then
           if (mu == 4 .or. nu == 4) then
              do eo = EVEN,ODD
                 do count = 1, bc_len_b(eo)
                    i = bc_list_b(count, eo)
                    cp(i, eo, mu, nu) = cpt
                    cr1(i, eo, mu, nu) = crt
                    cr2(i, eo, mu, nu) = crt
                 enddo
                 do count = 1, bc_len_t(eo)
                    i = bc_list_t(count, eo)
                    cp(i, eo, mu, nu) = cpt
                    cr1(i, eo, mu, nu) = crt
                    cr2(i, eo, mu, nu) = ZERO
                 enddo
              enddo
           endif
           if (mu /= 4 .and. nu /= 4) then
              do eo = EVEN,ODD
                 do count = 1, bc_len_b(eo)
                    i = bc_list_b(count, eo)
                    cp(i, eo, mu, nu) = cps
                    cr1(i, eo, mu, nu) = ZERO
                    cr2(i, eo, mu, nu) = ZERO
                 enddo
                 do count = 1, bc_len_tp(eo)
                    i = bc_list_tp(count, eo)
                    cp(i, eo, mu, nu) = cps
                    cr1(i, eo, mu, nu) = ZERO
                    cr2(i, eo, mu, nu) = ZERO
                 enddo
              enddo
           endif
        endif
     enddo
  enddo

end

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