subroutine dump_nonlocal_projectors(xf,ps)
use xmlf90_wxml
type(xmlf_t), intent(inout) :: xf
type(ps_t), intent(in), target :: ps
type(nonlocal_t), pointer :: nlp
type(nlpj_t), pointer :: nlpp
type(Grid_t) :: parent_grid
integer :: set
nlp => ps%nonlocal
do while (associated(nlp))
set = nlp%set
call xml_NewElement(xf,"nonlocal-projectors")
if (set /= SET_NULL) then
! Group set was specified
call my_add_attribute(xf,"set",str_of_set(set))
else
call die("Set not specified in NonLocalProjectors block")
endif
call dump_annotation(xf,nlp%annotation)
if (initialized(nlp%grid)) then
parent_grid = nlp%grid
call dump_grid(xf,nlp%grid)
else
parent_grid = ps%global_grid
endif
nlpp => nlp%proj
do while (associated(nlpp))
call xml_NewElement(xf,"proj")
call my_add_attribute(xf,"l",nlpp%l)
if (set == SET_LJ) then
call my_add_attribute(xf,"j",str(nlpp%j,format="(f3.1)"))
endif
call my_add_attribute(xf,"seq",str(nlpp%seq))
call my_add_attribute(xf,"ekb",str(nlpp%ekb))
! If eref has a physical value, output it
if (nlpp%eref < 0.1*huge(1.0_dp)) then
call my_add_attribute(xf,"eref",str(nlpp%eref))
endif
call my_add_attribute(xf,"type",nlpp%type)
call dump_radfunc(xf,nlpp%proj,parent_grid)
call xml_EndElement(xf,"proj")
nlpp => nlpp%next
enddo
call xml_EndElement(xf,"nonlocal-projectors")
nlp => nlp%next
enddo
call delete(parent_grid)
end subroutine dump_nonlocal_projectors