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
44 /**************************************************************
46 * The routines in the corresponding c-file tpxio.c
47 * are based on the lower level routines in gmxfio.c
48 * The integer file pointer returned from open_tpx
49 * can also be used with the routines in gmxfio.h
51 **************************************************************/
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
, bool TopOnlyOK
, int *version
, int *generation
);
89 /* Read the header from a tpx file and then close it again.
90 * By setting TopOnlyOK to true, it is possible to read future
91 * versions too (we skip the changed inputrec), provided we havent
92 * changed the topology description. If it is possible to read
93 * the inputrec it will still be done even if TopOnlyOK is TRUE.
95 * The version and generation if the topology (see top of tpxio.c)
96 * are returned in the two last arguments.
99 extern void write_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 /* Write a file, and close it again.
103 * If fn == NULL, an efTPA file will be written to stdout (which
104 * will not be closed afterwards)
107 extern void read_tpx(char *fn
,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 /* Read a file, and close it again.
111 * If fn == NULL, an efTPA file will be read from stdin (which
112 * will not be closed afterwards)
115 extern bool fn2bTPX(char *file
);
116 /* return if *file is one of the TPX file types */
118 extern bool read_tps_conf(char *infile
,char *title
,t_topology
*top
,
119 rvec
**x
,rvec
**v
,matrix box
,bool bMass
);
120 /* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
121 * memory for atoms, x and v will be allocated.
122 * Return TRUE if a complete topology was read.
123 * If infile is a TPX file read the whole top,
124 * else if bMass=TRUE, read the masses into top.atoms from the mass database.