[gmx-developers] Analysis API - AbstractDataStorage - tryGetDataFrame() not working

Teemu Murtola teemu.murtola at gmail.com
Fri Nov 21 06:05:15 CET 2014


On Thu, Nov 20, 2014 at 9:14 PM, Yunlong Liu <yliu120 at jh.edu> wrote:

> I am trying to write my own analysis code using Gromacs API.
> I made my own analysis module which inherits AbstractAnalysisData and
> AbstractDataModuleSerial interface. I want to call tryGetDataFrame( index )
> to assess data store in the my AnalysisDataStorage object in the function
> of dataFinished(). Though I tried many ways, I still get an invalid header.
> I called storage_.finishFrame() in finishedFrame function so that this
> should be a problem. I am curious about why the storage object doesn't
> provide an easier way to access the data like getData( index ).

Just naming the function differently does not help; there is already a
getDataFrame() in AbstractAnalysisData, but it would probably not do what
you expect. ;) If you would expect to have such a function that would be
able to unconditionally return all the data, never failing, that would mean
that the storage object would need to unconditionally store all the data
that you produce. That can come at a very high memory cost (depending on
the amount of data that your tool produces, and on the length of your
trajectory). So the storage object only stores previous frames if someone
explicitly requests it do so, by calling requestStorage().

If you really need to access all the data, you can call requestStorage(-1)
on the storage object before adding any data, and then you can access all
the data using tryGetDataFrame(). But you should be aware that this
increases memory consumption significantly.

None of the Gromacs tools that have been so far converted (either merged,
or those still waiting for review at gerrit.gromacs.org) to use the
framework actually require such storage, so it is quite a reasonable design
to not store all that data unnecessary. And some, like 'gmx rdf', produce
massive amounts of intermediate data that would not really make sense to

Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20141121/bd75da10/attachment.html>

More information about the gromacs.org_gmx-developers mailing list