source: ThirdParty/mpqc_open/src/bin/mpqc/mpqc_main.cc

Candidate_v1.6.1
Last change on this file 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.0 KB
Line 
1//
2// mpqc_main.cc
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Edward Seidl <seidl@janed.com>
7// Maintainer: LPS
8//
9// This file is part of MPQC.
10//
11// MPQC is free software; you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// MPQC is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with the MPQC; see the file COPYING. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27// \note This was extracted from \file mpqc.cc for refactoring into a library.
28
29#ifdef HAVE_CONFIG_H
30#include <scconfig.h>
31#endif
32
33#include <iostream>
34
35#include <util/class/scexception.h>
36
37#include "mpqc.h"
38
39using namespace std;
40
41using namespace sc;
42
43int
44main(int argc, char *argv[])
45{
46 size_t exitflag = 0;
47 try {
48 exitflag = detail::try_main(argc, argv);
49 }
50 catch (SCException &e) {
51 cout << argv[0] << ": ERROR: SC EXCEPTION RAISED:" << endl
52 << e.what()
53 << endl;
54 detail::clean_up();
55 throw;
56 }
57 catch (bad_alloc &e) {
58 cout << argv[0] << ": ERROR: MEMORY ALLOCATION FAILED:" << endl
59 << e.what()
60 << endl;
61 detail::clean_up();
62 throw;
63 }
64 catch (exception &e) {
65 cout << argv[0] << ": ERROR: EXCEPTION RAISED:" << endl
66 << e.what()
67 << endl;
68 detail::clean_up();
69 throw;
70 }
71 catch (...) {
72 cout << argv[0] << ": ERROR: UNKNOWN EXCEPTION RAISED" << endl;
73 detail::clean_up();
74 throw;
75 }
76
77 return exitflag;
78}
79
80/////////////////////////////////////////////////////////////////////////////
81
82// Local Variables:
83// mode: c++
84// c-file-style: "ETS"
85// End:
Note: See TracBrowser for help on using the repository browser.