subroutine open_replica_est_file()
use CalcData, only: tEN2Init, tEN2Rigorous
use fcimc_output, only: open_create_stats
use global_det_data, only: replica_est_len
use util_mod, only: get_free_unit
integer :: j
if (iProcIndex == 0) then
replica_est_unit = get_free_unit()
call open_create_stats('replica_estimates', replica_est_unit)
write(replica_est_unit, '("#", 4X, "Iteration")', advance='no')
do j = 1, replica_est_len
write(replica_est_unit, '(7x,"Energy numerator")', advance='no')
write(replica_est_unit, '(5x,"Energy^2 numerator")', advance='no')
if (tEN2Init) then
write(replica_est_unit, '(10x,"EN2 numerator")', advance='no')
write(replica_est_unit, '(9x,"Var + EN2 num.")', advance='no')
end if
if (tEN2Rigorous) then
write(replica_est_unit, '(10x,"Var + EN2 new")', advance='no')
end if
write(replica_est_unit, '(10x,"Normalisation")', advance='no')
if (tEN2Rigorous) then
write(replica_est_unit, '(11x,"B correction")', advance='no')
write(replica_est_unit, '(10x,"C denominator")', advance='no')
end if
write(replica_est_unit, '(8x,"Precond. energy")', advance='no')
write(replica_est_unit, '(9x,"Precond. norm.")', advance='no')
end do
write(replica_est_unit, '()')
end if
end subroutine open_replica_est_file