SUBROUTINE WriteDetBit(nUnit, iLutnI, lTerm)
integer, intent(in) :: nUnit
integer(kind=n_int), intent(in) :: iLutnI(0:NIfTot)
logical, intent(in) :: lTerm
integer :: i
do i = 1, nBasis - 1
if (IsOcc(iLutnI, i)) then
write (nUnit, "(A1)", advance='no') "1"
else
write (nUnit, "(A1)", advance='no') "0"
end if
end do
if (IsOcc(iLutnI, nBasis)) then
if (lTerm) then
write (nUnit, "(A1)") "1"
else
write (nUnit, "(A1)", advance='no') "1"
end if
else
if (lTerm) then
write (nUnit, "(A1)") "0"
else
write (nUnit, "(A1)", advance='no') "0"
end if
end if
END SUBROUTINE WriteDetBit