Removed genalg.h by mistake
[gromacs.git] / include / trnio.h
blob3693f43a0850d3c59c0f7cc6bc627bb0865d7712
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 3.1
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
29 * And Hey:
30 * Getting the Right Output Means no Artefacts in Calculating Stuff
33 #ifndef _trnio_h
34 #define _trnio_h
36 static char *SRCID_trnio_h = "$Id$";
37 #ifdef HAVE_CONFIG_H
38 #include <config.h>
39 #endif
41 /**************************************************************
43 * These routines handle trj (trajectory) I/O, they read and
44 * write trj/trr files. The routines should be able to read single
45 * and double precision files without the user noting it.
46 * The files are backward compatible, therefore the header holds
47 * some unused variables.
49 * The routines in the corresponding c-file trnio.c
50 * are based on the lower level routines in gmxfio.c
51 * The integer file pointer returned from open_trn
52 * can also be used with the routines in gmxfio.h
54 **************************************************************/
56 #include "typedefs.h"
58 typedef struct /* This struct describes the order and the */
59 /* sizes of the structs in a trjfile, sizes are given in bytes. */
61 int ir_size; /* Backward compatibility */
62 int e_size; /* Backward compatibility */
63 int box_size; /* Non zero if a box is present */
64 int vir_size; /* Backward compatibility */
65 int pres_size; /* Backward compatibility */
66 int top_size; /* Backward compatibility */
67 int sym_size; /* Backward compatibility */
68 int x_size; /* Non zero if coordinates are present */
69 int v_size; /* Non zero if velocities are present */
70 int f_size; /* Non zero if forces are present */
72 int natoms; /* The total number of atoms */
73 int step; /* Current step number */
74 int nre; /* Backward compatibility */
75 real t; /* Current time */
76 real lambda; /* Current value of lambda */
77 } t_trnheader;
79 extern int open_trn(char *fn,char *mode);
80 /* Open a trj / trr file */
82 extern void close_trn(int fp);
83 /* Close it */
85 extern bool fread_trnheader(int fp,t_trnheader *trn,bool *bOK);
86 /* Read the header of a trn file. Return FALSE if there is no frame.
87 * bOK will be FALSE when the header is incomplete.
90 extern void read_trnheader(char *fn,t_trnheader *header);
91 /* Read the header of a trn file from fn, and close the file afterwards.
94 extern void pr_trnheader(FILE *fp,int indent,char *title,t_trnheader *sh);
95 /* Print the header of a trn file to fp */
97 extern bool is_trn(FILE *fp);
98 /* Return true when the file is a trn file. File will be rewound
99 * afterwards.
102 extern void fwrite_trn(int fp,int step,real t,real lambda,
103 rvec *box,int natoms,rvec *x,rvec *v,rvec *f);
104 /* Write a trn frame to file fp, box, x, v, f may be NULL */
106 extern bool fread_htrn(int fp,t_trnheader *sh,
107 rvec *box,rvec *x,rvec *v,rvec *f);
108 /* Extern read a frame except the header (that should be pre-read,
109 * using routine read_trnheader, see above) from a trn file.
110 * Return FALSE on error
113 extern bool fread_trn(int fp,int *step,real *t,real *lambda,
114 rvec *box,int *natoms,rvec *x,rvec *v,rvec *f);
115 /* Read a trn frame, including the header from fp. box, x, v, f may
116 * be NULL, in which case the data will be skipped over.
117 * return FALSE on error
120 extern void write_trn(char *fn,int step,real t,real lambda,
121 rvec *box,int natoms,rvec *x,rvec *v,rvec *f);
122 /* Write a single trn frame to file fn, which is closed afterwards */
124 extern void read_trn(char *fn,int *step,real *t,real *lambda,
125 rvec *box,int *natoms,rvec *x,rvec *v,rvec *);
126 /* Read a single trn frame from file fn, which is closed afterwards
129 #endif