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
subroutine param_get_centre_constraints
!=============================================================================!
! !
!! 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_io, only: io_error
use w90_utility, only: utility_frac_to_cart
integer :: loop1, index1, constraint_num, index2, loop2
integer :: column, start, finish, wann, ierr
!logical :: found
character(len=maxlen) :: dummy
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, num_lines
dummy = in_data(loop1)
if (constraint_num > 0) then
if (trim(dummy) == '') cycle
index1 = index(dummy, 'begin')
if (index1 > 0) call io_error("slwf_centres block hasn't ended yet")
index1 = index(dummy, 'end')
if (index1 > 0) then
index1 = index(dummy, 'slwf_centres')
if (index1 == 0) call io_error('Wrong ending of block (need to end slwf_centres)')
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 param_get_centre_constraint_from_column(column, start, finish, wann, dummy)
start = loop2 + 1
finish = start
end if
end if
if (loop2 == len_trim(dummy) .and. dummy(loop2:loop2) /= ' ') then
finish = loop2
call param_get_centre_constraint_from_column(column, start, finish, wann, dummy)
start = loop2 + 1
finish = start
end if
end do
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
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
end subroutine param_get_centre_constraints