# How to generate xvg for free energy estimation

**URL:** <https://gromacs.bioexcel.eu/t/how-to-generate-xvg-for-free-energy-estimation/9695>\
**Category:** User discussions\
**Created:** [July 20, 2024, 2:02pm UTC](https://gromacs.bioexcel.eu/t/how-to-generate-xvg-for-free-energy-estimation/9695 "2024-07-20T14:02:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xywang181](https://avatars.discourse-cdn.com/v4/letter/x/b19c9b/32.png) [@xywang181](https://gromacs.bioexcel.eu/u/xywang181)\
**Post date:** [July 20, 2024, 2:02pm UTC](https://gromacs.bioexcel.eu/t/how-to-generate-xvg-for-free-energy-estimation/9695/1 "2024-07-20T14:02:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [August 14, 2024, 5:49am UTC](https://gromacs.bioexcel.eu/t/how-to-generate-xvg-for-free-energy-estimation/9695/2 "2024-08-14T05:49:04Z")

</div>

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?
