Class hmc_job_manager_class
In: LatticeClass/hmc_job_manager_class.F90
comlib lattice_class counter_class hmc_job_manager_class dot/f_259.png

Define HMC JOB Manager algorithm controller class

Version

$Id: hmc_job_manager_class.F90,v 1.1 2011/06/14 11:10:12 ishikawa Exp $

Methods

Included Modules

comlib lattice_class counter_class

Public Instance methods

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

delete HMC controller

[Source]

subroutine delete_manager(this)
!
! delete HMC controller
!
  implicit none
  type(hmc_job_manager), intent(inout) :: this
  return
end subroutine
Function :
fname_cont :character(CHARLEN)
icont :integer , intent(in)
: # of continue
prefix :character(*), intent(in)
: path name for configuration
fhead :character(*), intent(in)
: file name header for configuration

Returns full file name for the continuation configuration

 prefix/fhead.x?y?z?.{01}

 prefix / fhead.x?y?z?.(icont mod 2)

for ex. prefix = "./config"

         fhead = "myconf"
         icont = 102

   output is "./config/myconf.x0y0z0.0" for [0,0,0] node

[Source]

character(CHARLEN) function fname_cont(icont,prefix,fhead)
!
! Returns full file name for the continuation configuration
!
!  prefix/fhead.x?y?z?.{01}
!
!  prefix / fhead.x?y?z?.(icont mod 2)
!
! for ex.  prefix = "./config"
!          fhead = "myconf"
!          icont = 102
!
!    output is "./config/myconf.x0y0z0.0" for [0,0,0] node
!
!
  implicit none
  integer ,     intent(in) :: icont     ! # of continue
  character(*), intent(in) :: prefix    ! path name for configuration
  character(*), intent(in) :: fhead     ! file name header for configuration
  character(CHARLEN) :: fbuff,fname,fdir
  integer :: i

  fdir=REPEAT(' ',LEN(fdir))
  fdir=TRIM(ADJUSTL(prefix))
  i=LEN_TRIM(ADJUSTL(fdir))
  if (fdir(i:i).NE.'/') then
    fdir=TRIM(ADJUSTL(fdir))//'/'
  endif

  fbuff=REPEAT(' ',LEN(fbuff))
  write(fbuff,'(".x",z1,"y",z1,"z",z1)')(ipsite(i),i=1,NDIM-1)
  fname=TRIM(TRIM(ADJUSTL(fhead))//TRIM(ADJUSTL(fbuff)))

  fbuff=REPEAT(' ',LEN(fbuff))
  write(fbuff,'(".",z1)')mod(icont,2)

  fname_cont=REPEAT(' ',LEN(fname_cont))
  fname_cont=TRIM(TRIM(ADJUSTL(fdir)) //TRIM(ADJUSTL(fname)) //TRIM(ADJUSTL(fbuff)))

  return
end function
Function :
fname_save :character(CHARLEN)
itraj :integer , intent(in)
: # of trajectory
prefix :character(*), intent(in)
: path name for configuration
fhead :character(*), intent(in)
: file name header for configuration

Returns full file name to save configuration for measurement

 prefix/[0:9][0:9][0:9][0:9][0:9][0:9]/fhead.x?y?z?

 prefix / 6-digit trajectory numbr / fhead.x?y?z?

for ex. prefix = "./config"

         fhead = "myconf"
         itraj = 102

   output is "./config/000102/myconf.x0y0z0" for [0,0,0] node

[Source]

character(CHARLEN) function fname_save(itraj,prefix,fhead)
!
! Returns full file name to save configuration for measurement
!
!  prefix/[0:9][0:9][0:9][0:9][0:9][0:9]/fhead.x?y?z?
!
!  prefix / 6-digit trajectory numbr / fhead.x?y?z?
!
! for ex.  prefix = "./config"
!          fhead = "myconf"
!          itraj = 102
!
!    output is "./config/000102/myconf.x0y0z0" for [0,0,0] node
!
  implicit none
  integer ,     intent(in) :: itraj    ! # of trajectory
  character(*), intent(in) :: prefix   ! path name for configuration
  character(*), intent(in) :: fhead    ! file name header for configuration
  character(CHARLEN) :: fbuff,fname,fdir
  integer :: i

  fdir=REPEAT(' ',LEN(fdir))
  fdir=TRIM(ADJUSTL(save_path(itraj,prefix)))
  i=LEN_TRIM(fdir)
  if (fdir(i:i).NE.'/') then
    fdir=TRIM(ADJUSTL(fdir))//'/'
  endif

  fbuff=REPEAT(' ',LEN(fbuff))
  write(fbuff,'(".x",z1,"y",z1,"z",z1)')(ipsite(i),i=1,NDIM-1)
  fname=TRIM(TRIM(ADJUSTL(fhead))//TRIM(ADJUSTL(fbuff)))

  fname_save=REPEAT(' ',LEN(fname_save))
  fname_save=TRIM(TRIM(ADJUSTL(fdir))//TRIM(ADJUSTL(fname)))

  return
end function
Function :
irun :integer
this :type(hmc_job_manager), intent(in)

reutrn HMC run id/ run number

[Source]

function get_run_number(this) result(irun)
!
! reutrn HMC run id/ run number
!
  implicit none
  type(hmc_job_manager), intent(in) :: this
  integer :: irun
  irun = this%total_program_run
  return
end function
Function :
itraj :integer
this :type(hmc_job_manager), intent(in)

return HMC current trajectory number

[Source]

function get_trajectory_number(this) result(itraj)
!
! return HMC current trajectory number
!
  implicit none
  type(hmc_job_manager), intent(in) :: this
  integer :: itraj
  itraj = this%total_trajectory
  return
end function
hmc_job_manager
Derived Type :

HMC job manager

Function :
flag :logical
this :type(hmc_job_manager), intent(inout)

return HMC job loop status.

 .true.:: HMC run reaches requied sweep. exit loop.
.false.:HMC run still remains. go next iteration.

[Source]

function is_do_loop_ended(this) result(flag)
!
! return HMC job loop status.
!
!  .true.:: HMC run reaches requied sweep. exit loop.
! .false.:: HMC run still remains. go next iteration.
!
  implicit none
  type(hmc_job_manager), intent(inout) :: this
  logical :: flag

  if (0 == this%sweep_count) then
    this%total_program_run = this%total_program_run + 1
  endif

  this%sweep_count = this%sweep_count + 1

  if (this%sweep_count > this%trajectory) then
    flag = .TRUE.
    return
  else
    this%total_trajectory = this%total_trajectory + 1
    flag = .FALSE.
    return
  endif
end function
Function :
flag :logical
this :type(hmc_job_manager), intent(in)

return HMC Meropolis test switch

 .true.:: Metropolis test is on
.false.:Metropolis test is off

[Source]

function is_hmc_metropolis_on(this) result(flag)
!
! return HMC Meropolis test switch
!
!  .true.:: Metropolis test is on
! .false.:: Metropolis test is off
!
  implicit none
  type(hmc_job_manager), intent(in) :: this
  logical :: flag
  select case (this%switch_metropolis_test)
  case(SW_ON)
    flag = .TRUE.
  case(SW_OFF)
    flag = .FALSE.
  end select
  return
end function
Function :
flag :logical
this :type(hmc_job_manager), intent(in)

return whether save or not save configuration for measurment.

 .true.:: user should save configuration for measurement
.false.:user need not save configuration for measurement

[Source]

function is_save_config(this) result(flag)
!
! return whether save or not save configuration for measurment.
!
!  .true.:: user should save configuration for measurement
! .false.:: user need not save configuration for measurement
!
  implicit none
  type(hmc_job_manager), intent(in) :: this
  logical :: flag

  if (0 == this%save_config_trajectory_skip) then
    flag = .FALSE.
    return
  endif
  if (0 /= mod(this%total_trajectory,this%save_config_trajectory_skip)) then
    flag = .FALSE.
    return
  endif

  flag = .TRUE.
  return
end function
Subroutine :
this :type(hmc_job_manager), intent(inout)

initialize HMC controller

[Source]

subroutine new_manager(this)
!
! initialize HMC controller
!
  implicit none
  type(hmc_job_manager), intent(inout) :: this
  this%switch_metropolis_test = SW_OFF
  this%total_program_run      = 0
  this%total_trajectory       = 0
  this%trajectory             = 0
  this%save_config_trajectory_skip = 0
  this%sweep_count            = 0
  return
end subroutine
Subroutine :
this :type(hmc_job_manager), intent(inout)

Print out HMC controller status on display

[Source]

subroutine print_manager(this)
!
! \Print out HMC controller status on display
!
  use lattice_class, only : nodeid
  implicit none
  type(hmc_job_manager), intent(inout) :: this

  if (nodeid == 0) then
    select case (this%total_program_run)
    case (0)
      write(*,'(8X,"               Continue : No ")')
    case default
      write(*,'(8X,"               Continue : Yes")')
    end select

    write(*,'(8X,"         # of Total Run :",I8)')this%total_program_run
    write(*,'(8X,"        # of Total Traj :",I8)')this%total_trajectory
    write(*,'(8X,"          # of Traj/Run :",I8)')this%trajectory
    write(*,'(8X,"    Save Conf Skip Traj :",I8)')this%save_config_trajectory_skip

    select case(this%switch_metropolis_test)
    case (SW_ON)
      write(*,'(8X,"     HMC Metropois TEST : ON")')
    case (SW_OFF)
      write(*,'(8X,"     HMC Metropois TEST : OFF")')
    end select
  endif

  return
end subroutine
Subroutine :
this :type(hmc_job_manager), intent(inout)

Print out HMC controller statistics on display

[Source]

subroutine print_stat_manager(this)
!
! \Print out HMC controller statistics on display
!
  use lattice_class, only : nodeid
  implicit none
  type(hmc_job_manager), intent(inout) :: this
  return
end subroutine
Subroutine :
this :type(hmc_job_manager), intent(inout)
: HMC controller
iout :integer, intent(in)
: file unit number

read HMC controller paramteres from formatted file (by unit number)

[Source]

subroutine read_manager(this,iout)
!
! read HMC controller paramteres from formatted file (by unit number)
!
  use comlib
  use lattice_class, only : nodeid, NPU
  implicit none
  type(hmc_job_manager), intent(inout) :: this  ! HMC controller
  integer,                intent(in)    :: iout  ! file unit number

  if (nodeid==0) then
  read(iout,*)this%total_program_run
  read(iout,*)this%total_trajectory
  read(iout,*)this%trajectory
  read(iout,*)this%save_config_trajectory_skip
  read(iout,*)this%switch_metropolis_test
  endif
#ifndef _singlePU
  call comlib_bcast(this%total_program_run,0)
  call comlib_bcast(this%total_trajectory,0)
  call comlib_bcast(this%trajectory,0)
  call comlib_bcast(this%save_config_trajectory_skip,0)
  call comlib_bcast(this%switch_metropolis_test,0)
#endif
  return
end subroutine
Subroutine :
this :type(hmc_job_manager), intent(inout)
: HMC controller
iout :integer, intent(in)
: file unit number

Save HMC controller status on formated file (by unit number)

[Source]

subroutine save_manager(this,iout)
!
! \Save HMC controller status on formated file (by unit number)
!
  use lattice_class, only : nodeid
  implicit none
  type(hmc_job_manager), intent(inout) :: this ! HMC controller
  integer,                intent(in)    :: iout ! file unit number

  if (nodeid == 0) then
  write(iout,*)this%total_program_run
  write(iout,*)this%total_trajectory
  write(iout,*)this%trajectory
  write(iout,*)this%save_config_trajectory_skip
  write(iout,*)this%switch_metropolis_test
  endif

  return
end subroutine
Function :
save_path :character(CHARLEN)
itraj :integer , intent(in)
: # of trajectory
prefix :character(*), intent(in)
: path name

Returns file path name to save configuration

path <= prefix.[0:9][0:9][0:9][0:9][0:9][0:9]

6-digit trajectory number is added to prefix.

for ex. prefix = "./config"

         itraj = 102

 output is "./config/000102/"

[Source]

character(CHARLEN) function save_path(itraj,prefix)
!
! Returns file path name to save configuration
!
! path <= prefix.[0:9][0:9][0:9][0:9][0:9][0:9]
!
! 6-digit trajectory number is added to prefix.
!
! for ex.  prefix = "./config"
!          itraj = 102
!
!  output is "./config/000102/"
!
  implicit none
  integer , intent(in)     :: itraj   ! # of trajectory
  character(*), intent(in) :: prefix  ! path name
  character(CHARLEN) :: fbuff,fdir
  integer :: i

  fdir=REPEAT(' ',LEN(fdir))
  fdir=TRIM(ADJUSTL(prefix))
  i=LEN_TRIM(fdir)
  if (fdir(i:i).NE.'/') then
    fdir=TRIM(ADJUSTL(fdir))//'/'
  endif

  fbuff=REPEAT(' ',LEN(fbuff))
  write(fbuff,'(I6.6)') itraj
  save_path=REPEAT(' ',LEN(save_path))
  save_path=TRIM(TRIM(ADJUSTL(fdir))//TRIM(ADJUSTL(fbuff)))

  return
end function
Subroutine :
this :type(hmc_job_manager), intent(inout)
irun :integer, intent(in)

set HMC run id/ run number

[Source]

subroutine set_run_number(this,irun)
!
! set HMC run id/ run number
!
  implicit none
  type(hmc_job_manager), intent(inout) :: this
  integer,                intent(in) :: irun
  this%total_program_run = irun
  return
end subroutine
Subroutine :
this :type(hmc_job_manager), intent(inout)
itraj :integer, intent(in)

set HMC current trajectory number

[Source]

subroutine set_trajectory_number(this,itraj)
!
! set HMC current trajectory number
!
  implicit none
  type(hmc_job_manager), intent(inout) :: this
  integer, intent(in) :: itraj
  this%total_trajectory = itraj
  return
end subroutine