summaryrefslogtreecommitdiff
path: root/src/lib/tng_io.c
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-11-26 13:33:18 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-11-26 13:33:18 (GMT)
commit5ca97941b166add88a734033bf6df6be951b02bb (patch)
treeaa91d74e3e9ab2e9f1ac231f12ccbeda75b0a3d2 /src/lib/tng_io.c
parentc85ff9e8d3374ee6e11b5a49ce9f098a9856b7ef (diff)
Write current frame set if time per frame is changed.
Other minor fixes.
Diffstat (limited to 'src/lib/tng_io.c')
-rw-r--r--src/lib/tng_io.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index d224679..536403d 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -7055,7 +7055,8 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_w_id_add
if(tng_data->molecules[i].id == id)
{
stat = TNG_FAILURE;
- printf("TNG library: Molecule ID already in use. %s: %d\n", __FILE__, __LINE__);
+ printf("TNG library: Molecule ID %"PRId64" already in use. %s: %d\n", id,
+ __FILE__, __LINE__);
break;
}
}
@@ -9790,21 +9791,25 @@ tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_set
(tng_trajectory_t tng_data,
const double time)
{
-/* tng_trajectory_frame_set_t frame_set;*/
+ tng_trajectory_frame_set_t frame_set;
TNG_ASSERT(tng_data, "TNG library: Trajectory container not properly setup.");
TNG_ASSERT(time >= 0, "TNG library: The time per frame must be >= 0.");
-/* frame_set = &tng_data->current_trajectory_frame_set;*/
+ if(time == tng_data->time_per_frame)
+ {
+ return(TNG_SUCCESS);
+ }
+
+ frame_set = &tng_data->current_trajectory_frame_set;
/* If the current frame set is not finished write it to disk before
changing time per frame. */
-/* if(frame_set->n_unwritten_frames > 0)
+ if(tng_data->time_per_frame > 0 && frame_set->n_unwritten_frames > 0)
{
frame_set->n_frames = frame_set->n_unwritten_frames;
tng_frame_set_write(tng_data, TNG_USE_HASH);
}
-*/
tng_data->time_per_frame = time;
return(TNG_SUCCESS);
contact: Jan Huwald // Impressum