subroutine open_create_stats(stem,funit)
integer, intent(in) :: funit
character(*), intent(in) :: stem
character(*), parameter :: t_r = 'open_create_fciqmc_stats'
character(30) :: filename
character(43) :: filename2
character(12) :: num
! If we are using Molpro, then append the molpro ID to uniquely
! identify the output
if (tMolpro .and. .not. tMolproMimic) then
filename = stem // adjustl(MolproID)
else
filename = stem
end if
if (tReadPops) then
! If we are reading from a POPSFILE, then we want to continue an
! existing fciqmc_stats file if it exists.
open(funit, file=filename, status='unknown', position='append')
else
call open_new_file(funit, filename)
end if
end subroutine open_create_stats