summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagnus Lundborg <magnus.lundborg@scilifelab.se>2013-01-18 07:49:28 (GMT)
committerMagnus Lundborg <magnus.lundborg@scilifelab.se>2013-01-18 07:49:28 (GMT)
commitdf6a0a106939c5bae52f5a2594becaa7aef70d05 (patch)
tree0126cdfde5edc717c99595a0b6356280c9735bea /src
parent2591623f80c8defd91a5fbb7f359062050933bb3 (diff)
Write annotations block in test write/read.
Diffstat (limited to 'src')
-rw-r--r--src/tests/tng_io_testing.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c
index 74e08f8..193e294 100644
--- a/src/tests/tng_io_testing.c
+++ b/src/tests/tng_io_testing.c
@@ -129,7 +129,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj)
int64_t mapping[300], n_particles, n_frames_per_frame_set, tot_n_mols;
int64_t frame_nr;
double box_shape[9];
- char atom_type[16];
+ char atom_type[16], annotation[128];
tng_function_status stat;
tng_medium_stride_length_set(traj, 10);
@@ -182,10 +182,11 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj)
printf("Failed setting partial charges.\n");
return(TNG_CRITICAL);
}
- /* There is no ID for partial charges data in the standard. Make an ID up. */
- stat = tng_particle_data_block_add(traj, 10099, "PARTIAL CHARGES", TNG_FLOAT_DATA,
- TNG_NON_TRAJECTORY_BLOCK, 1, 1, 1, 0, n_particles,
- TNG_UNCOMPRESSED, charges);
+ /* There is no ID for partial charges data in the standard. Make an ID up.*/
+ stat = tng_particle_data_block_add(traj, 10099, "PARTIAL CHARGES",
+ TNG_FLOAT_DATA, TNG_NON_TRAJECTORY_BLOCK,
+ 1, 1, 1, 0, n_particles,
+ TNG_UNCOMPRESSED, charges);
free(charges);
if(stat != TNG_SUCCESS)
{
@@ -193,6 +194,18 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj)
return(TNG_CRITICAL);
}
+
+ /* Generate a custom annotation data block */
+ strcpy(annotation, "This trajectory was generated from tng_io_testing. "
+ "It is not a real MD trajectory.");
+ if(tng_data_block_add(traj, 10100, "DETAILS", TNG_CHAR_DATA,
+ TNG_NON_TRAJECTORY_BLOCK, 1, 1, 1, TNG_UNCOMPRESSED,
+ annotation) != TNG_SUCCESS)
+ {
+ printf("Failed adding details annotation data block.\n");
+ return(TNG_CRITICAL);
+ }
+
/* Write file headers (includes non trajectory data blocks */
if(tng_file_headers_write(traj, TNG_USE_HASH) == TNG_CRITICAL)
{
contact: Jan Huwald // Impressum