subroutine splotP_IC(pname,X,Y1,Y2,Y3,Y4,append)
character(len=*) :: pname
integer :: X
complex(8) :: Y1
complex(8),optional:: Y2,Y3,Y4
logical,optional :: append
logical :: rw
rw=.false.;if(present(append))rw=append
if(rw)then
open(719,file=reg((pname)),position="append")
else
open(719,file=reg((pname)))
endif
if(present(Y4))then
write(719,"(I15,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,"(I15,6(F21.12))")X,dreal(Y1),dimag(Y1),&
dreal(Y2),dimag(Y2),dreal(Y3),dimag(Y3)
elseif(present(Y2))then
write(719,"(I15,4(F21.12))")X,dreal(Y1),dimag(Y1),dreal(Y2),dimag(Y2)
else
write(719,*)X,dreal(Y1),aimag(Y1)
endif
close(719)
end subroutine splotP_IC