Class lattice_class
In: LatticeClass/lattice_class.F90
constants_module random_class counter_class comlib qmxf03_module lattice_class dot/f_252.png

Lattice Class (defines constans, Lattics size, PU size, Color, Dimension etc.)

Version

$Id: lattice_class.F90,v 1.23 2011/10/30 02:48:26 ishikawa Exp $

Methods

C0   C1   CHARLEN   CI   CLSP   CLSPH   COL   DP   NDIM   NDIMX   NDIMY   NDIMZ   NPU   NT   NT1   NTH   NTT   NTX   NTY   NTZ   NX   NX1   NY   NY1   NZ   NZ1   ONE   PI   SP   SPIN   SW_OFF   SW_ON   TWO   Z0   Z1   ZERO   ZI   delete   g_rand   get   get   get_rand2   get_rand3   imunu   ipeo   ipsite   is_initialized   ist   isx   isy   isz   lattice_world   new   nodeid   nodeiddn   nodeidup   print   rand_gfsr_obj   read   save  

Included Modules

constants_module random_class counter_class comlib qmxf03_module

Public Instance methods

C0
Constant :
C0 = (0.0_SP,0.0_SP) :complex(SP), parameter

Original external subprogram is constants_module#C0

C1
Constant :
C1 = (1.0_SP,0.0_SP) :complex(SP), parameter

Original external subprogram is constants_module#C1

CHARLEN
Constant :
CHARLEN =256 :integer, parameter
: max characger length, used for file names.

Original external subprogram is constants_module#CHARLEN

CI
Constant :
CI = (0.0_SP,1.0_SP) :complex(SP), parameter

Original external subprogram is constants_module#CI

CLSP
Constant :
CLSP =COL*SPIN :integer, parameter
CLSPH
Constant :
CLSPH =(CLSP/2+1)*(CLSP/4) :integer, parameter
COL
Constant :
COL =3 :integer, parameter
DP
Constant :
DP = SELECTED_REAL_KIND(15) :integer, parameter

Original external subprogram is constants_module#DP

NDIM
Constant :
NDIM =4 :integer, parameter
: lattice dimension
NDIMX
Constant :
NDIMX =_NDIMX :integer, parameter
: X node size
NDIMY
Constant :
NDIMY =_NDIMY :integer, parameter
: Y node size
NDIMZ
Constant :
NDIMZ =_NDIMZ :integer, parameter
: Z node size
NPU
Constant :
NPU =NDIMX*NDIMY*NDIMZ :integer, parameter
NT
Constant :
NT =NTT :integer, parameter
: T size/node
NT1
Constant :
NT1 =NT+1 :integer, parameter
NTH
Constant :
NTH =NT/2 :integer, parameter
NTT
Constant :
NTT =_NTT :integer, parameter
: T extent ********************************
  • set PU array size

********************************

NTX
Constant :
NTX =_NTX :integer, parameter
: X extent
NTY
Constant :
NTY =_NTY :integer, parameter
: Y extent
NTZ
Constant :
NTZ =_NTZ :integer, parameter
: Z extent
NX
Constant :
NX =NTX/NDIMX :integer, parameter
: X size/node
NX1
Constant :
NX1 =NX+1 :integer, parameter
NY
Constant :
NY =NTY/NDIMY :integer, parameter
: Y size/node
NY1
Constant :
NY1 =NY+1 :integer, parameter
NZ
Constant :
NZ =NTZ/NDIMZ :integer, parameter
: Z size/node
NZ1
Constant :
NZ1 =NZ+1 :integer, parameter
ONE
Constant :
ONE = 1.0_DP :real(DP), parameter

Original external subprogram is constants_module#ONE

PI
Constant :
PI = 4 * ATAN(1.0_DP) :real(DP), parameter

Original external subprogram is constants_module#PI

SP
Constant :
SP = SELECTED_REAL_KIND(6) :integer, parameter

Original external subprogram is constants_module#SP

SPIN
Constant :
SPIN =4 :integer, parameter
SW_OFF
Constant :
SW_OFF = 0 :integer, parameter
: switch off

Original external subprogram is constants_module#SW_OFF

SW_ON
Constant :
SW_ON = 1 :integer, parameter
: switch on

Original external subprogram is constants_module#SW_ON

TWO
Constant :
TWO = 2.0_DP :real(DP), parameter

Original external subprogram is constants_module#TWO

Z0
Constant :
Z0 = (0.0_DP,0.0_DP) :complex(DP), parameter

Original external subprogram is constants_module#Z0

Z1
Constant :
Z1 = (1.0_DP,0.0_DP) :complex(DP), parameter

Original external subprogram is constants_module#Z1

ZERO
Constant :
ZERO = 0.0_DP :real(DP), parameter

Original external subprogram is constants_module#ZERO

ZI
Constant :
ZI = (0.0_DP,1.0_DP) :complex(DP), parameter

Original external subprogram is constants_module#ZI

Subroutine :
this :type(lattice_world), intent(inout)

Delete lattice constants, node information (next to nearest node rank etc.)

[Source]

subroutine delete_lattice(this)
!
! Delete lattice constants, node information (next to nearest node rank etc.)
!
  use comlib
  implicit none
  type(lattice_world), intent(inout) :: this
  if (.not.m_is_initialized) return

#ifndef _singlePU
  call comlib_finalize()
#endif

  m_is_initialized = .FALSE.
  return
end subroutine
g_rand
Variable :
g_rand :type(rand_gfsr_obj), save
: random number generator, GLOBAL variable.
get( this, scl )
Subroutine :
this :type(rand_gfsr_obj), intent(inout)
scl :real(8), intent(inout)

Get random number scalar

generate normalized random numbers: 0 < scl < 1

 - this : rand_gfsr_obj
 -  scl : uniform random number scalar

Original external subprogram is random_class#get

get( this, vec )
Subroutine :
this :type(rand_gfsr_obj), intent(inout)
vec(:) :real(8), intent(inout)

Get real random number vector

generate normalized random numbers: 0 < vec(:) < 1

 - this : rand_gfsr_obj
 -  vec : uniform random number vector

Original external subprogram is random_class#get

get_rand2( this, vec )
Subroutine :
this :type(rand_gfsr_obj), intent(inout)
vec(:) :real(8), intent(inout)

Get real random number vector

generate normalized random numbers: 0 <= vec(:) <= 1

 - this : rand_gfsr_obj
 -  vec : uniform random number vector

Original external subprogram is random_class#get_rand2

get_rand3( this, vec )
Subroutine :
this :type(rand_gfsr_obj), intent(inout)
vec(:) :real(8), intent(inout)

Get real random number vector

generate normalized random numbers: 0 <= vec(:) < 1

 - this : rand_gfsr_obj
 -  vec : uniform random number vector

Original external subprogram is random_class#get_rand3

imunu
Constant :
imunu(NDIM,NDIM) =RESHAPE((/ 0,-1,-2,-3, 1, 0,-4,-5, 2, 4, 0,-6, 3, 5, 6, 0 /),(/4,4/)) :integer, parameter
ipeo
Variable :
ipeo :integer, save
: node fiest site even/odd-ness.
ipsite
Variable :
ipsite(NDIM-1) :integer, save
: XYZ node location
Function :
status :logical
this :type(lattice_world), intent(in)

return lattice initialization status

 .true.:: lattice is initialized
.false.:lattice is not initialized

[Source]

function is_initialized_lattice(this) result(status)
!
! return lattice initialization status
!
!  .true.:: lattice is initialized
! .false.:: lattice is not initialized
!
  implicit none
  type(lattice_world), intent(in) :: this
  logical :: status 
  status = m_is_initialized
  return
end function
ist
Constant :
ist(NDIM) =(/0,0,0,1/) :integer, parameter
isx
Constant :
isx(NDIM) =(/1,0,0,0/) :integer, parameter
isy
Constant :
isy(NDIM) =(/0,1,0,0/) :integer, parameter
isz
Constant :
isz(NDIM) =(/0,0,1,0/) :integer, parameter
lattice_world
Derived Type :

lattice object

Subroutine :
this :type(lattice_world), intent(inout)

Initialize lattice constants, node information (next to nearest node rank etc.)

[Source]

subroutine new_lattice(this)
!
! Initialize lattice constants, node information (next to nearest node rank etc.)
!
  use comlib
#ifdef _QMX_
  use qmxf03_module
#endif
  implicit none
  type(lattice_world), intent(inout) :: this
#ifndef _singlePU
  integer :: npe
#endif

  if (m_is_initialized) then
    write(*,'("Lattice_world is already initialized.")')
    return
  endif

!-------------------------
!  Set node information
!-------------------------
#ifndef _singlePU
  call comlib_init
  call comlib_node(nodeid,npe)
  if (npe.NE.NPU) then
    write(*,'(" Error : PE num: NPU=",I5," npe=",I5)')
    call comlib_finalize
    stop 999
  endif

#ifdef _QMX_
  ipsite(1) = qmx_get_2d_local_rank_x()
  ipsite(2) = qmx_get_2d_local_rank_y()
  ipsite(3) = 0

  ipeo=mod(ipsite(1)*NX+ipsite(2)*NY+ipsite(3)*NZ,2)

  nodeidup(1) = qmx_get_2d_next_x_rank()
  nodeiddn(1) = qmx_get_2d_prev_x_rank()
  nodeidup(2) = qmx_get_2d_next_y_rank()
  nodeiddn(2) = qmx_get_2d_prev_y_rank()
  nodeidup(3) = nodeid
  nodeiddn(3) = nodeid

#else
  ipsite(1)=mod(nodeid,NDIMX)
  ipsite(2)=mod(nodeid/NDIMX,NDIMY)
  ipsite(3)=mod(nodeid/NDIMX/NDIMY,NDIMZ)

  ipeo=mod(ipsite(1)*NX+ipsite(2)*NY+ipsite(3)*NZ,2)

  nodeidup(1)=mod(ipsite(1)+1,NDIMX) +ipsite(2)               *NDIMX +ipsite(3)               *NDIMX*NDIMY
  nodeiddn(1)=mod(ipsite(1)-1+NDIMX,NDIMX) +ipsite(2)               *NDIMX +ipsite(3)               *NDIMX*NDIMY
  nodeidup(2)=    ipsite(1) +mod(ipsite(2)+1,NDIMY)      *NDIMX +ipsite(3)               *NDIMX*NDIMY
  nodeiddn(2)=    ipsite(1) +mod(ipsite(2)-1+NDIMY,NDIMY)*NDIMX +ipsite(3)               *NDIMX*NDIMY
  nodeidup(3)=    ipsite(1) +ipsite(2)               *NDIMX +mod(ipsite(3)+1,NDIMZ)      *NDIMX*NDIMY
  nodeiddn(3)=    ipsite(1) +ipsite(2)               *NDIMX +mod(ipsite(3)-1+NDIMZ,NDIMZ)*NDIMX*NDIMY
#endif

#else
  ipsite(1)=0
  ipsite(2)=0
  ipsite(3)=0
  ipeo=0
  nodeid=0
#endif

  m_is_initialized = .TRUE.

  return
end subroutine
nodeid
Variable :
nodeid :integer, save
: node index(MPI rank), [0..NPE-1].
nodeiddn
Variable :
nodeiddn(NDIM-1) :integer, save
: lower node index
nodeidup
Variable :
nodeidup(NDIM-1) :integer, save
: upper node index
Subroutine :
this :type(lattice_world), intent(inout)

Print out Lattice configuration (size,partition,etc...) on display

[Source]

subroutine print_lattice(this)
!
! Print out Lattice configuration (size,partition,etc...) on display
!
  implicit none
  type(lattice_world), intent(inout) :: this
  if (nodeid==0) then
    write(*,'(16X,"   Lattice Size :",4I3)')NTX,NTY,NTZ,NTT
    write(*,'(16X,"PU Lattice Size :",4I3)')NX ,NY ,NZ ,NT
    write(*,'(16X,"  PU Array Size :",4I3)')NDIMX,NDIMY,NDIMZ,1
  endif
  return
end subroutine
rand_gfsr_obj
Derived Type :
rr(:) :real(8), pointer
: Container array of uniform random number
seed(:) :integer(prc), pointer
: State vector for GFSR
irhere :integer(INT)
: Pointer to random number rr(:)
irseed :integer(INT)
: Inital random number seed
myid :integer(INT)
: MPI Rank, Total Rank
NPU :integer(INT)
: MPI Rank, Total Rank

Original external subprogram is random_class#rand_gfsr_obj

read( this, iout )
Subroutine :
this :type(rand_gfsr_obj), intent(inout)
iout :integer, intent(in)

Original external subprogram is random_class#read

save( this, iout )
Subroutine :
this :type(rand_gfsr_obj), intent(inout)
iout :integer, intent(in)

Original external subprogram is random_class#save