subroutine sreadP_RR(pname,X,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8)
character(len=*) :: pname
real(8) :: X
real(8) :: Y1
real(8),optional :: Y2,Y3,Y4,Y5,Y6,Y7,Y8
open(719,file=trim(adjustl(trim(pname))))
if(present(Y8))then
write(719,"(9F21.12)")X,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8
elseif(present(Y7))then
write(719,"(8F21.12)")X,Y1,Y2,Y3,Y4,Y5,Y6,Y7
elseif(present(Y6))then
write(719,"(7F21.12)")X,Y1,Y2,Y3,Y4,Y5,Y6
elseif(present(Y5))then
write(719,"(6F21.12)")X,Y1,Y2,Y3,Y4,Y5
elseif(present(Y4))then
write(719,"(5F21.12)")X,Y1,Y2,Y3,Y4
elseif(present(Y3))then
write(719,"(4F21.12)")X,Y1,Y2,Y3
elseif(present(Y2))then
write(719,*)X,Y1,Y2
else
write(719,*)X,Y1
endif
close(719)
end subroutine sreadP_RR