assigns projection centres as default centre constraints and global Lagrange multiplier as individual Lagrange multipliers then reads the centre_constraints block for individual centre constraint parameters
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(settings_type), | intent(inout) | :: | settings | |||
| real(kind=dp), | intent(inout) | :: | ccentres_cart(:,:) | |||
| real(kind=dp), | intent(in) | :: | proj_site(:,:) | |||
| integer, | intent(in) | :: | num_wann | |||
| real(kind=dp), | intent(in) | :: | real_lattice(3,3) | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine w90_readwrite_get_centre_constraints(settings, ccentres_cart, & proj_site, num_wann, real_lattice, error, comm) !================================================! !! assigns projection centres as default centre constraints and global !! Lagrange multiplier as individual Lagrange multipliers then reads !! the centre_constraints block for individual centre constraint parameters ! !================================================! use w90_error, only: w90_error_type, set_error_input, set_error_alloc, set_error_dealloc use w90_utility, only: utility_frac_to_cart implicit none ! arguments real(kind=dp), intent(inout) :: ccentres_cart(:, :) real(kind=dp), intent(in) :: proj_site(:, :) integer, intent(in) :: num_wann real(kind=dp), intent(in) :: real_lattice(3, 3) type(w90_error_type), allocatable, intent(out) :: error type(w90_comm_type), intent(in) :: comm type(settings_type), intent(inout) :: settings ! local variables integer :: loop1, index1, constraint_num, loop2, ierr integer :: column, start, finish, wann character(len=maxlen) :: dummy real(kind=dp), allocatable :: ccentres_frac(:, :) allocate (ccentres_frac(num_wann, 3), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating ccentres_frac in w90_readwrite_get_centre_constraints', comm) return end if do loop1 = 1, num_wann do loop2 = 1, 3 ccentres_frac(loop1, loop2) = proj_site(loop2, loop1) end do end do constraint_num = 0 do loop1 = 1, settings%num_lines dummy = settings%in_data(loop1) if (constraint_num > 0) then if (trim(dummy) == '') cycle index1 = index(dummy, 'begin') if (index1 > 0) then call set_error_input(error, "slwf_centres block hasn't ended yet", comm) return end if index1 = index(dummy, 'end') if (index1 > 0) then index1 = index(dummy, 'slwf_centres') if (index1 == 0) then call set_error_input(error, 'Wrong ending of block (need to end slwf_centres)', comm) return end if settings%in_data(loop1) (1:maxlen) = ' ' exit end if column = 0 start = 1 finish = 1 do loop2 = 1, len_trim(dummy) if (start == loop2 .and. dummy(loop2:loop2) == ' ') then start = loop2 + 1 end if if (start < loop2) then if (dummy(loop2:loop2) == ' ') then finish = loop2 - 1 call get_centre_constraint_from_column(column, start, finish, & wann, dummy, ccentres_frac, error, comm) if (allocated(error)) return start = loop2 + 1 finish = start end if end if if (loop2 == len_trim(dummy) .and. dummy(loop2:loop2) /= ' ') then finish = loop2 call get_centre_constraint_from_column(column, start, finish, & wann, dummy, ccentres_frac, error, comm) if (allocated(error)) return start = loop2 + 1 finish = start end if end do settings%in_data(loop1) (1:maxlen) = ' ' constraint_num = constraint_num + 1 end if index1 = index(dummy, 'slwf_centres') if (index1 > 0) then index1 = index(dummy, 'begin') if (index1 > 0) then constraint_num = 1 settings%in_data(loop1) (1:maxlen) = ' ' end if end if end do do loop1 = 1, num_wann call utility_frac_to_cart(ccentres_frac(loop1, :), & ccentres_cart(loop1, :), real_lattice) end do deallocate (ccentres_frac, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error deallocating ccentres_frac in w90_readwrite_get_centre_constraints', comm) return end if end subroutine w90_readwrite_get_centre_constraints