w90_wannier90_readwrite_read_special Subroutine

public subroutine w90_wannier90_readwrite_read_special(settings, atom_data, kmesh_input, kmesh_info, kpt_latt, wann_control, proj, proj_input, select_proj, w90_system, w90_calculation, real_lattice, bohr, mp_grid, num_bands, exclude_bands, num_kpts, num_proj, num_wann, gamma_only, lhasproj, use_bloch_phases, distk, stdout, error, comm)

Uses

  • proc~~w90_wannier90_readwrite_read_special~~UsesGraph proc~w90_wannier90_readwrite_read_special w90_wannier90_readwrite_read_special module~w90_constants w90_constants proc~w90_wannier90_readwrite_read_special->module~w90_constants module~w90_utility w90_utility proc~w90_wannier90_readwrite_read_special->module~w90_utility module~w90_utility->module~w90_constants module~w90_comms w90_comms module~w90_utility->module~w90_comms module~w90_comms->module~w90_constants module~w90_error_base w90_error_base module~w90_comms->module~w90_error_base

Read parameters and calculate derived values

Note on parallelization: this function should be called from the root node only!

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
type(atom_data_type), intent(inout) :: atom_data
type(kmesh_input_type), intent(inout) :: kmesh_input
type(kmesh_info_type), intent(inout) :: kmesh_info
real(kind=dp), intent(inout), allocatable :: kpt_latt(:,:)
type(wann_control_type), intent(inout) :: wann_control
type(proj_type), intent(inout), allocatable :: proj(:)
type(proj_type), intent(inout), allocatable :: proj_input(:)
type(select_projection_type), intent(inout) :: select_proj
type(w90_system_type), intent(inout) :: w90_system
type(w90_calculation_type), intent(inout) :: w90_calculation
real(kind=dp), intent(inout) :: real_lattice(3,3)
real(kind=dp), intent(in) :: bohr
integer, intent(inout) :: mp_grid(3)
integer, intent(inout) :: num_bands
integer, intent(inout), allocatable :: exclude_bands(:)
integer, intent(inout) :: num_kpts
integer, intent(inout) :: num_proj
integer, intent(inout) :: num_wann
logical, intent(inout) :: gamma_only
logical, intent(inout) :: lhasproj
logical, intent(inout) :: use_bloch_phases
integer, intent(inout), allocatable :: distk(:)
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_special~~CallsGraph proc~w90_wannier90_readwrite_read_special w90_wannier90_readwrite_read_special proc~set_error_alloc set_error_alloc proc~w90_wannier90_readwrite_read_special->proc~set_error_alloc proc~utility_inverse_mat utility_inverse_mat proc~w90_wannier90_readwrite_read_special->proc~utility_inverse_mat proc~w90_readwrite_read_atoms w90_readwrite_read_atoms proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_atoms proc~w90_readwrite_read_distk w90_readwrite_read_distk proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_distk proc~w90_readwrite_read_exclude_bands w90_readwrite_read_exclude_bands proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_exclude_bands proc~w90_readwrite_read_kmesh_data w90_readwrite_read_kmesh_data proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_kmesh_data proc~w90_readwrite_read_kpoints w90_readwrite_read_kpoints proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_kpoints proc~w90_readwrite_read_lattice w90_readwrite_read_lattice proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_lattice proc~w90_readwrite_read_mp_grid w90_readwrite_read_mp_grid proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_mp_grid proc~w90_readwrite_read_num_bands w90_readwrite_read_num_bands proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_num_bands proc~w90_readwrite_read_num_wann w90_readwrite_read_num_wann proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_num_wann proc~w90_readwrite_read_system w90_readwrite_read_system proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_system proc~w90_readwrite_read_total_bands w90_readwrite_read_total_bands proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_total_bands proc~w90_wannier90_readwrite_read_explicit_kpts w90_wannier90_readwrite_read_explicit_kpts proc~w90_wannier90_readwrite_read_special->proc~w90_wannier90_readwrite_read_explicit_kpts proc~w90_wannier90_readwrite_read_projections w90_wannier90_readwrite_read_projections proc~w90_wannier90_readwrite_read_special->proc~w90_wannier90_readwrite_read_projections proc~comms_sync_error comms_sync_error proc~set_error_alloc->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_alloc->proc~set_base_error proc~utility_inv3 utility_inv3 proc~utility_inverse_mat->proc~utility_inv3 proc~w90_readwrite_read_atoms->proc~set_error_alloc proc~readwrite_get_atoms readwrite_get_atoms proc~w90_readwrite_read_atoms->proc~readwrite_get_atoms proc~set_error_dealloc set_error_dealloc proc~w90_readwrite_read_atoms->proc~set_error_dealloc proc~set_error_input set_error_input proc~w90_readwrite_read_atoms->proc~set_error_input proc~utility_cart_to_frac utility_cart_to_frac proc~w90_readwrite_read_atoms->proc~utility_cart_to_frac proc~w90_readwrite_get_block_length w90_readwrite_get_block_length proc~w90_readwrite_read_atoms->proc~w90_readwrite_get_block_length proc~w90_readwrite_get_keyword_vector w90_readwrite_get_keyword_vector proc~w90_readwrite_read_atoms->proc~w90_readwrite_get_keyword_vector proc~w90_readwrite_get_vector_length w90_readwrite_get_vector_length proc~w90_readwrite_read_atoms->proc~w90_readwrite_get_vector_length proc~w90_readwrite_set_atoms w90_readwrite_set_atoms proc~w90_readwrite_read_atoms->proc~w90_readwrite_set_atoms proc~w90_readwrite_read_distk->proc~set_error_alloc proc~mpirank mpirank proc~w90_readwrite_read_distk->proc~mpirank proc~mpisize mpisize proc~w90_readwrite_read_distk->proc~mpisize proc~set_error_fatal set_error_fatal proc~w90_readwrite_read_distk->proc~set_error_fatal proc~w90_readwrite_read_distk->proc~set_error_input proc~w90_readwrite_get_range_vector w90_readwrite_get_range_vector proc~w90_readwrite_read_distk->proc~w90_readwrite_get_range_vector proc~w90_readwrite_read_exclude_bands->proc~set_error_alloc proc~w90_readwrite_read_exclude_bands->proc~set_error_input proc~w90_readwrite_read_exclude_bands->proc~w90_readwrite_get_range_vector proc~w90_readwrite_read_kmesh_data->proc~set_error_alloc proc~w90_readwrite_read_kmesh_data->proc~set_error_input proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~w90_readwrite_read_kmesh_data->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_kmesh_data->proc~w90_readwrite_get_range_vector proc~w90_readwrite_read_kpoints->proc~set_error_alloc proc~w90_readwrite_read_kpoints->proc~set_error_dealloc proc~w90_readwrite_get_keyword_block w90_readwrite_get_keyword_block proc~w90_readwrite_read_kpoints->proc~w90_readwrite_get_keyword_block proc~w90_readwrite_read_lattice->proc~set_error_input proc~w90_readwrite_read_lattice->proc~w90_readwrite_get_keyword_block proc~w90_readwrite_read_mp_grid->proc~set_error_input proc~w90_readwrite_read_mp_grid->proc~w90_readwrite_get_keyword_vector proc~w90_readwrite_read_num_bands->proc~set_error_input proc~w90_readwrite_read_num_bands->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_num_wann->proc~set_error_input proc~w90_readwrite_read_num_wann->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_system->proc~set_error_input proc~w90_readwrite_read_system->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_total_bands->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_explicit_kpts->proc~set_error_alloc proc~w90_wannier90_readwrite_read_explicit_kpts->proc~set_error_dealloc proc~w90_wannier90_readwrite_read_explicit_kpts->proc~set_error_input proc~w90_wannier90_readwrite_read_explicit_kpts->proc~w90_readwrite_get_block_length proc~w90_wannier90_readwrite_read_explicit_kpts->proc~w90_readwrite_get_keyword_block proc~w90_wannier90_readwrite_read_projections->proc~set_error_alloc proc~w90_wannier90_readwrite_read_projections->proc~set_error_dealloc proc~w90_wannier90_readwrite_read_projections->proc~set_error_input proc~w90_wannier90_readwrite_read_projections->proc~w90_readwrite_get_block_length proc~w90_wannier90_readwrite_read_projections->proc~w90_readwrite_get_keyword proc~w90_readwrite_get_projections w90_readwrite_get_projections proc~w90_wannier90_readwrite_read_projections->proc~w90_readwrite_get_projections proc~w90_wannier90_readwrite_read_projections->proc~w90_readwrite_get_range_vector proc~readwrite_get_atoms->proc~set_error_alloc proc~readwrite_get_atoms->proc~utility_inverse_mat proc~readwrite_get_atoms->proc~set_error_input proc~readwrite_get_atoms->proc~utility_cart_to_frac proc~readwrite_get_atoms->proc~w90_readwrite_get_block_length proc~utility_frac_to_cart utility_frac_to_cart proc~readwrite_get_atoms->proc~utility_frac_to_cart proc~set_error_dealloc->proc~comms_sync_error proc~set_error_dealloc->proc~set_base_error proc~set_error_fatal->proc~comms_sync_error proc~set_error_fatal->proc~set_base_error proc~set_error_input->proc~comms_sync_error proc~set_error_input->proc~set_base_error proc~w90_readwrite_get_block_length->proc~set_error_input proc~w90_readwrite_get_keyword->proc~set_error_fatal proc~w90_readwrite_get_keyword->proc~set_error_input proc~w90_readwrite_get_keyword_block->proc~set_error_fatal proc~w90_readwrite_get_keyword_block->proc~set_error_input proc~w90_readwrite_get_keyword_vector->proc~set_error_fatal proc~w90_readwrite_get_keyword_vector->proc~set_error_input proc~w90_readwrite_get_projections->proc~set_error_alloc proc~w90_readwrite_get_projections->proc~set_error_input proc~w90_readwrite_get_projections->proc~utility_cart_to_frac proc~utility_string_to_coord utility_string_to_coord proc~w90_readwrite_get_projections->proc~utility_string_to_coord proc~utility_strip utility_strip proc~w90_readwrite_get_projections->proc~utility_strip proc~w90_readwrite_get_range_vector->proc~set_error_input proc~w90_readwrite_get_range_vector->proc~w90_readwrite_get_keyword_vector proc~w90_readwrite_get_range_vector->proc~w90_readwrite_get_vector_length proc~w90_readwrite_get_vector_length->proc~set_error_fatal proc~w90_readwrite_get_vector_length->proc~set_error_input proc~w90_readwrite_set_atoms->proc~set_error_alloc proc~utility_lowercase utility_lowercase proc~w90_readwrite_set_atoms->proc~utility_lowercase proc~utility_string_to_coord->proc~set_error_input

Called by

proc~~w90_wannier90_readwrite_read_special~~CalledByGraph proc~w90_wannier90_readwrite_read_special w90_wannier90_readwrite_read_special 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 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_wannier90_readwrite_read_special(settings, atom_data, kmesh_input, kmesh_info, &
                                                  kpt_latt, wann_control, proj, proj_input, &
                                                  select_proj, w90_system, w90_calculation, &
                                                  real_lattice, bohr, mp_grid, num_bands, &
                                                  exclude_bands, num_kpts, num_proj, num_wann, &
                                                  gamma_only, lhasproj, use_bloch_phases, distk, &
                                                  stdout, error, comm)
    !================================================!
    !
    !! Read parameters and calculate derived values
    !!
    !! Note on parallelization: this function should be called
    !! from the root node only!
    !!
    !
    !================================================

    use w90_constants, only: w90_physical_constants_type
    use w90_utility, only: utility_recip_lattice, utility_inverse_mat

    implicit none

    ! arguments
    type(atom_data_type), intent(inout) :: atom_data
    type(kmesh_info_type), intent(inout) :: kmesh_info
    type(kmesh_input_type), intent(inout) :: kmesh_input
    type(proj_type), allocatable, intent(inout) :: proj(:), proj_input(:)
    type(select_projection_type), intent(inout) :: select_proj
    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
    type(wann_control_type), intent(inout) :: wann_control
    type(w90_calculation_type), intent(inout) :: w90_calculation !check if really needed??

    integer, allocatable, intent(inout) :: exclude_bands(:)
    integer, allocatable, intent(inout) :: distk(:)
    integer, intent(inout) :: mp_grid(3)
    integer, intent(inout) :: num_bands
    integer, intent(inout) :: num_kpts
    integer, intent(inout) :: num_proj
    integer, intent(inout) :: num_wann
    integer, intent(in) :: stdout

    real(kind=dp), allocatable, intent(inout) :: kpt_latt(:, :)
    real(kind=dp), intent(in) :: bohr
    real(kind=dp), intent(inout) :: real_lattice(3, 3)

    logical, intent(inout) :: lhasproj
    logical, intent(inout) :: use_bloch_phases
    logical, intent(inout) :: gamma_only

    ! local variables
    logical :: disentanglement
    real(kind=dp) :: inv_lattice(3, 3)
    integer :: ip, ierr
    integer :: num_exclude_bands, total_bands

    call w90_readwrite_read_lattice(settings, real_lattice, bohr, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_atoms(settings, atom_data, real_lattice, bohr, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_num_wann(settings, num_wann, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_exclude_bands(settings, exclude_bands, num_exclude_bands, error, comm)
    if (allocated(error)) return

    total_bands = 0
    call w90_readwrite_read_total_bands(settings, total_bands, error, comm)
    if (allocated(error)) return
    if (total_bands > 0) then
      num_bands = total_bands - num_exclude_bands
    else
      call w90_readwrite_read_num_bands(settings, .false., num_bands, num_wann, error, comm)
      if (allocated(error)) return
    end if

    disentanglement = (num_bands > num_wann)

    call w90_readwrite_read_mp_grid(settings, .false., mp_grid, num_kpts, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_distk(settings, distk, num_kpts, stdout, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_kmesh_data(settings, kmesh_input, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_kpoints(settings, .false., kpt_latt, num_kpts, mp_grid, bohr, error, &
                                    comm)
    if (allocated(error)) return

    call w90_wannier90_readwrite_read_explicit_kpts(settings, w90_calculation, kmesh_info, &
                                                    num_kpts, bohr, error, comm)
    if (allocated(error)) return

    call w90_readwrite_read_system(settings, w90_system, error, comm)
    if (allocated(error)) return

    num_proj = num_wann !default, no projections specified

    call utility_inverse_mat(real_lattice, inv_lattice)
    call w90_wannier90_readwrite_read_projections(settings, proj, proj_input, use_bloch_phases, &
                                                  lhasproj, wann_control%guiding_centres%enable, &
                                                  select_proj, num_proj, atom_data, inv_lattice, &
                                                  num_wann, gamma_only, w90_system%spinors, bohr, &
                                                  stdout, error, comm)
    if (allocated(error)) return

    if (allocated(proj)) then
      allocate (wann_control%guiding_centres%centres(3, num_proj), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error in allocating ann_control%guiding_centres%centres &
        & in w90_wannier90_readwrite_read_special', comm)
        return
      end if
      do ip = 1, num_proj
        wann_control%guiding_centres%centres(:, ip) = proj(ip)%site(:)
      end do
    end if

  end subroutine w90_wannier90_readwrite_read_special