Closed jhenin closed 4 years ago
To be precise, this confusion applies only to the ABF-written PMFs. Metadynamics-written PMFs are already consistent with the "histogram" convention (I picked that because they are pretty much histograms themselves).
In ABF, you usually integrate using a straight trapezoid rule starting from the left edge of each bin. To re-express the PMF at the midpoint of each bin, you'd need to interpolate between the left and right edge, or else to change the integration scheme altogether.
I'm fine if you change the margin
field to a logical flag, for as long as this doesn't change the header for metadynamics and histogram output files, where there isn't confusion.
EDIT: margin
is already a boolean flag, it probably could use a better name, and the header of the resulting multicol file could just reflect the value of this flag instead of adding a half-bin offset to the lower boundary if that is confusing.
After careful consideration, I've renamed margin as suggested (8b2b52d4fd2d3db6b35dfeee9d06e76af5786bd4), and there is nothing more that's obvious to do. The shifted bin centers allow generic plotting tools to plot things right despite being blissfully unaware of Colvars file formats, I'd like to keep that.
colvargrid can describe two types of grids: histogram-style, whose data pertains to grid intervals, and PMF-style, whose data is associated with grid points.
Right now this is dealt with using the not-so-clear parameter
margin
. If set, the grid lower boundaries are (artificially) shifted down by half a bin, so that the x values in the output are in the center of the (offset) bin, that is, at the boundaries of actual bins. The benefit is that the functionsbin_to_value
,bin_to_value_scalar
remain valid in all cases. As a result, the "official" bin boundaries look quite wrong, and they are exposed to users in multicol files.Downside to changing this: this would be a user-visible change for any user scripts that parse the multicol header.