[gmx-developers] Help needed with tng_io library!
Semen Esilevsky
yesint4 at yahoo.com
Tue Aug 5 10:50:07 CEST 2014
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. It seems to be clear, but on practice the functions just return insane results and don't behave as expected.
The tng code is got from the latest git. Test trajectory is generated by Gromacs 5.0.
Problem #1: 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 than?
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 when called in a loop. stat is always true. How should I use it correctly to finish rearing 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 stops at n=10, 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
More information about the gromacs.org_gmx-developers
mailing list