4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
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
30 * Getting the Right Output Means no Artefacts in Calculating Stuff
36 static char *SRCID_tpxio_h
= "$Id$";
45 /**************************************************************
47 * The routines in the corresponding c-file tpxio.c
48 * are based on the lower level routines in gmxfio.c
49 * The integer file pointer returned from open_tpx
50 * can also be used with the routines in gmxfio.h
52 **************************************************************/
57 int bIr
; /* Non zero if input_rec is present */
58 int bBox
; /* Non zero if a box is present */
59 int bTop
; /* Non zero if a topology is present */
60 int bX
; /* Non zero if coordinates are present */
61 int bV
; /* Non zero if velocities are present */
62 int bF
; /* Non zero if forces are present */
64 int natoms
; /* The total number of atoms */
65 int step
; /* Current step number */
66 real t
; /* Current time */
67 real lambda
; /* Current value of lambda */
71 * These routines handle reading and writing of preprocessed
72 * topology files in any of the following formats:
73 * TPR : topology in XDR format, portable accross platforms
74 * TPB : binary topology, not portable accross platforms
75 * TPA : ascii topology (possibbly huge)
76 * TRR : trajectory in XDR format (non compressed)
77 * TRJ : trajectory in binary format
79 * Files are written in the precision with which the source are compiled,
80 * but double and single precision can be read by either.
83 extern int open_tpx(char *fn
,char *mode
);
84 /* Return an integer corresponding to the file you have just opened */
86 extern void close_tpx(int fp
);
87 /* Close the file corresponding to fp */
89 extern void read_tpxheader(char *fn
,t_tpxheader
*tpx
);
90 /* Read the header from a tpx file and then close it again */
92 extern void write_tpx(char *fn
,int step
,real t
,real lambda
,
93 t_inputrec
*ir
,rvec
*box
,int natoms
,
94 rvec
*x
,rvec
*v
,rvec
*f
,t_topology
*top
);
95 /* Write a file, and close it again.
96 * If fn == NULL, an efTPA file will be written to stdout (which
97 * will not be closed afterwards)
100 extern void read_tpx(char *fn
,int *step
,real
*t
,real
*lambda
,
101 t_inputrec
*ir
,rvec
*box
,int *natoms
,
102 rvec
*x
,rvec
*v
,rvec
*f
,t_topology
*top
);
103 /* Read a file, and close it again.
104 * If fn == NULL, an efTPA file will be read from stdin (which
105 * will not be closed afterwards)
108 extern bool fn2bTPX(char *file
);
109 /* return if *file is one of the TPX file types */
111 extern bool read_tps_conf(char *infile
,char *title
,t_topology
*top
,
112 rvec
**x
,rvec
**v
,matrix box
,bool bMass
);
113 /* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
114 * memory for atoms, x and v will be allocated.
115 * Return TRUE if a complete topology was read.
116 * If infile is a TPX file read the whole top,
117 * else if bMass=TRUE, read the masses into top.atoms from the mass database.