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$";
43 /**************************************************************
45 * The routines in the corresponding c-file tpxio.c
46 * are based on the lower level routines in gmxfio.c
47 * The integer file pointer returned from open_tpx
48 * can also be used with the routines in gmxfio.h
50 **************************************************************/
56 int bIr; /* Non zero if input_rec is present */
57 int bBox; /* Non zero if a box is present */
58 int bTop; /* Non zero if a topology is present */
59 int bX; /* Non zero if coordinates are present */
60 int bV; /* Non zero if velocities are present */
61 int bF; /* Non zero if forces are present */
63 int natoms; /* The total number of atoms */
64 int step; /* Current step number */
65 real t; /* Current time */
66 real lambda; /* Current value of lambda */
70 * These routines handle reading and writing of preprocessed
71 * topology files in any of the following formats:
72 * TPR : topology in XDR format, portable accross platforms
73 * TPB : binary topology, not portable accross platforms
74 * TPA : ascii topology (possibbly huge)
75 * TRR : trajectory in XDR format (non compressed)
76 * TRJ : trajectory in binary format
78 * Files are written in the precision with which the source are compiled,
79 * but double and single precision can be read by either.
82 extern int open_tpx(char *fn,char *mode);
83 /* Return an integer corresponding to the file you have just opened */
85 extern void close_tpx(int fp);
86 /* Close the file corresponding to fp */
88 extern void read_tpxheader(char *fn,t_tpxheader *tpx);
89 /* Read the header from a tpx file and then close it again */
91 extern void write_tpx(char *fn,int step,real t,real lambda,
92 t_inputrec *ir,rvec *box,int natoms,
93 rvec *x,rvec *v,rvec *f,t_topology *top);
94 /* Write a file, and close it again.
95 * If fn == NULL, an efTPA file will be written to stdout (which
96 * will not be closed afterwards)
99 extern void read_tpx(char *fn,int *step,real *t,real *lambda,
100 t_inputrec *ir,rvec *box,int *natoms,
101 rvec *x,rvec *v,rvec *f,t_topology *top);
102 /* Read a file, and close it again.
103 * If fn == NULL, an efTPA file will be read from stdin (which
104 * will not be closed afterwards)
107 extern void fwrite_tpx(int fp,int step,real t,real lambda,
108 t_inputrec *ir,rvec *box,int natoms,
109 rvec *x,rvec *v,rvec *f,t_topology *top);
110 /* Write a file, and do not close it */
112 extern void fread_tpx(int fp,int *step,real *t,real *lambda,
113 t_inputrec *ir,rvec *box,int *natoms,
114 rvec *x,rvec *v,rvec *f,t_topology *top);
115 /* Read a file, and do not close it */
117 extern bool fn2bTPX(char *file);
118 /* return if *file is one of the TPX file types */
120 extern bool read_tps_conf(char *infile,char *title,t_topology *top,
121 rvec **x,rvec **v,matrix box,bool bMass);
122 /* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
123 * memory for atoms, x and v will be allocated.
124 * Return TRUE if a complete topology was read.
125 * If infile is a TPX file read the whole top,
126 * else if bMass=TRUE, read the masses into top.atoms from the mass database.