anchor.diff:  use const
   
   implicit none
  +
  +real(p) :: Ecore
   
   contains
   
  
positive.code:         real(dp) :: x
  
          ! reading in...
          integer :: ir, ios
          logical :: t_exists
  
          namelist /FCI/ norb, nelec, ms2, orbsym, uhf
  
          ! FCIDUMP file format is as follows:
  
  
negative.code:         read (ir, FCI)
  
          if (uhf) then
              nbasis = norb
          else
              nbasis = 2*norb
          end if
  
          allocate(basis_fns(nbasis), stat=ierr)
          call check_allocate('basis_fns', nbasis, ierr)
  
          do i = 1, nbasis
              if (uhf) then
                  if (mod(i,2) == 0) then
                      call init_basis_fn(basis_fns(i), (/orbsym(i)-1/), -1)
                  else
                      call init_basis_fn(basis_fns(i), (/orbsym(i)-1/), 1)
                  end if
              else
                  ! Need to initialise both up- and down-spin basis functions.
                  call init_basis_fn(basis_fns(2*i-1), (/orbsym(i)-1/), -1)
                  call init_basis_fn(basis_fns(2*i), (/orbsym(i)-1/), -1)
              end if
          end do
  
          ! read integrals and eigenvalues
          do
              ! loop over lines.
              read (ir,*) x, i, a, j, b
              if (ios < 0) exit ! end of file
              if (i == 0 .and. j == 0 .and. a == 0 .and. b == 0) then
                  ! Ecore
                  Ecore = x
              else if (j == 0 .and. a == 0 .and. b == 0) then
                  ! \epsilon_i
                  if (uhf) then
                      basis_fn(i)%kinetic = x
                  else
                      basis_fn(2*i-1)%kinetic = x
                      basis_fn(2*i)%kinetic = x
                  end if
              else if (j == 0 .and. b == 0) then
                  ! < i | h | a >
              else
                  ! < i j | 1/r_12 | a b >
              end if
          end do
  
          if (ios > 0) call stop_all('read_input','Problem reading input.')
          close(ir, status='keep')
  
          do i = 1, nbasis
              write (6,*) basis_fns(i)
          end do
  
      end subroutine read_in_fcidump
  
  end module read_in
  