source: ThirdParty/mpqc_open/src/bin/mpqc/mpqc.h@ a844d8

Candidate_v1.6.1
Last change on this file since a844d8 was fbf005, checked in by Frederik Heber <heber@…>, 8 years ago

HUGE: Extracted libmolecuilder_mpqc that is now linked to poolworker.

  • This stops the problems with MemDebug and mpqc when linking against libLinearAlgebra in debug mode: static global variables in libLinAlg are allocated using MemDebug (prefixed with a checksum) but are deallocated using normal libc's free() on exit. This causes an invalid free() as the ptr given to free points inside the block and not at its start. The problem comes from mpqc's use of own new and delete implementation. I'm guessing its reference counting is the culprit. Hence, we need to separate these two compilations from another in different units/libraries. Therefore, we have split off libmolecuilder_mpqc, .._mpqc_extract and additionally place the MPQCJob::Work() implementation inside libMolecuilderJobs_Work.
  • libmolecuilder_mpqc contains all MPQC's code in mpqc.cc (and linked libraries) that is not the main() function.
  • libmolecuilder_mpqc_extract contains functions that extract results such as energies, forces, charge grids from the obtained mpqc solution. These were added by myself to the mpqc code before.
  • molecuilder_mpqc is then linked against a NoOp .._extract library version. Thereby, it does not use any of the Molecuilder or related libraries and does not come in contact with MemDebug.
  • molecuilder_poolworker however is linked with the full .._extract library and hence performs these extractions.
  • poolworker now executes MPQCJob, MPQCCommandJob, and VMGJob and therefore needs to enforce binding to all of them.
  • TESTS: renamed molecuilder_mpqc.in to molecuilder_poolworker.in.
  • Property mode set to 100644
File size: 2.5 KB
Line 
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
15namespace 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
44namespace 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
Note: See TracBrowser for help on using the repository browser.