Update TNG build system
[gromacs.git] / src / external / tng_io / include / tng / tng_io.h
blob42119a5328863cd1dbfb538ef71da68fc2b49237
1 /* This code is part of the tng binary trajectory format.
3 * Written by Magnus Lundborg
4 * Copyright (c) 2012-2014, The GROMACS development team.
5 * Check out http://www.gromacs.org for more information.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the Revised BSD License.
12 /** @file tng_io.h
13 * @brief API for input and output of tng trajectory files
14 * @mainpage TNG: A flexible binary trajectory format
15 * @section intro_sec Introduction
17 * The TNG format is developed as part of the ScalaLife EU project.
18 * It is flexible by design to allow parallel writing, custom data blocks,
19 * different output frequencies and different compression algorithms.
21 * Each block can contain MD5 hashes to verify data integrity and the file
22 * can be signed by the user to ensure that the origin is correct.
24 * The intention is that the API and ABI should be stable, but it is
25 * still possible that future changes might make that impossible, in which
26 * case that will be clarified.
28 * The API and all examples are released without any warranties. Use them at
29 * your own risk.
31 * @section authors_sec Authors
33 * The TNG trajectory format is developed by:
35 * Magnus Lundborg magnus.lundborg@scilifelab.se
37 * Daniel SpÄngberg daniels@mkem.uu.se
39 * Rossen Apostolov rossen@kth.se
41 * The API is implemented mainly by:
43 * Magnus Lundborg
45 * @section License
47 * Copyright (c) 2012, The GROMACS development team.
48 * check out http://www.gromacs.org for more information.
50 * The TNG API is released under the Revised BSD License and is free to
51 * redistribute according to that license.
53 * A license file (named COPYING) should be included with each copy of the API.
55 * @section install_sec Installation
57 * \code
58 * mkdir build
60 * cd build
62 * cmake ..
64 * make
66 * make install
67 * \endcode
68 * Test by running:
69 * \code
70 * bin/tests/tng_testing
71 * \endcode
73 * @section change_sec Change Log
75 * See git log for full revision history.
77 * Revisions
79 * v. 1.6 - Fourth stable release of the API.
81 * - Removed OpenMP option when building.
82 * - Functionality for migrating data blocks.
83 * - Improved handling of molecules.
84 * - Improved installation of TNG documentation.
85 * - Enhancements to CMake usage.
86 * - Required CMake version raised to 2.8.8.
87 * - Bugs fixed.
89 * v. 1.5 - Third stable release of the API.
91 * - Fortran wrapper split into separate file
92 * - Added more block IDs.
93 * - Some new functions and utility functions added.
94 * - Improved compression precision settings.
95 * - Improved tests.
96 * - Make appending to file work better.
97 * - Modified CMake settings
98 * - Bugs fixed
100 * v. 1.4 - Changed from LGPL to the Revised BSD License.
102 * - More flexible support for digital signatures in header.
103 * - Block ID numbers changed.
105 * v. 1.3 - Second stable release of the API.
107 * - Added multiplication factor for coordinate units to general info.
108 * - Added time stamps and time per frame in frame sets.
109 * - High-level API functions added (not for managing molecules yet)
110 * - Added functions for reading data blocks into 1D arrays.
111 * - TNG compression added.
112 * - C++ interface added.
113 * - Avoid memory allocation if no data is submitted when adding data
114 * blocks.
115 * - Added function tng_num_frames_per_frame_set_set
116 * - Added data block IDs for charges, b-factors and occupancy.
117 * - GZIP compression added.
118 * - Fixed bug when updating MD5 hashes of data blocks.
119 * - Fixed bug in chain_name_of_particle_get(...)
120 * - Update frame set pointers properly.
121 * - Moved fortran wrapper from header file to source file.
122 * - Write sparse data in mdrun examples.
123 * - Fixed bugs related to reading and writing sparse data.
124 * - Fixed memory leak for non-trajectory particle data blocks.
125 * - Fixed bug when writing data blocks.
126 * - Fixed wrong values in dependency constants
127 * - Write box shape, partial charges and annotation data in tng_testing
128 * - Bug fixes in tng_testing (frame sets not written before)
130 * v. 1.0 - First stable release of the API.
133 * @section examples_sec Examples
135 * There are some examples of how to use the library located in src/tests/
137 * @subsection tng_subsec TNG files
139 * The build directory contains an example_files directory, which in turn
140 * contains a very short example of a TNG file containing a few water molecules,
141 * a box shape description and positions in 10 frames.
143 * It is also possible to run the bin/examples/md_openmp_util
144 * (see src/tests/md_openmp_util.c)
145 * testing program, which will save MD simulations output to a new file
146 * (saved in the example_files directory).
148 * These files can be read using the bin/examples/tng_io_read_pos_util
149 * program.
151 * @subsection c_subsec C
153 * Example writing data to a TNG file (just an excerpt):
154 * \code
155 * for ( step = 1; step < step_num; step++ )
157 * compute ( np, nd, pos, vel, mass, force, &potential, &kinetic );
159 * if(step % step_save == 0)
161 * // Write positions, velocities and forces
162 * if(tng_util_pos_write(traj, step, pos) != TNG_SUCCESS)
164 * printf("Error adding data. %s: %d\n", __FILE__, __LINE__);
165 * break;
167 * if(tng_util_vel_write(traj, step, vel) != TNG_SUCCESS)
169 * printf("Error adding data. %s: %d\n", __FILE__, __LINE__);
170 * break;
172 * if(tng_util_force_write(traj, step, force) != TNG_SUCCESS)
174 * printf("Error adding data. %s: %d\n", __FILE__, __LINE__);
175 * break;
178 * update ( np, nd, pos, vel, force, acc, mass, dt );
180 * \endcode
182 * Example reading positions from a TNG file:
183 * \code
184 * #include <stdlib.h>
185 * #include <stdio.h>
186 * #include "tng/tng_io.h"
188 * int main(int argc, char **argv)
190 * tng_trajectory_t traj;
191 * // Assume that the data is stored as floats. The data is placed in 1-D
192 * // arrays
193 * float *positions = 0, *box_shape = 0;
194 * int64_t n_particles, n_frames, tot_n_frames, stride_length, i, j;
195 * // Set a default frame range
196 * int64_t first_frame = 0, last_frame = 5000;
197 * int k;
199 * // A reference must be passed to allocate memory
200 * tng_util_trajectory_open(argv[1], 'r', &traj);
202 * if(tng_num_frames_get(traj, &tot_n_frames) != TNG_SUCCESS)
204 * printf("Cannot determine the number of frames in the file\n");
205 * tng_util_trajectory_close(&traj);
206 * exit(1);
209 * if(tng_num_particles_get(traj, &n_particles) != TNG_SUCCESS)
211 * printf("Cannot determine the number of particles in the file\n");
212 * tng_util_trajectory_close(&traj);
213 * exit(1);
216 * printf("%"PRId64" frames in file\n", tot_n_frames);
218 * if(last_frame > tot_n_frames - 1)
220 * last_frame = tot_n_frames - 1;
223 * if(tng_util_box_shape_read(traj, &box_shape, &stride_length) ==
224 * TNG_SUCCESS)
226 * printf("Simulation box shape: ");
227 * for(i=0; i < 9; i++)
229 * printf("%f ", box_shape[i]);
231 * printf("\n");
233 * else
235 * printf("Simulation box shape not set in the file (or could not be read)\n");
238 * n_frames = last_frame - first_frame + 1;
241 * // Get the positions of all particles in the requested frame range.
242 * // The positions are stored in the positions array.
243 * // N.B. No proper error checks.
244 * if(tng_util_pos_read_range(traj, 0, last_frame, &positions, &stride_length)
245 * == TNG_SUCCESS)
247 * // Print the positions of the wanted particle (zero based)
248 * for(i=0; i < n_frames; i += stride_length)
250 * printf("\nFrame %"PRId64":\n", first_frame + i);
251 * for(j=0; j < n_particles; j++)
253 * printf("Atom nr: %"PRId64"", j);
254 * for(k=0; k < 3; k++)
256 * printf("\t%f", positions[i/stride_length*n_particles*
257 * 3+j*3+k]);
259 * printf("\n");
263 * else
265 * printf("Cannot read positions\n");
268 * // Free memory
269 * if(positions)
271 * free(positions);
273 * tng_util_trajectory_close(&traj);
275 * return(0);
278 * \endcode
280 * @subsection fortran_subsec Fortran
282 * The TNG library can be used from Fortran. It requires cray pointers, which
283 * are not part of the Fortran 77 standard, but available in most compilers.
285 * To compile the fortran example -DTNG_BUILD_FORTRAN=ON needs to be specified when
286 * running cmake.
290 #ifndef TNG_IO_H
291 #define TNG_IO_H 1
293 #include <stdio.h>
294 #include <stdlib.h>
295 #include <string.h>
296 #include <assert.h>
297 #include "tng_io_fwd.h"
299 #ifdef USE_STD_INTTYPES_H
300 #include <inttypes.h>
301 #else
302 /* Visual Studio does not contain inttypes.h and stdint.h. Some defines and
303 * typedefs are used from the GNU C Library */
304 #ifdef _MSC_VER
306 typedef __int32 int32_t;
307 typedef unsigned __int32 uint32_t;
308 typedef __int64 int64_t;
309 typedef unsigned __int64 uint64_t;
311 #else
312 #include <stdint.h>
313 #endif /* _MSC_VER */
315 /* This is from inttypes.h (GNU C Library) */
316 /* The ISO C99 standard specifies that these macros must only be
317 defined if explicitly requested. */
318 #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
320 # if __WORDSIZE == 64
321 # define __PRI64_PREFIX "l"
322 # define __PRIPTR_PREFIX "l"
323 # else
324 # define __PRI64_PREFIX "ll"
325 # define __PRIPTR_PREFIX
326 # endif
328 /* From stdint.h (GNU C Library) */
329 /* Macros for printing format specifiers. */
330 /* Decimal notation. */
331 #ifndef PRId64
332 # define PRId64 __PRI64_PREFIX "d"
333 #endif
335 #endif
337 #endif /* USE_STD_INTTYPES_H */
340 #ifndef USE_WINDOWS
341 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
342 #define USE_WINDOWS
343 #endif /* win32... */
344 #endif /* not defined USE_WINDOWS */
346 #ifndef DECLSPECDLLEXPORT
347 #ifdef USE_WINDOWS
348 #define DECLSPECDLLEXPORT __declspec(dllexport)
349 #else /* USE_WINDOWS */
350 #define DECLSPECDLLEXPORT
351 #endif /* USE_WINDOWS */
352 #endif /* DECLSPECDLLEXPORT */
354 /** Flag to indicate frame dependent data. */
355 #define TNG_FRAME_DEPENDENT 1
356 /** Flag to indicate particle dependent data. */
357 #define TNG_PARTICLE_DEPENDENT 2
359 /** The maximum length of a date string */
360 #define TNG_MAX_DATE_STR_LEN 24
361 /** The length of an MD5 hash */
362 #define TNG_MD5_HASH_LEN 16
363 /** The maximum allowed length of a string */
364 #define TNG_MAX_STR_LEN 1024
366 #ifndef NDEBUG
367 #define TNG_ASSERT(cnd, msg) if(!(cnd)) {printf("%s\n", msg); assert(cnd);}
368 #else
369 #define TNG_ASSERT(cnd, msg) (void)0;
370 #endif
372 /** Flag to specify the endianness of a TNG file */
373 typedef enum {TNG_BIG_ENDIAN,
374 TNG_LITTLE_ENDIAN} tng_file_endianness;
376 /** Flag to specify the endianness of 32 bit values of the current architecture. */
377 typedef enum {TNG_BIG_ENDIAN_32,
378 TNG_LITTLE_ENDIAN_32,
379 TNG_BYTE_PAIR_SWAP_32} tng_endianness_32;
381 /** Flag to specify the endianness of 64 bit values of the current architecture. */
382 typedef enum {TNG_BIG_ENDIAN_64,
383 TNG_LITTLE_ENDIAN_64,
384 TNG_QUAD_SWAP_64,
385 TNG_BYTE_PAIR_SWAP_64,
386 TNG_BYTE_SWAP_64} tng_endianness_64;
388 /** Compression mode is specified in each data block */
389 typedef enum {TNG_UNCOMPRESSED,
390 TNG_XTC_COMPRESSION,
391 TNG_TNG_COMPRESSION,
392 TNG_GZIP_COMPRESSION} tng_compression;
394 /** Hash types */
395 typedef enum {TNG_NO_HASH,
396 TNG_MD5,
397 TNG_SHA256} tng_hash_type;
399 /** Non trajectory blocks come before the first frame set block */
400 typedef enum {TNG_NON_TRAJECTORY_BLOCK, TNG_TRAJECTORY_BLOCK} tng_block_type;
402 /** @defgroup def1 Standard non-trajectory blocks
403 * Block IDs of standard non-trajectory blocks.
404 * @{
406 #define TNG_GENERAL_INFO 0x0000000000000000LL
407 #define TNG_MOLECULES 0x0000000000000001LL
408 #define TNG_TRAJECTORY_FRAME_SET 0x0000000000000002LL
409 #define TNG_PARTICLE_MAPPING 0x0000000000000003LL
410 /** @} */
412 /** @defgroup def2 Standard trajectory blocks
413 * Block IDs of standard trajectory blocks. Box shape and partial charges can
414 * be either trajectory blocks or non-trajectory blocks
415 * @{
417 #define TNG_TRAJ_BOX_SHAPE 0x0000000010000000LL
418 #define TNG_TRAJ_POSITIONS 0x0000000010000001LL
419 #define TNG_TRAJ_VELOCITIES 0x0000000010000002LL
420 #define TNG_TRAJ_FORCES 0x0000000010000003LL
421 #define TNG_TRAJ_PARTIAL_CHARGES 0x0000000010000004LL
422 #define TNG_TRAJ_FORMAL_CHARGES 0x0000000010000005LL
423 #define TNG_TRAJ_B_FACTORS 0x0000000010000006LL
424 #define TNG_TRAJ_ANISOTROPIC_B_FACTORS 0x0000000010000007LL
425 #define TNG_TRAJ_OCCUPANCY 0x0000000010000008LL
426 #define TNG_TRAJ_GENERAL_COMMENTS 0x0000000010000009LL
427 /** @} */
430 /** @defgroup def3 GROMACS data block IDs
431 * Block IDs of data blocks specific to GROMACS.
432 * @{
434 #define TNG_GMX_LAMBDA 0x1000000010000000LL
435 #define TNG_GMX_ENERGY_ANGLE 0x1000000010000001LL
436 #define TNG_GMX_ENERGY_RYCKAERT_BELL 0x1000000010000002LL
437 #define TNG_GMX_ENERGY_LJ_14 0x1000000010000003LL
438 #define TNG_GMX_ENERGY_COULOMB_14 0x1000000010000004LL
439 #define TNG_GMX_ENERGY_LJ_(SR) 0x1000000010000005LL
440 #define TNG_GMX_ENERGY_COULOMB_(SR) 0x1000000010000006LL
441 #define TNG_GMX_ENERGY_COUL_RECIP 0x1000000010000007LL
442 #define TNG_GMX_ENERGY_POTENTIAL 0x1000000010000008LL
443 #define TNG_GMX_ENERGY_KINETIC_EN 0x1000000010000009LL
444 #define TNG_GMX_ENERGY_TOTAL_ENERGY 0x1000000010000010LL
445 #define TNG_GMX_ENERGY_TEMPERATURE 0x1000000010000011LL
446 #define TNG_GMX_ENERGY_PRESSURE 0x1000000010000012LL
447 #define TNG_GMX_ENERGY_CONSTR_RMSD 0x1000000010000013LL
448 #define TNG_GMX_ENERGY_BOX_X 0x1000000010000014LL
449 #define TNG_GMX_ENERGY_BOX_Y 0x1000000010000015LL
450 #define TNG_GMX_ENERGY_BOX_Z 0x1000000010000016LL
451 #define TNG_GMX_ENERGY_VOLUME 0x1000000010000017LL
452 #define TNG_GMX_ENERGY_DENSITY 0x1000000010000018LL
453 #define TNG_GMX_ENERGY_PV 0x1000000010000019LL
454 #define TNG_GMX_ENERGY_ENTHALPY 0x1000000010000020LL
455 #define TNG_GMX_ENERGY_VIR_XX 0x1000000010000021LL
456 #define TNG_GMX_ENERGY_VIR_XY 0x1000000010000022LL
457 #define TNG_GMX_ENERGY_VIR_XZ 0x1000000010000023LL
458 #define TNG_GMX_ENERGY_VIR_YX 0x1000000010000024LL
459 #define TNG_GMX_ENERGY_VIR_YY 0x1000000010000025LL
460 #define TNG_GMX_ENERGY_VIR_YZ 0x1000000010000026LL
461 #define TNG_GMX_ENERGY_VIR_ZX 0x1000000010000027LL
462 #define TNG_GMX_ENERGY_VIR_ZY 0x1000000010000028LL
463 #define TNG_GMX_ENERGY_VIR_ZZ 0x1000000010000029LL
464 #define TNG_GMX_ENERGY_PRES_XX 0x1000000010000030LL
465 #define TNG_GMX_ENERGY_PRES_XY 0x1000000010000031LL
466 #define TNG_GMX_ENERGY_PRES_XZ 0x1000000010000032LL
467 #define TNG_GMX_ENERGY_PRES_YX 0x1000000010000033LL
468 #define TNG_GMX_ENERGY_PRES_YY 0x1000000010000034LL
469 #define TNG_GMX_ENERGY_PRES_YZ 0x1000000010000035LL
470 #define TNG_GMX_ENERGY_PRES_ZX 0x1000000010000036LL
471 #define TNG_GMX_ENERGY_PRES_ZY 0x1000000010000037LL
472 #define TNG_GMX_ENERGY_PRES_ZZ 0x1000000010000038LL
473 #define TNG_GMX_ENERGY_SURFXSURFTEN 0x1000000010000039LL
474 #define TNG_GMX_ENERGY_T_SYSTEM 0x1000000010000040LL
475 #define TNG_GMX_ENERGY_LAMB_SYSTEM 0x1000000010000041LL
476 #define TNG_GMX_SELECTION_GROUP_NAMES 0x1000000010000042LL
477 #define TNG_GMX_ATOM_SELECTION_GROUP 0x1000000010000043LL
478 /** @} */
480 /** Flag to specify if a data block contains data related to particles or not.*/
481 typedef enum {TNG_NON_PARTICLE_BLOCK_DATA,
482 TNG_PARTICLE_BLOCK_DATA} tng_particle_dependency;
485 typedef enum {TNG_FALSE, TNG_TRUE} tng_bool;
487 /** Flag to specify if the number of atoms change throughout the trajectory or
488 * if it is constant. */
489 typedef enum {TNG_CONSTANT_N_ATOMS, TNG_VARIABLE_N_ATOMS}
490 tng_variable_n_atoms_flag;
492 /** Return values of API functions. TNG_SUCCESS means that the operation
493 * was successful. TNG_FAILURE means that the operation failed for some
494 * reason, but it is possible to try to continue anyhow. TNG_CRITICAL
495 * means that the error is irrecoverable. */
496 typedef enum {TNG_SUCCESS, TNG_FAILURE, TNG_CRITICAL} tng_function_status;
498 /** If tng_hash_mode == TNG_USE_HASH md5 hashes will be written to output files
499 * and when reading a file the md5 hashes of the contents will be compared to
500 * those in the file (for each block) in order to ensure data integrity */
501 typedef enum {TNG_SKIP_HASH, TNG_USE_HASH} tng_hash_mode;
503 /** Possible formats of data block contents */
504 typedef enum {TNG_CHAR_DATA,
505 TNG_INT_DATA,
506 TNG_FLOAT_DATA,
507 TNG_DOUBLE_DATA} tng_data_type;
510 struct tng_trajectory;
511 struct tng_molecule;
512 struct tng_chain;
513 struct tng_residue;
514 struct tng_atom;
515 struct tng_bond;
516 struct tng_gen_block;
517 struct tng_particle_mapping;
518 struct tng_trajectory_frame_set;
519 struct tng_particle_data;
520 struct tng_non_particle_data;
522 /** Data can be either double, float, int or a string */
523 union data_values {
524 double d;
525 float f;
526 int64_t i;
527 char *c;
531 #ifdef __cplusplus
532 extern "C"
534 #endif
536 /** @defgroup group1 Low-level API
537 * These functions give detailed control of the TNG data management. Most
538 * things can be done using the more convenient high-level API functions
539 * instead.
540 * @{
544 * @brief Get the major version of the TNG library.
545 * @param tng_data is a trajectory data container, it does not have
546 * to be initialized beforehand.
547 * @param version is pointing to a value set to the major version of
548 * the library.
549 * @return TNG_SUCCESS (0) if successful.
551 tng_function_status DECLSPECDLLEXPORT tng_version_major
552 (const tng_trajectory_t tng_data,
553 int *version);
556 * @brief Get the minor version of the TNG library.
557 * @param tng_data is a trajectory data container, it does not have
558 * to be initialized beforehand.
559 * @param version is pointing to a value set to the minor version of
560 * the library.
561 * @return TNG_SUCCESS (0) if successful.
563 tng_function_status DECLSPECDLLEXPORT tng_version_minor
564 (const tng_trajectory_t tng_data,
565 int *version);
568 * @brief Get the patch level of the TNG library.
569 * @param tng_data is a trajectory data container, it does not have
570 * to be initialized beforehand.
571 * @param patch_level is the string to fill with the full version,
572 * memory must be allocated before.
573 * @return TNG_SUCCESS (0) if successful.
575 tng_function_status DECLSPECDLLEXPORT tng_version_patchlevel
576 (const tng_trajectory_t tng_data,
577 int *patch_level);
580 * @brief Get the full version string of the TNG library.
581 * @param tng_data is a trajectory data container, it does not have
582 * to be initialized beforehand.
583 * @param version is pointing to a value set to the major version of
584 * the library.
585 * @param max_len maximum char length of the string, i.e. how much memory has
586 * been reserved for version. This includes \0 terminating character.
587 * @pre \code version != 0 \endcode The pointer to the name string
588 * must not be a NULL pointer.
589 * @return TNG_SUCCESS (0) if successful.
591 tng_function_status DECLSPECDLLEXPORT tng_version
592 (const tng_trajectory_t tng_data,
593 char *version,
594 const int max_len);
597 * @brief Setup a trajectory data container.
598 * @param tng_data_p a pointer to memory to initialise as a trajectory.
599 * @pre tng_data_p must not be pointing at a reserved memory block.
600 * @details Memory is allocated during initialisation.
601 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
602 * error has occured.
604 tng_function_status DECLSPECDLLEXPORT tng_trajectory_init
605 (tng_trajectory_t *tng_data_p);
608 * @brief Clean up a trajectory data container.
609 * @param tng_data_p a pointer to the trajectory data to destroy.
610 * @details All allocated memory in the data structure is freed, as well as
611 * tng_data_p itself.
612 * @return TNG_SUCCESS (0) if successful.
614 tng_function_status DECLSPECDLLEXPORT tng_trajectory_destroy
615 (tng_trajectory_t *tng_data_p);
618 * @brief Copy a trajectory data container (dest is setup as well).
619 * @details This initialises dest and copies only what is absolute necessary for
620 * parallel i/o. This can be used inside pragma omp for setting up a thread
621 * local copy of src. It can be freed (using tng_trajectory_destroy) at the
622 * end of the parallel block.
623 * @param src the original trajectory.
624 * @param dest_p a pointer to memory to initialise as a trajectory.
625 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
626 * must be initialised before using it.
627 * @pre tng_data_p must not be pointing at a reserved memory block.
628 * @details Memory is allocated during initialisation.
629 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
630 * error has occured.
632 tng_function_status DECLSPECDLLEXPORT tng_trajectory_init_from_src
633 (tng_trajectory_t src, tng_trajectory_t *dest_p);
636 * @brief Get the name of the input file.
637 * @param tng_data the trajectory of which to get the input file name.
638 * @param file_name the string to fill with the name of the input file,
639 * memory must be allocated before.
640 * @param max_len maximum char length of the string, i.e. how much memory has
641 * been reserved for file_name. This includes \0 terminating character.
642 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
643 * must be initialised before using it.
644 * @pre \code file_name != 0 \endcode The pointer to the file name string
645 * must not be a NULL pointer.
646 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
647 * has occurred (source string longer than destination string).
649 tng_function_status DECLSPECDLLEXPORT tng_input_file_get
650 (const tng_trajectory_t tng_data,
651 char *file_name, const int max_len);
654 * @brief Set the name of the input file.
655 * @param tng_data the trajectory of which to set the input file name.
656 * @param file_name the name of the input file.
657 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
658 * must be initialised before using it.
659 * @pre \code file_name != 0 \endcode The pointer to the file name string
660 * must not be a NULL pointer.
661 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
662 * error has occured.
664 tng_function_status DECLSPECDLLEXPORT tng_input_file_set
665 (tng_trajectory_t tng_data,
666 const char *file_name);
669 * @brief Get the name of the output file.
670 * @param tng_data the trajectory of which to get the input file name.
671 * @param file_name the string to fill with the name of the output file,
672 * memory must be allocated before.
673 * @param max_len maximum char length of the string, i.e. how much memory has
674 * been reserved for file_name. This includes \0 terminating character.
675 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
676 * must be initialised before using it.
677 * @pre \code file_name != 0 \endcode The pointer to the file name string
678 * must not be a NULL pointer.
679 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
680 * has occurred (source string longer than destination string).
682 tng_function_status DECLSPECDLLEXPORT tng_output_file_get
683 (const tng_trajectory_t tng_data,
684 char *file_name, const int max_len);
687 * @brief Set the name of the output file.
688 * @param tng_data the trajectory of which to set the output file name.
689 * @param file_name the name of the output file.
690 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
691 * must be initialised before using it.
692 * @pre \code file_name != 0 \endcode The pointer to the file name string
693 * must not be a NULL pointer.
694 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
695 * error has occured.
697 tng_function_status DECLSPECDLLEXPORT tng_output_file_set
698 (tng_trajectory_t tng_data,
699 const char *file_name);
702 * @brief Set the name of the output file for appending. The output file
703 * will not be overwritten.
704 * @param tng_data the trajectory of which to set the output file name.
705 * @param file_name the name of the output file to append to.
706 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
707 * must be initialised before using it.
708 * @pre \code file_name != 0 \endcode The pointer to the file name string
709 * must not be a NULL pointer.
710 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
711 * error has occured.
713 tng_function_status DECLSPECDLLEXPORT tng_output_append_file_set
714 (tng_trajectory_t tng_data,
715 const char *file_name);
718 * @brief Get the endianness of the output file.
719 * @param tng_data the trajectory of which to get the endianness of the current
720 * output file.
721 * @param endianness will contain the enumeration of the endianness.
722 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
723 * must be initialised before using it.
724 * @pre \code endianness != 0 \endcode The pointer to the endianness container
725 * must not be a NULL pointer.
726 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (1) if the endianness
727 * could not be retrieved.
729 tng_function_status DECLSPECDLLEXPORT tng_output_file_endianness_get
730 (const tng_trajectory_t tng_data, tng_file_endianness *endianness);
733 * @brief Set the endianness of the output file.
734 * @param tng_data the trajectory of which to set the endianness of the current
735 * output file.
736 * @param endianness the enumeration of the endianness, can be either
737 * TNG_BIG_ENDIAN (0) or TNG_LITTLE_ENDIAN (1).
738 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
739 * must be initialised before using it.
740 * @details The endianness cannot be changed after file output has started.
741 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (1) if the endianness
742 * could not be set.
744 tng_function_status DECLSPECDLLEXPORT tng_output_file_endianness_set
745 (tng_trajectory_t tng_data,
746 const tng_file_endianness endianness);
749 * @brief Get the name of the program used when creating the trajectory.
750 * @param tng_data the trajectory of which to get the program name.
751 * @param name the string to fill with the name of the program,
752 * memory must be allocated before.
753 * @param max_len maximum char length of the string, i.e. how much memory has
754 * been reserved for name. This includes \0 terminating character.
755 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
756 * must be initialised before using it.
757 * @pre \code name != 0 \endcode The pointer to the name string
758 * must not be a NULL pointer.
759 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
760 * has occurred (source string longer than destination string).
762 tng_function_status DECLSPECDLLEXPORT tng_first_program_name_get
763 (const tng_trajectory_t tng_data,
764 char *name, const int max_len);
767 * @brief Set the name of the program used when creating the trajectory.
768 * @param tng_data the trajectory of which to set the program name.
769 * @param new_name is a string containing the wanted name.
770 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
771 * must be initialised before using it.
772 * @pre \code new_name != 0 \endcode The pointer to the new_name string
773 * must not be a NULL pointer.
774 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
775 * error has occured.
777 tng_function_status DECLSPECDLLEXPORT tng_first_program_name_set
778 (tng_trajectory_t tng_data,
779 const char *new_name);
782 * @brief Get the name of the program used when last modifying the trajectory.
783 * @param tng_data the trajectory of which to get the program name.
784 * @param name the string to fill with the name of the program,
785 * memory must be allocated before.
786 * @param max_len maximum char length of the string, i.e. how much memory has
787 * been reserved for name. This includes \0 terminating character.
788 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
789 * must be initialised before using it.
790 * @pre \code name != 0 \endcode The pointer to the name string
791 * must not be a NULL pointer.
792 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
793 * has occurred (source string longer than destination string).
795 tng_function_status DECLSPECDLLEXPORT tng_last_program_name_get
796 (const tng_trajectory_t tng_data,
797 char *name, const int max_len);
800 * @brief Set the name of the program used when last modifying the trajectory.
801 * @param tng_data the trajectory of which to set the program name.
802 * @param new_name is a string containing the wanted name.
803 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
804 * must be initialised before using it.
805 * @pre \code new_name != 0 \endcode The pointer to the new_name string
806 * must not be a NULL pointer.
807 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
808 * error has occured.
810 tng_function_status DECLSPECDLLEXPORT tng_last_program_name_set
811 (tng_trajectory_t tng_data,
812 const char *new_name);
815 * @brief Get the name of the user who created the trajectory.
816 * @param tng_data the trajectory of which to get the user name.
817 * @param name the string to fill with the name of the user,
818 * memory must be allocated before.
819 * @param max_len maximum char length of the string, i.e. how much memory has
820 * been reserved for name. This includes \0 terminating character.
821 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
822 * must be initialised before using it.
823 * @pre \code name != 0 \endcode The pointer to the name string
824 * must not be a NULL pointer.
825 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
826 * has occurred (source string longer than destination string).
828 tng_function_status DECLSPECDLLEXPORT tng_first_user_name_get
829 (const tng_trajectory_t tng_data,
830 char *name, const int max_len);
833 * @brief Set the name of the user who created the trajectory.
834 * @param tng_data the trajectory of which to set the user name.
835 * @param new_name is a string containing the wanted name.
836 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
837 * must be initialised before using it.
838 * @pre \code new_name != 0 \endcode The pointer to the new_name string
839 * must not be a NULL pointer.
840 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
841 * error has occured.
843 tng_function_status DECLSPECDLLEXPORT tng_first_user_name_set
844 (tng_trajectory_t tng_data,
845 const char *new_name);
848 * @brief Get the name of the user who last modified the trajectory.
849 * @param tng_data the trajectory of which to get the user name.
850 * @param name the string to fill with the name of the user,
851 * memory must be allocated before.
852 * @param max_len maximum char length of the string, i.e. how much memory has
853 * been reserved for name. This includes \0 terminating character.
854 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
855 * must be initialised before using it.
856 * @pre \code name != 0 \endcode The pointer to the name string
857 * must not be a NULL pointer.
858 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
859 * has occurred (source string longer than destination string).
861 tng_function_status DECLSPECDLLEXPORT tng_last_user_name_get
862 (const tng_trajectory_t tng_data,
863 char *name, const int max_len);
866 * @brief Set the name of the user who last modified the trajectory.
867 * @param tng_data the trajectory of which to set the user name.
868 * @param new_name is a string containing the wanted name.
869 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
870 * must be initialised before using it.
871 * @pre \code new_name != 0 \endcode The pointer to the new_name string
872 * must not be a NULL pointer.
873 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
874 * error has occured.
876 tng_function_status DECLSPECDLLEXPORT tng_last_user_name_set
877 (tng_trajectory_t tng_data,
878 const char *new_name);
881 * @brief Get the name of the computer used when creating the trajectory.
882 * @param tng_data the trajectory of which to get the computer name.
883 * @param name the string to fill with the name of the computer,
884 * memory must be allocated before.
885 * @param max_len maximum char length of the string, i.e. how much memory has
886 * been reserved for name. This includes \0 terminating character.
887 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
888 * must be initialised before using it.
889 * @pre \code name != 0 \endcode The pointer to the name string
890 * must not be a NULL pointer.
891 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
892 * has occurred (source string longer than destination string).
894 tng_function_status DECLSPECDLLEXPORT tng_first_computer_name_get
895 (const tng_trajectory_t tng_data,
896 char *name, const int max_len);
899 * @brief Set the name of the computer used when creating the trajectory.
900 * @param tng_data the trajectory of which to set the computer name.
901 * @param new_name is a string containing the wanted name.
902 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
903 * must be initialised before using it.
904 * @pre \code new_name != 0 \endcode The pointer to the new_name string
905 * must not be a NULL pointer.
906 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
907 * error has occured.
909 tng_function_status DECLSPECDLLEXPORT tng_first_computer_name_set
910 (tng_trajectory_t tng_data,
911 const char *new_name);
914 * @brief Get the name of the computer used when last modifying the trajectory.
915 * @param tng_data the trajectory of which to get the computer name.
916 * @param name the string to fill with the name of the computer,
917 * memory must be allocated before.
918 * @param max_len maximum char length of the string, i.e. how much memory has
919 * been reserved for name. This includes \0 terminating character.
920 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
921 * must be initialised before using it.
922 * @pre \code name != 0 \endcode The pointer to the name string
923 * must not be a NULL pointer.
924 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
925 * has occurred (source string longer than destination string).
927 tng_function_status DECLSPECDLLEXPORT tng_last_computer_name_get
928 (const tng_trajectory_t tng_data,
929 char *name, const int max_len);
932 * @brief Set the name of the computer used when last modifying the trajectory.
933 * @param tng_data the trajectory of which to set the computer name.
934 * @param new_name is a string containing the wanted name.
935 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
936 * must be initialised before using it.
937 * @pre \code new_name != 0 \endcode The pointer to the new_name string
938 * must not be a NULL pointer.
939 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
940 * error has occured.
942 tng_function_status DECLSPECDLLEXPORT tng_last_computer_name_set
943 (tng_trajectory_t tng_data,
944 const char *new_name);
947 * @brief Get the pgp_signature of the user creating the trajectory.
948 * @param tng_data the trajectory of which to get the computer name.
949 * @param signature the string to fill with the signature,
950 * memory must be allocated before.
951 * @param max_len maximum char length of the string, i.e. how much memory has
952 * been reserved for name. This includes \0 terminating character.
953 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
954 * must be initialised before using it.
955 * @pre \code signature != 0 \endcode The pointer to the signature
956 * must not be a NULL pointer.
957 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
958 * has occurred (source string longer than destination string).
960 tng_function_status DECLSPECDLLEXPORT tng_first_signature_get
961 (const tng_trajectory_t tng_data,
962 char *signature, const int max_len);
965 * @brief Set the pgp_signature of the user creating the trajectory.
966 * @param tng_data the trajectory of which to set the computer name.
967 * @param signature is a string containing the pgp_signature.
968 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
969 * must be initialised before using it.
970 * @pre \code signature != 0 \endcode The pointer to the signature
971 * must not be a NULL pointer.
972 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
973 * error has occured.
975 tng_function_status DECLSPECDLLEXPORT tng_first_signature_set
976 (tng_trajectory_t tng_data,
977 const char *signature);
980 * @brief Get the pgp_signature of the user last modifying the trajectory.
981 * @param tng_data the trajectory of which to get the computer name.
982 * @param signature the string to fill with the signature,
983 * memory must be allocated before.
984 * @param max_len maximum char length of the string, i.e. how much memory has
985 * been reserved for name. This includes \0 terminating character.
986 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
987 * must be initialised before using it.
988 * @pre \code signature != 0 \endcode The pointer to the signature
989 * must not be a NULL pointer.
990 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
991 * has occurred (source string longer than destination string).
993 tng_function_status DECLSPECDLLEXPORT tng_last_signature_get
994 (const tng_trajectory_t tng_data,
995 char *signature, const int max_len);
998 * @brief Set the pgp_signature of the user last modifying the trajectory.
999 * @param tng_data the trajectory of which to set the computer name.
1000 * @param signature is a string containing the pgp_signature.
1001 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1002 * must be initialised before using it.
1003 * @pre \code signature != 0 \endcode The pointer to the signature
1004 * must not be a NULL pointer.
1005 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1006 * error has occured.
1008 tng_function_status DECLSPECDLLEXPORT tng_last_signature_set
1009 (tng_trajectory_t tng_data,
1010 const char *signature);
1013 * @brief Get the name of the forcefield used in the trajectory.
1014 * @param tng_data the trajectory of which to get the forcefield name.
1015 * @param name the string to fill with the name of the forcefield,
1016 * memory must be allocated before.
1017 * @param max_len maximum char length of the string, i.e. how much memory has
1018 * been reserved for name. This includes \0 terminating character.
1019 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1020 * must be initialised before using it.
1021 * @pre \code name != 0 \endcode The pointer to the name string
1022 * must not be a NULL pointer.
1023 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1024 * has occurred (source string longer than destination string).
1026 tng_function_status DECLSPECDLLEXPORT tng_forcefield_name_get
1027 (const tng_trajectory_t tng_data,
1028 char *name, const int max_len);
1031 * @brief Set the name of the forcefield used in the trajectory.
1032 * @param tng_data the trajectory of which to set the forcefield name.
1033 * @param new_name is a string containing the wanted name.
1034 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1035 * must be initialised before using it.
1036 * @pre \code new_name != 0 \endcode The pointer to the new_name string
1037 * must not be a NULL pointer.
1038 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1039 * error has occured.
1041 tng_function_status DECLSPECDLLEXPORT tng_forcefield_name_set
1042 (tng_trajectory_t tng_data,
1043 const char *new_name);
1046 * @brief Get the medium stride length of the trajectory.
1047 * @param tng_data is the trajectory from which to get the stride length.
1048 * @param len is pointing to a value set to the stride length.
1049 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1050 * must be initialised before using it.
1051 * @pre \code len != 0 \endcode The pointer to len must not be a NULL pointer.
1052 * @return TNG_SUCCESS (0) if successful.
1054 tng_function_status DECLSPECDLLEXPORT tng_medium_stride_length_get
1055 (const tng_trajectory_t tng_data,
1056 int64_t *len);
1059 * @brief Set the medium stride length of the trajectory.
1060 * @param tng_data is the trajectory of which to set the stride length.
1061 * @param len is the wanted medium stride length.
1062 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1063 * must be initialised before using it.
1064 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1065 * has occurred.
1067 tng_function_status DECLSPECDLLEXPORT tng_medium_stride_length_set
1068 (tng_trajectory_t tng_data,
1069 const int64_t len);
1072 * @brief Get the long stride length of the trajectory.
1073 * @param tng_data is the trajectory from which to get the stride length.
1074 * @param len is pointing to a value set to the stride length.
1075 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1076 * must be initialised before using it.
1077 * @pre \code len != 0 \endcode The pointer to len must not be a NULL pointer.
1078 * @return TNG_SUCCESS (0) if successful.
1080 tng_function_status DECLSPECDLLEXPORT tng_long_stride_length_get
1081 (const tng_trajectory_t tng_data,
1082 int64_t *len);
1085 * @brief Set the long stride length of the trajectory.
1086 * @param tng_data is the trajectory of which to set the stride length.
1087 * @param len is the wanted long stride length.
1088 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1089 * must be initialised before using it.
1090 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1091 * has occurred.
1093 tng_function_status DECLSPECDLLEXPORT tng_long_stride_length_set
1094 (tng_trajectory_t tng_data,
1095 const int64_t len);
1098 * @brief Get the current time per frame of the trajectory.
1099 * @param tng_data is the trajectory from which to get the time per frame.
1100 * @param time is pointing to a value set to the time per frame.
1101 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1102 * must be initialised before using it.
1103 * @pre \code time != 0 \endcode The pointer to time must not be a NULL pointer.
1104 * @return TNG_SUCCESS (0) if successful.
1106 tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_get
1107 (const tng_trajectory_t tng_data,
1108 double *time);
1111 * @brief Set the time per frame of the trajectory.
1112 * @param tng_data is the trajectory of which to set the time per frame.
1113 * @param time is the new time per frame.
1114 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1115 * must be initialised before using it.
1116 * @pre \code time > 0 \endcode The time per frame must be >= 0.
1117 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1118 * has occurred.
1120 tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_set
1121 (tng_trajectory_t tng_data,
1122 const double time);
1125 * @brief Get the length of the input file.
1126 * @param tng_data is the trajectory from which to get the input file length.
1127 * @param len is pointing to a value set to the file length.
1128 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1129 * must be initialised before using it.
1130 * @pre \code len != 0 \endcode The pointer to len must not be a NULL pointer.
1131 * @return TNG_SUCCESS (0) if successful.
1133 tng_function_status DECLSPECDLLEXPORT tng_input_file_len_get
1134 (const tng_trajectory_t tng_data,
1135 int64_t *len);
1138 * @brief Get the number of frames in the trajectory
1139 * @param tng_data is the trajectory of which to get the number of frames.
1140 * @param n is pointing to a value set to the number of frames.
1141 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1142 * must be initialised before using it.
1143 * @pre \code tng_data->input_file != 0 \endcode An input file must be open
1144 * to find the next frame set.
1145 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1146 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1147 * has occurred (could not find last frame set).
1149 tng_function_status DECLSPECDLLEXPORT tng_num_frames_get
1150 (const tng_trajectory_t tng_data,
1151 int64_t *n);
1154 * @brief Get the precision of lossy compression.
1155 * @param tng_data is the trajectory of which to get the compression precision.
1156 * @param precision will be pointing to the retrieved compression precision.
1157 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1158 * must be initialised before using it.
1159 * @details A compression precision of 0.001 (the default) means that the
1160 * compressed values are accurate to the third decimal. This function does
1161 * not check actual precision of compressed data, but just returns what has
1162 * previously been set using tng_compression_precision_set().
1163 * @return TNG_SUCCESS (0) if successful.
1165 tng_function_status DECLSPECDLLEXPORT tng_compression_precision_get
1166 (const tng_trajectory_t tng_data,
1167 double *precision);
1170 * @brief Set the precision of lossy compression.
1171 * @param tng_data is the trajectory of which to set the compression precision.
1172 * @param precision is the new compression precision.
1173 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1174 * must be initialised before using it.
1175 * @details A compression precision of 0.001 (the default) means that the
1176 * compressed values are accurate to the third decimal.
1177 * @return TNG_SUCCESS (0) if successful.
1179 tng_function_status DECLSPECDLLEXPORT tng_compression_precision_set
1180 (tng_trajectory_t tng_data,
1181 const double precision);
1184 * @brief Set the number of particles, in the case no molecular system is used.
1185 * @param tng_data is the trajectory of which to get the number of particles.
1186 * @param n is the number of particles to use.
1187 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1188 * must be initialised before using it.
1189 * @details When creating a molecular system the number of particles are set
1190 * automatically. This should only be used when there is no molecular system
1191 * specified or if the number of atoms needs to be overridden for some reason.
1192 * @return TNG_SUCCESS (0) if successful.
1194 tng_function_status DECLSPECDLLEXPORT tng_implicit_num_particles_set
1195 (tng_trajectory_t tng_data,
1196 const int64_t n);
1199 * @brief Get the current number of particles.
1200 * @param tng_data is the trajectory from which to get the number of particles.
1201 * @param n is pointing to a value set to the number of particles.
1202 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1203 * must be initialised before using it.
1204 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1205 * @details If variable number of particles are used this function will return
1206 * the number of particles in the current frame set.
1207 * @return TNG_SUCCESS (0) if successful.
1209 tng_function_status DECLSPECDLLEXPORT tng_num_particles_get
1210 (const tng_trajectory_t tng_data,
1211 int64_t *n);
1214 * @brief Get if the number of particle can be varied during the simulation.
1215 * @param tng_data is the trajectory from which to get the number of particles.
1216 * @param variable is pointing to a value set to TNG_CONSTANT_N_ATOMS if the
1217 * number of particles cannot change or TNG_VARIABLE_N_ATOMS if the number of
1218 * particles can change.
1219 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1220 * must be initialised before using it.
1221 * @pre \code variable != 0 \endcode The pointer to variable must not be
1222 * a NULL pointer.
1223 * @return TNG_SUCCESS (0) if successful.
1225 tng_function_status DECLSPECDLLEXPORT tng_num_particles_variable_get
1226 (const tng_trajectory_t tng_data,
1227 char *variable);
1230 * @brief Get the number of molecule types (length of tng_data->molecules).
1231 * @param tng_data is the trajectory from which to get the number of molecules.
1232 * @param n is pointing to a value set to the number of molecule types.
1233 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1234 * must be initialised before using it.
1235 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1236 * @return TNG_SUCCESS (0) if successful.
1238 tng_function_status DECLSPECDLLEXPORT tng_num_molecule_types_get
1239 (const tng_trajectory_t tng_data,
1240 int64_t *n);
1243 * @brief Get the current total number of molecules.
1244 * @param tng_data is the trajectory from which to get the number of molecules.
1245 * @param n is pointing to a value set to the number of molecules.
1246 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1247 * must be initialised before using it.
1248 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1249 * @details If variable number of particles are used this function will return
1250 * the total number of molecules in the current frame set.
1251 * @return TNG_SUCCESS (0) if successful.
1253 tng_function_status DECLSPECDLLEXPORT tng_num_molecules_get
1254 (const tng_trajectory_t tng_data,
1255 int64_t *n);
1257 /** @brief Get the list of the count of each molecule.
1258 * @param tng_data is the trajectory from which to get the molecule count list.
1259 * @param mol_cnt_list is a list of the count of each molecule in the
1260 * mol system. This is a pointer to the list in the TNG container, which
1261 * means that it should be handled carefully, e.g. not freed.
1262 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1263 * must be initialised before using it.
1264 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE(1) if the list of
1265 * molecule counts was not valid.
1267 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_list_get
1268 (const tng_trajectory_t tng_data,
1269 int64_t **mol_cnt_list);
1272 * @brief Get the exponent used for distances in the trajectory.
1273 * @param tng_data is the trajectory from which to get the information.
1274 * @param exp is pointing to a value set to the distance unit exponent.
1275 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1276 * must be initialised before using it.
1277 * @pre \code exp != 0 \endcode The pointer to exp must not be a NULL pointer.
1278 * @details Example: If the distances are specified in nm (default) exp is -9.
1279 * If the distances are specified in Å exp is -10.
1280 * @return TNG_SUCCESS (0) if successful.
1282 tng_function_status DECLSPECDLLEXPORT tng_distance_unit_exponential_get
1283 (const tng_trajectory_t tng_data,
1284 int64_t *exp);
1287 * @brief Set the exponent used for distances in the trajectory.
1288 * @param tng_data is the trajectory of which to set the unit exponent.
1289 * @param exp is the distance unit exponent to use.
1290 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1291 * must be initialised before using it.
1292 * @details Example: If the distances are specified in nm (default) exp is -9.
1293 * If the distances are specified in Å exp is -10.
1294 * @return TNG_SUCCESS (0) if successful.
1296 tng_function_status DECLSPECDLLEXPORT tng_distance_unit_exponential_set
1297 (const tng_trajectory_t tng_data,
1298 const int64_t exp);
1301 * @brief Get the number of frames per frame set.
1302 * @param tng_data is the trajectory from which to get the number of frames
1303 * per frame set.
1304 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1305 * must be initialised before using it.
1306 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1307 * @param n is pointing to a value set to the number of frames per frame set.
1308 * @return TNG_SUCCESS (0) if successful.
1310 tng_function_status DECLSPECDLLEXPORT tng_num_frames_per_frame_set_get
1311 (const tng_trajectory_t tng_data,
1312 int64_t *n);
1315 * @brief Set the number of frames per frame set.
1316 * @param tng_data is the trajectory of which to set the number of frames
1317 * per frame set.
1318 * @param n is the number of frames per frame set.
1319 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1320 * must be initialised before using it.
1321 * @details This does not affect already existing frame sets. For
1322 * consistency the number of frames per frame set should be set
1323 * betfore creating any frame sets.
1324 * @return TNG_SUCCESS (0) if successful.
1326 tng_function_status DECLSPECDLLEXPORT tng_num_frames_per_frame_set_set
1327 (const tng_trajectory_t tng_data,
1328 const int64_t n);
1331 * @brief Get the number of frame sets.
1332 * @details This updates tng_data->n_trajectory_frame_sets before returning it.
1333 * @param tng_data is the trajectory from which to get the number of frame sets.
1334 * @param n is pointing to a value set to the number of frame sets.
1335 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1336 * must be initialised before using it.
1337 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1338 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1339 * has occurred or TNG_CRITICAL (2) if a major error has occured.
1341 tng_function_status DECLSPECDLLEXPORT tng_num_frame_sets_get
1342 (const tng_trajectory_t tng_data,
1343 int64_t *n);
1346 * @brief Get the current trajectory frame set.
1347 * @param tng_data is the trajectory from which to get the frame set.
1348 * @param frame_set_p will be set to point at the memory position of
1349 * the found frame set.
1350 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1351 * must be initialised before using it.
1352 * @return TNG_SUCCESS (0) if successful.
1354 tng_function_status DECLSPECDLLEXPORT tng_current_frame_set_get
1355 (const tng_trajectory_t tng_data,
1356 tng_trajectory_frame_set_t *frame_set_p);
1359 * @brief Find the requested frame set number.
1360 * @param tng_data is the trajectory from which to get the frame set.
1361 * @param nr is the frame set number to search for.
1362 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1363 * must be initialised before using it.
1364 * @pre \code nr >= 0 \endcode The frame set number (nr) must be >= 0.
1365 * @details tng_data->current_trajectory_frame_set will contain the
1366 * found trajectory if successful.
1367 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1368 * has occurred or TNG_CRITICAL (2) if a major error has occured.
1370 tng_function_status DECLSPECDLLEXPORT tng_frame_set_nr_find
1371 (tng_trajectory_t tng_data,
1372 const int64_t nr);
1375 * @brief Find the frame set containing a specific frame.
1376 * @param tng_data is the trajectory from which to get the frame set.
1377 * @param frame is the frame number to search for.
1378 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1379 * must be initialised before using it.
1380 * @pre \code frame >= 0 \endcode The frame number must be >= 0.
1381 * @details tng_data->current_trajectory_frame_set will contain the
1382 * found trajectory if successful.
1383 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1384 * has occurred or TNG_CRITICAL (2) if a major error has occured.
1386 tng_function_status DECLSPECDLLEXPORT tng_frame_set_of_frame_find
1387 (tng_trajectory_t tng_data,
1388 const int64_t frame);
1391 * @brief Get the file position of the next frame set in the input file.
1392 * @param tng_data is a trajectory data container.
1393 * @param frame_set is the frame set of which to get the position of the
1394 * following frame set.
1395 * @param pos is pointing to a value set to the file position.
1396 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1397 * must be initialised before using it.
1398 * @pre \code pos != 0 \endcode The pointer to pos must not be a NULL pointer.
1399 * @return TNG_SUCCESS (0) if successful.
1401 tng_function_status DECLSPECDLLEXPORT tng_frame_set_next_frame_set_file_pos_get
1402 (const tng_trajectory_t tng_data,
1403 const tng_trajectory_frame_set_t frame_set,
1404 int64_t *pos);
1407 * @brief Get the file position of the previous frame set in the input file.
1408 * @param tng_data is a trajectory data container.
1409 * @param frame_set is the frame set of which to get the position of the
1410 * previous frame set.
1411 * @param pos is pointing to a value set to the file position.
1412 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1413 * must be initialised before using it.
1414 * @pre \code pos != 0 \endcode The pointer to pos must not be a NULL pointer.
1415 * @return TNG_SUCCESS (0) if successful.
1417 tng_function_status DECLSPECDLLEXPORT tng_frame_set_prev_frame_set_file_pos_get
1418 (const tng_trajectory_t tng_data,
1419 const tng_trajectory_frame_set_t frame_set,
1420 int64_t *pos);
1423 * @brief Get the first and last frames of the frame set.
1424 * @param tng_data is a trajectory data container.
1425 * @param frame_set is the frame set of which to get the frame range.
1426 * @param first_frame is set to the first frame of the frame set.
1427 * @param last_frame is set to the last frame of the frame set.
1428 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1429 * must be initialised before using it.
1430 * @pre \code first_frame != 0 \endcode The pointer to first_frame must
1431 * not be a NULL pointer.
1432 * @pre \code last_frame != 0 \endcode The pointer to last_frame must
1433 * not be a NULL pointer.
1434 * @return TNG_SUCCESS (0) if successful.
1436 tng_function_status DECLSPECDLLEXPORT tng_frame_set_frame_range_get
1437 (const tng_trajectory_t tng_data,
1438 const tng_trajectory_frame_set_t frame_set,
1439 int64_t *first_frame,
1440 int64_t *last_frame);
1443 * @brief Allocate memory for and setup a molecule container.
1444 * @param tng_data is a trajectory data container.
1445 * @param molecule_p is a pointer to molecule to allocate and initialise.
1446 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1447 * error has occured.
1449 tng_function_status DECLSPECDLLEXPORT tng_molecule_alloc(const tng_trajectory_t tng_data,
1450 tng_molecule_t *molecule_p);
1453 * @brief Clean up a molecule container and free its allocated memory.
1454 * @param tng_data is a trajectory data container.
1455 * @param molecule_p is the molecule to destroy.
1456 * @details All allocated memory in the data structure is freed and also the memory
1457 * of the molecule itself.
1458 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1459 * error has occured.
1461 tng_function_status DECLSPECDLLEXPORT tng_molecule_free(const tng_trajectory_t tng_data,
1462 tng_molecule_t *molecule_p);
1465 * @brief Setup a molecule container.
1466 * @param tng_data is a trajectory data container.
1467 * @param molecule is the molecule to initialise. Memory must be preallocated.
1468 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1469 * error has occured.
1471 tng_function_status DECLSPECDLLEXPORT tng_molecule_init
1472 (const tng_trajectory_t tng_data,
1473 tng_molecule_t molecule);
1476 * @brief Clean up a molecule container.
1477 * @param tng_data is a trajectory data container.
1478 * @param molecule is the molecule to destroy.
1479 * @details All allocated memory in the data structure is freed, but not the
1480 * memory of molecule itself.
1481 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1482 * error has occured.
1484 tng_function_status DECLSPECDLLEXPORT tng_molecule_destroy
1485 (const tng_trajectory_t tng_data,
1486 tng_molecule_t molecule);
1489 * @brief Add a molecule to the trajectory.
1490 * @param tng_data is the trajectory data container containing the block..
1491 * @param name is a pointer to the string containing the name of the new molecule.
1492 * @param molecule is a pointer to the newly created molecule.
1493 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1494 * must be initialised before using it.
1495 * @pre \code name != 0 \endcode The pointer to the name string
1496 * must not be a NULL pointer.
1497 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
1498 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
1500 tng_function_status DECLSPECDLLEXPORT tng_molecule_add
1501 (tng_trajectory_t tng_data,
1502 const char *name,
1503 tng_molecule_t *molecule);
1506 * @brief Add a molecule with a specific ID to the trajectory.
1507 * @param tng_data is the trajectory data container containing the block..
1508 * @param name is a pointer to the string containing the name of the new molecule.
1509 * @param id is the ID of the created molecule.
1510 * @param molecule is a pointer to the newly created molecule.
1511 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1512 * must be initialised before using it.
1513 * @pre \code name != 0 \endcode The pointer to the name string
1514 * must not be a NULL pointer.
1515 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
1516 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
1518 tng_function_status DECLSPECDLLEXPORT tng_molecule_w_id_add
1519 (tng_trajectory_t tng_data,
1520 const char *name,
1521 const int64_t id,
1522 tng_molecule_t *molecule);
1525 * @brief Add an existing molecule (from a molecule container) to the trajectory.
1526 * @param tng_data is the trajectory data container containing the block..
1527 * @param molecule is a pointer to the molecule to add to the trajectory and will
1528 * afterwards point to the molecule in the trajectory.
1529 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1530 * must be initialised before using it.
1531 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major error
1532 * has occured.
1534 tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add
1535 (tng_trajectory_t tng_data,
1536 tng_molecule_t *molecule);
1539 * @brief Get the name of a molecule.
1540 * @param tng_data the trajectory containing the molecule.
1541 * @param molecule the molecule of which to get the name.
1542 * @param name the string to fill with the name of the molecule,
1543 * memory must be allocated before.
1544 * @param max_len maximum char length of the string, i.e. how much memory has
1545 * been reserved for name. This includes \0 terminating character.
1546 * @pre \code molecule != 0 \endcode The molecule must not be NULL.
1547 * @pre \code name != 0 \endcode The pointer to the name string
1548 * must not be a NULL pointer.
1549 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1550 * has occurred (source string longer than destination string).
1552 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_get
1553 (const tng_trajectory_t tng_data,
1554 const tng_molecule_t molecule,
1555 char *name,
1556 const int max_len);
1559 * @brief Set the name of a molecule.
1560 * @param tng_data is the trajectory data container containing the molecule..
1561 * @param molecule is the molecule to rename.
1562 * @param new_name is a string containing the wanted name.
1563 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1564 * must be initialised before using it.
1565 * @pre \code new_name != 0 \endcode The pointer to the name string
1566 * must not be a NULL pointer.
1567 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1568 * error has occured.
1570 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_set
1571 (tng_trajectory_t tng_data,
1572 tng_molecule_t molecule,
1573 const char *new_name);
1576 * @brief Get the count of a molecule.
1577 * @param tng_data is the trajectory data container containing the molecule..
1578 * @param molecule is the molecule of which to get the count.
1579 * @param cnt is a pointer to the variable to be populated with the count.
1580 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1581 * must be initialised before using it.
1582 * @pre \code cnt != 0 \endcode The pointer to the molecule count
1583 * must not be a NULL pointer.
1584 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1585 * has occurred or TNG_CRITICAL (2) if a major error has occured.
1587 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_get
1588 (const tng_trajectory_t tng_data,
1589 const tng_molecule_t molecule,
1590 int64_t *cnt);
1593 * @brief Set the count of a molecule.
1594 * @param tng_data is the trajectory data container containing the molecule..
1595 * @param molecule is the molecule of which to set the count.
1596 * @param cnt is the number of instances of this molecule.
1597 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1598 * must be initialised before using it.
1599 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1600 * has occurred or TNG_CRITICAL (2) if a major error has occured.
1602 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_set
1603 (tng_trajectory_t tng_data,
1604 tng_molecule_t molecule,
1605 const int64_t cnt);
1608 * @brief Find a molecule.
1609 * @param tng_data is the trajectory data container containing the molecule.
1610 * @param name is a string containing the name of the molecule. If name is empty
1611 * only id will be used for finding the molecule.
1612 * @param id is the id of the molecule to look for. If id is -1 only the name of
1613 * the molecule will be used for finding the molecule.
1614 * @param molecule is a pointer to the molecule if it was found - otherwise 0.
1615 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1616 * must be initialised before using it.
1617 * @pre \code name != 0 \endcode The pointer to the name string
1618 * must not be a NULL pointer.
1619 * @return TNG_SUCCESS (0) if the molecule is found or TNG_FAILURE (1) if the
1620 * molecule is not found.
1621 * @details If name is an empty string and id == -1 the first residue will
1622 * be found.
1624 tng_function_status DECLSPECDLLEXPORT tng_molecule_find
1625 (tng_trajectory_t tng_data,
1626 const char *name,
1627 int64_t id,
1628 tng_molecule_t *molecule);
1631 * @brief Retrieve the molecule with specified index in the list of molecules.
1632 * @param tng_data is the trajectory data container containing the molecule.
1633 * @param index is the index (in tng_data->molecules) of the molecule to return
1634 * @param molecule is a pointer to the molecule if it was found - otherwise 0.
1635 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1636 * must be initialised before using it.
1637 * @pre \code molecule != 0 \endcode molecule must not be a NULL pointer.
1638 * @return TNG_SUCCESS (0) if the molecule is found or TNG_FAILURE (1) if the
1639 * molecule is not found.
1641 tng_function_status DECLSPECDLLEXPORT tng_molecule_of_index_get
1642 (tng_trajectory_t tng_data,
1643 int64_t index,
1644 tng_molecule_t *molecule);
1647 * @brief Copy all molecules and the molecule counts from one TNG trajectory
1648 * to another.
1649 * @param tng_data_src is the source trajectory containing the molecular
1650 * system to copy.
1651 * @param tng_data_dest is the destination trajectory.
1652 * @pre \code tng_data_src != 0 \endcode The trajectory container (tng_data_src)
1653 * must be initialised before using it.
1654 * @pre \code tng_data_dest != 0 \endcode The trajectory container (tng_data_dest)
1655 * must be initialised before using it.
1656 * @details The molecular system in tng_data_dest will be overwritten.
1657 * @return TNG_SUCCESS(0) if the copying is successful, TNG_FAILURE if a minor
1658 * error has occured or TNG_CRITICAL(2) if a major error has occured.
1660 tng_function_status DECLSPECDLLEXPORT tng_molecule_system_copy(tng_trajectory_t tng_data_src,
1661 tng_trajectory_t tng_data_dest);
1664 * @brief Get the number of chains in a molecule.
1665 * @param tng_data is the trajectory containing the molecule.
1666 * @param molecule is the molecule of which to get the number of chains.
1667 * @param n is pointing to a value set to the number of chains.
1668 * @pre \code molecule != 0 \endcode The molecule must not be NULL.
1669 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1670 * @return TNG_SUCCESS (0) if successful.
1672 tng_function_status DECLSPECDLLEXPORT tng_molecule_num_chains_get
1673 (const tng_trajectory_t tng_data,
1674 const tng_molecule_t molecule,
1675 int64_t *n);
1678 * @brief Retrieve the chain of a molecule with specified index in the list
1679 * of chains.
1680 * @param tng_data is the trajectory data container containing the molecule.
1681 * @param index is the index (in molecule->chains) of the chain to return
1682 * @param molecule is the molecule from which to get the chain.
1683 * @param chain is a pointer to the chain if it was found - otherwise 0.
1684 * @pre \code molecule != 0 \endcode molecule must not be a NULL pointer.
1685 * @pre \code chain != 0 \endcode chain must not be a NULL pointer.
1686 * @return TNG_SUCCESS (0) if the chain is found or TNG_FAILURE (1) if the
1687 * chain is not found.
1689 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_of_index_get
1690 (tng_trajectory_t tng_data,
1691 tng_molecule_t molecule,
1692 int64_t index,
1693 tng_chain_t *chain);
1696 * @brief Get the number of residues in a molecule.
1697 * @param tng_data is the trajectory containing the molecule.
1698 * @param molecule is the molecule of which to get the number residues.
1699 * @param n is pointing to a value set to the number of residues.
1700 * @pre \code molecule != 0 \endcode The molecule must not be NULL.
1701 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1702 * @return TNG_SUCCESS (0) if successful.
1704 tng_function_status DECLSPECDLLEXPORT tng_molecule_num_residues_get
1705 (const tng_trajectory_t tng_data,
1706 const tng_molecule_t molecule,
1707 int64_t *n);
1710 * @brief Retrieve the residue of a molecule with specified index in the list
1711 * of chains.
1712 * @param tng_data is the trajectory data container containing the molecule.
1713 * @param index is the index (in molecule->residues) of the residue to return
1714 * @param molecule is the molecule from which to get the residue.
1715 * @param residue is a pointer to the residue if it was found - otherwise 0.
1716 * @pre \code molecule != 0 \endcode molecule must not be a NULL pointer.
1717 * @pre \code residue != 0 \endcode residue must not be a NULL pointer.
1718 * @return TNG_SUCCESS (0) if the residue is found or TNG_FAILURE (1) if the
1719 * residue is not found.
1721 tng_function_status DECLSPECDLLEXPORT tng_molecule_residue_of_index_get
1722 (const tng_trajectory_t tng_data,
1723 const tng_molecule_t molecule,
1724 const int64_t index,
1725 tng_residue_t *residue);
1728 * @brief Get the number of atoms in a molecule.
1729 * @param tng_data is the trajectory containing the molecule.
1730 * @param molecule is the molecule of which to get the number of atoms.
1731 * @param n is pointing to a value set to the number of atoms.
1732 * @pre \code molecule != 0 \endcode The molecule must not be NULL.
1733 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1734 * @return TNG_SUCCESS (0) if successful.
1736 tng_function_status DECLSPECDLLEXPORT tng_molecule_num_atoms_get
1737 (const tng_trajectory_t tng_data,
1738 const tng_molecule_t molecule,
1739 int64_t *n);
1742 * @brief Retrieve the atom of a molecule with specified index in the list
1743 * of atoms.
1744 * @param tng_data is the trajectory data container containing the molecule.
1745 * @param index is the index (in molecule->atoms) of the atom to return
1746 * @param molecule is the molecule from which to get the atom.
1747 * @param atom is a pointer to the atom if it was found - otherwise 0.
1748 * @pre \code molecule != 0 \endcode molecule must not be a NULL pointer.
1749 * @pre \code atom != 0 \endcode atom must not be a NULL pointer.
1750 * @return TNG_SUCCESS (0) if the atom is found or TNG_FAILURE (1) if the
1751 * atom is not found.
1753 tng_function_status DECLSPECDLLEXPORT tng_molecule_atom_of_index_get
1754 (const tng_trajectory_t tng_data,
1755 const tng_molecule_t molecule,
1756 const int64_t index,
1757 tng_atom_t *atom);
1760 * @brief Find a chain in a molecule.
1761 * @param tng_data is the trajectory data container containing the molecule.
1762 * @param molecule is the molecule in which to search for the chain.
1763 * @param name is a string containing the name of the chain. If name is empty
1764 * only id will be used for finding the chain.
1765 * @param id is the id of the chain to look for. If id is -1 only the name of
1766 * the chain will be used for finding the chain.
1767 * @param chain is a pointer to the chain if it was found - otherwise 0.
1768 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1769 * must be initialised before using it.
1770 * @pre \code name != 0 \endcode The pointer to the name string
1771 * must not be a NULL pointer.
1772 * @return TNG_SUCCESS (0) if the chain is found or TNG_FAILURE (1) if the
1773 * chain is not found.
1774 * @details If name is an empty string and id == -1 the first residue will
1775 * be found.
1777 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_find
1778 (tng_trajectory_t tng_data,
1779 tng_molecule_t molecule,
1780 const char *name,
1781 int64_t id,
1782 tng_chain_t *chain);
1785 * @brief Add a chain to a molecule.
1786 * @param tng_data is the trajectory data container containing the molecule..
1787 * @param molecule is the molecule to add a chain to.
1788 * @param name is a string containing the name of the chain.
1789 * @param chain is a pointer to the newly created chain.
1790 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1791 * must be initialised before using it.
1792 * @pre \code name != 0 \endcode The pointer to the name string
1793 * must not be a NULL pointer.
1794 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
1795 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
1797 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_add
1798 (tng_trajectory_t tng_data,
1799 tng_molecule_t molecule,
1800 const char *name,
1801 tng_chain_t *chain);
1804 * @brief Add a chain with a specific id to a molecule.
1805 * @param tng_data is the trajectory data container containing the molecule..
1806 * @param molecule is the molecule to add a chain to.
1807 * @param name is a string containing the name of the chain.
1808 * @param id is the ID of the created chain.
1809 * @param chain is a pointer to the newly created chain.
1810 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1811 * must be initialised before using it.
1812 * @pre \code name != 0 \endcode The pointer to the name string
1813 * must not be a NULL pointer.
1814 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
1815 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
1817 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_w_id_add
1818 (tng_trajectory_t tng_data,
1819 tng_molecule_t molecule,
1820 const char *name,
1821 const int64_t id,
1822 tng_chain_t *chain);
1825 * @brief Add a bond between two atoms to a molecule.
1826 * @param tng_data is the trajectory data container containing the molecule.
1827 * @param molecule is the molecule containing the atoms to connect.
1828 * @param from_atom_id is the id of one of the two atoms in the bond.
1829 * @param to_atom_id is the id of the other atom in the bond.
1830 * @param bond is a pointer to the newly created bond.
1831 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1832 * must be initialised before using it.
1833 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (!) if a minor error
1834 * has occured or TNG_CRITICAL (2) if a major error has occured.
1836 tng_function_status DECLSPECDLLEXPORT tng_molecule_bond_add
1837 (const tng_trajectory_t tng_data,
1838 tng_molecule_t molecule,
1839 const int64_t from_atom_id,
1840 const int64_t to_atom_id,
1841 tng_bond_t *bond);
1844 * @brief Find an atom in a molecule.
1845 * @param tng_data is the trajectory data container containing the molecule.
1846 * @param molecule is the molecule in which to search for the atom.
1847 * @param name is a string containing the name of the atom. If name is an
1848 * empty string only id will be used for searching.
1849 * @param id is the id of the atom to find. If id == -1 the first atom
1850 * that matches the specified name will be found.
1851 * @param atom is a pointer to the atom if it was found - otherwise 0.
1852 * @pre \code name != 0 \endcode The pointer to the name string
1853 * must not be a NULL pointer.
1854 * @return TNG_SUCCESS (0) if the atom is found or TNG_FAILURE (1) if the
1855 * atom is not found.
1856 * @details If name is an empty string and id == -1 the first residue will
1857 * be found.
1859 tng_function_status DECLSPECDLLEXPORT tng_molecule_atom_find
1860 (tng_trajectory_t tng_data,
1861 tng_molecule_t molecule,
1862 const char *name,
1863 int64_t id,
1864 tng_atom_t *atom);
1867 * @brief Get the name of a chain.
1868 * @param tng_data the trajectory containing the chain.
1869 * @param chain the chain of which to get the name.
1870 * @param name the string to fill with the name of the chain,
1871 * memory must be allocated before.
1872 * @param max_len maximum char length of the string, i.e. how much memory has
1873 * been reserved for name. This includes \0 terminating character.
1874 * @pre \code chain != 0 \endcode The chain must not be NULL.
1875 * @pre \code name != 0 \endcode The pointer to the name string
1876 * must not be a NULL pointer.
1877 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
1878 * has occurred (source string longer than destination string).
1880 tng_function_status DECLSPECDLLEXPORT tng_chain_name_get
1881 (const tng_trajectory_t tng_data,
1882 const tng_chain_t chain,
1883 char *name,
1884 const int max_len);
1887 * @brief Set the name of a chain.
1888 * @param tng_data is the trajectory data container containing the atom..
1889 * @param chain is the chain to rename.
1890 * @param new_name is a string containing the wanted name.
1891 * @pre \code new_name != 0 \endcode The pointer to the name string
1892 * must not be a NULL pointer.
1893 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
1894 * error has occured.
1896 tng_function_status DECLSPECDLLEXPORT tng_chain_name_set
1897 (tng_trajectory_t tng_data,
1898 tng_chain_t chain,
1899 const char *new_name);
1902 * @brief Get the number of residues in a molecule chain.
1903 * @param tng_data is the trajectory containing the chain.
1904 * @param chain is the chain of which to get the number of residues.
1905 * @param n is pointing to a value set to the number of residues.
1906 * @pre \code chain != 0 \endcode The chain must not be NULL.
1907 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
1908 * @return TNG_SUCCESS (0) if successful.
1910 tng_function_status DECLSPECDLLEXPORT tng_chain_num_residues_get
1911 (const tng_trajectory_t tng_data,
1912 const tng_chain_t chain,
1913 int64_t *n);
1916 * @brief Retrieve the residue of a chain with specified index in the list
1917 * of residues.
1918 * @param tng_data is the trajectory data container containing the chain.
1919 * @param index is the index (in chain->residues) of the residue to return
1920 * @param chain is the chain from which to get the residue.
1921 * @param residue is a pointer to the residue if it was found - otherwise 0.
1922 * @pre \code chain != 0 \endcode chain must not be a NULL pointer.
1923 * @pre \code residue != 0 \endcode residue must not be a NULL pointer.
1924 * @return TNG_SUCCESS (0) if the residue is found or TNG_FAILURE (1) if the
1925 * residue is not found.
1927 tng_function_status DECLSPECDLLEXPORT tng_chain_residue_of_index_get
1928 (const tng_trajectory_t tng_data,
1929 const tng_chain_t chain,
1930 const int64_t index,
1931 tng_residue_t *residue);
1934 * @brief Find a residue in a chain.
1935 * @param tng_data is the trajectory data container containing the chain.
1936 * @param chain is the chain in which to search for the residue.
1937 * @param name is a string containing the name of the residue. If name is an
1938 * empty string only id will be used for searching.
1939 * @param id is the id of the residue to find. If id == -1 the first residue
1940 * that matches the specified name will be found.
1941 * @param residue is a pointer to the residue if it was found - otherwise 0.
1942 * @pre \code name != 0 \endcode The pointer to the name string
1943 * must not be a NULL pointer.
1944 * @return TNG_SUCCESS (0) if the residue is found or TNG_FAILURE (1) if the
1945 * residue is not found.
1946 * @details If name is an empty string and id == -1 the first residue will
1947 * be found.
1949 tng_function_status DECLSPECDLLEXPORT tng_chain_residue_find
1950 (tng_trajectory_t tng_data,
1951 tng_chain_t chain,
1952 const char *name,
1953 int64_t id,
1954 tng_residue_t *residue);
1957 * @brief Add a residue to a chain.
1958 * @param tng_data is the trajectory data container containing the chain..
1959 * @param chain is the chain to add a residue to.
1960 * @param name is a string containing the name of the residue.
1961 * @param residue is a pointer to the newly created residue.
1962 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1963 * must be initialised before using it.
1964 * @pre \code name != 0 \endcode The pointer to the name string
1965 * must not be a NULL pointer.
1966 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
1967 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
1969 tng_function_status DECLSPECDLLEXPORT tng_chain_residue_add
1970 (tng_trajectory_t tng_data,
1971 tng_chain_t chain,
1972 const char *name,
1973 tng_residue_t *residue);
1976 * @brief Add a residue with a specific ID to a chain.
1977 * @param tng_data is the trajectory data container containing the chain..
1978 * @param chain is the chain to add a residue to.
1979 * @param name is a string containing the name of the residue.
1980 * @param id is the ID of the created residue.
1981 * @param residue is a pointer to the newly created residue.
1982 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
1983 * must be initialised before using it.
1984 * @pre \code name != 0 \endcode The pointer to the name string
1985 * must not be a NULL pointer.
1986 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
1987 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
1989 tng_function_status DECLSPECDLLEXPORT tng_chain_residue_w_id_add
1990 (tng_trajectory_t tng_data,
1991 tng_chain_t chain,
1992 const char *name,
1993 const int64_t id,
1994 tng_residue_t *residue);
1997 * @brief Get the name of a residue.
1998 * @param tng_data the trajectory containing the residue.
1999 * @param residue the residue of which to get the name.
2000 * @param name the string to fill with the name of the residue,
2001 * memory must be allocated before.
2002 * @param max_len maximum char length of the string, i.e. how much memory has
2003 * been reserved for name. This includes \0 terminating character.
2004 * @pre \code residue != 0 \endcode The residue must not be NULL.
2005 * @pre \code name != 0 \endcode The pointer to the name string
2006 * must not be a NULL pointer.
2007 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2008 * has occurred (source string longer than destination string).
2010 tng_function_status DECLSPECDLLEXPORT tng_residue_name_get
2011 (const tng_trajectory_t tng_data,
2012 const tng_residue_t residue,
2013 char *name,
2014 const int max_len);
2017 * @brief Set the name of a residue.
2018 * @param tng_data is the trajectory data container containing the residue.
2019 * @param residue is the residue to rename.
2020 * @param new_name is a string containing the wanted name.
2021 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2022 * must be initialised before using it.
2023 * @pre \code new_name != 0 \endcode The new name to set (new_name) must
2024 * not be a NULL pointer.
2025 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
2026 * error has occured.
2028 tng_function_status DECLSPECDLLEXPORT tng_residue_name_set
2029 (tng_trajectory_t tng_data,
2030 tng_residue_t residue,
2031 const char *new_name);
2034 * @brief Get the number of atoms in a residue.
2035 * @param tng_data is the trajectory containing the residue.
2036 * @param residue is the residue of which to get the number atoms.
2037 * @param n is pointing to a value set to the number of atoms.
2038 * @pre \code residue != 0 \endcode The residue must not be NULL.
2039 * @pre \code n != 0 \endcode The pointer to n must not be a NULL pointer.
2040 * @return TNG_SUCCESS (0) if successful.
2042 tng_function_status DECLSPECDLLEXPORT tng_residue_num_atoms_get
2043 (const tng_trajectory_t tng_data,
2044 const tng_residue_t residue,
2045 int64_t *n);
2048 * @brief Retrieve the atom of a residue with specified index in the list
2049 * of atoms.
2050 * @param tng_data is the trajectory data container containing the residue.
2051 * @param index is the index (in residue->atoms) of the atom to return
2052 * @param residue is the residue from which to get the atom.
2053 * @param atom is a pointer to the atom if it was found - otherwise 0.
2054 * @pre \code residue != 0 \endcode residue must not be a NULL pointer.
2055 * @pre \code atom != 0 \endcode atom must not be a NULL pointer.
2056 * @return TNG_SUCCESS (0) if the atom is found or TNG_FAILURE (1) if the
2057 * atom is not found.
2059 tng_function_status DECLSPECDLLEXPORT tng_residue_atom_of_index_get
2060 (const tng_trajectory_t tng_data,
2061 const tng_residue_t residue,
2062 const int64_t index,
2063 tng_atom_t *atom);
2066 * @brief Add an atom to a residue.
2067 * @param tng_data is the trajectory containing the residue.
2068 * @param residue is the residue to add an atom to.
2069 * @param atom_name is a string containing the name of the atom.
2070 * @param atom_type is a string containing the atom type of the atom.
2071 * @param atom is a pointer to the newly created atom.
2072 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2073 * must be initialised before using it.
2074 * @pre \code atom_name != 0 \endcode The pointer to the atom name string
2075 * must not be a NULL pointer.
2076 * @pre \code atom_type != 0 \endcode The pointer to the atom_type string
2077 * must not be a NULL pointer.
2078 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
2079 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
2081 tng_function_status DECLSPECDLLEXPORT tng_residue_atom_add
2082 (tng_trajectory_t tng_data,
2083 tng_residue_t residue,
2084 const char *atom_name,
2085 const char *atom_type,
2086 tng_atom_t *atom);
2089 * @brief Add an atom with a specific ID to a residue.
2090 * @param tng_data is the trajectory containing the residue.
2091 * @param residue is the residue to add an atom to.
2092 * @param atom_name is a string containing the name of the atom.
2093 * @param atom_type is a string containing the atom type of the atom.
2094 * @param id is the ID of the created atom.
2095 * @param atom is a pointer to the newly created atom.
2096 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2097 * must be initialised before using it.
2098 * @pre \code atom_name != 0 \endcode The pointer to the atom name string
2099 * must not be a NULL pointer.
2100 * @pre \code atom_type != 0 \endcode The pointer to the atom_type string
2101 * must not be a NULL pointer.
2102 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if the ID could
2103 * not be set properly or TNG_CRITICAL (2) if a major error has occured.
2105 tng_function_status DECLSPECDLLEXPORT tng_residue_atom_w_id_add
2106 (tng_trajectory_t tng_data,
2107 tng_residue_t residue,
2108 const char *atom_name,
2109 const char *atom_type,
2110 const int64_t id,
2111 tng_atom_t *atom);
2114 * @brief Get the residue of an atom.
2115 * @param tng_data the trajectory containing the atom.
2116 * @param atom the atom of which to get the name.
2117 * @param residue is set to the residue of the atom.
2118 * @pre \code atom != 0 \endcode The atom must not be NULL.
2119 * @return TNG_SUCCESS (0) if successful.
2121 tng_function_status tng_atom_residue_get(const tng_trajectory_t tng_data,
2122 const tng_atom_t atom,
2123 tng_residue_t *residue);
2126 * @brief Get the name of an atom.
2127 * @param tng_data the trajectory containing the atom.
2128 * @param atom the atom of which to get the name.
2129 * @param name the string to fill with the name of the atom,
2130 * memory must be allocated before.
2131 * @param max_len maximum char length of the string, i.e. how much memory has
2132 * been reserved for name. This includes \0 terminating character.
2133 * @pre \code atom != 0 \endcode The atom must not be NULL.
2134 * @pre \code name != 0 \endcode The pointer to the name string
2135 * must not be a NULL pointer.
2136 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2137 * has occurred (source string longer than destination string).
2139 tng_function_status DECLSPECDLLEXPORT tng_atom_name_get
2140 (const tng_trajectory_t tng_data,
2141 const tng_atom_t atom,
2142 char *name,
2143 const int max_len);
2146 * @brief Set the name of an atom.
2147 * @param tng_data is the trajectory data container containing the atom.
2148 * @param atom is the atom to rename.
2149 * @param new_name is a string containing the wanted name.
2150 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2151 * must be initialised before using it.
2152 * @pre \code new_name != 0 \endcode The pointer to the name string
2153 * must not be a NULL pointer.
2154 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
2155 * error has occured.
2157 tng_function_status DECLSPECDLLEXPORT tng_atom_name_set
2158 (tng_trajectory_t tng_data,
2159 tng_atom_t atom,
2160 const char *new_name);
2163 * @brief Get the type of an atom.
2164 * @param tng_data the trajectory containing the atom.
2165 * @param atom the atom of which to get the type.
2166 * @param type the string to fill with the type of the atom,
2167 * memory must be allocated before.
2168 * @param max_len maximum char length of the string, i.e. how much memory has
2169 * been reserved for type. This includes \0 terminating character.
2170 * @pre \code atom != 0 \endcode The atom must not be NULL.
2171 * @pre \code type != 0 \endcode The pointer to the type string
2172 * must not be a NULL pointer.
2173 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2174 * has occurred (source string longer than destination string).
2176 tng_function_status DECLSPECDLLEXPORT tng_atom_type_get
2177 (const tng_trajectory_t tng_data,
2178 const tng_atom_t atom,
2179 char *type,
2180 const int max_len);
2183 * @brief Set the atom type of an atom.
2184 * @param tng_data is the trajectory data container containing the atom.
2185 * @param atom is the atom to change.
2186 * @param new_type is a string containing the atom type.
2187 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2188 * must be initialised before using it.
2189 * @pre \code new_type != 0 \endcode The pointer to the atom type string
2190 * must not be a NULL pointer.
2191 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
2192 * error has occured.
2194 tng_function_status DECLSPECDLLEXPORT tng_atom_type_set
2195 (tng_trajectory_t tng_data,
2196 tng_atom_t atom,
2197 const char *new_type);
2200 * @brief Get the molecule name of real particle number (number in mol system).
2201 * @param tng_data is the trajectory data container containing the atom.
2202 * @param nr is the real number of the particle in the molecular system.
2203 * @param name is a string, which is set to the name of the molecule. Memory
2204 * must be reserved beforehand.
2205 * @param max_len is the maximum length of name.
2206 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2207 * must be initialised before using it.
2208 * @pre \code name != 0 \endcode The pointer to the name string
2209 * must not be a NULL pointer.
2210 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2211 * has occured.
2213 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_of_particle_nr_get
2214 (const tng_trajectory_t tng_data,
2215 const int64_t nr,
2216 char *name,
2217 int max_len);
2220 * @brief Get the molecule id of real particle number (number in mol system).
2221 * @param tng_data is the trajectory data container containing the atom.
2222 * @param nr is the real number of the particle in the molecular system.
2223 * @param id is will be set to the id of the molecule.
2224 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2225 * must be initialised before using it.
2226 * @pre \code id != 0 \endcode The pointer to id must not be a NULL pointer.
2227 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2228 * has occured.
2230 tng_function_status DECLSPECDLLEXPORT tng_molecule_id_of_particle_nr_get
2231 (const tng_trajectory_t tng_data,
2232 const int64_t nr,
2233 int64_t *id);
2236 * @brief Get the bonds of the current molecular system.
2237 * @param tng_data is the trajectory data container containing the molecular
2238 * system.
2239 * @param n_bonds is set to the number of bonds in the molecular system and
2240 * thereby also the lengths of the two lists: from_atoms and to_atoms.
2241 * @param from_atoms is a list (memory reserved by this function) of atoms
2242 * (number of atom in mol system) in bonds.
2243 * @param to_atoms is a list (memory reserved by this function) of atoms
2244 * (number of atom in mol system) in bonds.
2245 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2246 * must be initialised before using it.
2247 * @pre \code n_bonds != 0 \endcode The pointer to n_bonds must not be a
2248 * NULL pointer.
2249 * @pre \code from_atoms != 0 \endcode The pointer to from_atoms must not
2250 * be a NULL pointer.
2251 * @pre \code to_atoms != 0 \endcode The pointer to to_atoms must not
2252 * be a NULL pointer.
2253 * @details The two lists of atoms use the same index, i.e. from_atoms[0]
2254 * and to_atoms[0] are linked with a bond. Since memory is reserved in
2255 * this function it must be freed afterwards.
2256 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2257 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2259 tng_function_status DECLSPECDLLEXPORT tng_molsystem_bonds_get
2260 (const tng_trajectory_t tng_data,
2261 int64_t *n_bonds,
2262 int64_t **from_atoms,
2263 int64_t **to_atoms);
2266 * @brief Get the chain name of real particle number (number in mol system).
2267 * @param tng_data is the trajectory data container containing the atom.
2268 * @param nr is the real number of the particle in the molecular system.
2269 * @param name is a string, which is set to the name of the chain. Memory
2270 * must be reserved beforehand.
2271 * @param max_len is the maximum length of name.
2272 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2273 * must be initialised before using it.
2274 * @pre \code name != 0 \endcode The pointer to the name string
2275 * must not be a NULL pointer.
2276 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2277 * has occured.
2279 tng_function_status DECLSPECDLLEXPORT tng_chain_name_of_particle_nr_get
2280 (const tng_trajectory_t tng_data,
2281 const int64_t nr,
2282 char *name,
2283 int max_len);
2286 * @brief Get the residue name of real particle number (number in mol system).
2287 * @param tng_data is the trajectory data container containing the atom.
2288 * @param nr is the real number of the particle in the molecular system.
2289 * @param name is a string, which is set to the name of the residue. Memory
2290 * must be reserved beforehand.
2291 * @param max_len is the maximum length of name.
2292 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2293 * must be initialised before using it.
2294 * @pre \code name != 0 \endcode The pointer to the name string
2295 * must not be a NULL pointer.
2296 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2297 * has occured.
2299 tng_function_status DECLSPECDLLEXPORT tng_residue_name_of_particle_nr_get
2300 (const tng_trajectory_t tng_data,
2301 const int64_t nr,
2302 char *name,
2303 int max_len);
2306 * @brief Get the residue id (local to molecule) of real particle number
2307 * (number in mol system).
2308 * @param tng_data is the trajectory data container containing the atom.
2309 * @param nr is the real number of the particle in the molecular system.
2310 * @param id is a pointer to the variable, which will be set to the ID.
2311 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2312 * must be initialised before using it.
2313 * @pre \code id != 0 \endcode The pointer to id must not be a NULL pointer.
2314 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2315 * has occured.
2317 tng_function_status DECLSPECDLLEXPORT tng_residue_id_of_particle_nr_get
2318 (const tng_trajectory_t tng_data,
2319 const int64_t nr,
2320 int64_t *id);
2323 * @brief Get the residue id (based on other molecules and molecule counts)
2324 * of real particle number (number in mol system).
2325 * @param tng_data is the trajectory data container containing the atom.
2326 * @param nr is the real number of the particle in the molecular system.
2327 * @param id is a pointer to the variable, which will be set to the ID.
2328 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2329 * must be initialised before using it.
2330 * @pre \code id != 0 \endcode The pointer to id must not be a NULL pointer.
2331 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2332 * has occured.
2334 tng_function_status DECLSPECDLLEXPORT tng_global_residue_id_of_particle_nr_get
2335 (const tng_trajectory_t tng_data,
2336 const int64_t nr,
2337 int64_t *id);
2340 * @brief Get the atom name of real particle number (number in mol system).
2341 * @param tng_data is the trajectory data container containing the atom.
2342 * @param nr is the real number of the particle in the molecular system.
2343 * @param name is a string, which is set to the name of the atom. Memory
2344 * must be reserved beforehand.
2345 * @param max_len is the maximum length of name.
2346 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2347 * must be initialised before using it.
2348 * @pre \code name != 0 \endcode The pointer to the name string
2349 * must not be a NULL pointer.
2350 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2351 * has occured.
2353 tng_function_status DECLSPECDLLEXPORT tng_atom_name_of_particle_nr_get
2354 (const tng_trajectory_t tng_data,
2355 const int64_t nr,
2356 char *name,
2357 int max_len);
2360 * @brief Get the atom type of real particle number (number in mol system).
2361 * @param tng_data is the trajectory data container containing the atom.
2362 * @param nr is the real number of the particle in the molecular system.
2363 * @param type is a string, which is set to the type of the atom. Memory
2364 * must be reserved beforehand.
2365 * @param max_len is the maximum length of type.
2366 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2367 * must be initialised before using it.
2368 * @pre \code type != 0 \endcode The pointer to the type string
2369 * must not be a NULL pointer.
2370 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (!) if a minor error
2371 * has occured.
2373 tng_function_status DECLSPECDLLEXPORT tng_atom_type_of_particle_nr_get
2374 (const tng_trajectory_t tng_data,
2375 const int64_t nr,
2376 char *type,
2377 int max_len);
2380 * @brief Add a particle mapping table.
2381 * @details Each particle mapping table will be written as a separate block,
2382 * followed by the data blocks for the corresponding particles. In most cases
2383 * there is one particle mapping block for each thread writing the trajectory.
2384 * @param tng_data is the trajectory, with the frame set to which to add
2385 * the mapping block.
2386 * @details The mapping information is added to the currently active frame set
2387 * of tng_data
2388 * @param num_first_particle is the first particle number of this mapping
2389 * block.
2390 * @param n_particles is the number of particles in this mapping block.
2391 * @param mapping_table is a list of the real particle numbers (i.e. the numbers
2392 * used in the molecular system). The list is n_particles long.
2393 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2394 * must be initialised before using it.
2395 * @details mapping_table[0] is the real particle number of the first particle
2396 * in the following data blocks.
2397 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2398 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2400 tng_function_status DECLSPECDLLEXPORT tng_particle_mapping_add
2401 (tng_trajectory_t tng_data,
2402 const int64_t num_first_particle,
2403 const int64_t n_particles,
2404 const int64_t *mapping_table);
2407 * @brief Remove all particle mappings (in memory) from the current frame set.
2408 * @details Clears the currently setup particle mappings of the current frame
2409 * set.
2410 * @param tng_data is the trajectory, with the frame set of which to clear
2411 * all particle mappings.
2412 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2413 * must be initialised before using it.
2414 * @return TNG_SUCCESS (0) if successful.
2416 tng_function_status DECLSPECDLLEXPORT tng_frame_set_particle_mapping_free
2417 (tng_trajectory_t tng_data);
2420 * @brief Read the header blocks from the input_file of tng_data.
2421 * @details The trajectory blocks must be read separately and iteratively in chunks
2422 * to fit in memory.
2423 * @param tng_data is a trajectory data container.
2424 * @details tng_data->input_file_path specifies
2425 * which file to read from. If the file (input_file) is not open it will be
2426 * opened.
2427 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2428 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2429 * compared to the md5 hash of the read contents to ensure valid data.
2430 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2431 * must be initialised before using it.
2432 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
2433 * error has occured.
2435 tng_function_status DECLSPECDLLEXPORT tng_file_headers_read
2436 (tng_trajectory_t tng_data,
2437 const char hash_mode);
2440 * @brief Write the header blocks to the output_file of tng_data.
2441 * @details The trajectory blocks must be written separately and iteratively in chunks
2442 * to fit in memory.
2443 * @param tng_data is a trajectory data container.
2444 * @details tng_data->output_file_path
2445 * specifies which file to write to. If the file (output_file) is not open it
2446 * will be opened.
2447 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2448 * If hash_mode == TNG_USE_HASH an md5 hash for each header block will be generated.
2449 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2450 * must be initialised before using it.
2451 * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major
2452 * error has occured.
2454 tng_function_status DECLSPECDLLEXPORT tng_file_headers_write
2455 (tng_trajectory_t tng_data,
2456 const char hash_mode);
2459 * @brief Read one (the next) block (of any kind) from the input_file of tng_data.
2460 * @param tng_data is a trajectory data container.
2461 * @details tng_data->input_file_path specifies
2462 * which file to read from. If the file (input_file) is not open it will be
2463 * opened.
2464 * @param block_data is a pointer to the struct which will be populated with the
2465 * data.
2466 * @details If block_data->input_file_pos > 0 it is the position from where the
2467 * reading starts otherwise it starts from the current position.
2468 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2469 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2470 * compared to the md5 hash of the read contents to ensure valid data.
2471 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2472 * must be initialised before using it.
2473 * @pre \code block != 0 \endcode The block container (block) must be
2474 * initialised before using it.
2475 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2476 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2478 tng_function_status DECLSPECDLLEXPORT tng_block_read_next
2479 (tng_trajectory_t tng_data,
2480 tng_gen_block_t block_data,
2481 const char hash_mode);
2484 * @brief Read one frame set, including all particle mapping blocks and data
2485 * blocks, starting from the current file position.
2486 * @param tng_data is a trajectory data container.
2487 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2488 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2489 * compared to the md5 hash of the read contents to ensure valid data.
2490 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2491 * must be initialised before using it.
2492 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2493 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2495 tng_function_status DECLSPECDLLEXPORT tng_frame_set_read
2496 (tng_trajectory_t tng_data,
2497 const char hash_mode);
2500 * @brief Read data from the current frame set from the input_file. Only read
2501 * particle mapping and data blocks matching the specified block_id.
2502 * @param tng_data is a trajectory data container.
2503 * @details tng_data->input_file_path specifies
2504 * which file to read from. If the file (input_file) is not open it will be
2505 * opened.
2506 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2507 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2508 * compared to the md5 hash of the read contents to ensure valid data.
2509 * @param block_id is the ID of the data block to read from file.
2510 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2511 * must be initialised before using it.
2512 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2513 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2515 tng_function_status DECLSPECDLLEXPORT tng_frame_set_read_current_only_data_from_block_id
2516 (tng_trajectory_t tng_data,
2517 const char hash_mode,
2518 const int64_t block_id);
2521 * @brief Read one (the next) frame set, including particle mapping and related data blocks
2522 * from the input_file of tng_data.
2523 * @param tng_data is a trajectory data container.
2524 * @details tng_data->input_file_path specifies
2525 * which file to read from. If the file (input_file) is not open it will be
2526 * opened.
2527 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2528 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2529 * compared to the md5 hash of the read contents to ensure valid data.
2530 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2531 * must be initialised before using it.
2532 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2533 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2535 tng_function_status DECLSPECDLLEXPORT tng_frame_set_read_next
2536 (tng_trajectory_t tng_data,
2537 const char hash_mode);
2540 * @brief Read one (the next) frame set, including particle mapping and data blocks with a
2541 * specific block id from the input_file of tng_data.
2542 * @param tng_data is a trajectory data container.
2543 * @details tng_data->input_file_path specifies
2544 * which file to read from. If the file (input_file) is not open it will be
2545 * opened.
2546 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2547 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2548 * compared to the md5 hash of the read contents to ensure valid data.
2549 * @param block_id is the ID number of the blocks that should be read from file.
2550 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2551 * must be initialised before using it.
2552 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2553 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2555 tng_function_status DECLSPECDLLEXPORT tng_frame_set_read_next_only_data_from_block_id
2556 (tng_trajectory_t tng_data,
2557 const char hash_mode,
2558 const int64_t block_id);
2561 * @brief Write one frame set, including mapping and related data blocks
2562 * to the output_file of tng_data.
2563 * @param tng_data is a trajectory data container.
2564 * @details tng_data->output_file_path specifies
2565 * which file to write to. If the file (output_file) is not open it will be
2566 * opened.
2567 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2568 * If hash_mode == TNG_USE_HASH an md5 hash for each header block will be generated.
2569 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2570 * must be initialised before using it.
2571 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2572 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2574 tng_function_status DECLSPECDLLEXPORT tng_frame_set_write
2575 (tng_trajectory_t tng_data,
2576 const char hash_mode);
2579 * @brief Write one frame set even if it does not have as many frames as
2580 * expected. The function also writes mapping and related data blocks
2581 * to the output_file of tng_data.
2582 * @param tng_data is a trajectory data container.
2583 * @details tng_data->output_file_path specifies
2584 * which file to write to. If the file (output_file) is not open it will be
2585 * opened.
2586 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2587 * If hash_mode == TNG_USE_HASH an md5 hash for each header block will be generated.
2588 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2589 * must be initialised before using it.
2590 * @details The number of frames in the frame set is set to the number of
2591 * frames of the data blocks before writing it to disk.
2592 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2593 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2595 tng_function_status DECLSPECDLLEXPORT tng_frame_set_premature_write
2596 (tng_trajectory_t tng_data,
2597 const char hash_mode);
2600 * @brief Create and initialise a frame set.
2601 * @details Particle mappings are retained from previous frame set (if any).
2602 * To explicitly clear particle mappings use tng_frame_set_particle_mapping_free().
2603 * @param tng_data is the trajectory data container in which to add the frame
2604 * set.
2605 * @param first_frame is the first frame of the frame set.
2606 * @param n_frames is the number of frames in the frame set.
2607 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2608 * must be initialised before using it.
2609 * @pre \code first_frame >= 0 \endcode The first frame must not be negative.
2610 * @pre \code n_frames >= 0 \endcode The number of frames must not be negative.
2611 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2612 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2614 tng_function_status DECLSPECDLLEXPORT tng_frame_set_new
2615 (tng_trajectory_t tng_data,
2616 const int64_t first_frame,
2617 const int64_t n_frames);
2620 * @brief Create and initialise a frame set with the time of the first frame
2621 * specified.
2622 * @param tng_data is the trajectory data container in which to add the frame
2623 * set.
2624 * @param first_frame is the first frame of the frame set.
2625 * @param n_frames is the number of frames in the frame set.
2626 * @param first_frame_time is the time stamp of the first frame (in seconds).
2627 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2628 * must be initialised before using it.
2629 * @pre \code first_frame >= 0 \endcode The first frame must not be negative.
2630 * @pre \code n_frames >= 0 \endcode The number of frames must not be negative.
2631 * @pre \code first_frame_time >= 0 \endcode The time stamp of the first frame
2632 * must not be negative.
2633 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2634 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2636 tng_function_status DECLSPECDLLEXPORT tng_frame_set_with_time_new
2637 (tng_trajectory_t tng_data,
2638 const int64_t first_frame,
2639 const int64_t n_frames,
2640 const double first_frame_time);
2643 * @brief Set the time stamp of the first frame of the current frame set.
2644 * @param tng_data is the trajectory containing the frame set.
2645 * @param first_frame_time is the time stamp of the first frame in the
2646 * frame set.
2647 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2648 * must be initialised before using it.
2649 * @pre \code first_frame_time >= 0 \endcode The time stamp of the first frame
2650 * must not be negative.
2651 * @return TNG_SUCCESS (0) if successful.
2653 tng_function_status DECLSPECDLLEXPORT tng_frame_set_first_frame_time_set
2654 (tng_trajectory_t tng_data,
2655 const double first_frame_time);
2658 * @brief Read the number of the first frame of the next frame set.
2659 * @param tng_data is the trajectory containing the frame set.
2660 * @param frame is set to the frame number of the first frame in the
2661 * next frame set.
2662 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2663 * must be initialised before using it.
2664 * @pre \code tng_data->input_file != 0 \endcode An input file must be open
2665 * to find the next frame set.
2666 * @pre \code frame != 0 \endcode The pointer to the frame must not be a NULL
2667 * pointer.
2668 * @return TNG_SUCCESS(0) if successful, TNG_FAILURE(1) if there is no next
2669 * frame set or TNG_CRITICAL(2) if a major error has occured.
2671 tng_function_status DECLSPECDLLEXPORT tng_first_frame_nr_of_next_frame_set_get
2672 (const tng_trajectory_t tng_data,
2673 int64_t *frame);
2676 * @brief Add a non-particle dependent data block.
2677 * @param tng_data is the trajectory data container in which to add the data
2678 * block
2679 * @param id is the block ID of the block to add.
2680 * @param block_name is a descriptive name of the block to add
2681 * @param datatype is the datatype of the data in the block (e.g. int/float)
2682 * @param block_type_flag indicates if this is a non-trajectory block (added
2683 * directly to tng_data) or if it is a trajectory block (added to the
2684 * frame set)
2685 * @param n_frames is the number of frames of the data block (automatically
2686 * set to 1 if adding a non-trajectory data block)
2687 * @param n_values_per_frame is how many values a stored each frame (e.g. 9
2688 * for a box shape block)
2689 * @param stride_length is how many frames are between each entry in the
2690 * data block
2691 * @param codec_id is the ID of the codec to compress the data.
2692 * @param new_data is an array of data values to add.
2693 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2694 * must be initialised before using it.
2695 * @pre \code block_name != 0 \endcode The pointer to the block name must
2696 * not be a NULL pointer.
2697 * @pre \code n_values_per_frame > 0 \endcode n_values_per_frame must be
2698 * a positive integer.
2699 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2700 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2702 tng_function_status DECLSPECDLLEXPORT tng_data_block_add
2703 (tng_trajectory_t tng_data,
2704 const int64_t id,
2705 const char *block_name,
2706 const char datatype,
2707 const char block_type_flag,
2708 int64_t n_frames,
2709 const int64_t n_values_per_frame,
2710 int64_t stride_length,
2711 const int64_t codec_id,
2712 void *new_data);
2715 * @brief Add a particle dependent data block.
2716 * @param tng_data is the trajectory data container in which to add the data
2717 * block
2718 * @param id is the block ID of the block to add.
2719 * @param block_name is a descriptive name of the block to add
2720 * @param datatype is the datatype of the data in the block (e.g. int/float)
2721 * @param block_type_flag indicates if this is a non-trajectory block (added
2722 * directly to tng_data) or if it is a trajectory block (added to the
2723 * frame set)
2724 * @param n_frames is the number of frames of the data block (automatically
2725 * set to 1 if adding a non-trajectory data block)
2726 * @param n_values_per_frame is how many values a stored each frame (e.g. 9
2727 * for a box shape block)
2728 * @param stride_length is how many frames are between each entry in the
2729 * data block
2730 * @param num_first_particle is the number of the first particle stored
2731 * in this data block
2732 * @param n_particles is the number of particles stored in this data block
2733 * @param codec_id is the ID of the codec to compress the data.
2734 * @param new_data is an array of data values to add.
2735 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2736 * must be initialised before using it.
2737 * @pre \code block_name != 0 \endcode The pointer to the block name must
2738 * not be a NULL pointer.
2739 * @pre \code n_values_per_frame > 0 \endcode n_values_per_frame must be
2740 * a positive integer.
2741 * @pre \code num_first_particle >= 0 \endcode The number of the
2742 * first particle must be >= 0.
2743 * @pre \code n_particles >= 0 \endcode n_particles must be >= 0.
2744 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2745 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2747 tng_function_status DECLSPECDLLEXPORT tng_particle_data_block_add
2748 (tng_trajectory_t tng_data,
2749 const int64_t id,
2750 const char *block_name,
2751 const char datatype,
2752 const char block_type_flag,
2753 int64_t n_frames,
2754 const int64_t n_values_per_frame,
2755 int64_t stride_length,
2756 const int64_t num_first_particle,
2757 const int64_t n_particles,
2758 const int64_t codec_id,
2759 void *new_data);
2761 /** @brief Get the name of a data block of a specific ID.
2762 * @param tng_data is the trajectory data container.
2763 * @param block_id is the ID of the data block of which to get the name.
2764 * @param name is a string, which is set to the name of the data block.
2765 * Memory must be reserved beforehand.
2766 * @param max_len is the maximum length of name.
2767 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2768 * must be initialised before using it.
2769 * @pre \code name != 0 \endcode The pointer to the name string
2770 * must not be a NULL pointer.
2771 * @return TNG_SUCCESS (0) if the data block is found, TNG_FAILURE (1)
2772 * if a minor error has occured or the data block is not found or
2773 * TNG_CRITICAL (2) if a major error has occured.
2775 tng_function_status DECLSPECDLLEXPORT tng_data_block_name_get
2776 (tng_trajectory_t tng_data,
2777 int64_t block_id,
2778 char *name,
2779 int max_len);
2781 /** @brief Get the dependency of a data block of a specific ID.
2782 * @param tng_data is the trajectory data container.
2783 * @param block_id is the ID of the data block of which to get the name.
2784 * @param block_dependency is a pointer to the dependency of the data block.
2785 * If the block is frame dependent it will be set to TNG_FRAME_DEPENDENT,
2786 * if it is particle dependent it will be set to TNG_PARTICLE_DEPENDENT and
2787 * if it is both it will be set to TNG_FRAME_DEPENDENT & TNG_PARTICLE_DEPENDENT.
2788 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2789 * must be initialised before using it.
2790 * @pre \code block_dependency != 0 \endcode The pointer to the block dependency
2791 * must not be a NULL pointer.
2792 * @return TNG_SUCCESS (0) if the data block is found, TNG_FAILURE (1)
2793 * if a minor error has occured or the data block is not found or
2794 * TNG_CRITICAL (2) if a major error has occured.
2796 tng_function_status DECLSPECDLLEXPORT tng_data_block_dependency_get
2797 (const tng_trajectory_t tng_data,
2798 int64_t block_id,
2799 int *block_dependency);
2801 /** @brief Get the number of values per frame of a data block of a specific ID.
2802 * @param tng_data is the trajectory data container.
2803 * @param block_id is the ID of the data block of which to get the name.
2804 * @param n_values_per_frame is a pointer set to the number of values per frame.
2805 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2806 * must be initialised before using it.
2807 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of values
2808 * per frame must not be a NULL pointer.
2809 * @return TNG_SUCCESS (0) if the data block is found, TNG_FAILURE (1)
2810 * if a minor error has occured or the data block is not found or
2811 * TNG_CRITICAL (2) if a major error has occured.
2813 tng_function_status DECLSPECDLLEXPORT tng_data_block_num_values_per_frame_get
2814 (const tng_trajectory_t tng_data,
2815 int64_t block_id,
2816 int64_t *n_values_per_frame);
2819 * @brief Write data of one trajectory frame to the output_file of tng_data.
2820 * @param tng_data is a trajectory data container. tng_data->output_file_path
2821 * specifies which file to write to. If the file (output_file) is not open it
2822 * will be opened.
2823 * @param frame_nr is the index number of the frame to write.
2824 * @param block_id is the ID of the data block to write the data to.
2825 * @param values is an array of data to write. The length of the array should
2826 * equal n_values_per_frame.
2827 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2828 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2829 * compared to the md5 hash of the read contents to ensure valid data.
2830 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2831 * must be initialised before using it.
2832 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
2833 * @pre \code values != 0 \endcode The pointer to the values must not be a NULL
2834 * pointer.
2835 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2836 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2838 tng_function_status DECLSPECDLLEXPORT tng_frame_data_write
2839 (tng_trajectory_t tng_data,
2840 const int64_t frame_nr,
2841 const int64_t block_id,
2842 const void *values,
2843 const char hash_mode);
2846 * @brief Write particle data of one trajectory frame to the output_file of
2847 * tng_data.
2848 * @param tng_data is a trajectory data container. tng_data->output_file_path
2849 * specifies which file to write to. If the file (output_file) is not open it
2850 * will be opened.
2851 * @param frame_nr is the index number of the frame to write.
2852 * @param block_id is the ID of the data block to write the data to.
2853 * @param val_first_particle is the number of the first particle in the data
2854 * array.
2855 * @param val_n_particles is the number of particles in the data array.
2856 * @param values is a 1D-array of data to write. The length of the array should
2857 * equal n_particles * n_values_per_frame.
2858 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2859 * If hash_mode == TNG_USE_HASH the written md5 hash in the file will be
2860 * compared to the md5 hash of the read contents to ensure valid data.
2861 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2862 * must be initialised before using it.
2863 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
2864 * @pre \code val_first_particle >= 0 \endcode The number of the
2865 * first particle must be >= 0.
2866 * @pre \code val_n_particles >= 0 \endcode The number of particles must be >= 0.
2867 * @pre \code values != 0 \endcode The pointer to the values must not be a NULL
2868 * pointer.
2869 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2870 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2872 tng_function_status DECLSPECDLLEXPORT tng_frame_particle_data_write
2873 (tng_trajectory_t tng_data,
2874 const int64_t frame_nr,
2875 const int64_t block_id,
2876 const int64_t val_first_particle,
2877 const int64_t val_n_particles,
2878 const void *values,
2879 const char hash_mode);
2882 * @brief Free data of an array of values (2D).
2883 * @param tng_data is a trajectory data container.
2884 * @param values is the 2D array to free and will be set to 0 afterwards.
2885 * @param n_frames is the number of frames in the data array.
2886 * @param n_values_per_frame is the number of values per frame in the data array.
2887 * @param type is the data type of the data in the array (e.g. int/float/char).
2888 * @return TNG_SUCCESS (0) if successful.
2890 tng_function_status DECLSPECDLLEXPORT tng_data_values_free
2891 (const tng_trajectory_t tng_data,
2892 union data_values **values,
2893 const int64_t n_frames,
2894 const int64_t n_values_per_frame,
2895 const char type);
2898 * @brief Free data of an array of values (3D).
2899 * @param tng_data is a trajectory data container.
2900 * @param values is the array to free and will be set to 0 afterwards.
2901 * @param n_frames is the number of frames in the data array.
2902 * @param n_particles is the number of particles in the data array.
2903 * @param n_values_per_frame is the number of values per frame in the data array.
2904 * @param type is the data type of the data in the array (e.g. int/float/char).
2905 * @return TNG_SUCCESS (0) if successful.
2907 tng_function_status DECLSPECDLLEXPORT tng_particle_data_values_free
2908 (const tng_trajectory_t tng_data,
2909 union data_values ***values,
2910 const int64_t n_frames,
2911 const int64_t n_particles,
2912 const int64_t n_values_per_frame,
2913 const char type);
2916 * @brief Retrieve non-particle data, from the last read frame set. Obsolete!
2917 * @param tng_data is a trajectory data container. tng_data->input_file_path specifies
2918 * which file to read from. If the file (input_file) is not open it will be
2919 * opened.
2920 * @param block_id is the id number of the particle data block to read.
2921 * @param values is a pointer to a 2-dimensional array (memory unallocated), which
2922 * will be filled with data. The array will be sized
2923 * (n_frames * n_values_per_frame).
2924 * Since ***values is allocated in this function it is the callers
2925 * responsibility to free the memory.
2926 * @param n_frames is set to the number of frames in the returned data. This is
2927 * needed to properly reach and/or free the data afterwards.
2928 * @param n_values_per_frame is set to the number of values per frame in the data.
2929 * This is needed to properly reach and/or free the data afterwards.
2930 * @param type is set to the data type of the data in the array.
2931 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2932 * must be initialised before using it.
2933 * @pre \code n_frames != 0 \endcode The pointer to the number of frames
2934 * must not be a NULL pointer.
2935 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
2936 * values per frame must not be a NULL pointer.
2937 * @pre \code type != 0 \endcode The pointer to the data type must not
2938 * be a NULL pointer.
2939 * @details This function is obsolete and only retained for compatibility. Use
2940 * tng_data_vector_get() instead.
2941 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2942 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2944 tng_function_status DECLSPECDLLEXPORT tng_data_get(tng_trajectory_t tng_data,
2945 const int64_t block_id,
2946 union data_values ***values,
2947 int64_t *n_frames,
2948 int64_t *n_values_per_frame,
2949 char *type);
2952 * @brief Retrieve a vector (1D array) of non-particle data, from the last read frame set.
2953 * @param tng_data is a trajectory data container. tng_data->input_file_path specifies
2954 * which file to read from. If the file (input_file) is not open it will be
2955 * opened.
2956 * @param block_id is the id number of the particle data block to read.
2957 * @param values is a pointer to a 1-dimensional array (memory unallocated), which
2958 * will be filled with data. The length of the array will be (n_frames * n_values_per_frame).
2959 * Since **values is allocated in this function it is the callers
2960 * responsibility to free the memory.
2961 * @param n_frames is set to the number of particles in the returned data. This is
2962 * needed to properly reach and/or free the data afterwards.
2963 * @param stride_length is set to the stride length of the returned data.
2964 * @param n_values_per_frame is set to the number of values per frame in the data.
2965 * This is needed to properly reach and/or free the data afterwards.
2966 * @param type is set to the data type of the data in the array.
2967 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
2968 * must be initialised before using it.
2969 * @pre \code n_frames != 0 \endcode The pointer to the number of frames
2970 * must not be a NULL pointer.
2971 * @pre \code stride_length != 0 \endcode The pointer to the stride length
2972 * must not be a NULL pointer.
2973 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
2974 * values per frame must not be a NULL pointer.
2975 * @pre \code type != 0 \endcode The pointer to the data type must not
2976 * be a NULL pointer.
2977 * @details This does only work for numerical (int, float, double) data.
2978 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
2979 * has occurred or TNG_CRITICAL (2) if a major error has occured.
2981 tng_function_status DECLSPECDLLEXPORT tng_data_vector_get
2982 (tng_trajectory_t tng_data,
2983 const int64_t block_id,
2984 void **values,
2985 int64_t *n_frames,
2986 int64_t *stride_length,
2987 int64_t *n_values_per_frame,
2988 char *type);
2991 * @brief Read and retrieve non-particle data, in a specific interval. Obsolete!
2992 * @param tng_data is a trajectory data container. tng_data->input_file_path specifies
2993 * which file to read from. If the file (input_file) is not open it will be
2994 * opened.
2995 * @param block_id is the id number of the particle data block to read.
2996 * @param start_frame_nr is the index number of the first frame to read.
2997 * @param end_frame_nr is the index number of the last frame to read.
2998 * @param hash_mode is an option to decide whether to use the md5 hash or not.
2999 * If hash_mode == TNG_USE_HASH the md5 hash in the file will be
3000 * compared to the md5 hash of the read contents to ensure valid data.
3001 * @param values is a pointer to a 2-dimensional array (memory unallocated), which
3002 * will be filled with data. The array will be sized
3003 * (n_frames * n_values_per_frame).
3004 * Since ***values is allocated in this function it is the callers
3005 * responsibility to free the memory.
3006 * @param n_values_per_frame is set to the number of values per frame in the data.
3007 * This is needed to properly reach and/or free the data afterwards.
3008 * @param type is set to the data type of the data in the array.
3009 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3010 * must be initialised before using it.
3011 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3012 * the last frame.
3013 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
3014 * values per frame must not be a NULL pointer.
3015 * @pre \code type != 0 \endcode The pointer to the data type must not
3016 * be a NULL pointer.
3017 * @details This function is obsolete and only retained for compatibility. Use
3018 * tng_data_vector_interval_get() instead.
3019 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3020 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3022 tng_function_status DECLSPECDLLEXPORT tng_data_interval_get
3023 (tng_trajectory_t tng_data,
3024 const int64_t block_id,
3025 const int64_t start_frame_nr,
3026 const int64_t end_frame_nr,
3027 const char hash_mode,
3028 union data_values ***values,
3029 int64_t *n_values_per_frame,
3030 char *type);
3033 * @brief Read and retrieve a vector (1D array) of non-particle data,
3034 * in a specific interval.
3035 * @param tng_data is a trajectory data container. tng_data->input_file_path specifies
3036 * which file to read from. If the file (input_file) is not open it will be
3037 * opened.
3038 * @param block_id is the id number of the particle data block to read.
3039 * @param start_frame_nr is the index number of the first frame to read.
3040 * @param end_frame_nr is the index number of the last frame to read.
3041 * @param hash_mode is an option to decide whether to use the md5 hash or not.
3042 * If hash_mode == TNG_USE_HASH the md5 hash in the file will be
3043 * compared to the md5 hash of the read contents to ensure valid data.
3044 * @param values is a pointer to a 1-dimensional array (memory unallocated), which
3045 * will be filled with data. The length of the array will be (n_frames * n_values_per_frame).
3046 * Since **values is allocated in this function it is the callers
3047 * responsibility to free the memory.
3048 * @param stride_length is set to the stride length (writing interval) of
3049 * the data.
3050 * @param n_values_per_frame is set to the number of values per frame in the data.
3051 * This is needed to properly reach and/or free the data afterwards.
3052 * @param type is set to the data type of the data in the array.
3053 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3054 * must be initialised before using it.
3055 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3056 * the last frame.
3057 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3058 * must not be a NULL pointer.
3059 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
3060 * values per frame must not be a NULL pointer.
3061 * @pre \code type != 0 \endcode The pointer to the data type must not
3062 * be a NULL pointer.
3063 * @details This does only work for numerical (int, float, double) data.
3064 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3065 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3067 tng_function_status DECLSPECDLLEXPORT tng_data_vector_interval_get
3068 (tng_trajectory_t tng_data,
3069 const int64_t block_id,
3070 const int64_t start_frame_nr,
3071 const int64_t end_frame_nr,
3072 const char hash_mode,
3073 void **values,
3074 int64_t *stride_length,
3075 int64_t *n_values_per_frame,
3076 char *type);
3079 * @brief Retrieve particle data, from the last read frame set. Obsolete!
3080 * @details The particle dimension of the returned values array is translated
3081 * to real particle numbering, i.e. the numbering of the actual molecular
3082 * system.
3083 * @param tng_data is a trajectory data container. tng_data->input_file_path
3084 * specifies which file to read from. If the file (input_file) is not open it
3085 * will be opened.
3086 * @param block_id is the id number of the particle data block to read.
3087 * @param values is a pointer to a 3-dimensional array (memory unallocated), which
3088 * will be filled with data. The array will be sized
3089 * (n_frames * n_particles * n_values_per_frame).
3090 * Since ****values is allocated in this function it is the callers
3091 * responsibility to free the memory.
3092 * @param n_frames is set to the number of frames in the returned data. This is
3093 * needed to properly reach and/or free the data afterwards.
3094 * @param n_particles is set to the number of particles in the returned data. This is
3095 * needed to properly reach and/or free the data afterwards.
3096 * @param n_values_per_frame is set to the number of values per frame in the data.
3097 * This is needed to properly reach and/or free the data afterwards.
3098 * @param type is set to the data type of the data in the array.
3099 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3100 * must be initialised before using it.
3101 * @pre \code n_frames != 0 \endcode The pointer to the number of frames
3102 * must not be a NULL pointer.
3103 * @pre \code n_particles != 0 \endcode The pointer to the number of particles must
3104 * not be a NULL pointer.
3105 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
3106 * values per frame must not be a NULL pointer.
3107 * @pre \code type != 0 \endcode The pointer to the data type must not
3108 * be a NULL pointer.
3109 * @details This function is obsolete and only retained for compatibility. Use
3110 * tng_particle_data_vector_get() instead.
3111 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3112 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3114 tng_function_status DECLSPECDLLEXPORT tng_particle_data_get
3115 (tng_trajectory_t tng_data,
3116 const int64_t block_id,
3117 union data_values ****values,
3118 int64_t *n_frames,
3119 int64_t *n_particles,
3120 int64_t *n_values_per_frame,
3121 char *type);
3124 * @brief Retrieve a vector (1D array) of particle data, from the last read frame set.
3125 * @details The particle dimension of the returned values array is translated
3126 * to real particle numbering, i.e. the numbering of the actual molecular
3127 * system.
3128 * @param tng_data is a trajectory data container. tng_data->input_file_path
3129 * specifies which file to read from. If the file (input_file) is not open it
3130 * will be opened.
3131 * @param block_id is the id number of the particle data block to read.
3132 * @param values is a pointer to a 1-dimensional array (memory unallocated), which
3133 * will be filled with data. The length of the array will be
3134 * (n_frames * n_particles * n_values_per_frame).
3135 * Since **values is allocated in this function it is the callers
3136 * responsibility to free the memory.
3137 * @param n_frames is set to the number of frames in the returned data. This is
3138 * needed to properly reach and/or free the data afterwards.
3139 * @param stride_length is set to the stride length of the returned data.
3140 * @param n_particles is set to the number of particles in the returned data. This is
3141 * needed to properly reach and/or free the data afterwards.
3142 * @param n_values_per_frame is set to the number of values per frame in the data.
3143 * This is needed to properly reach and/or free the data afterwards.
3144 * @param type is set to the data type of the data in the array.
3145 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3146 * must be initialised before using it.
3147 * @pre \code n_particles != 0 \endcode The pointer to the number of particles must
3148 * not be a NULL pointer.
3149 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3150 * must not be a NULL pointer.
3151 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
3152 * values per frame must not be a NULL pointer.
3153 * @pre \code type != 0 \endcode The pointer to the data type must not
3154 * be a NULL pointer.
3155 * @details This does only work for numerical (int, float, double) data.
3156 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3157 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3159 tng_function_status DECLSPECDLLEXPORT tng_particle_data_vector_get
3160 (tng_trajectory_t tng_data,
3161 const int64_t block_id,
3162 void **values,
3163 int64_t *n_frames,
3164 int64_t *stride_length,
3165 int64_t *n_particles,
3166 int64_t *n_values_per_frame,
3167 char *type);
3170 * @brief Read and retrieve particle data, in a specific interval. Obsolete!
3171 * @details The particle dimension of the returned values array is translated
3172 * to real particle numbering, i.e. the numbering of the actual molecular
3173 * system.
3174 * @param tng_data is a trajectory data container. tng_data->input_file_path specifies
3175 * which file to read from. If the file (input_file) is not open it will be
3176 * opened.
3177 * @param block_id is the id number of the particle data block to read.
3178 * @param start_frame_nr is the index number of the first frame to read.
3179 * @param end_frame_nr is the index number of the last frame to read.
3180 * @param hash_mode is an option to decide whether to use the md5 hash or not.
3181 * If hash_mode == TNG_USE_HASH the md5 hash in the file will be
3182 * compared to the md5 hash of the read contents to ensure valid data.
3183 * @param values is a pointer to a 3-dimensional array (memory unallocated), which
3184 * will be filled with data. The array will be sized
3185 * (n_frames * n_particles * n_values_per_frame).
3186 * Since ****values is allocated in this function it is the callers
3187 * responsibility to free the memory.
3188 * @param n_particles is set to the number of particles in the returned data. This is
3189 * needed to properly reach and/or free the data afterwards.
3190 * @param n_values_per_frame is set to the number of values per frame in the data.
3191 * This is needed to properly reach and/or free the data afterwards.
3192 * @param type is set to the data type of the data in the array.
3193 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3194 * must be initialised before using it.
3195 * @pre \code n_frames != 0 \endcode The pointer to the number of frames
3196 * must not be a NULL pointer.
3197 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3198 * the last frame.
3199 * @pre \code n_particles != 0 \endcode The pointer to the number of particles must
3200 * not be a NULL pointer.
3201 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
3202 * values per frame must not be a NULL pointer.
3203 * @pre \code type != 0 \endcode The pointer to the data type must not
3204 * be a NULL pointer.
3205 * @details This function is obsolete and only retained for compatibility. Use
3206 * tng_particle_data_vector_interval_get() instead.
3207 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3208 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3210 tng_function_status DECLSPECDLLEXPORT tng_particle_data_interval_get
3211 (tng_trajectory_t tng_data,
3212 const int64_t block_id,
3213 const int64_t start_frame_nr,
3214 const int64_t end_frame_nr,
3215 const char hash_mode,
3216 union data_values ****values,
3217 int64_t *n_particles,
3218 int64_t *n_values_per_frame,
3219 char *type);
3222 * @brief Read and retrieve a vector (1D array) particle data, in a
3223 * specific interval.
3224 * @details The particle dimension of the returned values array is translated
3225 * to real particle numbering, i.e. the numbering of the actual molecular
3226 * system.
3227 * @param tng_data is a trajectory data container. tng_data->input_file_path specifies
3228 * which file to read from. If the file (input_file) is not open it will be
3229 * opened.
3230 * @param block_id is the id number of the particle data block to read.
3231 * @param start_frame_nr is the index number of the first frame to read.
3232 * @param end_frame_nr is the index number of the last frame to read.
3233 * @param hash_mode is an option to decide whether to use the md5 hash or not.
3234 * If hash_mode == TNG_USE_HASH the md5 hash in the file will be
3235 * compared to the md5 hash of the read contents to ensure valid data.
3236 * @param values is a pointer to a 1-dimensional array (memory unallocated), which
3237 * will be filled with data. The length of the array will be
3238 * (n_frames * n_particles * n_values_per_frame).
3239 * Since **values is allocated in this function it is the callers
3240 * responsibility to free the memory.
3241 * @param stride_length is set to the stride length (writing interval) of
3242 * the data.
3243 * @param n_particles is set to the number of particles in the returned data. This is
3244 * needed to properly reach and/or free the data afterwards.
3245 * @param n_values_per_frame is set to the number of values per frame in the data.
3246 * This is needed to properly reach and/or free the data afterwards.
3247 * @param type is set to the data type of the data in the array.
3248 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3249 * must be initialised before using it.
3250 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3251 * the last frame.
3252 * @pre \code n_particles != 0 \endcode The pointer to the number of particles must
3253 * not be a NULL pointer.
3254 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3255 * must not be a NULL pointer.
3256 * @pre \code n_values_per_frame != 0 \endcode The pointer to the number of
3257 * values per frame must not be a NULL pointer.
3258 * @pre \code type != 0 \endcode The pointer to the data type must not
3259 * be a NULL pointer.
3260 * @details This does only work for numerical (int, float, double) data.
3261 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3262 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3264 tng_function_status DECLSPECDLLEXPORT tng_particle_data_vector_interval_get
3265 (tng_trajectory_t tng_data,
3266 const int64_t block_id,
3267 const int64_t start_frame_nr,
3268 const int64_t end_frame_nr,
3269 const char hash_mode,
3270 void **values,
3271 int64_t *n_particles,
3272 int64_t *stride_length,
3273 int64_t *n_values_per_frame,
3274 char *type);
3277 * @brief Get the stride length of a specific data (particle dependency does not matter)
3278 * block, either in the current frame set or of a specific frame.
3279 * @param tng_data is the trajectory data container.
3280 * @param block_id is the block ID of the data block, of which to retrieve the
3281 * stride length of the data.
3282 * @param frame is the frame from which to get the stride length. If frame is set to -1
3283 * no specific frame will be used, but instead the first frame, starting from the last read
3284 * frame set, containing the data block will be used.
3285 * @param stride_length is set to the value of the stride length of the data block.
3286 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3287 * has occurred or TNG_CRITICAL (2) if a major error has occured.
3289 tng_function_status DECLSPECDLLEXPORT tng_data_get_stride_length
3290 (const tng_trajectory_t tng_data,
3291 const int64_t block_id,
3292 int64_t frame,
3293 int64_t *stride_length);
3296 * @brief Get the date and time of initial file creation in ISO format (string).
3297 * @param tng_data is a trajectory data container.
3298 * @param time is a pointer to the string in which the date will be stored. Memory
3299 * must be reserved beforehand.
3300 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3301 * must be initialised before using it.
3302 * @pre \code time != 0 \endcode The pointer to the time must not be a NULL
3303 * pointer.
3304 * @return TNG_SUCCESS (0) if successful.
3306 tng_function_status DECLSPECDLLEXPORT tng_time_get_str
3307 (const tng_trajectory_t tng_data,
3308 char *time);
3309 /** @} */ /* end of group1 */
3311 /** @defgroup group2 High-level API
3312 * These functions make it easier to access and output TNG data. They
3313 * are recommended unless there is a special reason to use the more
3314 * detailed functions available in the low-level API.
3315 * @{
3319 * @brief High-level function for opening and initializing a TNG trajectory.
3320 * @param filename is a string containing the name of the trajectory to open.
3321 * @param mode specifies the file mode of the trajectory. Can be set to 'r',
3322 * 'w' or 'a' for reading, writing or appending respectively.
3323 * @param tng_data_p is a pointer to the opened trajectory. This will be
3324 * allocated by the TNG library. The trajectory must be
3325 * closed by the user, whereby memory is freed.
3326 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3327 * must be initialised before using it.
3328 * @pre \code filename != 0 \endcode The pointer to the filename must not be a
3329 * NULL pointer.
3330 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3331 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3332 * has occured.
3334 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_open
3335 (const char *filename,
3336 const char mode,
3337 tng_trajectory_t *tng_data_p);
3340 * @brief High-level function for closing a TNG trajectory.
3341 * @param tng_data_p is a pointer to the trajectory to close. The memory
3342 * will be freed after finalising the writing.
3343 * @return TNG_SUCCESS (0) if successful.
3345 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_close
3346 (tng_trajectory_t *tng_data_p);
3349 * @brief High-level function for getting the time (in seconds) of a frame.
3350 * @param tng_data is the trajectory containing the frame.
3351 * @param frame_nr is the frame number of which to get the time.
3352 * @param time is set to the time (in seconds) of the specified frame.
3353 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3354 * must be initialised before using it.
3355 * @pre \code time != 0 \endcode The pointer to the time must not be a
3356 * NULL pointer.
3357 * @return TNG_SUCCESS (0) if successful or TNG_FAILURE (1) if a
3358 * minor error has occured.
3360 tng_function_status DECLSPECDLLEXPORT tng_util_time_of_frame_get
3361 (tng_trajectory_t tng_data,
3362 const int64_t frame_nr,
3363 double *time);
3366 * @brief High-level function for getting the molecules in the mol system.
3367 * @param tng_data is the trajectory containing the mol system.
3368 * @param n_mols is set to the number of molecules in the system.
3369 * @param molecule_cnt_list will be pointing to the list of counts of each molecule
3370 * in the mol system.
3371 * @param mols pointing to the list of molecules in the mol system.
3372 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3373 * must be initialised before using it.
3374 * @pre \code n_mols != 0 \endcode The pointer to the number of molecules must
3375 * not be a NULL pointer.
3376 * @return TNG_SUCCESS (0) if successful.
3378 /*tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_molecules_get
3379 (tng_trajectory_t tng_data,
3380 int64_t *n_mols,
3381 int64_t **molecule_cnt_list,
3382 tng_molecule_t *mols);
3385 * @brief High-level function for adding a molecule to the mol system.
3386 * @param tng_data is the trajectory containing the mol system.
3387 * @param name is the name of the molecule to add.
3388 * @param cnt is the count of the molecule.
3389 * @param mol is set to point to the newly created molecule.
3390 * @pre \code name != 0 \endcode The pointer to the name must not be a
3391 * NULL pointer.
3392 * @pre \code cnt >= 0 \endcode The requested count must be >= 0.
3393 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3394 * has occured or TNG_CRITICAL (2) if a major error has occured.
3396 /*tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_molecule_add
3397 (tng_trajectory_t tng_data,
3398 const char *name,
3399 const int64_t cnt,
3400 tng_molecule_t *mol);
3403 // tng_function_status DECLSPECDLLEXPORT tng_util_molecule_particles_get
3404 // (tng_trajectory_t tng_data,
3405 // const tng_molecule_t mol,
3406 // int64_t *n_particles,
3407 // char ***names,
3408 // char ***types,
3409 // char ***res_names,
3410 // int64_t **res_ids,
3411 // char ***chain_names,
3412 // int64_t **chain_ids);
3414 // tng_function_status DECLSPECDLLEXPORT tng_util_molecule_particles_set
3415 // (tng_trajectory_t tng_data,
3416 // tng_molecule_t mol,
3417 // const int64_t n_particles,
3418 // const char **names,
3419 // const char **types,
3420 // const char **res_names,
3421 // const int64_t *res_ids,
3422 // const char **chain_names,
3423 // const int64_t *chain_ids);
3426 * @brief High-level function for reading the positions of all particles
3427 * from all frames.
3428 * @param tng_data is the trajectory to read from.
3429 * @param positions will be set to point at a 1-dimensional array of floats,
3430 * which will contain the positions. The data is stored sequentially in order
3431 * of frames. For each frame the positions (x, y and z coordinates) are stored.
3432 * The variable may point at already allocated memory or be a NULL pointer.
3433 * The memory must be freed afterwards.
3434 * @param stride_length will be set to the writing interval of the stored data.
3435 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3436 * must be initialised before using it.
3437 * @pre \code positions != 0 \endcode The pointer to the positions array
3438 * must not be a NULL pointer.
3439 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3440 * must not be a NULL pointer.
3441 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3442 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3443 * has occured.
3445 tng_function_status DECLSPECDLLEXPORT tng_util_pos_read
3446 (tng_trajectory_t tng_data,
3447 float **positions,
3448 int64_t *stride_length);
3451 * @brief High-level function for reading the velocities of all particles
3452 * from all frames.
3453 * @param tng_data is the trajectory to read from.
3454 * @param velocities will be set to point at a 1-dimensional array of floats,
3455 * which will contain the velocities. The data is stored sequentially in order
3456 * of frames. For each frame the velocities (in x, y and z) are stored. The
3457 * variable may point at already allocated memory or be a NULL pointer.
3458 * The memory must be freed afterwards.
3459 * @param stride_length will be set to the writing interval of the stored data.
3460 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3461 * must be initialised before using it.
3462 * @pre \code velocities != 0 \endcode The pointer to the velocities array
3463 * must not be a NULL pointer.
3464 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3465 * must not be a NULL pointer.
3466 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3467 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3468 * has occured.
3470 tng_function_status DECLSPECDLLEXPORT tng_util_vel_read
3471 (tng_trajectory_t tng_data,
3472 float **velocities,
3473 int64_t *stride_length);
3476 * @brief High-level function for reading the forces of all particles
3477 * from all frames.
3478 * @param tng_data is the trajectory to read from.
3479 * @param forces will be set to point at a 1-dimensional array of floats,
3480 * which will contain the forces. The data is stored sequentially in order
3481 * of frames. For each frame the forces (in x, y and z) are stored. The
3482 * variable may point at already allocated memory or be a NULL pointer.
3483 * The memory must be freed afterwards.
3484 * @param stride_length will be set to the writing interval of the stored data.
3485 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3486 * must be initialised before using it.
3487 * @pre \code forces != 0 \endcode The pointer to the forces array
3488 * must not be a NULL pointer.
3489 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3490 * must not be a NULL pointer.
3491 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3492 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3493 * has occured.
3495 tng_function_status DECLSPECDLLEXPORT tng_util_force_read
3496 (tng_trajectory_t tng_data,
3497 float **forces,
3498 int64_t *stride_length);
3501 * @brief High-level function for reading the box shape from all frames.
3502 * @param tng_data is the trajectory to read from.
3503 * @param box_shape will be set to point at a 1-dimensional array of floats,
3504 * which will contain the box shape. The data is stored sequentially in order
3505 * of frames. The variable may point at already allocated memory or be a NULL pointer.
3506 * If the box shape is not modified during the trajectory, but as general data,
3507 * that will be returned instead.
3508 * @param stride_length will be set to the writing interval of the stored data.
3509 * @details This function should only be used if number of values used to specify
3510 * the box shape is known (by default TNG uses 9 values) since it does not
3511 * return the number of values in the array. It is recommended to use
3512 * tng_data_vector_interval_get() instead.
3513 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3514 * must be initialised before using it.
3515 * @pre \code box_shape != 0 \endcode The pointer to the box_shape array
3516 * must not be a NULL pointer.
3517 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3518 * must not be a NULL pointer.
3519 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3520 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3521 * has occured.
3523 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_read
3524 (tng_trajectory_t tng_data,
3525 float **box_shape,
3526 int64_t *stride_length);
3529 * @brief High-level function for reading the next frame of particle-dependent
3530 * data of a specific type.
3531 * @param tng_data is the trajectory to read from.
3532 * @param block_id is the ID number of the block containing the data of interest.
3533 * @param values will be set to point at a 1-dimensional array containing the
3534 * requested data. The variable may point at already allocated memory or be a
3535 * NULL pointer. The memory must be freed afterwards.
3536 * @param data_type will be pointing to a character indicating the size of the
3537 * data of the returned values, e.g. TNG_INT_DATA, TNG_FLOAT_DATA or TNG_DOUBLE_DATA.
3538 * @param retrieved_frame_number will be pointing at the frame number of the
3539 * returned frame.
3540 * @param retrieved_time will be pointing at the time stamp of the returned
3541 * frame.
3542 * @details If no frame has been read before the first frame of the trajectory
3543 * is read.
3544 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3545 * must be initialised before using it.
3546 * @pre \code values != 0 \endcode The pointer to the values array
3547 * must not be a NULL pointer.
3548 * @pre \code data_type != 0 \endcode The pointer to the data type of the
3549 * returned data must not be a NULL pointer.
3550 * @pre \code retrieved_frame_number != 0 \endcode The pointer to the frame
3551 * number of the returned data must not be a NULL pointer.
3552 * @pre \code retrieved_time != 0 \endcode The pointer to the time of the
3553 * returned data must not be a NULL pointer.
3554 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3555 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3556 * has occured.
3558 tng_function_status DECLSPECDLLEXPORT tng_util_particle_data_next_frame_read
3559 (tng_trajectory_t tng_data,
3560 const int64_t block_id,
3561 void **values,
3562 char *data_type,
3563 int64_t *retrieved_frame_number,
3564 double *retrieved_time);
3567 * @brief High-level function for reading the next frame of non-particle-dependent
3568 * data of a specific type.
3569 * @param tng_data is the trajectory to read from.
3570 * @param block_id is the ID number of the block containing the data of interest.
3571 * @param values will be set to point at a 1-dimensional array containing the
3572 * requested data. The variable may point at already allocated memory or be a
3573 * NULL pointer. The memory must be freed afterwards.
3574 * @param data_type will be pointing to a character indicating the size of the
3575 * data of the returned values, e.g. TNG_INT_DATA, TNG_FLOAT_DATA or TNG_DOUBLE_DATA.
3576 * @param retrieved_frame_number will be pointing at the frame number of the
3577 * returned frame.
3578 * @param retrieved_time will be pointing at the time stamp of the returned
3579 * frame.
3580 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3581 * must be initialised before using it.
3582 * @pre \code values != 0 \endcode The pointer to the values array
3583 * must not be a NULL pointer.
3584 * @pre \code data_type != 0 \endcode The pointer to the data type of the
3585 * returned data must not be a NULL pointer.
3586 * @pre \code retrieved_frame_number != 0 \endcode The pointer to the frame
3587 * number of the returned data must not be a NULL pointer.
3588 * @pre \code retrieved_time != 0 \endcode The pointer to the time of the
3589 * returned data must not be a NULL pointer.
3590 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3591 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3592 * has occured.
3594 tng_function_status DECLSPECDLLEXPORT tng_util_non_particle_data_next_frame_read
3595 (tng_trajectory_t tng_data,
3596 const int64_t block_id,
3597 void **values,
3598 char *data_type,
3599 int64_t *retrieved_frame_number,
3600 double *retrieved_time);
3603 * @brief High-level function for reading the positions of all particles
3604 * from a specific range of frames.
3605 * @param tng_data is the trajectory to read from.
3606 * @param first_frame is the first frame to return position data from.
3607 * @param last_frame is the last frame to return position data from.
3608 * @param positions will be set to point at a 1-dimensional array of floats,
3609 * which will contain the positions. The data is stored sequentially in order
3610 * of frames. For each frame the positions (x, y and z coordinates) are stored.
3611 * The variable may point at already allocated memory or be a NULL pointer.
3612 * The memory must be freed afterwards.
3613 * @param stride_length will be set to the writing interval of the stored data.
3614 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3615 * must be initialised before using it.
3616 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3617 * the last frame.
3618 * @pre \code positions != 0 \endcode The pointer to the positions array
3619 * must not be a NULL pointer.
3620 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3621 * must not be a NULL pointer.
3622 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3623 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3624 * has occured.
3626 tng_function_status DECLSPECDLLEXPORT tng_util_pos_read_range
3627 (tng_trajectory_t tng_data,
3628 const int64_t first_frame,
3629 const int64_t last_frame,
3630 float **positions,
3631 int64_t *stride_length);
3634 * @brief High-level function for reading the velocities of all particles
3635 * from a specific range of frames.
3636 * @param tng_data is the trajectory to read from.
3637 * @param first_frame is the first frame to return position data from.
3638 * @param last_frame is the last frame to return position data from.
3639 * @param velocities will be set to point at a 1-dimensional array of floats,
3640 * which will contain the velocities. The data is stored sequentially in order
3641 * of frames. For each frame the velocities (in x, y and z) are stored. The
3642 * variable may point at already allocated memory or be a NULL pointer.
3643 * The memory must be freed afterwards.
3644 * @param stride_length will be set to the writing interval of the stored data.
3645 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3646 * must be initialised before using it.
3647 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3648 * the last frame.
3649 * @pre \code velocities != 0 \endcode The pointer to the velocities array
3650 * must not be a NULL pointer.
3651 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3652 * must not be a NULL pointer.
3653 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3654 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3655 * has occured.
3657 tng_function_status DECLSPECDLLEXPORT tng_util_vel_read_range
3658 (tng_trajectory_t tng_data,
3659 const int64_t first_frame,
3660 const int64_t last_frame,
3661 float **velocities,
3662 int64_t *stride_length);
3665 * @brief High-level function for reading the forces of all particles
3666 * from a specific range of frames.
3667 * @param tng_data is the trajectory to read from.
3668 * @param first_frame is the first frame to return position data from.
3669 * @param last_frame is the last frame to return position data from.
3670 * @param forces will be set to point at a 1-dimensional array of floats,
3671 * which will contain the forces. The data is stored sequentially in order
3672 * of frames. For each frame the forces (in x, y and z) are stored. The
3673 * variable may point at already allocated memory or be a NULL pointer.
3674 * The memory must be freed afterwards.
3675 * @param stride_length will be set to the writing interval of the stored data.
3676 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3677 * must be initialised before using it.
3678 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3679 * the last frame.
3680 * @pre \code forces != 0 \endcode The pointer to the forces array
3681 * must not be a NULL pointer.
3682 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3683 * must not be a NULL pointer.
3684 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3685 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3686 * has occured.
3688 tng_function_status DECLSPECDLLEXPORT tng_util_force_read_range
3689 (tng_trajectory_t tng_data,
3690 const int64_t first_frame,
3691 const int64_t last_frame,
3692 float **forces,
3693 int64_t *stride_length);
3696 * @brief High-level function for reading the box shape
3697 * from a specific range of frames.
3698 * @param tng_data is the trajectory to read from.
3699 * @param first_frame is the first frame to return position data from.
3700 * @param last_frame is the last frame to return position data from.
3701 * @param box_shape will be set to point at a 1-dimensional array of floats,
3702 * which will contain the box shape. The data is stored sequentially in order
3703 * of frames.
3704 * If the box shape is not modified during the trajectory, but as general data,
3705 * that will be returned instead. The
3706 * variable may point at already allocated memory or be a NULL pointer.
3707 * The memory must be freed afterwards.
3708 * @param stride_length will be set to the writing interval of the stored data.
3709 * @details This function should only be used if number of values used to specify
3710 * the box shape is known (by default TNG uses 9 values) since it does not
3711 * return the number of values in the array. It is recommended to use
3712 * tng_data_vector_interval_get() instead.
3713 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3714 * must be initialised before using it.
3715 * @pre \code start_frame_nr <= end_frame_nr \endcode The first frame must be before
3716 * the last frame.
3717 * @pre \code box_shape != 0 \endcode The pointer to the box_shape array
3718 * must not be a NULL pointer.
3719 * @pre \code stride_length != 0 \endcode The pointer to the stride length
3720 * must not be a NULL pointer.
3721 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3722 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3723 * has occured.
3725 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_read_range
3726 (tng_trajectory_t tng_data,
3727 const int64_t first_frame,
3728 const int64_t last_frame,
3729 float **box_shape,
3730 int64_t *stride_length);
3733 * @brief High-level function for setting the writing interval of data blocks.
3734 * @param tng_data is the trajectory to use.
3735 * @param i is the output interval, i.e. i == 10 means data written every 10th
3736 * frame.
3737 * @param n_values_per_frame is the number of values to store per frame. If the
3738 * data is particle dependent there will be n_values_per_frame stored per
3739 * particle each frame.
3740 * @param block_id is the ID of the block, of which to set the output interval.
3741 * @param block_name is a string that will be used as name of the block. Only
3742 * required if the block did not exist, i.e. a new block is created.
3743 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
3744 * data is not related to specific particles (e.g. box shape) or
3745 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
3746 * positions). Only required if the block did not exist, i.e. a new block is
3747 * created.
3748 * @param compression is the compression routine to use when writing the data.
3749 * Only required if the block did not exist, i.e. a new block is created.
3750 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3751 * must be initialised before using it.
3752 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3753 * @details n_values_per_frame, block_name, particle_dependency and
3754 * compression are only used if the data block did not exist before calling
3755 * this function, in which case it is created.
3756 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3757 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3758 * has occured.
3760 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_interval_set
3761 (tng_trajectory_t tng_data,
3762 const int64_t i,
3763 const int64_t n_values_per_frame,
3764 const int64_t block_id,
3765 const char *block_name,
3766 const char particle_dependency,
3767 const char compression);
3770 * @brief High-level function for setting the writing interval of data blocks
3771 * containing double precision data.
3772 * @param tng_data is the trajectory to use.
3773 * @param i is the output interval, i.e. i == 10 means data written every 10th
3774 * frame.
3775 * @param n_values_per_frame is the number of values to store per frame. If the
3776 * data is particle dependent there will be n_values_per_frame stored per
3777 * particle each frame.
3778 * @param block_id is the ID of the block, of which to set the output interval.
3779 * @param block_name is a string that will be used as name of the block. Only
3780 * required if the block did not exist, i.e. a new block is created.
3781 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
3782 * data is not related to specific particles (e.g. box shape) or
3783 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
3784 * positions). Only required if the block did not exist, i.e. a new block is
3785 * created.
3786 * @param compression is the compression routine to use when writing the data.
3787 * Only required if the block did not exist, i.e. a new block is created.
3788 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3789 * must be initialised before using it.
3790 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3791 * @details n_values_per_frame, block_name, particle_dependency and
3792 * compression are only used if the data block did not exist before calling
3793 * this function, in which case it is created.
3794 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3795 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3796 * has occured.
3798 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_interval_double_set
3799 (tng_trajectory_t tng_data,
3800 const int64_t i,
3801 const int64_t n_values_per_frame,
3802 const int64_t block_id,
3803 const char *block_name,
3804 const char particle_dependency,
3805 const char compression);
3808 * @brief High-level function for setting the writing interval of data blocks.
3809 * Obsolete! Use tng_util_generic_write_interval_set()
3810 * @param tng_data is the trajectory to use.
3811 * @param i is the output interval, i.e. i == 10 means data written every 10th
3812 * frame.
3813 * @param n_values_per_frame is the number of values to store per frame. If the
3814 * data is particle dependent there will be n_values_per_frame stored per
3815 * particle each frame.
3816 * @param block_id is the ID of the block, of which to set the output interval.
3817 * @param block_name is a string that will be used as name of the block. Only
3818 * required if the block did not exist, i.e. a new block is created.
3819 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
3820 * data is not related to specific particles (e.g. box shape) or
3821 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
3822 * positions). Only required if the block did not exist, i.e. a new block is
3823 * created.
3824 * @param compression is the compression routine to use when writing the data.
3825 * Only required if the block did not exist, i.e. a new block is created.
3826 * @details n_values_per_frame, block_name, particle_dependency and
3827 * compression are only used if the data block did not exist before calling
3828 * this function, in which case it is created.
3829 * This function is replaced by the more correcly named
3830 * tng_util_generic_write_interval_set(), but is kept for compatibility.
3831 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3832 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3833 * has occured.
3835 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_frequency_set
3836 (tng_trajectory_t tng_data,
3837 const int64_t i,
3838 const int64_t n_values_per_frame,
3839 const int64_t block_id,
3840 const char *block_name,
3841 const char particle_dependency,
3842 const char compression);
3845 * @brief High-level function for setting the writing interval of position
3846 * data blocks.
3847 * @param tng_data is the trajectory to use.
3848 * @param i is the output interval, i.e. i == 10 means data written every 10th
3849 * frame.
3850 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3851 * must be initialised before using it.
3852 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3853 * @details This function uses tng_util_generic_write_interval_set() and will
3854 * create a positions data block if none exists.
3855 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3856 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3857 * has occured.
3859 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_interval_set
3860 (tng_trajectory_t tng_data,
3861 const int64_t i);
3864 * @brief High-level function for setting the writing interval of position
3865 * data blocks containing double precision data.
3866 * @param tng_data is the trajectory to use.
3867 * @param i is the output interval, i.e. i == 10 means data written every 10th
3868 * frame.
3869 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3870 * must be initialised before using it.
3871 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3872 * @details This function uses tng_util_generic_write_interval_set() and will
3873 * create a positions data block if none exists.
3874 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3875 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3876 * has occured.
3878 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_interval_double_set
3879 (tng_trajectory_t tng_data,
3880 const int64_t i);
3883 * @brief High-level function for setting the writing interval of position
3884 * data blocks. Obsolete! Use tng_util_pos_write_interval_set()
3885 * @param tng_data is the trajectory to use.
3886 * @param i is the output interval, i.e. i == 10 means data written every 10th
3887 * frame.
3888 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3889 * must be initialised before using it.
3890 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3891 * @details This function uses tng_util_generic_write_interval_set() and will
3892 * create a positions data block if none exists.
3893 * This function is replaced by the more correcly named
3894 * tng_util_pos_write_interval_set(), but is kept for compatibility.
3895 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3896 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3897 * has occured.
3899 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_frequency_set
3900 (tng_trajectory_t tng_data,
3901 const int64_t i);
3904 * @brief High-level function for setting the writing interval of velocity
3905 * data blocks.
3906 * @param tng_data is the trajectory to use.
3907 * @param i is the output interval, i.e. i == 10 means data written every 10th
3908 * frame.
3909 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3910 * must be initialised before using it.
3911 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3912 * @details This function uses tng_util_generic_write_interval_set() and will
3913 * create a velocities data block if none exists.
3914 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3915 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3916 * has occured.
3918 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_interval_set
3919 (tng_trajectory_t tng_data,
3920 const int64_t i);
3923 * @brief High-level function for setting the writing interval of velocity
3924 * data blocks containing double precision data.
3925 * @param tng_data is the trajectory to use.
3926 * @param i is the output interval, i.e. i == 10 means data written every 10th
3927 * frame.
3928 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3929 * must be initialised before using it.
3930 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3931 * @details This function uses tng_util_generic_write_interval_set() and will
3932 * create a velocities data block if none exists.
3933 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3934 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3935 * has occured.
3937 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_interval_double_set
3938 (tng_trajectory_t tng_data,
3939 const int64_t i);
3942 * @brief High-level function for setting the writing interval of velocity
3943 * data blocks. Obsolete! Use tng_util_vel_write_interval_set()
3944 * @param tng_data is the trajectory to use.
3945 * @param i is the output interval, i.e. i == 10 means data written every 10th
3946 * frame.
3947 * @details This function uses tng_util_generic_write_interval_set() and will
3948 * create a velocities data block if none exists.
3949 * This function is replaced by the more correcly named
3950 * tng_util_vel_write_interval_set(), but is kept for compatibility.
3951 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3952 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3953 * has occured.
3955 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_frequency_set
3956 (tng_trajectory_t tng_data,
3957 const int64_t i);
3960 * @brief High-level function for setting the writing interval of force
3961 * data blocks.
3962 * @param tng_data is the trajectory to use.
3963 * @param i is the output interval, i.e. i == 10 means data written every 10th
3964 * frame.
3965 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3966 * must be initialised before using it.
3967 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3968 * @details This function uses tng_util_generic_write_interval_set() and will
3969 * create a forces data block if none exists.
3970 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3971 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3972 * has occured.
3974 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_interval_set
3975 (tng_trajectory_t tng_data,
3976 const int64_t i);
3979 * @brief High-level function for setting the writing interval of force
3980 * data blocks containing double precision data.
3981 * @param tng_data is the trajectory to use.
3982 * @param i is the output interval, i.e. i == 10 means data written every 10th
3983 * frame.
3984 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
3985 * must be initialised before using it.
3986 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
3987 * @details This function uses tng_util_generic_write_interval_set() and will
3988 * create a forces data block if none exists.
3989 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
3990 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
3991 * has occured.
3993 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_interval_double_set
3994 (tng_trajectory_t tng_data,
3995 const int64_t i);
3998 * @brief High-level function for setting the writing interval of force
3999 * data blocks. Obsolete! Use tng_util_force_write_interval_set()
4000 * @param tng_data is the trajectory to use.
4001 * @param i is the output interval, i.e. i == 10 means data written every 10th
4002 * frame.
4003 * @details This function uses tng_util_generic_write_interval_set() and will
4004 * create a forces data block if none exists.
4005 * This function is replaced by the more correcly named
4006 * tng_util_force_write_interval_set(), but is kept for compatibility.
4007 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4008 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4009 * has occured.
4011 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_frequency_set
4012 (tng_trajectory_t tng_data,
4013 const int64_t i);
4016 * @brief High-level function for setting the writing interval of box shape
4017 * data blocks.
4018 * @param tng_data is the trajectory to use.
4019 * @param i is the output interval, i.e. i == 10 means data written every 10th
4020 * frame.
4021 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4022 * must be initialised before using it.
4023 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
4024 * @details This function uses tng_util_generic_write_interval_set() and will
4025 * create a box shape data block if none exists.
4026 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4027 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4028 * has occured.
4030 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_interval_set
4031 (tng_trajectory_t tng_data,
4032 const int64_t i);
4035 * @brief High-level function for setting the writing interval of box shape
4036 * data blocks containing double precision data.
4037 * @param tng_data is the trajectory to use.
4038 * @param i is the output interval, i.e. i == 10 means data written every 10th
4039 * frame.
4040 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4041 * must be initialised before using it.
4042 * @pre \code i >= 0 \endcode The writing interval must be >= 0.
4043 * @details This function uses tng_util_generic_write_interval_set() and will
4044 * create a box shape data block if none exists.
4045 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4046 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4047 * has occured.
4049 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_interval_double_set
4050 (tng_trajectory_t tng_data,
4051 const int64_t i);
4054 * @brief High-level function for setting the writing interval of velocity
4055 * data blocks. Obsolete! Use tng_util_box_shape_write_interval_set()
4056 * @param tng_data is the trajectory to use.
4057 * @param i is the output interval, i.e. i == 10 means data written every 10th
4058 * frame.
4059 * @details This function uses tng_util_generic_write_interval_set() and will
4060 * create a box shape data block if none exists.
4061 * This function is replaced by the more correcly named
4062 * tng_util_box_shape_write_interval_set(), but is kept for compatibility.
4063 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4064 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4065 * has occured.
4067 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_frequency_set
4068 (tng_trajectory_t tng_data,
4069 const int64_t i);
4072 * @brief High-level function for writing data of one frame to a data block.
4073 * @param tng_data is the trajectory to use.
4074 * @param frame_nr is the frame number of the data.
4075 * @param values is a 1D array of data to add. The array should be of length
4076 * n_particles * n_values_per_frame if writing particle related data, otherwise
4077 * it should be n_values_per_frame.
4078 * @param n_values_per_frame is the number of values to store per frame. If the
4079 * data is particle dependent there will be n_values_per_frame stored per
4080 * particle each frame.
4081 * @param block_id is the ID of the block, of which to set the output interval.
4082 * @param block_name is a string that will be used as name of the block. Only
4083 * required if the block did not exist, i.e. a new block is created.
4084 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
4085 * data is not related to specific particles (e.g. box shape) or
4086 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
4087 * positions). Only required if the block did not exist, i.e. a new block is
4088 * created.
4089 * @param compression is the compression routine to use when writing the data.
4090 * Only required if the block did not exist, i.e. a new block is created.
4091 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4092 * must be initialised before using it.
4093 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4094 * @pre \code values != 0 \endcode The pointer to the values array must not
4095 * be a NULL pointer.
4096 * @details n_values_per_frame, block_name, particle_dependency and
4097 * compression are only used if the data block did not exist before calling
4098 * this function, in which case it is created.
4099 * N.b. Data is written a whole block at a time. The data is not
4100 * actually written to disk until the frame set is finished or the TNG
4101 * trajectory is closed.
4102 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4103 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4104 * has occured.
4106 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write
4107 (tng_trajectory_t tng_data,
4108 const int64_t frame_nr,
4109 const float *values,
4110 const int64_t n_values_per_frame,
4111 const int64_t block_id,
4112 const char *block_name,
4113 const char particle_dependency,
4114 const char compression);
4117 * @brief High-level function for writing data of one frame to a double precision
4118 * data block.
4119 * @param tng_data is the trajectory to use.
4120 * @param frame_nr is the frame number of the data.
4121 * @param values is a 1D array of data to add. The array should be of length
4122 * n_particles * n_values_per_frame if writing particle related data, otherwise
4123 * it should be n_values_per_frame.
4124 * @param n_values_per_frame is the number of values to store per frame. If the
4125 * data is particle dependent there will be n_values_per_frame stored per
4126 * particle each frame.
4127 * @param block_id is the ID of the block, of which to set the output interval.
4128 * @param block_name is a string that will be used as name of the block. Only
4129 * required if the block did not exist, i.e. a new block is created.
4130 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
4131 * data is not related to specific particles (e.g. box shape) or
4132 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
4133 * positions). Only required if the block did not exist, i.e. a new block is
4134 * created.
4135 * @param compression is the compression routine to use when writing the data.
4136 * Only required if the block did not exist, i.e. a new block is created.
4137 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4138 * must be initialised before using it.
4139 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4140 * @pre \code values != 0 \endcode The pointer to the values array must not
4141 * be a NULL pointer.
4142 * @details n_values_per_frame, block_name, particle_dependency and
4143 * compression are only used if the data block did not exist before calling
4144 * this function, in which case it is created.
4145 * N.b. Data is written a whole block at a time. The data is not
4146 * actually written to disk until the frame set is finished or the TNG
4147 * trajectory is closed.
4148 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4149 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4150 * has occured.
4152 tng_function_status DECLSPECDLLEXPORT tng_util_generic_double_write
4153 (tng_trajectory_t tng_data,
4154 const int64_t frame_nr,
4155 const double *values,
4156 const int64_t n_values_per_frame,
4157 const int64_t block_id,
4158 const char *block_name,
4159 const char particle_dependency,
4160 const char compression);
4163 * @brief High-level function for adding data to positions data blocks.
4164 * @param tng_data is the trajectory to use.
4165 * @param frame_nr is the frame number of the data.
4166 * @param positions is a 1D array of data to add. The array should be of length
4167 * n_particles * 3.
4168 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4169 * must be initialised before using it.
4170 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4171 * @pre \code positions != 0 \endcode The pointer to the positions array must not
4172 * be a NULL pointer.
4173 * @details This function uses tng_util_generic_write() and will
4174 * create a positions data block if none exists. Positions are stored as three
4175 * values per frame and compressed using TNG compression.
4176 * N.b. Since compressed data is written a whole block at a time the data is not
4177 * actually written to disk until the frame set is finished or the TNG
4178 * trajectory is closed.
4179 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4180 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4181 * has occured.
4183 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write
4184 (tng_trajectory_t tng_data,
4185 const int64_t frame_nr,
4186 const float *positions);
4189 * @brief High-level function for adding data to positions data blocks at double
4190 * precision.
4191 * @param tng_data is the trajectory to use.
4192 * @param frame_nr is the frame number of the data.
4193 * @param positions is a 1D array of data to add. The array should be of length
4194 * n_particles * 3.
4195 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4196 * must be initialised before using it.
4197 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4198 * @pre \code positions != 0 \endcode The pointer to the positions array must not
4199 * be a NULL pointer.
4200 * @details This function uses tng_util_generic_write() and will
4201 * create a positions data block if none exists. Positions are stored as three
4202 * values per frame and compressed using TNG compression.
4203 * N.b. Since compressed data is written a whole block at a time the data is not
4204 * actually written to disk until the frame set is finished or the TNG
4205 * trajectory is closed.
4206 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4207 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4208 * has occured.
4210 tng_function_status DECLSPECDLLEXPORT tng_util_pos_double_write
4211 (tng_trajectory_t tng_data,
4212 const int64_t frame_nr,
4213 const double *positions);
4216 * @brief High-level function for adding data to velocities data blocks.
4217 * @param tng_data is the trajectory to use.
4218 * @param frame_nr is the frame number of the data.
4219 * @param velocities is a 1D array of data to add. The array should be of length
4220 * n_particles * 3.
4221 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4222 * must be initialised before using it.
4223 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4224 * @pre \code velocities != 0 \endcode The pointer to the velocities array must not
4225 * be a NULL pointer.
4226 * @details This function uses tng_util_generic_write() and will
4227 * create a velocities data block if none exists. Velocities are stored as three
4228 * values per frame and compressed using TNG compression.
4229 * N.b. Since compressed data is written a whole block at a time the data is not
4230 * actually written to disk until the frame set is finished or the TNG
4231 * trajectory is closed.
4232 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4233 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4234 * has occured.
4236 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write
4237 (tng_trajectory_t tng_data,
4238 const int64_t frame_nr,
4239 const float *velocities);
4242 * @brief High-level function for adding data to velocities data blocks at double
4243 * precision.
4244 * @param tng_data is the trajectory to use.
4245 * @param frame_nr is the frame number of the data.
4246 * @param velocities is a 1D array of data to add. The array should be of length
4247 * n_particles * 3.
4248 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4249 * must be initialised before using it.
4250 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4251 * @pre \code velocities != 0 \endcode The pointer to the velocities array must not
4252 * be a NULL pointer.
4253 * @details This function uses tng_util_generic_write() and will
4254 * create a velocities data block if none exists. Velocities are stored as three
4255 * values per frame and compressed using TNG compression.
4256 * N.b. Since compressed data is written a whole block at a time the data is not
4257 * actually written to disk until the frame set is finished or the TNG
4258 * trajectory is closed.
4259 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4260 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4261 * has occured.
4263 tng_function_status DECLSPECDLLEXPORT tng_util_vel_double_write
4264 (tng_trajectory_t tng_data,
4265 const int64_t frame_nr,
4266 const double *velocities);
4269 * @brief High-level function for adding data to forces data blocks.
4270 * @param tng_data is the trajectory to use.
4271 * @param frame_nr is the frame number of the data.
4272 * @param forces is a 1D array of data to add. The array should be of length
4273 * n_particles * 3.
4274 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4275 * must be initialised before using it.
4276 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4277 * @pre \code forces != 0 \endcode The pointer to the forces array must not
4278 * be a NULL pointer.
4279 * @details This function uses tng_util_generic_write() and will
4280 * create a forces data block if none exists. Forces are stored as three
4281 * values per frame and compressed using gzip compression.
4282 * N.b. Since compressed data is written a whole block at a time the data is not
4283 * actually written to disk until the frame set is finished or the TNG
4284 * trajectory is closed.
4285 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4286 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4287 * has occured.
4289 tng_function_status DECLSPECDLLEXPORT tng_util_force_write
4290 (tng_trajectory_t tng_data,
4291 const int64_t frame_nr,
4292 const float *forces);
4295 * @brief High-level function for adding data to forces data blocks at double
4296 * precision.
4297 * @param tng_data is the trajectory to use.
4298 * @param frame_nr is the frame number of the data.
4299 * @param forces is a 1D array of data to add. The array should be of length
4300 * n_particles * 3.
4301 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4302 * must be initialised before using it.
4303 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4304 * @pre \code forces != 0 \endcode The pointer to the forces array must not
4305 * be a NULL pointer.
4306 * @details This function uses tng_util_generic_write() and will
4307 * create a forces data block if none exists. Forces are stored as three
4308 * values per frame and compressed using gzip compression.
4309 * N.b. Since compressed data is written a whole block at a time the data is not
4310 * actually written to disk until the frame set is finished or the TNG
4311 * trajectory is closed.
4312 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4313 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4314 * has occured.
4316 tng_function_status DECLSPECDLLEXPORT tng_util_force_double_write
4317 (tng_trajectory_t tng_data,
4318 const int64_t frame_nr,
4319 const double *forces);
4322 * @brief High-level function for adding data to box shape data blocks.
4323 * @param tng_data is the trajectory to use.
4324 * @param frame_nr is the frame number of the data.
4325 * @param box_shape is a 1D array of data to add. The array should be of length 9.
4326 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4327 * must be initialised before using it.
4328 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4329 * @pre \code box_shape != 0 \endcode The pointer to the box_shape array must not
4330 * be a NULL pointer.
4331 * @details This function uses tng_util_generic_write() and will
4332 * create a box shape data block if none exists. Box shapes are stored as 9
4333 * values per frame and compressed using TNG compression.
4334 * N.b. Since compressed data is written a whole block at a time the data is not
4335 * actually written to disk until the frame set is finished or the TNG
4336 * trajectory is closed.
4337 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4338 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4339 * has occured.
4341 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write
4342 (tng_trajectory_t tng_data,
4343 const int64_t frame_nr,
4344 const float *box_shape);
4347 * @brief High-level function for adding data to box shape data blocks at double
4348 * precision.
4349 * @param tng_data is the trajectory to use.
4350 * @param frame_nr is the frame number of the data.
4351 * @param box_shape is a 1D array of data to add. The array should be of length 9.
4352 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4353 * must be initialised before using it.
4354 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4355 * @pre \code box_shape != 0 \endcode The pointer to the box_shape array must not
4356 * be a NULL pointer.
4357 * @details This function uses tng_util_generic_write() and will
4358 * create a box shape data block if none exists. Box shapes are stored as 9
4359 * values per frame and compressed using TNG compression.
4360 * N.b. Since compressed data is written a whole block at a time the data is not
4361 * actually written to disk until the frame set is finished or the TNG
4362 * trajectory is closed.
4363 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4364 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4365 * has occured.
4367 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_double_write
4368 (tng_trajectory_t tng_data,
4369 const int64_t frame_nr,
4370 const double *box_shape);
4373 * @brief High-level function for writing data of one frame to a data block.
4374 * If the frame is at the beginning of a frame set the time stamp of the frame
4375 * set is set.
4376 * @param tng_data is the trajectory to use.
4377 * @param frame_nr is the frame number of the data.
4378 * @param time is the time stamp of the frame (in seconds).
4379 * @param values is a 1D array of data to add. The array should be of length
4380 * n_particles * n_values_per_frame if writing particle related data, otherwise
4381 * it should be n_values_per_frame.
4382 * @param n_values_per_frame is the number of values to store per frame. If the
4383 * data is particle dependent there will be n_values_per_frame stored per
4384 * particle each frame.
4385 * @param block_id is the ID of the block, of which to set the output interval.
4386 * @param block_name is a string that will be used as name of the block. Only
4387 * required if the block did not exist, i.e. a new block is created.
4388 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
4389 * data is not related to specific particles (e.g. box shape) or
4390 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
4391 * positions). Only required if the block did not exist, i.e. a new block is
4392 * created.
4393 * @param compression is the compression routine to use when writing the data.
4394 * Only required if the block did not exist, i.e. a new block is created.
4395 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4396 * must be initialised before using it.
4397 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4398 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4399 * @pre \code values != 0 \endcode The pointer to the values array must not
4400 * be a NULL pointer.
4401 * @details n_values_per_frame, block_name, particle_dependency and
4402 * compression are only used if the data block did not exist before calling
4403 * this function, in which case it is created.
4404 * N.b. Data is written a whole block at a time. The data is not
4405 * actually written to disk until the frame set is finished or the TNG
4406 * trajectory is closed.
4407 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4408 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4409 * has occured.
4411 tng_function_status DECLSPECDLLEXPORT tng_util_generic_with_time_write
4412 (tng_trajectory_t tng_data,
4413 const int64_t frame_nr,
4414 const double time,
4415 const float *values,
4416 const int64_t n_values_per_frame,
4417 const int64_t block_id,
4418 const char *block_name,
4419 const char particle_dependency,
4420 const char compression);
4423 * @brief High-level function for writing data of one frame to a double precision
4424 * data block. If the frame is at the beginning of a frame set the time stamp of
4425 * the frame set is set.
4426 * @param tng_data is the trajectory to use.
4427 * @param frame_nr is the frame number of the data.
4428 * @param time is the time stamp of the frame (in seconds).
4429 * @param values is a 1D array of data to add. The array should be of length
4430 * n_particles * n_values_per_frame if writing particle related data, otherwise
4431 * it should be n_values_per_frame.
4432 * @param n_values_per_frame is the number of values to store per frame. If the
4433 * data is particle dependent there will be n_values_per_frame stored per
4434 * particle each frame.
4435 * @param block_id is the ID of the block, of which to set the output interval.
4436 * @param block_name is a string that will be used as name of the block. Only
4437 * required if the block did not exist, i.e. a new block is created.
4438 * @param particle_dependency should be TNG_NON_PARTICLE_BLOCK_DATA (0) if the
4439 * data is not related to specific particles (e.g. box shape) or
4440 * TNG_PARTICLE_BLOCK_DATA (1) is it is related to specific particles (e.g.
4441 * positions). Only required if the block did not exist, i.e. a new block is
4442 * created.
4443 * @param compression is the compression routine to use when writing the data.
4444 * Only required if the block did not exist, i.e. a new block is created.
4445 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4446 * must be initialised before using it.
4447 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4448 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4449 * @pre \code values != 0 \endcode The pointer to the values array must not
4450 * be a NULL pointer.
4451 * @details n_values_per_frame, block_name, particle_dependency and
4452 * compression are only used if the data block did not exist before calling
4453 * this function, in which case it is created.
4454 * N.b. Data is written a whole block at a time. The data is not
4455 * actually written to disk until the frame set is finished or the TNG
4456 * trajectory is closed.
4457 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4458 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4459 * has occured.
4461 tng_function_status DECLSPECDLLEXPORT tng_util_generic_with_time_double_write
4462 (tng_trajectory_t tng_data,
4463 const int64_t frame_nr,
4464 const double time,
4465 const double *values,
4466 const int64_t n_values_per_frame,
4467 const int64_t block_id,
4468 const char *block_name,
4469 const char particle_dependency,
4470 const char compression);
4473 * @brief High-level function for adding data to positions data blocks. If the
4474 * frame is at the beginning of a frame set the time stamp of the frame set
4475 * is set.
4476 * @param tng_data is the trajectory to use.
4477 * @param frame_nr is the frame number of the data.
4478 * @param time is the time stamp of the frame (in seconds).
4479 * @param positions is a 1D array of data to add. The array should be of length
4480 * n_particles * 3.
4481 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4482 * must be initialised before using it.
4483 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4484 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4485 * @pre \code positions != 0 \endcode The pointer to the positions array must not
4486 * be a NULL pointer.
4487 * @details This function uses tng_util_generic_with_time_write() and will
4488 * create a positions data block if none exists. Positions are stored as three
4489 * values per frame and compressed using TNG compression.
4490 * N.b. Since compressed data is written a whole block at a time the data is not
4491 * actually written to disk until the frame set is finished or the TNG
4492 * trajectory is closed.
4493 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4494 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4495 * has occured.
4497 tng_function_status DECLSPECDLLEXPORT tng_util_pos_with_time_write
4498 (tng_trajectory_t tng_data,
4499 const int64_t frame_nr,
4500 const double time,
4501 const float *positions);
4504 * @brief High-level function for adding data to positions data blocks at double
4505 * precision. If the frame is at the beginning of a frame set the time stamp of
4506 * the frame set is set.
4507 * @param tng_data is the trajectory to use.
4508 * @param frame_nr is the frame number of the data.
4509 * @param time is the time stamp of the frame (in seconds).
4510 * @param positions is a 1D array of data to add. The array should be of length
4511 * n_particles * 3.
4512 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4513 * must be initialised before using it.
4514 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4515 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4516 * @pre \code positions != 0 \endcode The pointer to the positions array must not
4517 * be a NULL pointer.
4518 * @details This function uses tng_util_generic_with_time_double_write() and will
4519 * create a positions data block if none exists. Positions are stored as three
4520 * values per frame and compressed using TNG compression.
4521 * N.b. Since compressed data is written a whole block at a time the data is not
4522 * actually written to disk until the frame set is finished or the TNG
4523 * trajectory is closed.
4524 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4525 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4526 * has occured.
4528 tng_function_status DECLSPECDLLEXPORT tng_util_pos_with_time_double_write
4529 (tng_trajectory_t tng_data,
4530 const int64_t frame_nr,
4531 const double time,
4532 const double *positions);
4535 * @brief High-level function for adding data to velocities data blocks. If the
4536 * frame is at the beginning of a frame set the time stamp of the frame set
4537 * is set.
4538 * @param tng_data is the trajectory to use.
4539 * @param frame_nr is the frame number of the data.
4540 * @param time is the time stamp of the frame (in seconds).
4541 * @param velocities is a 1D array of data to add. The array should be of length
4542 * n_particles * 3.
4543 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4544 * must be initialised before using it.
4545 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4546 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4547 * @pre \code velocities != 0 \endcode The pointer to the velocities array must not
4548 * be a NULL pointer.
4549 * @details This function uses tng_util_generic_with_time_write() and will
4550 * create a velocities data block if none exists. Velocities are stored as three
4551 * values per frame and compressed using TNG compression.
4552 * N.b. Since compressed data is written a whole block at a time the data is not
4553 * actually written to disk until the frame set is finished or the TNG
4554 * trajectory is closed.
4555 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4556 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4557 * has occured.
4559 tng_function_status DECLSPECDLLEXPORT tng_util_vel_with_time_write
4560 (tng_trajectory_t tng_data,
4561 const int64_t frame_nr,
4562 const double time,
4563 const float *velocities);
4566 * @brief High-level function for adding data to velocities data blocks at
4567 * double precision. If the frame is at the beginning of a frame set the
4568 * time stamp of the frame set is set.
4569 * @param tng_data is the trajectory to use.
4570 * @param frame_nr is the frame number of the data.
4571 * @param time is the time stamp of the frame (in seconds).
4572 * @param velocities is a 1D array of data to add. The array should be of length
4573 * n_particles * 3.
4574 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4575 * must be initialised before using it.
4576 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4577 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4578 * @pre \code velocities != 0 \endcode The pointer to the velocities array must not
4579 * be a NULL pointer.
4580 * @details This function uses tng_util_generic_with_time_double_write() and will
4581 * create a velocities data block if none exists. Velocities are stored as three
4582 * values per frame and compressed using TNG compression.
4583 * N.b. Since compressed data is written a whole block at a time the data is not
4584 * actually written to disk until the frame set is finished or the TNG
4585 * trajectory is closed.
4586 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4587 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4588 * has occured.
4590 tng_function_status DECLSPECDLLEXPORT tng_util_vel_with_time_double_write
4591 (tng_trajectory_t tng_data,
4592 const int64_t frame_nr,
4593 const double time,
4594 const double *velocities);
4597 * @brief High-level function for adding data to forces data blocks. If the
4598 * frame is at the beginning of a frame set the time stamp of the frame set
4599 * is set.
4600 * @param tng_data is the trajectory to use.
4601 * @param frame_nr is the frame number of the data.
4602 * @param time is the time stamp of the frame (in seconds).
4603 * @param forces is a 1D array of data to add. The array should be of length
4604 * n_particles * 3.
4605 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4606 * must be initialised before using it.
4607 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4608 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4609 * @pre \code forces != 0 \endcode The pointer to the forces array must not
4610 * be a NULL pointer.
4611 * @details This function uses tng_util_generic_with_time_write() and will
4612 * create a forces data block if none exists. Forces are stored as three
4613 * values per frame and compressed using gzip compression.
4614 * N.b. Since compressed data is written a whole block at a time the data is not
4615 * actually written to disk until the frame set is finished or the TNG
4616 * trajectory is closed.
4617 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4618 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4619 * has occured.
4621 tng_function_status DECLSPECDLLEXPORT tng_util_force_with_time_write
4622 (tng_trajectory_t tng_data,
4623 const int64_t frame_nr,
4624 const double time,
4625 const float *forces);
4628 * @brief High-level function for adding data to forces data blocks at
4629 * double precision. If the frame is at the beginning of a frame set
4630 * the time stamp of the frame set is set.
4631 * @param tng_data is the trajectory to use.
4632 * @param frame_nr is the frame number of the data.
4633 * @param time is the time stamp of the frame (in seconds).
4634 * @param forces is a 1D array of data to add. The array should be of length
4635 * n_particles * 3.
4636 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4637 * must be initialised before using it.
4638 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4639 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4640 * @pre \code forces != 0 \endcode The pointer to the forces array must not
4641 * be a NULL pointer.
4642 * @details This function uses tng_util_generic_with_time_double_write() and will
4643 * create a forces data block if none exists. Forces are stored as three
4644 * values per frame and compressed using gzip compression.
4645 * N.b. Since compressed data is written a whole block at a time the data is not
4646 * actually written to disk until the frame set is finished or the TNG
4647 * trajectory is closed.
4648 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4649 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4650 * has occured.
4652 tng_function_status DECLSPECDLLEXPORT tng_util_force_with_time_double_write
4653 (tng_trajectory_t tng_data,
4654 const int64_t frame_nr,
4655 const double time,
4656 const double *forces);
4659 * @brief High-level function for adding data to box shape data blocks. If the
4660 * frame is at the beginning of a frame set the time stamp of the frame set
4661 * is set.
4662 * @param tng_data is the trajectory to use.
4663 * @param frame_nr is the frame number of the data.
4664 * @param time is the time stamp of the frame (in seconds).
4665 * @param box_shape is a 1D array of data to add. The array should be of length 9.
4666 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4667 * must be initialised before using it.
4668 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4669 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4670 * @pre \code box_shape != 0 \endcode The pointer to the box_shape array must not
4671 * be a NULL pointer.
4672 * @details This function uses tng_util_generic_with_time_write() and will
4673 * create a box shape data block if none exists. Box shapes are stored as 9
4674 * values per frame and compressed using TNG compression.
4675 * N.b. Since compressed data is written a whole block at a time the data is not
4676 * actually written to disk until the frame set is finished or the TNG
4677 * trajectory is closed.
4678 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4679 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4680 * has occured.
4682 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_with_time_write
4683 (tng_trajectory_t tng_data,
4684 const int64_t frame_nr,
4685 const double time,
4686 const float *box_shape);
4689 * @brief High-level function for adding data to box shape data blocks at
4690 * double precision. If the frame is at the beginning of a frame set the
4691 * time stamp of the frame set is set.
4692 * @param tng_data is the trajectory to use.
4693 * @param frame_nr is the frame number of the data.
4694 * @param time is the time stamp of the frame (in seconds).
4695 * @param box_shape is a 1D array of data to add. The array should be of length 9.
4696 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4697 * must be initialised before using it.
4698 * @pre \code frame_nr >= 0 \endcode The frame number to write must be >= 0.
4699 * @pre \code time >= 0 \endcode The time stamp must be >= 0.
4700 * @pre \code box_shape != 0 \endcode The pointer to the box_shape array must not
4701 * be a NULL pointer.
4702 * @details This function uses tng_util_generic_with_time_double_write() and will
4703 * create a box shape data block if none exists. Box shapes are stored as 9
4704 * values per frame and compressed using TNG compression.
4705 * N.b. Since compressed data is written a whole block at a time the data is not
4706 * actually written to disk until the frame set is finished or the TNG
4707 * trajectory is closed.
4708 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4709 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4710 * has occured.
4712 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_with_time_double_write
4713 (tng_trajectory_t tng_data,
4714 const int64_t frame_nr,
4715 const double time,
4716 const double *box_shape);
4719 * @brief High-level function for getting the compression method and
4720 * multiplication factor of the last read frame of a specific data block.
4721 * @param tng_data is the trajectory to use.
4722 * @param block_id is the ID number of the block containing the data of
4723 * interest.
4724 * @param codec_id will be set to the value of the codec_id of the
4725 * compression of the data block. See tng_compression for more details.
4726 * @param factor will be set to the multiplication factor applied to
4727 * the values before compression, in order to get integers from them.
4728 * factor is 1/precision.
4729 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4730 * must be initialised before using it.
4731 * @pre \code codec_id != 0 \endcode The pointer to the returned codec id
4732 * must not be a NULL pointer.
4733 * @pre \code factor != 0 \endcode The pointer to the returned multiplication
4734 * factor must not be a NULL pointer.
4735 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4736 * has occured (such as invalid mode) or TNG_CRITICAL (2) if a major error
4737 * has occured.
4739 tng_function_status DECLSPECDLLEXPORT tng_util_frame_current_compression_get
4740 (tng_trajectory_t tng_data,
4741 const int64_t block_id,
4742 int64_t *codec_id,
4743 double *factor);
4745 /** @brief High-level function for determining the next frame with data and what
4746 * data blocks have data for that frame. The search can be limited to certain
4747 * data blocks.
4748 * @param tng_data is the trajectory to use.
4749 * @param current_frame is the frame that was last read, from where to start
4750 * looking for data.
4751 * @param n_requested_data_block_ids is the number of data blocks listed in
4752 * requested_data_block_ids. If this is 0 all data blocks will be taken into
4753 * account.
4754 * @param requested_data_block_ids is an array of data blocks to look for.
4755 * @param next_frame will be set to the next frame with data.
4756 * @param n_data_blocks_in_next_frame is set to the number of data blocks with
4757 * data for next_frame.
4758 * @param data_block_ids_in_next_frame is set to an array (of length
4759 * n_data_blocks_in_next_frame) that lists the data block IDs with data for
4760 * next_frame. It must be pointing at NULL or previously allocated memory.
4761 * Memory for the array is allocated by this function.
4762 * The memory must be freed by the client afterwards or
4763 * there will be a memory leak.
4764 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4765 * must be initialised before using it.
4766 * @pre \code next_frame != 0 \endcode The pointer to the next frame must not
4767 * be NULL.
4768 * @pre \code n_data_blocks_in_next_frame != 0 \endcode The pointer to
4769 * n_data_blocks_in_next_frame must not be NULL.
4770 * @pre \code *data_block_ids_in_next_frame != 0 \endcode The pointer to the
4771 * list of data block IDs must not be NULL.
4772 * @pre \code n_requested_data_block_ids == 0 || requested_data_block_ids != 0 \endcode
4773 * If the number of requested data blocks != 0 then the array of data block IDs must not be NULL.
4774 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4775 * has occured or TNG_CRITICAL (2) if a major error
4776 * has occured.
4778 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_data_blocks_find
4779 (tng_trajectory_t tng_data,
4780 int64_t current_frame,
4781 const int64_t n_requested_data_block_ids,
4782 const int64_t *requested_data_block_ids,
4783 int64_t *next_frame,
4784 int64_t *n_data_blocks_in_next_frame,
4785 int64_t **data_block_ids_in_next_frame);
4787 /* @brief High-level function for getting all data block ids and their names
4788 * and stride lengths.
4789 * @param tng_data is the trajectory to use.
4790 * @param n_data_blocks is set to the number of data blocks in the trajectory.
4791 * @param data_block_ids is set to an array (of length
4792 * n_data_blocks) that lists the data block IDs in the trajectory.
4793 * It must be pointing at NULL or previously allocated memory.
4794 * Memory for the array is allocated by this function.
4795 * The memory must be freed by the client afterwards or
4796 * there will be a memory leak.
4797 * @param data_block_names is set to an array (of length
4798 * n_data_blocks) that contains the names of the data blocks.
4799 * It must be pointing at NULL or previously allocated memory.
4800 * Memory for the array is allocated by this function.
4801 * The memory must be freed by the client afterwards or
4802 * there will be a memory leak.
4803 * @param stride_lengths is set to an array (of length
4804 * n_data_blocks) that lists the stride lengths of the data blocks.
4805 * It must be pointing at NULL or previously allocated memory.
4806 * Memory for the array is allocated by this function.
4807 * The memory must be freed by the client afterwards or
4808 * there will be a memory leak.
4809 * @param n_values_per_frame is set to an array (of length
4810 * n_data_blocks) that lists the number of values per frame of the data blocks.
4811 * It must be pointing at NULL or previously allocated memory.
4812 * Memory for the array is allocated by this function.
4813 * The memory must be freed by the client afterwards or
4814 * there will be a memory leak.
4815 * @param block_types is set to an array (of length
4816 * n_data_blocks) that lists the block types of the data blocks.
4817 * It must be pointing at NULL or previously allocated memory.
4818 * Memory for the array is allocated by this function.
4819 * The memory must be freed by the client afterwards or
4820 * there will be a memory leak.
4821 * @param dependencies is set to an array (of length
4822 * n_data_blocks) that lists the dependencies of the data blocks.
4823 * It must be pointing at NULL or previously allocated memory.
4824 * Memory for the array is allocated by this function.
4825 * The memory must be freed by the client afterwards or
4826 * there will be a memory leak.
4827 * @param compressions is set to an array (of length
4828 * n_data_blocks) that lists the compressions of the data blocks.
4829 * It must be pointing at NULL or previously allocated memory.
4830 * Memory for the array is allocated by this function.
4831 * The memory must be freed by the client afterwards or
4832 * there will be a memory leak.
4833 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4834 * must be initialised before using it.
4835 * @pre \code n_data_blocks != 0 \endcode The pointer to
4836 * n_data_blocks must not be NULL.
4837 * @pre \code data_block_ids != 0 \endcode The pointer to the
4838 * list of data block IDs must not be NULL.
4839 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4840 * has occured or TNG_CRITICAL (2) if a major error
4841 * has occured.
4844 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_all_data_block_types_get
4845 (tng_trajectory_t tng_data,
4846 int64_t *n_data_blocks,
4847 int64_t **data_block_ids,
4848 char ***data_block_names,
4849 int64_t **stride_lengths,
4850 int64_t **n_values_per_frame,
4851 char **block_types,
4852 char **dependencies,
4853 char **compressions);
4856 /** @brief Finds the frame set of the specified frame in order to prepare for writing
4857 * after it.
4858 * @param tng_data is the trajectory to use.
4859 * @param prev_frame is the frame after which to start appending.
4860 * @pre \code tng_data != 0 \endcode The trajectory container (tng_data)
4861 * must be initialised before using it.
4862 * @pre \code prev_frame >= 0 \endcode The previous frame must not be negative.
4863 * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error
4864 * has occured (such as not finding the requested frame) or TNG_CRITICAL (2)
4865 * if a major error has occured.
4867 tng_function_status DECLSPECDLLEXPORT tng_util_prepare_append_after_frame
4868 (tng_trajectory_t tng_data,
4869 const int64_t prev_frame);
4871 /** @} */ /* end of group2 */
4874 #ifdef __cplusplus
4875 } /* end extern "C" */
4876 #endif
4878 #endif /* TNG_IO_H */