4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Green Red Orange Magenta Azure Cyan Skyblue
33 static char *SRCID_tpxio_h
= "$Id$";
39 /**************************************************************
41 * The routines in the corresponding c-file tpxio.c
42 * are based on the lower level routines in gmxfio.c
43 * The integer file pointer returned from open_tpx
44 * can also be used with the routines in gmxfio.h
46 **************************************************************/
52 int bIr
; /* Non zero if input_rec is present */
53 int bBox
; /* Non zero if a box is present */
54 int bTop
; /* Non zero if a topology is present */
55 int bX
; /* Non zero if coordinates are present */
56 int bV
; /* Non zero if velocities are present */
57 int bF
; /* Non zero if forces are present */
59 int natoms
; /* The total number of atoms */
60 int step
; /* Current step number */
61 real t
; /* Current time */
62 real lambda
; /* Current value of lambda */
66 * These routines handle reading and writing of preprocessed
67 * topology files in any of the following formats:
68 * TPR : topology in XDR format, portable accross platforms
69 * TPB : binary topology, not portable accross platforms
70 * TPA : ascii topology (possibbly huge)
71 * TRR : trajectory in XDR format (non compressed)
72 * TRJ : trajectory in binary format
74 * Files are written in the precision with which the source are compiled,
75 * but double and single precision can be read by either.
78 extern int open_tpx(char *fn
,char *mode
);
79 /* Return an integer corresponding to the file you have just opened */
81 extern void close_tpx(int fp
);
82 /* Close the file corresponding to fp */
84 extern void read_tpxheader(char *fn
,t_tpxheader
*tpx
);
85 /* Read the header from a tpx file and then close it again */
87 extern void write_tpx(char *fn
,int step
,real t
,real lambda
,
88 t_inputrec
*ir
,rvec
*box
,int natoms
,
89 rvec
*x
,rvec
*v
,rvec
*f
,t_topology
*top
);
90 /* Write a file, and close it again.
91 * If fn == NULL, an efTPA file will be written to stdout (which
92 * will not be closed afterwards)
95 extern void read_tpx(char *fn
,int *step
,real
*t
,real
*lambda
,
96 t_inputrec
*ir
,rvec
*box
,int *natoms
,
97 rvec
*x
,rvec
*v
,rvec
*f
,t_topology
*top
);
98 /* Read a file, and close it again.
99 * If fn == NULL, an efTPA file will be read from stdin (which
100 * will not be closed afterwards)
103 extern void fwrite_tpx(int fp
,int step
,real t
,real lambda
,
104 t_inputrec
*ir
,rvec
*box
,int natoms
,
105 rvec
*x
,rvec
*v
,rvec
*f
,t_topology
*top
);
106 /* Write a file, and do not close it */
108 extern void fread_tpx(int fp
,int *step
,real
*t
,real
*lambda
,
109 t_inputrec
*ir
,rvec
*box
,int *natoms
,
110 rvec
*x
,rvec
*v
,rvec
*f
,t_topology
*top
);
111 /* Read a file, and do not close it */
113 extern bool fn2bTPX(char *file
);
114 /* return if *file is one of the TPX file types */
116 extern bool read_tps_conf(char *infile
,char *title
,t_topology
*top
,
117 rvec
**x
,rvec
**v
,matrix box
,bool bMass
);
118 /* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
119 * memory for atoms, x and v will be allocated.
120 * Return TRUE if a topology was read.
121 * If infile is a TPX file read the whole top,
122 * else if bMass=TRUE, read the masses into top.atoms from the mass database.