baceef75d1cd51fc05539d1dc6e7f1216897eca7
[alexxy/gromacs.git] / src / external / tng_io / src / lib / tng_io_fortran.c
1 /* This code is part of the tng binary trajectory format.
2  *
3  *                      VERSION 1.5
4  *
5  * Written by Magnus Lundborg
6  * Copyright (c) 2012-2013, The GROMACS development team.
7  * Check out http://www.gromacs.org for more information.
8  *
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the Revised BSD License.
12  */
13
14 #include "../../include/tng_io.h"
15
16 /* The following is for calling the library from fortran */
17
18 tng_function_status DECLSPECDLLEXPORT tng_trajectory_init_(tng_trajectory_t *tng_data_p)
19 {
20     return(tng_trajectory_init(tng_data_p));
21 }
22
23 tng_function_status DECLSPECDLLEXPORT tng_trajectory_destroy_(tng_trajectory_t *tng_data_p)
24 {
25     return(tng_trajectory_destroy(tng_data_p));
26 }
27
28 tng_function_status DECLSPECDLLEXPORT tng_trajectory_init_from_src_(tng_trajectory_t src,
29                                                    tng_trajectory_t *dest_p)
30 {
31     return(tng_trajectory_init_from_src(src, dest_p));
32 }
33
34 tng_function_status DECLSPECDLLEXPORT tng_input_file_get_(const tng_trajectory_t tng_data,
35                                         char *file_name, const int max_len)
36 {
37     return(tng_input_file_get(tng_data, file_name, max_len));
38 }
39
40 tng_function_status DECLSPECDLLEXPORT tng_input_file_set_(tng_trajectory_t tng_data,
41                                         const char *file_name, int name_len)
42 {
43     char *name = malloc(name_len + 1);
44     tng_function_status stat;
45
46     strncpy(name, file_name, name_len);
47     name[name_len] = 0;
48     stat = tng_input_file_set(tng_data, name);
49     free(name);
50     return(stat);
51 }
52
53 tng_function_status DECLSPECDLLEXPORT tng_output_file_get_(const tng_trajectory_t tng_data,
54                                          char *file_name, const int max_len)
55 {
56     return(tng_output_file_get(tng_data, file_name, max_len));
57 }
58
59 tng_function_status DECLSPECDLLEXPORT tng_output_file_set_(tng_trajectory_t tng_data,
60                                          const char *file_name, int name_len)
61 {
62     char *name = malloc(name_len + 1);
63     tng_function_status stat;
64
65     strncpy(name, file_name, name_len);
66     name[name_len] = 0;
67     stat = tng_output_file_set(tng_data, name);
68     free(name);
69     return(stat);
70 }
71
72 tng_function_status DECLSPECDLLEXPORT tng_first_program_name_get_(const tng_trajectory_t tng_data,
73                                                 char *name, const int max_len)
74 {
75     return(tng_first_program_name_get(tng_data, name, max_len));
76 }
77
78 tng_function_status DECLSPECDLLEXPORT tng_output_file_endianness_get_
79                 (tng_trajectory_t tng_data, tng_file_endianness *endianness)
80 {
81     return(tng_output_file_endianness_get(tng_data, endianness));
82 }
83
84 tng_function_status DECLSPECDLLEXPORT tng_output_file_endianness_set_
85                 (tng_trajectory_t tng_data, const tng_file_endianness *endianness)
86 {
87     return(tng_output_file_endianness_set(tng_data, *endianness));
88 }
89
90 tng_function_status DECLSPECDLLEXPORT tng_first_program_name_set_(tng_trajectory_t tng_data,
91                                                 const char *new_name,
92                                                 int name_len)
93 {
94     char *name = malloc(name_len + 1);
95     tng_function_status stat;
96
97     strncpy(name, new_name, name_len);
98     name[name_len] = 0;
99     stat = tng_first_program_name_set(tng_data, name);
100     free(name);
101     return(stat);
102 }
103
104 tng_function_status DECLSPECDLLEXPORT tng_last_program_name_get_(const tng_trajectory_t tng_data,
105                                                 char *name, const int max_len)
106 {
107     return(tng_last_program_name_get(tng_data, name, max_len));
108 }
109
110 tng_function_status DECLSPECDLLEXPORT tng_last_program_name_set_(tng_trajectory_t tng_data,
111                                                const char *new_name,
112                                                int name_len)
113 {
114     char *name = malloc(name_len + 1);
115     tng_function_status stat;
116
117     strncpy(name, new_name, name_len);
118     name[name_len] = 0;
119     stat = tng_last_program_name_set(tng_data, name);
120     free(name);
121     return(stat);
122 }
123
124 tng_function_status DECLSPECDLLEXPORT tng_first_user_name_get_(const tng_trajectory_t tng_data,
125                                              char *name, const int max_len)
126 {
127     return(tng_first_user_name_get(tng_data, name, max_len));
128 }
129
130 tng_function_status DECLSPECDLLEXPORT tng_first_user_name_set_(tng_trajectory_t tng_data,
131                                              const char *new_name,
132                                              int name_len)
133 {
134     char *name = malloc(name_len + 1);
135     tng_function_status stat;
136
137     strncpy(name, new_name, name_len);
138     name[name_len] = 0;
139     stat = tng_first_user_name_set(tng_data, name);
140     free(name);
141     return(stat);
142 }
143
144 tng_function_status DECLSPECDLLEXPORT tng_last_user_name_get_(const tng_trajectory_t tng_data,
145                                             char *name, const int max_len)
146 {
147     return(tng_last_user_name_get(tng_data, name, max_len));
148 }
149
150 tng_function_status DECLSPECDLLEXPORT tng_last_user_name_set_(tng_trajectory_t tng_data,
151                                             const char *new_name,
152                                             int name_len)
153 {
154     char *name = malloc(name_len + 1);
155     tng_function_status stat;
156
157     strncpy(name, new_name, name_len);
158     name[name_len] = 0;
159     stat = tng_last_user_name_set(tng_data, name);
160     free(name);
161     return(stat);
162 }
163
164 tng_function_status DECLSPECDLLEXPORT tng_first_computer_name_get_(const tng_trajectory_t tng_data,
165                                                  char *name, const int max_len)
166 {
167     return(tng_first_computer_name_get(tng_data, name, max_len));
168 }
169
170 tng_function_status DECLSPECDLLEXPORT tng_first_computer_name_set_(tng_trajectory_t tng_data,
171                                                  const char *new_name,
172                                                  int name_len)
173 {
174     char *name = malloc(name_len + 1);
175     tng_function_status stat;
176
177     strncpy(name, new_name, name_len);
178     name[name_len] = 0;
179     stat = tng_first_computer_name_set(tng_data, name);
180     free(name);
181     return(stat);
182 }
183
184 tng_function_status DECLSPECDLLEXPORT tng_last_computer_name_get_(const tng_trajectory_t tng_data,
185                                                  char *name, const int max_len)
186 {
187     return(tng_last_computer_name_get(tng_data, name, max_len));
188 }
189
190 tng_function_status DECLSPECDLLEXPORT tng_last_computer_name_set_(tng_trajectory_t tng_data,
191                                                 const char *new_name,
192                                                 int name_len)
193 {
194     char *name = malloc(name_len + 1);
195     tng_function_status stat;
196
197     strncpy(name, new_name, name_len);
198     name[name_len] = 0;
199     stat = tng_last_computer_name_set(tng_data, name);
200     free(name);
201     return(stat);
202 }
203
204 tng_function_status DECLSPECDLLEXPORT tng_first_signature_get_
205                 (const tng_trajectory_t tng_data,
206                  char *signature, const int max_len)
207 {
208     return(tng_first_signature_get(tng_data, signature, max_len));
209 }
210
211 tng_function_status DECLSPECDLLEXPORT tng_first_signature_set_(tng_trajectory_t tng_data,
212                                              const char *signature,
213                                              int sign_len)
214 {
215     char *sign = malloc(sign_len + 1);
216     tng_function_status stat;
217
218     strncpy(sign, signature, sign_len);
219     sign[sign_len] = 0;
220     stat = tng_first_signature_set(tng_data, sign);
221     free(sign);
222     return(stat);
223 }
224
225 tng_function_status DECLSPECDLLEXPORT tng_last_signature_get_
226                 (const tng_trajectory_t tng_data,
227                  char *signature, const int max_len)
228 {
229     return(tng_last_signature_get(tng_data, signature, max_len));
230 }
231
232 tng_function_status DECLSPECDLLEXPORT tng_last_signature_set_
233                 (tng_trajectory_t tng_data,
234                  const char *signature,
235                  int sign_len)
236 {
237     char *sign = malloc(sign_len + 1);
238     tng_function_status stat;
239
240     strncpy(sign, signature, sign_len);
241     sign[sign_len] = 0;
242     stat = tng_last_signature_set(tng_data, sign);
243     free(sign);
244     return(stat);
245 }
246
247 tng_function_status DECLSPECDLLEXPORT tng_forcefield_name_get_
248                 (const tng_trajectory_t tng_data,
249                  char *name, const int max_len)
250 {
251     return(tng_forcefield_name_get(tng_data, name, max_len));
252 }
253
254 tng_function_status DECLSPECDLLEXPORT tng_forcefield_name_set_
255                 (tng_trajectory_t tng_data,
256                  const char *new_name,
257                  int name_len)
258 {
259     char *name = malloc(name_len + 1);
260     tng_function_status stat;
261
262     strncpy(name, new_name, name_len);
263     name[name_len] = 0;
264     stat = tng_forcefield_name_set(tng_data, name);
265     free(name);
266     return(stat);
267 }
268
269 tng_function_status DECLSPECDLLEXPORT tng_medium_stride_length_get_
270                 (const tng_trajectory_t tng_data,
271                  int64_t *len)
272 {
273     return(tng_medium_stride_length_get(tng_data, len));
274 }
275
276 tng_function_status DECLSPECDLLEXPORT tng_medium_stride_length_set_
277                 (tng_trajectory_t tng_data,
278                  const int64_t *len)
279 {
280     return(tng_medium_stride_length_set(tng_data, *len));
281 }
282
283 tng_function_status DECLSPECDLLEXPORT tng_long_stride_length_get_
284                 (const tng_trajectory_t tng_data,
285                  int64_t *len)
286 {
287     return(tng_long_stride_length_get(tng_data, len));
288 }
289
290 tng_function_status DECLSPECDLLEXPORT tng_long_stride_length_set_
291                 (tng_trajectory_t tng_data,
292                  const int64_t *len)
293 {
294     return(tng_long_stride_length_set(tng_data, *len));
295 }
296
297 tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_get_
298                 (const tng_trajectory_t tng_data,
299                  double *time)
300 {
301     return(tng_time_per_frame_get(tng_data, time));
302 }
303
304 tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_set_
305                 (tng_trajectory_t tng_data,
306                  const double *time)
307 {
308     return(tng_time_per_frame_set(tng_data, *time));
309 }
310
311 tng_function_status DECLSPECDLLEXPORT tng_input_file_len_get_
312                 (const tng_trajectory_t tng_data,
313                  int64_t *len)
314 {
315     return(tng_input_file_len_get(tng_data, len));
316 }
317
318 tng_function_status DECLSPECDLLEXPORT tng_num_frames_get_
319                 (const tng_trajectory_t tng_data,
320                  int64_t *n)
321 {
322     return(tng_num_frames_get(tng_data, n));
323 }
324
325 tng_function_status DECLSPECDLLEXPORT tng_num_particles_get_
326                 (const tng_trajectory_t tng_data,
327                  int64_t *n)
328 {
329     return(tng_num_particles_get(tng_data, n));
330 }
331
332 tng_function_status DECLSPECDLLEXPORT tng_num_molecules_get_
333                 (const tng_trajectory_t tng_data,
334                  int64_t *n)
335 {
336     return(tng_num_molecules_get(tng_data, n));
337 }
338
339 tng_function_status DECLSPECDLLEXPORT tng_distance_unit_exponential_get_
340                 (const tng_trajectory_t tng_data,
341                  int64_t *exp)
342 {
343     return(tng_distance_unit_exponential_get(tng_data, exp));
344 }
345
346 tng_function_status DECLSPECDLLEXPORT tng_distance_unit_exponential_set_
347                 (const tng_trajectory_t tng_data,
348                  const int64_t *exp)
349 {
350     return(tng_distance_unit_exponential_set(tng_data, *exp));
351 }
352
353 tng_function_status DECLSPECDLLEXPORT tng_num_frames_per_frame_set_get_
354                 (const tng_trajectory_t tng_data,
355                  int64_t *n)
356 {
357     return(tng_num_frames_per_frame_set_get(tng_data, n));
358 }
359
360 tng_function_status DECLSPECDLLEXPORT tng_num_frames_per_frame_set_set_
361                 (const tng_trajectory_t tng_data,
362                  int64_t *n)
363 {
364     return(tng_num_frames_per_frame_set_set(tng_data, *n));
365 }
366
367 tng_function_status DECLSPECDLLEXPORT tng_num_frame_sets_get_
368                 (const tng_trajectory_t tng_data,
369                  int64_t *n)
370 {
371     return(tng_num_frame_sets_get(tng_data, n));
372 }
373
374 tng_function_status DECLSPECDLLEXPORT tng_current_frame_set_get_
375                 (tng_trajectory_t tng_data,
376                  tng_trajectory_frame_set_t *frame_set_p)
377 {
378     return(tng_current_frame_set_get(tng_data, frame_set_p));
379 }
380
381 tng_function_status DECLSPECDLLEXPORT tng_frame_set_nr_find_(tng_trajectory_t tng_data,
382                                                              const int64_t *nr)
383 {
384     return(tng_frame_set_nr_find(tng_data, *nr));
385 }
386
387 tng_function_status DECLSPECDLLEXPORT tng_frame_set_of_frame_find_
388                 (tng_trajectory_t tng_data,
389                  const int64_t *frame)
390 {
391     return(tng_frame_set_of_frame_find(tng_data, *frame));
392 }
393
394 tng_function_status DECLSPECDLLEXPORT tng_frame_set_next_frame_set_file_pos_get_
395                 (const tng_trajectory_t tng_data,
396                  const tng_trajectory_frame_set_t frame_set,
397                  int64_t *pos)
398 {
399     return(tng_frame_set_next_frame_set_file_pos_get(tng_data, frame_set, pos));
400 }
401
402 tng_function_status DECLSPECDLLEXPORT tng_frame_set_prev_frame_set_file_pos_get_
403                 (const tng_trajectory_t tng_data,
404                  const tng_trajectory_frame_set_t frame_set,
405                  int64_t *pos)
406 {
407     return(tng_frame_set_prev_frame_set_file_pos_get(tng_data, frame_set, pos));
408 }
409
410 tng_function_status DECLSPECDLLEXPORT tng_frame_set_frame_range_get_
411                 (const tng_trajectory_t tng_data,
412                  const tng_trajectory_frame_set_t frame_set,
413                  int64_t *first_frame,
414                  int64_t *last_frame)
415 {
416     return(tng_frame_set_frame_range_get(tng_data, frame_set, first_frame,
417                                          last_frame));
418 }
419
420 tng_function_status DECLSPECDLLEXPORT tng_molecule_init_(const tng_trajectory_t tng_data,
421                                        tng_molecule_t molecule)
422 {
423     return(tng_molecule_init(tng_data, molecule));
424 }
425
426 tng_function_status DECLSPECDLLEXPORT tng_molecule_destroy_
427                 (const tng_trajectory_t tng_data,
428                  tng_molecule_t molecule)
429 {
430     return(tng_molecule_destroy(tng_data, molecule));
431 }
432
433 tng_function_status DECLSPECDLLEXPORT tng_molecule_add_(tng_trajectory_t tng_data,
434                                                         const char *name,
435                                                         tng_molecule_t *molecule,
436                                                         int name_len)
437 {
438     char *n = malloc(name_len + 1);
439     tng_function_status stat;
440
441     strncpy(n, name, name_len);
442     n[name_len] = 0;
443     stat = tng_molecule_add(tng_data, n, molecule);
444     free(n);
445     return(stat);
446 }
447
448 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_set_(tng_trajectory_t tng_data,
449                                                              tng_molecule_t molecule,
450                                                              const char *new_name,
451                                                              int name_len)
452 {
453     char *name = malloc(name_len + 1);
454     tng_function_status stat;
455
456     strncpy(name, new_name, name_len);
457     name[name_len] = 0;
458     stat = tng_molecule_name_set(tng_data, molecule, name);
459     free(name);
460     return(stat);
461 }
462
463 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_get_(tng_trajectory_t tng_data,
464                                                             tng_molecule_t molecule,
465                                                             int64_t *cnt)
466 {
467     return(tng_molecule_cnt_get(tng_data, molecule, cnt));
468 }
469
470 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_set_(tng_trajectory_t tng_data,
471                                                             tng_molecule_t molecule,
472                                                             int64_t *cnt)
473 {
474     return(tng_molecule_cnt_set(tng_data, molecule, *cnt));
475 }
476
477 tng_function_status DECLSPECDLLEXPORT tng_molecule_find_(tng_trajectory_t tng_data,
478                                                          const char *name,
479                                                          int64_t nr,
480                                                          tng_molecule_t *molecule,
481                                                          int name_len)
482 {
483     char *n = malloc(name_len + 1);
484     tng_function_status stat;
485
486     strncpy(n, name, name_len);
487     n[name_len] = 0;
488     stat = tng_molecule_find(tng_data, n, nr, molecule);
489     free(n);
490     return(stat);
491 }
492
493 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_find_(tng_trajectory_t tng_data,
494                                                                tng_molecule_t molecule,
495                                                                const char *name,
496                                                                int64_t id,
497                                                                tng_chain_t *chain,
498                                                                int name_len)
499 {
500     char *n = malloc(name_len + 1);
501     tng_function_status stat;
502
503     strncpy(n, name, name_len);
504     n[name_len] = 0;
505     stat = tng_molecule_chain_find(tng_data, molecule, n, id, chain);
506     free(n);
507     return(stat);
508 }
509
510 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_add_(tng_trajectory_t tng_data,
511                                                               tng_molecule_t molecule,
512                                                               const char *name,
513                                                               tng_chain_t *chain,
514                                                               int name_len)
515 {
516     char *n = malloc(name_len + 1);
517     tng_function_status stat;
518
519     strncpy(n, name, name_len);
520     n[name_len] = 0;
521     stat = tng_molecule_chain_add(tng_data, molecule, n, chain);
522     free(n);
523     return(stat);
524 }
525
526 tng_function_status DECLSPECDLLEXPORT tng_chain_name_set_(tng_trajectory_t tng_data,
527                                                           tng_chain_t chain,
528                                                           const char *new_name,
529                                                           int name_len)
530 {
531     char *name = malloc(name_len + 1);
532     tng_function_status stat;
533
534     strncpy(name, new_name, name_len);
535     name[name_len] = 0;
536     stat = tng_chain_name_set(tng_data, chain, name);
537     free(name);
538     return(stat);
539 }
540
541 tng_function_status DECLSPECDLLEXPORT tng_chain_residue_add_(tng_trajectory_t tng_data,
542                                                              tng_chain_t chain,
543                                                              const char *name,
544                                                              tng_residue_t *residue,
545                                                              int name_len)
546 {
547     char *n = malloc(name_len + 1);
548     tng_function_status stat;
549
550     strncpy(n, name, name_len);
551     n[name_len] = 0;
552     stat = tng_chain_residue_add(tng_data, chain, n, residue);
553     free(n);
554     return(stat);
555 }
556
557 tng_function_status DECLSPECDLLEXPORT tng_residue_name_set_(tng_trajectory_t tng_data,
558                                                             tng_residue_t residue,
559                                                             const char *new_name,
560                                                             int name_len)
561 {
562     char *name = malloc(name_len + 1);
563     tng_function_status stat;
564
565     strncpy(name, new_name, name_len);
566     name[name_len] = 0;
567     stat = tng_residue_name_set(tng_data, residue, name);
568     free(name);
569     return(stat);
570 }
571
572 tng_function_status DECLSPECDLLEXPORT tng_residue_atom_add_(tng_trajectory_t tng_data,
573                                                             tng_residue_t residue,
574                                                             const char *atom_name,
575                                                             const char *atom_type,
576                                                             tng_atom_t *atom,
577                                                             int name_len,
578                                                             int type_len)
579 {
580     char *name = malloc(name_len + 1);
581     char *type = malloc(type_len + 1);
582     tng_function_status stat;
583
584     strncpy(name, atom_name, name_len);
585     strncpy(type, atom_type, type_len);
586     name[name_len] = 0;
587     type[type_len] = 0;
588     stat = tng_residue_atom_add(tng_data, residue, name, type, atom);
589     free(name);
590     free(type);
591     return(stat);
592 }
593
594 tng_function_status DECLSPECDLLEXPORT tng_atom_name_set_(tng_trajectory_t tng_data,
595                                                          tng_atom_t atom,
596                                                          const char *new_name,
597                                                          int name_len)
598 {
599     char *name = malloc(name_len + 1);
600     tng_function_status stat;
601
602     strncpy(name, new_name, name_len);
603     name[name_len] = 0;
604     stat = tng_atom_name_set(tng_data, atom, name);
605     free(name);
606     return(stat);
607 }
608
609 tng_function_status DECLSPECDLLEXPORT tng_atom_type_set_(tng_trajectory_t tng_data,
610                                                          tng_atom_t atom,
611                                                          const char *new_type,
612                                                          int type_len)
613 {
614     char *type = malloc(type_len + 1);
615     tng_function_status stat;
616
617     strncpy(type, new_type, type_len);
618     type[type_len] = 0;
619     stat = tng_atom_type_set(tng_data, atom, type);
620     free(type);
621     return(stat);
622 }
623
624 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_of_particle_nr_get_
625                 (const tng_trajectory_t tng_data,
626                  const int64_t nr,
627                  char *name,
628                  int max_len)
629 {
630     return(tng_molecule_name_of_particle_nr_get(tng_data, nr, name, max_len));
631 }
632
633 tng_function_status DECLSPECDLLEXPORT tng_chain_name_of_particle_nr_get_
634                 (const tng_trajectory_t tng_data,
635                  const int64_t nr,
636                  char *name,
637                  int max_len)
638 {
639     return(tng_chain_name_of_particle_nr_get(tng_data, nr, name, max_len));
640 }
641
642 tng_function_status DECLSPECDLLEXPORT tng_residue_name_of_particle_nr_get_
643                 (const tng_trajectory_t tng_data,
644                  const int64_t nr,
645                  char *name,
646                  int max_len)
647 {
648     return(tng_residue_name_of_particle_nr_get(tng_data, nr, name, max_len));
649 }
650
651 tng_function_status DECLSPECDLLEXPORT tng_residue_id_of_particle_nr_get_
652                 (const tng_trajectory_t tng_data,
653                  const int64_t nr,
654                  int64_t *id)
655 {
656     return(tng_residue_id_of_particle_nr_get(tng_data, nr, id));
657 }
658
659 tng_function_status DECLSPECDLLEXPORT tng_atom_name_of_particle_nr_get_
660                 (const tng_trajectory_t tng_data,
661                  const int64_t nr,
662                  char *name,
663                  int max_len)
664 {
665     return(tng_atom_name_of_particle_nr_get(tng_data, nr, name, max_len));
666 }
667
668 tng_function_status DECLSPECDLLEXPORT tng_atom_type_of_particle_nr_get_
669                 (const tng_trajectory_t tng_data,
670                  const int64_t nr,
671                  char *type,
672                  int max_len)
673 {
674     return(tng_atom_type_of_particle_nr_get(tng_data, nr, type, max_len));
675 }
676
677 tng_function_status DECLSPECDLLEXPORT tng_particle_mapping_add_
678                 (tng_trajectory_t tng_data,
679                  const int64_t *first_particle_number,
680                  const int64_t *n_particles,
681                  const int64_t *mapping_table)
682 {
683     return(tng_particle_mapping_add(tng_data, *first_particle_number,
684                                     *n_particles, mapping_table));
685 }
686
687 tng_function_status DECLSPECDLLEXPORT tng_file_headers_read_(tng_trajectory_t tng_data,
688                                                              const char *hash_mode)
689 {
690     return(tng_file_headers_read(tng_data, *hash_mode));
691 }
692
693 tng_function_status DECLSPECDLLEXPORT tng_file_headers_write_
694                 (tng_trajectory_t tng_data,
695                  const char *hash_mode)
696 {
697     return(tng_file_headers_write(tng_data, *hash_mode));
698 }
699
700 tng_function_status DECLSPECDLLEXPORT tng_block_read_next_
701                 (tng_trajectory_t tng_data,
702                  tng_gen_block_t block_data,
703                  const char *hash_mode)
704 {
705     return(tng_block_read_next(tng_data, block_data, *hash_mode));
706 }
707
708 tng_function_status DECLSPECDLLEXPORT tng_frame_set_read_next_
709                 (tng_trajectory_t tng_data,
710                  const char *hash_mode)
711 {
712     return(tng_frame_set_read_next(tng_data, *hash_mode));
713 }
714
715 tng_function_status DECLSPECDLLEXPORT tng_frame_set_write_(tng_trajectory_t tng_data,
716                                                            const char *hash_mode)
717 {
718     return(tng_frame_set_write(tng_data, *hash_mode));
719 }
720
721 tng_function_status DECLSPECDLLEXPORT tng_frame_set_new_(tng_trajectory_t tng_data,
722                                                          const int64_t *first_frame,
723                                                          const int64_t *n_frames)
724 {
725     return(tng_frame_set_new(tng_data, *first_frame, *n_frames));
726 }
727
728 tng_function_status DECLSPECDLLEXPORT tng_frame_set_with_time_new_
729                 (tng_trajectory_t tng_data,
730                  const int64_t *first_frame,
731                  const int64_t *n_frames,
732                  const double *first_frame_time)
733 {
734     return(tng_frame_set_with_time_new(tng_data, *first_frame, *n_frames,
735                              *first_frame_time));
736 }
737
738 tng_function_status DECLSPECDLLEXPORT tng_frame_set_first_frame_time_set_
739                 (tng_trajectory_t tng_data,
740                  const double *first_frame_time)
741 {
742     return(tng_frame_set_first_frame_time_set(tng_data, *first_frame_time));
743 }
744
745 tng_function_status DECLSPECDLLEXPORT tng_data_block_add_
746                 (tng_trajectory_t tng_data,
747                  const int64_t *id,
748                  const char *block_name,
749                  const char *datatype,
750                  const char *block_type_flag,
751                  int64_t *n_frames,
752                  const int64_t *n_values_per_frame,
753                  const int64_t *stride_length,
754                  const int64_t *codec_id,
755                  void *new_data,
756                  int name_len)
757 {
758     char *name = malloc(name_len + 1);
759     tng_function_status stat;
760
761     strncpy(name, block_name, name_len);
762     name[name_len] = 0;
763     stat = tng_data_block_add(tng_data, *id, name, *datatype, *block_type_flag,
764                               *n_frames, *n_values_per_frame, *stride_length,
765                               *codec_id, new_data);
766     free(name);
767     return(stat);
768 }
769
770 tng_function_status DECLSPECDLLEXPORT tng_particle_data_block_add_
771                 (tng_trajectory_t tng_data,
772                  const int64_t *id,
773                  const char *block_name,
774                  const char *datatype,
775                  const char *block_type_flag,
776                  int64_t *n_frames,
777                  const int64_t *n_values_per_frame,
778                  const int64_t *stride_length,
779                  const int64_t *first_particle_number,
780                  const int64_t *n_particles,
781                  const int64_t *codec_id,
782                  void *new_data,
783                  int name_len)
784 {
785     char *name = malloc(name_len + 1);
786     tng_function_status stat;
787
788     strncpy(name, block_name, name_len);
789     name[name_len] = 0;
790     stat = tng_particle_data_block_add(tng_data, *id, name, *datatype,
791                                        *block_type_flag, *n_frames,
792                                        *n_values_per_frame, *stride_length,
793                                        *first_particle_number, *n_particles,
794                                        *codec_id, new_data);
795     free(name);
796     return(stat);
797 }
798
799 tng_function_status DECLSPECDLLEXPORT tng_frame_data_write_
800                 (tng_trajectory_t tng_data,
801                  const int64_t *frame_nr,
802                  const int64_t *block_id,
803                  const void *data,
804                  const char *hash_mode)
805 {
806     return(tng_frame_data_write(tng_data, *frame_nr, *block_id, data,
807                                 *hash_mode));
808 }
809
810 tng_function_status DECLSPECDLLEXPORT tng_frame_particle_data_write_
811                 (tng_trajectory_t tng_data,
812                  const int64_t *frame_nr,
813                  const int64_t *block_id,
814                  const int64_t *val_first_particle,
815                  const int64_t *val_n_particles,
816                  const void *data,
817                  const char *hash_mode)
818 {
819     return(tng_frame_particle_data_write(tng_data, *frame_nr, *block_id,
820                                          *val_first_particle, *val_n_particles,
821                                          data, *hash_mode));
822 }
823
824 tng_function_status DECLSPECDLLEXPORT tng_data_values_free_
825                 (const tng_trajectory_t tng_data,
826                  union data_values **values,
827                  const int64_t *n_frames,
828                  const int64_t *n_values_per_frame,
829                  const char *type)
830 {
831     return(tng_data_values_free(tng_data, values, *n_frames,
832                                 *n_values_per_frame, *type));
833 }
834
835 tng_function_status DECLSPECDLLEXPORT tng_particle_data_values_free_
836                 (const tng_trajectory_t tng_data,
837                  union data_values ***values,
838                  const int64_t *n_frames,
839                  const int64_t *n_particles,
840                  const int64_t *n_values_per_frame,
841                  const char *type)
842 {
843     return(tng_particle_data_values_free(tng_data, values, *n_frames, *n_particles,
844                                          *n_values_per_frame, *type));
845 }
846
847 tng_function_status DECLSPECDLLEXPORT tng_data_get_
848                 (tng_trajectory_t tng_data,
849                  const int64_t *block_id,
850                  union data_values ***values,
851                  int64_t *n_frames,
852                  int64_t *n_values_per_frame,
853                  char *type)
854 {
855     return(tng_data_get(tng_data, *block_id, values, n_frames,
856                         n_values_per_frame, type));
857 }
858
859 tng_function_status DECLSPECDLLEXPORT tng_data_interval_get_
860                 (tng_trajectory_t tng_data,
861                  const int64_t *block_id,
862                  const int64_t *start_frame_nr,
863                  const int64_t *end_frame_nr,
864                  const char *hash_mode,
865                  union data_values ***values,
866                  int64_t *n_values_per_frame,
867                  char *type)
868 {
869     return(tng_data_interval_get(tng_data, *block_id, *start_frame_nr,
870                                  *end_frame_nr, *hash_mode, values,
871                                  n_values_per_frame, type));
872 }
873
874 tng_function_status DECLSPECDLLEXPORT tng_particle_data_get_
875                 (tng_trajectory_t tng_data,
876                  const int64_t *block_id,
877                  union data_values ****values,
878                  int64_t *n_frames,
879                  int64_t *n_particles,
880                  int64_t *n_values_per_frame,
881                  char *type)
882 {
883     return(tng_particle_data_get(tng_data, *block_id, values, n_frames,
884                                  n_particles, n_values_per_frame, type));
885 }
886
887 tng_function_status DECLSPECDLLEXPORT tng_particle_data_interval_get_
888                 (tng_trajectory_t tng_data,
889                  const int64_t *block_id,
890                  const int64_t *start_frame_nr,
891                  const int64_t *end_frame_nr,
892                  const char *hash_mode,
893                  union data_values ****values,
894                  int64_t *n_particles,
895                  int64_t *n_values_per_frame,
896                  char *type)
897 {
898     return(tng_particle_data_interval_get(tng_data, *block_id, *start_frame_nr,
899                                           *end_frame_nr, *hash_mode, values,
900                                           n_particles, n_values_per_frame,
901                                           type));
902 }
903
904 tng_function_status DECLSPECDLLEXPORT tng_time_get_str_
905                 (const tng_trajectory_t tng_data,
906                  char *time, int64_t str_len)
907 {
908     return(tng_time_get_str(tng_data, time));
909 }
910
911 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_open_
912                 (const char *filename, const char *mode,
913                  tng_trajectory_t *tng_data_p)
914 {
915     return(tng_util_trajectory_open(filename, *mode, tng_data_p));
916 }
917
918 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_close_
919                 (tng_trajectory_t *tng_data_p)
920 {
921     return(tng_util_trajectory_close(tng_data_p));
922 }
923
924 tng_function_status DECLSPECDLLEXPORT tng_util_pos_read_
925                 (tng_trajectory_t tng_data,
926                  float **positions,
927                  int64_t *stride_length)
928 {
929     return(tng_util_pos_read(tng_data, positions, stride_length));
930 }
931
932 tng_function_status DECLSPECDLLEXPORT tng_util_vel_read_
933                 (tng_trajectory_t tng_data,
934                  float **velocities,
935                  int64_t *stride_length)
936 {
937     return(tng_util_vel_read(tng_data, velocities, stride_length));
938 }
939
940 tng_function_status DECLSPECDLLEXPORT tng_util_force_read_
941                 (tng_trajectory_t tng_data,
942                  float **forces,
943                  int64_t *stride_length)
944 {
945     return(tng_util_force_read(tng_data, forces, stride_length));
946 }
947
948 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_read_
949                 (tng_trajectory_t tng_data,
950                  float **box_shape,
951                  int64_t *stride_length)
952 {
953     return(tng_util_box_shape_read(tng_data, box_shape, stride_length));
954 }
955
956 tng_function_status DECLSPECDLLEXPORT tng_util_pos_read_range_
957                 (tng_trajectory_t tng_data,
958                  const int64_t *first_frame,
959                  const int64_t *last_frame,
960                  float **positions,
961                  int64_t *stride_length)
962 {
963     return(tng_util_pos_read_range(tng_data, *first_frame, *last_frame,
964                                          positions, stride_length));
965 }
966
967 tng_function_status DECLSPECDLLEXPORT tng_util_vel_read_range_
968                 (tng_trajectory_t tng_data,
969                  const int64_t *first_frame,
970                  const int64_t *last_frame,
971                  float **velocities,
972                  int64_t *stride_length)
973 {
974     return(tng_util_vel_read_range(tng_data, *first_frame, *last_frame,
975                                          velocities, stride_length));
976 }
977
978 tng_function_status DECLSPECDLLEXPORT tng_util_force_read_range_
979                 (tng_trajectory_t tng_data,
980                  const int64_t *first_frame,
981                  const int64_t *last_frame,
982                  float **forces,
983                  int64_t *stride_length)
984 {
985     return(tng_util_force_read_range(tng_data, *first_frame, *last_frame,
986                                          forces, stride_length));
987 }
988
989 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_read_range_
990                 (tng_trajectory_t tng_data,
991                  const int64_t *first_frame,
992                  const int64_t *last_frame,
993                  float **box_shape,
994                  int64_t *stride_length)
995 {
996     return(tng_util_box_shape_read_range(tng_data, *first_frame, *last_frame,
997                                          box_shape, stride_length));
998 }
999
1000 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_frequency_set_
1001                 (tng_trajectory_t tng_data,
1002                  const int64_t *f,
1003                  const int64_t *n_values_per_frame,
1004                  const int64_t *block_id,
1005                  const char *block_name,
1006                  const char *particle_dependency,
1007                  const char *compression)
1008 {
1009     return(tng_util_generic_write_frequency_set(tng_data, *f,
1010                                                 *n_values_per_frame, *block_id,
1011                                                 block_name,
1012                                                 *particle_dependency,
1013                                                 *compression));
1014 }
1015
1016 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_frequency_set_
1017                 (tng_trajectory_t tng_data,
1018                  const int64_t *f)
1019 {
1020     return(tng_util_pos_write_frequency_set(tng_data, *f));
1021 }
1022
1023 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_frequency_set_
1024                 (tng_trajectory_t tng_data,
1025                  const int64_t *f)
1026 {
1027     return(tng_util_vel_write_frequency_set(tng_data, *f));
1028 }
1029
1030 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_frequency_set_
1031                 (tng_trajectory_t tng_data,
1032                  const int64_t *f)
1033 {
1034     return(tng_util_force_write_frequency_set(tng_data, *f));
1035 }
1036
1037 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_frequency_set_
1038                 (tng_trajectory_t tng_data,
1039                  const int64_t *f)
1040 {
1041     return(tng_util_box_shape_write_frequency_set(tng_data, *f));
1042 }
1043
1044 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_
1045                 (tng_trajectory_t tng_data,
1046                  const int64_t *frame_nr,
1047                  const float *values,
1048                  const int64_t *n_values_per_frame,
1049                  const int64_t *block_id,
1050                  const char *block_name,
1051                  const char *particle_dependency,
1052                  const char *compression)
1053 {
1054     return(tng_util_generic_write(tng_data, *frame_nr, values,
1055                                   *n_values_per_frame, *block_id, block_name,
1056                                   *particle_dependency, *compression));
1057 }
1058
1059 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_
1060                 (tng_trajectory_t tng_data,
1061                  const int64_t *frame_nr,
1062                  const float *positions)
1063 {
1064     return(tng_util_vel_write(tng_data, *frame_nr, positions));
1065 }
1066
1067 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_
1068                 (tng_trajectory_t tng_data,
1069                  const int64_t *frame_nr,
1070                  const float *velocities)
1071 {
1072     return(tng_util_vel_write(tng_data, *frame_nr, velocities));
1073 }
1074
1075 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_
1076                 (tng_trajectory_t tng_data,
1077                  const int64_t *frame_nr,
1078                  const float *forces)
1079 {
1080     return(tng_util_force_write(tng_data, *frame_nr, forces));
1081 }
1082
1083 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_
1084                 (tng_trajectory_t tng_data,
1085                  const int64_t *frame_nr,
1086                  const float *box_shape)
1087 {
1088     return(tng_util_box_shape_write(tng_data, *frame_nr, box_shape));
1089 }
1090
1091 tng_function_status DECLSPECDLLEXPORT tng_util_pos_with_time_write_
1092                 (tng_trajectory_t tng_data,
1093                  const int64_t *frame_nr,
1094                  const int64_t *time,
1095                  const float *positions)
1096 {
1097     return(tng_util_pos_with_time_write(tng_data, *frame_nr, *time,
1098                                         positions));
1099 }
1100
1101 tng_function_status DECLSPECDLLEXPORT tng_util_vel_with_time_write_
1102                 (tng_trajectory_t tng_data,
1103                  const int64_t *frame_nr,
1104                  const int64_t *time,
1105                  const float *velocities)
1106 {
1107     return(tng_util_vel_with_time_write(tng_data, *frame_nr, *time,
1108                                         velocities));
1109 }
1110
1111 tng_function_status DECLSPECDLLEXPORT tng_util_force_with_time_write_
1112                 (tng_trajectory_t tng_data,
1113                  const int64_t *frame_nr,
1114                  const int64_t *time,
1115                  const float *forces)
1116 {
1117     return(tng_util_force_with_time_write(tng_data, *frame_nr, *time,
1118                                           forces));
1119 }
1120
1121 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_with_time_write_
1122                 (tng_trajectory_t tng_data,
1123                  const int64_t *frame_nr,
1124                  const int64_t *time,
1125                  const float *box_shape)
1126 {
1127     return(tng_util_box_shape_with_time_write(tng_data, *frame_nr, *time,
1128                                               box_shape));
1129 }