How to generate xvg for free energy estimation

GROMACS version: 2023
GROMACS modification: No

Dear GROMACS community,
I have a general question on how GROMACS generate the xvg files for free energy generation. I am trying to generate xvg files from energy outputs that I generated by AMBER so that I can use gmx bar to estimate the free energy. My confusion comes from the last window at lambda=1. I know that del_U/del_lambda in each xvg is generated by using the potentials in the next window, which is U_i - U_(i+1). But what about the del_U/del_lambda in the last window when lambda=1. Is it calculated by (U_last - U_first)/-1.0?

Thanks for any hints.

If I understand your explanation correctly you are using the -extp option (to linearly extrapolate dH/dl values, right? Or are you doing a BAR analysis with the Hamiltonian difference between neighbouring lambda states?