1 |
|
---|
2 | #ifndef _mpqc_h
|
---|
3 | #define _mpqc_h
|
---|
4 |
|
---|
5 | #ifdef HAVE_CONFIG_H
|
---|
6 | #include <scconfig.h>
|
---|
7 | #endif
|
---|
8 |
|
---|
9 | #include <iosfwd>
|
---|
10 | #include <string>
|
---|
11 |
|
---|
12 | #include <util/group/message.h>
|
---|
13 | #include <util/options/GetLongOpt.h>
|
---|
14 |
|
---|
15 | namespace detail {
|
---|
16 |
|
---|
17 | /** Temporary structure for storing information from command-line
|
---|
18 | *
|
---|
19 | * This structure has been introduced to gather the various calls to GetLongOpts
|
---|
20 | * at one (initial) place and to abstract it from the source of command-lines.
|
---|
21 | * This temporary object can be set by other means, too. I.e. we become
|
---|
22 | * independent of usage in command-line programs.
|
---|
23 | */
|
---|
24 | struct OptionValues {
|
---|
25 | const char *keyvalue; // option "k"
|
---|
26 | const char *debug; // option ""
|
---|
27 | int limit; // option "l"
|
---|
28 | const char *check; // option "c"
|
---|
29 | const char *simple_input; // option "i"
|
---|
30 | std::string executablename;
|
---|
31 |
|
---|
32 | #ifdef HAVE_CHEMISTRY_CCA
|
---|
33 | string cca_load; // option "cca-path"
|
---|
34 | string cc_path; // option "cca-load"
|
---|
35 | #endif
|
---|
36 | };
|
---|
37 |
|
---|
38 | int try_main(int argc, char *argv[]);
|
---|
39 |
|
---|
40 | void clean_up(void);
|
---|
41 |
|
---|
42 | } /* namespace detail */
|
---|
43 |
|
---|
44 | namespace mpqc {
|
---|
45 |
|
---|
46 | /** This is just a helper structure to combine all variables that get
|
---|
47 | * initialized in init()
|
---|
48 | */
|
---|
49 | struct InitValues {
|
---|
50 | InitValues();
|
---|
51 |
|
---|
52 | const char *input;
|
---|
53 | const char *object_input;
|
---|
54 | const char *generic_input;
|
---|
55 | const char *output;
|
---|
56 | std::ostream *outstream;
|
---|
57 | char *in_char_array;
|
---|
58 | detail::OptionValues &values;
|
---|
59 | sc::GetLongOpt options;
|
---|
60 | sc::Ref< sc::MessageGrp> grp;
|
---|
61 | };
|
---|
62 |
|
---|
63 | /** Initializes all variables inside InitValues struct and prepares code
|
---|
64 | * for calculation.
|
---|
65 | *
|
---|
66 | * \param _initvalues struct holding state of variables to initialize
|
---|
67 | * \param argc argument count
|
---|
68 | * \param argv argument variables array
|
---|
69 | */
|
---|
70 | void init(InitValues &_initvalues, int argc, char *argv[]);
|
---|
71 |
|
---|
72 | /** Parses command-line options, sets files and initializes message group
|
---|
73 | *
|
---|
74 | * \param _initvalues struct holding state of variables to initialize
|
---|
75 | * \param argc argument count
|
---|
76 | * \param argv argument variables array
|
---|
77 | */
|
---|
78 | void parseOptions(InitValues &_initvalues, int argc, char *argv[]);
|
---|
79 |
|
---|
80 | /** Performs the main work to calculate the ground state energies, gradients, etc.
|
---|
81 | *
|
---|
82 | * @param _initvalues struct with all state variables
|
---|
83 | * @param argc argument count
|
---|
84 | * @param argv argument array
|
---|
85 | * @param data void ptr to extract structure
|
---|
86 | */
|
---|
87 | void mainFunction(
|
---|
88 | InitValues &_initvalues,
|
---|
89 | int argc,
|
---|
90 | char **argv,
|
---|
91 | void *data
|
---|
92 | );
|
---|
93 |
|
---|
94 | /** Cleans up variables in initialized variables struct.
|
---|
95 | *
|
---|
96 | */
|
---|
97 | void cleanup(InitValues &_initvalues);
|
---|
98 |
|
---|
99 | } /* namespace mpqc */
|
---|
100 |
|
---|
101 | #endif
|
---|