diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-10-04 08:34:18 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-10-04 08:34:18 (GMT) |
commit | 6af7c70e8c1f5d0bdcb98529ed88a16dde2e9c68 (patch) | |
tree | b783bc66f6c72bb1ae0520eb4bc90331da742524 /src/tests/tng_io_read_pos_util.c | |
parent | 1acac22f9b52c136ad099844f63cb7d1273557ac (diff) |
Improved examples.
Diffstat (limited to 'src/tests/tng_io_read_pos_util.c')
-rw-r--r-- | src/tests/tng_io_read_pos_util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/tests/tng_io_read_pos_util.c b/src/tests/tng_io_read_pos_util.c index e7b00d3..22e75d5 100644 --- a/src/tests/tng_io_read_pos_util.c +++ b/src/tests/tng_io_read_pos_util.c @@ -73,8 +73,11 @@ int main(int argc, char **argv) last_frame = tot_n_frames - 1; } + + n_frames = last_frame - first_frame + 1; + if(tng_util_box_shape_read(traj, &box_shape, &stride_length) == - TNG_SUCCESS) + TNG_SUCCESS) { printf("Simulation box shape: "); for(i=0; i < 9; i++) @@ -88,9 +91,6 @@ int main(int argc, char **argv) printf("Simulation box shape not set in the file (or could not be read)\n"); } - n_frames = last_frame - first_frame + 1; - - // Get the positions of all particles in the requested frame range. // The positions are stored in the positions array. // N.B. No proper error checks. @@ -123,6 +123,10 @@ int main(int argc, char **argv) { free(positions); } + if(box_shape) + { + free(box_shape); + } tng_util_trajectory_close(&traj); return(0); |