w90_wannier90_readwrite_read_constrained_centres Subroutine

private subroutine w90_wannier90_readwrite_read_constrained_centres(settings, wann_control, real_lattice, num_wann, iprint, stdout, error, comm)

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
type(wann_control_type), intent(inout) :: wann_control
real(kind=dp), intent(in) :: real_lattice(3,3)
integer, intent(in) :: num_wann
integer, intent(in) :: iprint
integer, intent(in) :: stdout
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_wannier90_readwrite_read_constrained_centres~~CallsGraph proc~w90_wannier90_readwrite_read_constrained_centres w90_wannier90_readwrite_read_constrained_centres proc~set_error_input set_error_input proc~w90_wannier90_readwrite_read_constrained_centres->proc~set_error_input proc~w90_readwrite_get_block_length w90_readwrite_get_block_length proc~w90_wannier90_readwrite_read_constrained_centres->proc~w90_readwrite_get_block_length proc~w90_readwrite_get_centre_constraints w90_readwrite_get_centre_constraints proc~w90_wannier90_readwrite_read_constrained_centres->proc~w90_readwrite_get_centre_constraints 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_block_length->proc~set_error_input proc~w90_readwrite_get_centre_constraints->proc~set_error_input proc~get_centre_constraint_from_column get_centre_constraint_from_column proc~w90_readwrite_get_centre_constraints->proc~get_centre_constraint_from_column proc~set_error_alloc set_error_alloc proc~w90_readwrite_get_centre_constraints->proc~set_error_alloc proc~set_error_dealloc set_error_dealloc proc~w90_readwrite_get_centre_constraints->proc~set_error_dealloc proc~utility_frac_to_cart utility_frac_to_cart proc~w90_readwrite_get_centre_constraints->proc~utility_frac_to_cart proc~get_centre_constraint_from_column->proc~set_error_input proc~set_error_alloc->proc~comms_sync_error proc~set_error_alloc->proc~set_base_error proc~set_error_dealloc->proc~comms_sync_error proc~set_error_dealloc->proc~set_base_error

Called by

proc~~w90_wannier90_readwrite_read_constrained_centres~~CalledByGraph proc~w90_wannier90_readwrite_read_constrained_centres w90_wannier90_readwrite_read_constrained_centres proc~w90_wannier90_readwrite_read w90_wannier90_readwrite_read proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_constrained_centres proc~w90_input_reader~2 w90_input_reader proc~w90_input_reader~2->proc~w90_wannier90_readwrite_read proc~w90_input_setopt w90_input_setopt proc~w90_input_setopt->proc~w90_wannier90_readwrite_read proc~w90_input_reader w90_input_reader proc~w90_input_reader->proc~w90_input_reader~2 proc~w90_input_setopt_f w90_input_setopt_f proc~w90_input_setopt_f->proc~w90_input_setopt program~wannier wannier program~wannier->proc~w90_input_reader~2

Source Code

  subroutine w90_wannier90_readwrite_read_constrained_centres(settings, wann_control, &
                                                              real_lattice, num_wann, iprint, &
                                                              stdout, error, comm)
    !================================================!
    implicit none

    integer, intent(in) :: num_wann, iprint, stdout
    real(kind=dp), intent(in) :: real_lattice(3, 3)
    type(settings_type), intent(inout) :: settings
    type(w90_comm_type), intent(in) :: comm
    type(w90_error_type), allocatable, intent(out) :: error
    type(wann_control_type), intent(inout) :: wann_control

    integer :: i_temp
    logical :: found

    ! Constrained centres
    call w90_readwrite_get_block_length(settings, 'slwf_centres', found, i_temp, error, comm)
    if (allocated(error)) return

    if (found) then
      if (wann_control%constrain%constrain) then
        ! Allocate array for constrained centres
        call w90_readwrite_get_centre_constraints(settings, &
                                                  wann_control%constrain%centres, &
                                                  wann_control%guiding_centres%centres, &
                                                  num_wann, real_lattice, error, comm)
        if (allocated(error)) return

      else
        write (stdout, '(a)') ' slwf_constrain set to false. Ignoring <slwf_centres> block '
      end if
      ! Check that either projections or constrained centres are specified if slwf_constrain=.true.
    elseif (.not. found) then
      if (wann_control%constrain%constrain) then
        if (.not. allocated(wann_control%guiding_centres%centres)) then
          call set_error_input(error, 'Error: slwf_constrain = true, but neither <slwf_centre> block  nor &
               & <projection_block> are specified.', comm)
          return
        else
          ! Allocate array for constrained centres
          call w90_readwrite_get_centre_constraints(settings, &
                                                    wann_control%constrain%centres, &
                                                    wann_control%guiding_centres%centres, &
                                                    num_wann, real_lattice, error, comm)
          if (allocated(error)) return

        end if
      end if
    end if

    ! Warning
    if (.not. found) then
      if (wann_control%constrain%constrain .and. allocated(wann_control%guiding_centres%centres)) then
        if (iprint > 0) then
          write (stdout, '(a)') ' Warning: No <slwf_centres> block found, but slwf_constrain set to true. &
          & Desired centres for SLWF same as projection centres.'
        end if
      end if
    end if
  end subroutine w90_wannier90_readwrite_read_constrained_centres