Class hmc_status_class
In: LatticeClass/hmc_status_class.F90
comlib lattice_class counter_class hmc_logfile_class hmc_job_manager_class metropolis_test_class hmc_status_class dot/f_248.png

Define HMC algorithm controller class

Version

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

Methods

Included Modules

comlib lattice_class counter_class hmc_logfile_class hmc_job_manager_class metropolis_test_class

Public Instance methods

Subroutine :
this :class(hmc_status), intent(inout)

[Source]

subroutine delete_hmc_status(this)
  implicit none
  class(hmc_status), intent(inout) :: this
  if (m_is_initialized) call delete(m_hmc_status)
  m_is_initialized = .false.
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)

delete HMC controller

[Source]

subroutine delete_hmc_status_base(this)
!
! delete HMC controller
!
  implicit none
  type(hmc_status_base), intent(inout) :: this
  call delete(this%action_log)
  call delete(this%mp_status)
  return
end subroutine
fname_cont( icont, prefix, fhead ) result(fname_cont)
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

Original external subprogram is hmc_job_manager_class#fname_cont

fname_save( itraj, prefix, fhead ) result(fname_save)
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

Original external subprogram is hmc_job_manager_class#fname_save

Function :
irun :integer
this :class(hmc_status), intent(in)

[Source]

function get_run_number_hmc_status(this) result(irun)
  implicit none
  class(hmc_status), intent(in) :: this
  integer :: irun
  irun = get_run_number(m_hmc_status)
  return
end function
Function :
irun :integer
this :type(hmc_status_base), intent(in)

reutrn HMC run id/ run number

[Source]

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

[Source]

function get_trajectory_number_hmc_status(this) result(itraj)
  implicit none
  class(hmc_status), intent(in) :: this
  integer :: itraj
  itraj = get_trajectory_number(m_hmc_status)
  return
end function
Function :
itraj :integer
this :type(hmc_status_base), intent(in)

return HMC current trajectory number

[Source]

function get_trajectory_number_hmc_status_base(this) result(itraj)
!
! return HMC current trajectory number
!
  implicit none
  type(hmc_status_base), intent(in) :: this
  integer :: itraj
  itraj = get_trajectory_number(this%job_manager)
  return
end function
hmc_status
Derived Type :
idummy(2) = 0 :integer
Function :
flag :logical
this :class(hmc_status), intent(inout)
dH :real(DP), intent(in)
: dH=H1-H0

[Source]

function is_accepted_hmc_status(this,dH) result(flag)
  implicit none
  class(hmc_status), intent(inout) :: this
  real(DP), intent(in) :: dH    ! dH=H1-H0
  logical :: flag
  flag  = is_accepted(m_hmc_status,dH)
  return
end function
Function :
flag :logical
this :type(hmc_status_base), intent(inout)
dH :real(DP), intent(in)
: dH=H1-H0

return HMC Metropolis test result using action difference value dH

 dH = H1 - H0

 .true.:: accept
.false.:reject

[Source]

function is_accepted_hmc_status_base(this,dH) result(flag)
!
! return HMC Metropolis test result using action difference value dH
!
!  dH = H1 - H0
!
!  .true.:: accept
! .false.:: reject
!
  implicit none
  type(hmc_status_base), intent(inout) :: this
  real(DP), intent(in) :: dH    ! dH=H1-H0
  integer :: itraj
  logical :: flag, onoff

  onoff =  is_hmc_metropolis_on(this%job_manager)
  itraj = get_trajectory_number(this%job_manager)
  flag  = is_accepted(this%mp_status,itraj,dH,onoff)

  return
end function
Function :
flag :logical
this :class(hmc_status), intent(inout)

[Source]

function is_do_loop_ended_hmc_status(this) result(flag)
  implicit none
  class(hmc_status), intent(inout) :: this
  logical :: flag
  flag = is_do_loop_ended(m_hmc_status)
  return
end function
Function :
flag :logical
this :type(hmc_status_base), 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_hmc_status_base(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_status_base), intent(inout) :: this
  logical :: flag
  flag = is_do_loop_ended(this%job_manager)
  return
end function
Function :
flag :logical
this :class(hmc_status), intent(in)

[Source]

function is_hmc_metropolis_on_hmc_status(this) result(flag)
  implicit none
  class(hmc_status), intent(in) :: this
  logical :: flag
  flag = is_hmc_metropolis_on(m_hmc_status)
  return
end function
Function :
flag :logical
this :type(hmc_status_base), intent(in)

return HMC Meropolis test switch

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

[Source]

function is_hmc_metropolis_on_hmc_status_base(this) result(flag)
!
! return HMC Meropolis test switch
!
!  .true.:: Metropolis test is on
! .false.:: Metropolis test is off
!
  implicit none
  type(hmc_status_base), intent(in) :: this
  logical :: flag
  flag = is_hmc_metropolis_on(this%job_manager)
  return
end function
Function :
flag :logical
this :class(hmc_status), intent(in)

[Source]

function is_save_config_hmc_status(this) result(flag)
  implicit none
  class(hmc_status), intent(in) :: this
  logical :: flag
  flag = is_save_config(m_hmc_status)
  return
end function
Function :
flag :logical
this :type(hmc_status_base), 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_hmc_status_base(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_status_base), intent(in) :: this
  logical :: flag
  flag = is_save_config(this%job_manager)
  return
end function
Subroutine :
this :class(hmc_status), intent(inout)

[Source]

subroutine new_hmc_status(this)
  implicit none
  class(hmc_status), intent(inout) :: this
  if (.not.m_is_initialized) call new(m_hmc_status)
  m_is_initialized = .true.
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)

initialize HMC controller

[Source]

subroutine new_hmc_status_base(this)
!
! initialize HMC controller
!
  implicit none
  type(hmc_status_base), intent(inout) :: this
  call new(this%job_manager)
  call new(this%action_log,this%action_log_fname)
  call new(this%mp_status,this%hmc_mp_log_fname, mp_test_name="  HMC Metropolis", mp_weight_name="dH")
  return
end subroutine
Subroutine :
this :class(hmc_status), intent(inout)

[Source]

subroutine print_hmc_status(this)
  implicit none
  class(hmc_status), intent(inout) :: this
  call print(m_hmc_status)
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)

Print out HMC controller status on display

[Source]

subroutine print_hmc_status_base(this)
!
! \Print out HMC controller status on display
!
  implicit none
  type(hmc_status_base), intent(inout) :: this

  call print(this%job_manager)

  return
end subroutine
Subroutine :
this :class(hmc_status), intent(inout)
: HMC controller
str :character(len=*), intent(in)
: HMC action strings

[Source]

subroutine print_log_action_hmc_status(this,str)
  implicit none
  class(hmc_status), intent(inout) :: this  ! HMC controller
  character(len=*),  intent(in)    :: str   ! HMC action strings
  call print_log_action(m_hmc_status,TRIM(str))
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)
: HMC controller
str :character(len=*), intent(in)
: HMC action strings

Print HMC action status to HMC controller

User supply action values in formatted string which is written directly to the action log file.

[Source]

subroutine print_log_action_hmc_status_base(this,str)
!
! \Print HMC action status to HMC controller
!
! User supply action values in formatted string which is written directly 
! to the action log file.
!
  implicit none
  type(hmc_status_base), intent(inout) :: this  ! HMC controller
  character(len=*),      intent(in)    :: str   ! HMC action strings
  call print(this%action_log,TRIM(str))
  return
end subroutine
Subroutine :
this :class(hmc_status), intent(inout)

[Source]

subroutine print_stat_hmc_status(this)
  implicit none
  class(hmc_status), intent(inout) :: this
  call print_statistics(m_hmc_status)
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)

Print out HMC controller statistics on display

[Source]

subroutine print_stat_hmc_status_base(this)
!
! \Print out HMC controller statistics on display
!
  use lattice_class, only : nodeid
  implicit none
  type(hmc_status_base), intent(inout) :: this
  character(CHARLEN) :: name

  call print_statistics(this%job_manager)
  call print_statistics(this%mp_status)

  return
end subroutine
Subroutine :
this :class(hmc_status), intent(inout)
: HMC controller
iout :integer, intent(in)

[Source]

subroutine read_hmc_status(this,iout)
  implicit none
  class(hmc_status), intent(inout) :: this  ! HMC controller
  integer, intent(in) :: iout
  call read(m_hmc_status,iout)
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)
: HMC controller
iout :integer, intent(in)
: file unit number

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

[Source]

subroutine read_hmc_status_base(this,iout)
!
! read HMC controller paramteres from formatted file (by unit number)
!
  implicit none
  type(hmc_status_base), intent(inout) :: this  ! HMC controller
  integer,           intent(in)    :: iout ! file unit number

  call read(this%job_manager,iout)
  call set_hmc_job_manager(this%action_log,this%job_manager)

  return
end subroutine
Subroutine :
this :class(hmc_status), intent(inout)
: HMC controller
iout :integer, intent(in)
: file unit number

[Source]

subroutine save_hmc_status(this,iout)
  implicit none
  class(hmc_status), intent(inout) :: this ! HMC controller
  integer,           intent(in)    :: iout ! file unit number
  call save(m_hmc_status,iout)
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)
: HMC controller
iout :integer, intent(in)
: file unit number

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

[Source]

subroutine save_hmc_status_base(this,iout)
!
! \Save HMC controller status on formated file (by unit number)
!
  implicit none
  type(hmc_status_base), intent(inout) :: this ! HMC controller
  integer,           intent(in)    :: iout ! file unit number

  call save(this%job_manager,iout)

  return
end subroutine
save_path( itraj, prefix ) result(save_path)
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/"

Original external subprogram is hmc_job_manager_class#save_path

Subroutine :
this :class(hmc_status), intent(inout)
irun :integer, intent(in)

[Source]

subroutine set_run_number_hmc_status(this,irun)
  implicit none
  class(hmc_status), intent(inout) :: this
  integer, intent(in) :: irun
  call set_run_number(m_hmc_status,irun)
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)
irun :integer, intent(in)

set HMC run id/ run number

[Source]

subroutine set_run_number_hmc_status_base(this,irun)
!
! set HMC run id/ run number
!
  implicit none
  type(hmc_status_base), intent(inout) :: this
  integer, intent(in) :: irun
  call set_run_number(this%job_manager,irun)
  return
end subroutine
Subroutine :
this :class(hmc_status), intent(inout)
itraj :integer, intent(in)

set HMC current trajectory number

[Source]

subroutine set_trajectory_number_hmc_status(this,itraj)
!
! set HMC current trajectory number
!
  implicit none
  class(hmc_status), intent(inout) :: this
  integer, intent(in) :: itraj
  call set_trajectory_number(m_hmc_status,itraj)
  return
end subroutine
Subroutine :
this :type(hmc_status_base), intent(inout)
itraj :integer, intent(in)

set HMC current trajectory number

[Source]

subroutine set_trajectory_number_hmc_status_base(this,itraj)
!
! set HMC current trajectory number
!
  implicit none
  type(hmc_status_base), intent(inout) :: this
  integer, intent(in) :: itraj
  call set_trajectory_number(this%job_manager,itraj)
  return
end subroutine