w90_readwrite_read_system Subroutine

public subroutine w90_readwrite_read_system(settings, w90_system, error, comm)

Uses

  • proc~~w90_readwrite_read_system~~UsesGraph proc~w90_readwrite_read_system w90_readwrite_read_system module~w90_error w90_error proc~w90_readwrite_read_system->module~w90_error module~w90_comms w90_comms module~w90_error->module~w90_comms module~w90_error_base w90_error_base module~w90_error->module~w90_error_base module~w90_comms->module~w90_error_base module~w90_constants w90_constants module~w90_comms->module~w90_constants

Read a group of variables defining the system "spinors" -- coupled spins "num_elec_per_state" -- spin degeneracy "num_valence_bands"

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
type(w90_system_type), intent(inout) :: w90_system
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_readwrite_read_system~~CallsGraph proc~w90_readwrite_read_system w90_readwrite_read_system proc~set_error_input set_error_input proc~w90_readwrite_read_system->proc~set_error_input proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~w90_readwrite_read_system->proc~w90_readwrite_get_keyword proc~comms_sync_error comms_sync_error proc~set_error_input->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_input->proc~set_base_error proc~w90_readwrite_get_keyword->proc~set_error_input proc~set_error_fatal set_error_fatal proc~w90_readwrite_get_keyword->proc~set_error_fatal proc~set_error_fatal->proc~comms_sync_error proc~set_error_fatal->proc~set_base_error

Called by

proc~~w90_readwrite_read_system~~CalledByGraph proc~w90_readwrite_read_system w90_readwrite_read_system proc~w90_postw90_readwrite_read w90_postw90_readwrite_read proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_system proc~w90_wannier90_readwrite_read_special w90_wannier90_readwrite_read_special proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_system proc~input_reader_special input_reader_special proc~input_reader_special->proc~w90_wannier90_readwrite_read_special proc~w90_input_setopt w90_input_setopt proc~w90_input_setopt->proc~w90_wannier90_readwrite_read_special program~postw90 postw90 program~postw90->proc~w90_postw90_readwrite_read proc~w90_input_setopt_f w90_input_setopt_f proc~w90_input_setopt_f->proc~w90_input_setopt program~wannier wannier program~wannier->proc~input_reader_special

Source Code

  subroutine w90_readwrite_read_system(settings, w90_system, error, comm)
    !! Read a group of variables defining the system
    !! "spinors" -- coupled spins
    !! "num_elec_per_state" -- spin degeneracy
    !! "num_valence_bands"
    use w90_error, only: w90_error_type, set_error_input
    implicit none

    type(settings_type), intent(inout) :: settings
    type(w90_comm_type), intent(in) :: comm
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_system_type), intent(inout) :: w90_system

    logical :: found, ltmp
    integer :: itmp

    ltmp = .false.  ! by default our WF are not spinors
    call w90_readwrite_get_keyword(settings, 'spinors', found, error, comm, l_value=ltmp)
    if (allocated(error)) return
    if (found) then
      w90_system%spinors = ltmp
    else
      w90_system%spinors = .false.
    end if
    ! We need to know if the bands are double degenerate due to spin, e.g. when calculating DOS
    if (w90_system%spinors) then
      w90_system%num_elec_per_state = 1
    else
      w90_system%num_elec_per_state = 2 ! the default
    end if

    call w90_readwrite_get_keyword(settings, 'num_elec_per_state', found, error, comm, &
                                   i_value=itmp)
    if (allocated(error)) return
    if (found) then
      if (itmp /= 1 .and. itmp /= 2) then
        call set_error_input(error, 'Error: num_elec_per_state can be only 1 or 2', comm)
        return
      else
        if (w90_system%spinors .and. itmp /= 1) then
          call set_error_input(error, 'Error: when spinors = T num_elec_per_state must be 1', comm)
          return
        else
          w90_system%num_elec_per_state = itmp
        end if
      end if
    end if

    call w90_readwrite_get_keyword(settings, 'num_valence_bands', found, error, comm, &
                                   i_value=w90_system%num_valence_bands)
    if (allocated(error)) return
    if (found .and. (w90_system%num_valence_bands .le. 0)) then
      call set_error_input(error, 'Error: num_valence_bands should be greater than zero', comm)
      return
    end if
  end subroutine w90_readwrite_read_system