Psi4
opt_except.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program 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 of the License, or
14  * (at your option) any later version.
15  *
16  * This program 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 along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #include <vector>
29 
30 namespace opt {
31 
37 /* If they relate to values of the coordinates and derivatives, then try new
38  coordinates ; if it looks like user error in definition, then
39  quit right away. */
40 class INTCO_EXCEPT {
41  private:
42  const char * message;
44 
45  public:
46 
47  static int dynamic_level; // defined in optking.cc
48  //static bool override_fragment_mode;
49  static std::vector<int> linear_angles;
50 
51 
52  INTCO_EXCEPT(const char * m) {
53  message = m;
54  really_quit = false;
55  //try_other_intcos = false;
56  }
57 
58  INTCO_EXCEPT(const char * m, bool t) {
59  message = m;
60  really_quit = t;
61  //try_other_intcos = t;
62  }
63 
64  INTCO_EXCEPT(const char * m, std::vector<int> l) {
65  message = m;
66  linear_angles = l;
67  really_quit = false;
68  //try_other_intcos = t;
69  }
70 
72  if (dynamic_level == 0) // turning 'on' dynamic
73  dynamic_level = 1;
74 
75  dynamic_level += 1;
76  }
77 
79 
80  //bool try_again() { return try_other_intcos; }
81  const char *g_message(void) { return message; }
82  bool g_really_quit(void) { return really_quit; }
83 };
84 
86  private:
87  const char * message;
88 
89  public:
90  BAD_STEP_EXCEPT(const char * m) { message = m; }
91 
93 
94  const char *g_message(void) { return message; }
95 };
96 
98  private:
99  const char * message;
100 
101  public:
102  BROKEN_SYMMETRY_EXCEPT(const char * m) { message = m; }
103 
105 
106  const char *g_message(void) { return message; }
107 };
108 
109 }
BROKEN_SYMMETRY_EXCEPT(const char *m)
Definition: opt_except.h:102
~INTCO_EXCEPT()
Definition: opt_except.h:78
Definition: opt_except.h:97
const char * message
Definition: opt_except.h:87
const char * message
Definition: opt_except.h:99
BAD_STEP_EXCEPT(const char *m)
Definition: opt_except.h:90
INTCO_EXCEPT(const char *m, std::vector< int > l)
Definition: opt_except.h:64
bool really_quit
Definition: opt_except.h:43
void increment_dynamic_level(void)
Definition: opt_except.h:71
static int dynamic_level
Definition: opt_except.h:47
const char * message
Definition: opt_except.h:42
Definition: opt_except.h:85
~BAD_STEP_EXCEPT()
Definition: opt_except.h:92
const char * g_message(void)
Definition: opt_except.h:81
const char * g_message(void)
Definition: opt_except.h:94
INTCO_EXCEPT(const char *m, bool t)
Definition: opt_except.h:58
const char * g_message(void)
Definition: opt_except.h:106
INTCO_EXCEPT(const char *m)
Definition: opt_except.h:52
~BROKEN_SYMMETRY_EXCEPT()
Definition: opt_except.h:104
Exception class for problems with internal coordinates.
Definition: opt_except.h:40
static std::vector< int > linear_angles
Definition: opt_except.h:49
bool g_really_quit(void)
Definition: opt_except.h:82