diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-05-29 09:04:20 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-05-29 09:04:20 (GMT) |
commit | b2520beb9e688284273ce252cb56ae4176d7903d (patch) | |
tree | c99928564f26db5e201482c661f2b22336f22522 /src/tests/tng_io_read_pos_util.c | |
parent | 841d527a8e363cdd810249059475988d6ca3c9af (diff) |
Fix utility function for box shape reading.
Reading box shape using the high-level API should work.
Fixed bugs in data reading.
Updated utility usage examples.
Diffstat (limited to 'src/tests/tng_io_read_pos_util.c')
-rw-r--r-- | src/tests/tng_io_read_pos_util.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tests/tng_io_read_pos_util.c b/src/tests/tng_io_read_pos_util.c index 322f4a4..e7b00d3 100644 --- a/src/tests/tng_io_read_pos_util.c +++ b/src/tests/tng_io_read_pos_util.c @@ -24,7 +24,7 @@ int main(int argc, char **argv) tng_trajectory_t traj; /* Assume that the data is stored as floats. The data is placed in 1-D * arrays */ - float *positions = 0, *velocities = 0, *forces = 0; + float *positions = 0, *box_shape = 0; int64_t n_particles, n_frames, tot_n_frames, stride_length, i, j; // Set a default frame range int64_t first_frame = 0, last_frame = 5000; @@ -73,6 +73,21 @@ int main(int argc, char **argv) last_frame = tot_n_frames - 1; } + if(tng_util_box_shape_read(traj, &box_shape, &stride_length) == + TNG_SUCCESS) + { + printf("Simulation box shape: "); + for(i=0; i < 9; i++) + { + printf("%f ", box_shape[i]); + } + printf("\n"); + } + else + { + printf("Simulation box shape not set in the file (or could not be read)\n"); + } + n_frames = last_frame - first_frame + 1; |