Velocities and forces for selections.
[gromacs/qmmm-gamess-us.git] / include / filenm.h
blobe4dbd6792f9e7adc1da5542fc2c433dc28872107
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.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _filenm_h
37 #define _filenm_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include "futil.h"
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 void set_default_file_name(const char *name);
50 /* Set the default file name for all file types to name */
52 extern const char *ftp2ext(int ftp);
53 /* Return extension for filetype */
55 extern const char *ftp2ext_generic(int ftp);
56 /* Return extension for filetype, and a generic name for generic types
57 (e.g. trx)*/
59 extern const char *ftp2desc(int ftp);
60 /* Return description for file type */
62 extern const char *ftp2defnm(int ftp);
63 /* Return default file name for file type */
65 extern const char *ftp2ftype(int ftp);
66 /* Return Binary or ASCII depending on file type */
68 extern void pr_def(FILE *fp,int ftp);
69 /* Print definitions for filename ftp */
71 extern void pr_defs(FILE *fp);
72 /* Print definitions for all filename */
74 extern void pr_fns(FILE *fp,int nf,const t_filenm tfn[]);
75 /* Print nf file names and types */
77 extern void pr_fopts(FILE *fp,int nf,const t_filenm tfn[], int shell);
78 /* prints file options in tcsh 'complete' format */
80 extern void parse_file_args(int *argc,char *argv[],int nf,t_filenm fnm[],
81 bool bKeep, bool bReadNode);
82 /* Parse command line for file names. When bKeep is set args are
83 * not removed from argv. */
85 extern const char *opt2fn(const char *opt,int nfile, const t_filenm fnm[]);
86 /* Return the filename belonging to cmd-line option opt, or NULL when
87 * no such option. */
89 extern const char *opt2fn_master(const char *opt, int nfile,
90 const t_filenm fnm[], t_commrec *cr);
91 /* Return the filename belonging to cmd-line option opt, or NULL when
92 * no such option or not running on master */
95 extern int opt2fns(char **fns[], const char *opt,int nfile,
96 const t_filenm fnm[]);
97 /* Return the filenames belonging to cmd-line option opt, or NULL when
98 * no such option. */
100 #define opt2FILE(opt,nfile,fnm,mode) ffopen(opt2fn(opt,nfile,fnm),mode)
101 /* Return a file pointer from the filename (see above) */
103 extern int fn2ftp(const char *fn);
104 /* Return the filetype corrsponding to filename */
106 extern const char *ftp2fn(int ftp,int nfile,const t_filenm fnm[]);
107 /* Return the first file name with type ftp, or NULL when none found. */
109 extern int ftp2fns(char **fns[], int ftp,int nfile,const t_filenm fnm[]);
110 /* Return the number of files for the first option with type ftp
111 and the files in **fns[] (will be allocated), or NULL when none found. */
113 #if 0
114 /* This function is not thread-safe and used nowhere: */
115 extern char *ftp2filter(int ftp);
116 /* Return a file extension filter for file type */
117 #endif
119 #define ftp2FILE(ftp,nfile,fnm,mode) ffopen(ftp2fn(ftp,nfile,fnm),mode)
120 /* Return a file pointer from the filename (see above) */
122 extern bool ftp2bSet(int ftp,int nfile,const t_filenm fnm[]);
123 /* Return TRUE when this file type has been found on the cmd-line */
125 extern bool opt2bSet(const char *opt,int nfile,const t_filenm fnm[]);
126 /* Return TRUE when this option has been found on the cmd-line */
128 extern const char *opt2fn_null(const char *opt,int nfile,const t_filenm fnm[]);
129 /* Return the filenm belonging top cmd-line option opt, or NULL when
130 * no such option.
131 * Also return NULL when opt is optional and option is not set.
134 extern const char *ftp2fn_null(int ftp,int nfile,const t_filenm fnm[]);
135 /* Return the first file name with type ftp, or NULL when none found.
136 * Also return NULL when ftp is optional and option is not set.
139 extern bool is_optional(const t_filenm *fnm);
140 /* Return whether or not this filenm is optional */
142 extern bool is_output(const t_filenm *fnm);
143 /* Return whether or not this filenm is output */
145 extern bool is_set(const t_filenm *fnm);
146 /* Return whether or not this filenm is set */
148 /* When we do checkpointing, this routine is called to check for previous
149 * output files and append a 'partNNNN' suffix before the (output) file extensions.
151 int add_suffix_to_output_names(t_filenm *fnm, int nfile, const char *suffix);
153 /* duplicate the filename list (to make a private copy for each thread,
154 for example) */
155 t_filenm *dup_tfn(int nf, const t_filenm tfn[]);
157 #ifdef __cplusplus
159 #endif
161 #endif /* _filenm_h */