Create fileio module
[alexxy/gromacs.git] / src / gromacs / legacyheaders / statutil.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  *                        VERSION 3.2.0
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2004, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  *
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  *
30  * For more info, check our website at http://www.gromacs.org
31  *
32  * And Hey:
33  * Gromacs Runs On Most of All Computer Systems
34  */
35
36 #ifndef _statutil_h
37 #define _statutil_h
38
39 #include "../fileio/filenm.h"
40 #include "readinp.h"
41 #include "oenv.h"
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 #if 0 /* avoid screwing up indentation */
47 }
48 #endif
49
50
51 /* The code below is to facilitate controlled begin and end of
52    trajectory reading. Corresponding routines in
53    src/gmxlib/tcontrol.c
54  */
55 enum {
56     TBEGIN, TEND, TDELTA, TNR
57 };
58
59 gmx_bool bTimeSet(int tcontrol);
60
61 real rTimeValue(int tcontrol);
62
63 void setTimeValue(int tcontrol, real value);
64
65 /* End trajectory time control */
66
67 /* LEGACY FUNCTIONS
68
69    The program names, command lines, etc. are now also set in the output_env
70    structure. That is now the preferred location, but the functions here
71    are still available as legacy functions. Because they all act on inherently
72    global informaion, their existence in a multi-threaded environment is not
73    a real problem. */
74
75 /* set the program name to the provided string, but note
76  * that it must be a real file - we determine the library
77  * directory from its location!
78  */
79 const char *Program(void);
80 /* Id. without leading directory */
81 const char *ShortProgram(void);
82
83 /*****************************************************
84  *         Some command line parsing routines
85  *****************************************************/
86
87 #define PCA_CAN_VIEW       (1<<5)
88 /* add option -w to view output files (must be implemented in program) */
89 #define PCA_CAN_BEGIN      (1<<6)
90 #define PCA_CAN_END        (1<<7)
91 #define PCA_CAN_DT         (1<<14)
92 #define PCA_CAN_TIME       (PCA_CAN_BEGIN | PCA_CAN_END | PCA_CAN_DT)
93 /* adds options -b and -e for begin and end time for reading trajectories */
94 #define PCA_TIME_UNIT      (1<<15)
95 /* set time unit for output */
96 #define PCA_KEEP_ARGS      (1<<8)
97 /* keep parsed args in argv (doesn't make sense without NOEXIT_ON_ARGS) */
98 #define PCA_CAN_SET_DEFFNM (1<<10)
99 /* does something for non-master mdrun nodes */
100 #define PCA_NOEXIT_ON_ARGS (1<<11)
101 /* no fatal_error when invalid options are encountered */
102 #define PCA_QUIET          (1<<12)
103 /* does something for non-master mdrun nodes */
104 #define PCA_BE_NICE        (1<<13)
105 /* Default to low priority, unless configured with --disable-nice */
106 #define PCA_NOT_READ_NODE  (1<<16)
107 /* Is this node not reading: for parallel all nodes but the master */
108
109 int iscan(int argc, char *argv[], int *i);
110 /* Scan an int from the argument at *i. If the argument length
111  * is > 2, the int is assumed to be in the remainder of the arg,
112  * eg: -p32, else the int is assumed to be in the next argument
113  * eg: -p 32. If neither is the case the routine exits with an error,
114  * otherwise it returns the value found. If the value is in the next
115  * argument *i is incremented. You typically would want to pass
116  * a loop variable to this routine.
117  */
118 gmx_large_int_t istepscan(int argc, char *argv[], int *i);
119 /* Same as above, but for large integer values */
120
121 double dscan(int argc, char *argv[], int *i);
122 /* Routine similar to the above, but working on doubles. */
123
124 char *sscan(int argc, char *argv[], int *i);
125 /* Routine similar to the above, but working on strings. The pointer
126  * returned is a pointer to the argv field.
127  */
128
129 void vscan(int argc, char *argv[], int *i, rvec *vec);
130 /* Routine similar to the above, but working on rvecs. */
131
132 int nenum(const char *const enumc[]);
133 /* returns ordinal number of selected enum from args
134  * depends on enumc[0] pointing to one of the other elements
135  * array must be terminated by a NULL pointer
136  */
137
138 gmx_bool parse_common_args(int *argc, char *argv[], unsigned long Flags,
139                            int nfile, t_filenm fnm[], int npargs, t_pargs *pa,
140                            int ndesc, const char **desc,
141                            int nbugs, const char **bugs,
142                            output_env_t *oenv);
143 /* Get arguments from the arg-list. The arguments extracted
144  * are removed from the list. If manual is NULL a default message is displayed
145  * when errors are encountered. The Flags argument, when non-0 enables
146  * some input checks. Using this routine also means that the arguments
147  * -b and -e will be used for begin and end time, whether this is
148  * appropriate or not!
149  */
150
151 #ifdef __cplusplus
152 }
153 #endif
154
155 #endif