subroutine splotP_RC(pname,X,Y1,Y2,Y3,Y4,append)
character(len=*) :: pname
real(8) :: X
complex(8) :: Y1
complex(8),optional :: Y2,Y3,Y4
logical,optional :: append
if(present(append).AND. append.eqv..true.)then
open(719,file=reg((pname)),position="append")
else
open(719,file=reg((pname)))
endif
if(present(Y4))then
write(719,"(F21.12,8(F21.12))")X,dreal(Y1),dimag(Y1),&
dreal(Y2),dimag(Y2),dreal(Y3),dimag(Y3),dreal(Y4),dimag(Y4)
elseif(present(Y3))then
write(719,"(F21.12,6(F21.12))")X,dreal(Y1),dimag(Y1),&
dreal(Y2),dimag(Y2),dreal(Y3),dimag(Y3)
elseif(present(Y2))then
write(719,"(F21.12,4(F21.12))")X,dreal(Y1),dimag(Y1),dreal(Y2),dimag(Y2)
else
write(719,*)X,dreal(Y1),dimag(Y1)
endif
close(719)
end subroutine splotP_RC