| 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 | int verbose; | 
|---|
| 62 | }; | 
|---|
| 63 |  | 
|---|
| 64 | /** Initializes all variables inside InitValues struct and prepares code | 
|---|
| 65 | * for calculation. | 
|---|
| 66 | * | 
|---|
| 67 | * \param _initvalues struct holding state of variables to initialize | 
|---|
| 68 | * \param argc argument count | 
|---|
| 69 | * \param argv argument variables array | 
|---|
| 70 | */ | 
|---|
| 71 | void init(InitValues &_initvalues, int argc, char *argv[]); | 
|---|
| 72 |  | 
|---|
| 73 | /** Parses command-line options, sets files and initializes message group | 
|---|
| 74 | * | 
|---|
| 75 | * \param _initvalues struct holding state of variables to initialize | 
|---|
| 76 | * \param argc argument count | 
|---|
| 77 | * \param argv argument variables array | 
|---|
| 78 | */ | 
|---|
| 79 | void parseOptions(InitValues &_initvalues, int argc, char *argv[]); | 
|---|
| 80 |  | 
|---|
| 81 | /** Performs the main work to calculate the ground state energies, gradients, etc. | 
|---|
| 82 | * | 
|---|
| 83 | * @param _initvalues struct with all state variables | 
|---|
| 84 | * @param argc argument count | 
|---|
| 85 | * @param argv argument array | 
|---|
| 86 | * @param data void ptr to extract structure | 
|---|
| 87 | */ | 
|---|
| 88 | void mainFunction( | 
|---|
| 89 | InitValues &_initvalues, | 
|---|
| 90 | int argc, | 
|---|
| 91 | char **argv, | 
|---|
| 92 | void *data | 
|---|
| 93 | ); | 
|---|
| 94 |  | 
|---|
| 95 | /** Cleans up variables in initialized variables struct. | 
|---|
| 96 | * | 
|---|
| 97 | */ | 
|---|
| 98 | void cleanup(InitValues &_initvalues); | 
|---|
| 99 |  | 
|---|
| 100 | } /* namespace mpqc */ | 
|---|
| 101 |  | 
|---|
| 102 | #endif | 
|---|