module constant
implicit none
real(8),parameter :: pi = 4.d0*datan(1.d0)
complex(8),parameter :: im=dcmplx(0.d0,1.d0)

integer(4),parameter :: nx = 128
real(8),parameter :: xmin = 0.d0, xmax = 2.d0*pi, hx = (xmax-xmin)/dble(nx)

real(8) :: x(0:nx),umx(0:nx),Vtemp(0:nx),vext(0:nx)

real(8),parameter :: beta = 1.d0
real(8),parameter :: Per = (xmax-xmin)**2.d0/(2.d0*pi)
integer(4),parameter :: order = 4 ! gradient approximation order

! time splitting fourth order coeffcient

real(8),parameter :: w1 = 1.d0/4.d0/(2.d0-2.d0**(1.d0/3.d0))
real(8),parameter :: w2 =  1.d0/2.d0/(2.d0-2.d0**(1.d0/3.d0))
real(8),parameter :: w3 = (1.d0-2.d0**(1.d0/3.d0))/4.d0/(2.d0-2.d0**(1.d0/3.d0))
real(8),parameter :: w4 = -2.d0**(1.d0/3.d0)/(2.d0-2.d0**(1.d0/3.d0))/2.d0

end module constant

	subroutine initial
!=======================================================================d
	use constant
	implicit none

	integer(4) :: i,nxh

	do i = 0,nx
	    x(i) = xmin+dble(i)*hx 
	enddo
	nxh = nx/2
	do i= 0,nxh-1
		umx(i) = 2.d0*pi*dble(i)/(xmax-xmin)
	enddo
	do i = nx-1,nxh,-1
		umx(i) =  -2.d0*pi*dble(nx-i)/(xmax-xmin)
	enddo

	do i = 0,nx-1
		vtemp(i) = umx(i)**2.d0
		vext(i) = 2.d0*cos(2.d0*x(i))
	enddo

	end

	subroutine initial_1d(psi)
!======================================================================d
	use constant
	implicit none
	complex(8) :: psi(0:nx)
	integer(4) :: i
	
	do  i = 0,nx
		psi(i) = dcos(x(i))+dsin(x(i))
	enddo

      end

