subroutine splotV_RC(pname,X,Y1,Y2,Y3,Y4,append)
integer :: i,Np
character(len=*) :: pname
real(8),dimension(:) :: X
complex(8),dimension(size(X)) :: Y1
complex(8),dimension(size(X)),optional :: Y2,Y3,Y4
logical,optional :: append
logical :: check,rw
rw=.false.;if(present(append))rw=append
Np=size(X)
if(rw)then
inquire(file=trim(adjustl(trim(pname))),exist=check)
open(719,file=adjustl(trim(pname)),position="append")
if(check)write(719,*)
else
open(719,file=adjustl(trim(pname)))
endif
if(present(Y4))then
do i=1,Np
write(719,"(F21.12,8(F21.12))")X(i),dimag(Y1(i)),dreal(Y1(i)),&
dimag(Y2(i)),dreal(Y2(i)),dimag(Y3(i)),dreal(Y3(i)),&
dimag(Y4(i)),dreal(Y4(i))
enddo
elseif(present(Y3))then
do i=1,Np
write(719,"(F21.12,6(F21.12))")X(i),dimag(Y1(i)),dreal(Y1(i)),&
dimag(Y2(i)),dreal(Y2(i)),dimag(Y3(i)),dreal(Y3(i))
enddo
elseif(present(Y2))then
do i=1,Np
write(719,"(F21.12,4(F21.12))")X(i),dimag(Y1(i)),dreal(Y1(i)),&
dimag(Y2(i)),dreal(Y2(i))
enddo
else
do i=1,Np
write(719,*)X(i),dimag(Y1(i)),dreal(Y1(i))
enddo
endif
close(719)
end subroutine splotV_RC