[gmx-developers] Help needed with tng_io library

Magnus Lundborg magnus.lundborg at scilifelab.se
Thu Aug 7 12:37:28 CEST 2014


Hi,

I'll look into this when I'm back from vacation next week.

Cheers,

Magnus
On 7 Aug 2014 12:19, "Semen Esilevsky" <yesint4 at yahoo.com> wrote:

> Dear All,
> I'm currently trying to add support for tng files to my code and I
> realised that I can't understand the logic of the library at all. I'm
> definetely doing something wrong, but can't figure out a mistake.
> The tng code is got from the latest git. Test trajectory is generated by
> Gromacs 5.0.
>
>
> I can open the tng file and can extract, for example, position exponential
> correctly, but after that...
>
>
> Problem #1: getting number of frames.
>
> int64_t n1,n2;
> tng_num_frames_get(trj, &n1);
> tng_num_frame_sets_get(trj, &n2);
>
> This gets
> n1 = 10761
> n2 = 1086
>
> The correct number of frames is 1086.
>
> What on Earth is returned from tng_num_frames_get()?
>
> Problem #2: Reading past the end of file.
>
> stat = tng_util_particle_data_next_frame_read(trj, TNG_TRAJ_POSITIONS,
> &values,
>                                                   &datatype, &frame,
> &physical_time);
>
> This function should return false when no more frames are available,
> right? It doesn't do this and reads forever returning garbage in values
> when called in a loop. stat is always true. How should I use it correctly
> to finish reading at the end of file?
> Also concerning the strange thing with the number of frames and frame sets
> - what it reads actually each time?
>
> Problem #3: tng_util_pos_read_range() behaves insane
>
> int n=0;
> bool stat = true;
> while(stat){
>     stat = tng_util_pos_read_range(trj,n,n, &ptr, &len);
>     n++;
> }
>
> This always stops at n=10 (why?!), while the number of frames is 1086!
> What I'm doing wrong here?
>
> I've also tried VMD plugin from pre-release VMD 1.9.2. It is said that
> this plugin is contributed by Gromacs developers, so it should work in
> principle. It doesn't work because of the bug #2 - it reads forever beyond
> the end of file.
>
>
> The test tng file is here:
> https://drive.google.com/file/d/0Bx_ng_72VH8BQlFsTGJOVC1oMjQ/edit?usp=sharing
>
>
> Any help is appreciated!
>
> Sincerely,
> Semen
>
> --
> Gromacs Developers mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20140807/0eb9578e/attachment.html>


More information about the gromacs.org_gmx-developers mailing list