        module thename
contains
        subroutine the_name(ip,plate)

        use param_run

        implicit none

        integer, intent(in) :: ip
        character*128, pointer :: plate(:)
        character numero*4,serie*4
        integer i,is

        include 'form_num.inc'
        allocate(plate(nbs(ip))) ; plate=''

        write(numero,444) ip_start+istep*(ip-1)
        numero=adjustl(numero)

! The reference serie is n_ref and will be from now on plate(1)
        do i=1,nbs(ip)
         is=modulo(i+nbs(ip)-n_ref,nbs(ip))+1 ! is=1 when i=n_ref or if nbs=1
         write(serie,"(i2)") i
         serie=adjustl(serie)
         if (nbs(ip) /= 1) then
           plate(is)=trim(prefix)//trim(serie)//'.'//trim(numero)//suffix
         else
           plate(is)=trim(prefix)//trim(numero)//suffix
         endif
        enddo


        end subroutine

        end module
