subroutine dump_local_potential(xf,ps)
use xmlf90_wxml
type(xmlf_t), intent(inout) :: xf
type(ps_t), intent(in), target :: ps
type(local_t), pointer :: lop
type(Grid_t) :: parent_grid
logical :: has_vlocal, has_local_charge
lop => ps%local
has_vlocal = associated(lop%Vlocal%data)
has_local_charge = associated(lop%Chlocal%data)
if (has_vlocal) then
call xml_NewElement(xf,"local-potential")
call my_add_attribute(xf,"type",lop%vlocal_type)
call dump_annotation(xf,lop%annotation)
! No processing of grids here
if (initialized(lop%grid)) then
parent_grid = lop%grid
call dump_grid(xf,lop%grid)
else
parent_grid = ps%global_grid
endif
call dump_radfunc(xf,lop%Vlocal,parent_grid)
if (has_local_charge) then
call xml_NewElement(xf,"local-charge")
call dump_radfunc(xf,lop%chlocal,parent_grid)
call xml_EndElement(xf,"local-charge")
endif
call xml_EndElement(xf,"local-potential")
call delete(parent_grid)
endif
end subroutine dump_local_potential