      subroutine restart

      include 'global.inc'
* *** *********************************************************

      open(18,file='pos_inp.res', status='unknown')

	write(18,'(2x,i8)') N
      WRITE(18,'(3(1x,f10.6))') (XC(I),YC(I),ZC(I),I=1,N)

      close(18)

	if(n_Molec.ge.2) then
        open(19,file='orn_inp.res', status='unknown')
	  write(18,'(2x,i8)') N
         WRITE(19,'(3(1x,f10.6))') (v(I), u(I), w(I), I=1,N)
	  close(19)
	endif

      open(8,file='gcmc_H2.res', status='unknown')
* *** ***************************************************************
*     
      Write (8,'(1x,f15.7)')Tmas		 ! Molar mass in kg
      Write (8,'(1x,f15.2)') TEMP 
      Write (8,'(1x,f15.2)') PBAR 
	Write (8,'(1x,i10)') N         ! number of molecules in MC pore (initial)
	WRITE (8,*)'  '

	Write (8,'(1x,i10)') nexc 	   ! nexc  - number of attempts to exchange
      Write (8,'(1x,i10)') ncycle      ! ncycle - number of cycles per step
      Write (8,'(1x,i10)') NSTEP
      Write (8,'(1x,i10)') NBIN 
	WRITE (8,*)'  '

      Write (8,'(1x,f15.7)') TD    		! stepsize - translational atom move
      Write (8,'(1x,f15.7)') OD			! stepsize for a orientational move
      Write (8,'(1x,f15.7)') STEPTST
      Write (8,'(1x,f15.2)') CTOF

      close(8)

      open(8,file='gcmc_H2_par.res',status='unknown')

      Write (8,'(1x,i10)') ISEED 	   ! initial seed for random number generator
      Write (8,'(1x,f10.1)')UPDATENB	! number of steps after to be updated
      Write (8,'(1x,i6)') MX			! if Mx.ne.0 we exchange particles
	WRITE (8,*)'  '

      Write (8,'(1x,f15.7)') xpore
	Write (8,'(1x,f15.7)') ypore	    
      Write (8,'(1x,f15.7)') zpore	  
	WRITE (8,*)'  '

	Write (8,'(1x,i6)') n_inter     ! number of intermolecular splines
	Write (8,'(1x,i6)') n_wall      ! number of wall splines
	Write (8,'(1xi6)') n_Molec      ! number of atoms in molecule
								    ! if =0 or 1, UAtom model 
	close(8)


	open(19,file='ene.fin',status='unknown')
      do J = 1,N
	  
	  write(19,'(i4,3(2x,f15.4))')j,egg(j),enmol(j)

	enddo

	close(19)

      end
