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