Hi,<br><br>I am trying to figure out how one would go about implementing a simple Hybrid Monte Carlo scheme in GROMACS. For my purposes I am only interested in the md-vv integrator, using either a NVT or NPT ensemble. MPI is not a strict necessity, as the system I am going to look at are probably small.<br>
So far I reversed the order between the energy calculation and the trajectory output, by keeping a backup of my current configuration where appropriate. This way I can check whether to accept the current configuration before anything is written to the trajectory file.<br>
The point I am struggling with is the overall energy: It seems it is not sufficient to just deal with enerd-&gt;term[F_ETOT] from md.c. For example if I do an integration step, (thereby changing the current enerd-&gt;term[F_ETOT]) and then decide to reject it (setting enerd-&gt;[F_ETOT] = previousEnergy and copying back the previous state-&gt;x), a different value than previousEnergy is written to the .edr file.<br>
<br>I guess the actual energy output takes place in print_ebin of mdlib/mdebin.c, or more precisely do_enx of gmxlib/enxio.c. I can&#39;t really make out of this works though. Is there any detailed information about the file format available somewhere? It seems like either enerd-&gt;term[F_ETOT] from md.c is not directly used and/or the total energy is recalculated somewhere along the way.<br>
If anybody sees a glaring error in my approach in general, please point it out as well - I am really new to the GROMACS source and have only a rough understanding of how it works overall. <br><br>Thanks,<br>Christian<br>