summaryrefslogtreecommitdiff
path: root/src/lib/tng_io.c
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-10-30 10:05:22 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-10-30 10:05:22 (GMT)
commitdc08c1e4cb0bb26e02219f49bb3f6eb9801fe764 (patch)
tree6568d123b2f2824f27792eaa0206563c93563ca9 /src/lib/tng_io.c
parent10bea89dbf552570f6d356e1576f27bc40b095f3 (diff)
Added utility function to get time of frame.
Diffstat (limited to 'src/lib/tng_io.c')
-rw-r--r--src/lib/tng_io.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index 69dbadd..dccbf03 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -14652,6 +14652,32 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_close
return(tng_trajectory_destroy(tng_data_p));
}
+tng_function_status DECLSPECDLLEXPORT tng_util_time_of_frame_get
+ (tng_trajectory_t tng_data,
+ const int64_t frame_nr,
+ double *time)
+{
+ int64_t first_frame;
+
+ tng_trajectory_frame_set_t frame_set;
+ tng_function_status stat;
+
+ stat = tng_frame_set_of_frame_find(tng_data, frame_nr);
+ if(stat != TNG_SUCCESS)
+ {
+ printf("Cannot find frame nr %"PRId64". %s: %d\n",
+ frame_nr, __FILE__, __LINE__);
+ return(stat);
+ }
+
+ frame_set = &tng_data->current_trajectory_frame_set;
+ first_frame = frame_set->first_frame;
+
+ *time = frame_set->first_frame_time + (tng_data->time_per_frame * frame_nr - first_frame);
+
+ return(TNG_SUCCESS);
+}
+
tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_molecules_get
(tng_trajectory_t tng_data,
int64_t *n_mols,
contact: Jan Huwald // Impressum