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 file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #include <vector>
30 
31 namespace opt {
32 
38 /* If they relate to values of the coordinates and derivatives, then try new
39  coordinates ; if it looks like user error in definition, then
40  quit right away. */
41 class INTCO_EXCEPT {
42  private:
43  const char * message;
45 
46  public:
47 
48  static int dynamic_level; // defined in optking.cc
49  //static bool override_fragment_mode;
50  static std::vector<int> linear_angles;
51 
52 
53  INTCO_EXCEPT(const char * m) {
54  message = m;
55  really_quit = false;
56  //try_other_intcos = false;
57  }
58 
59  INTCO_EXCEPT(const char * m, bool t) {
60  message = m;
61  really_quit = t;
62  //try_other_intcos = t;
63  }
64 
65  INTCO_EXCEPT(const char * m, std::vector<int> l) {
66  message = m;
67  linear_angles = l;
68  really_quit = false;
69  //try_other_intcos = t;
70  }
71 
73  if (dynamic_level == 0) // turning 'on' dynamic
74  dynamic_level = 1;
75 
76  dynamic_level += 1;
77  }
78 
80 
81  //bool try_again() { return try_other_intcos; }
82  const char *g_message(void) { return message; }
83  bool g_really_quit(void) { return really_quit; }
84 };
85 
87  private:
88  const char * message;
89 
90  public:
91  BAD_STEP_EXCEPT(const char * m) { message = m; }
92 
94 
95  const char *g_message(void) { return message; }
96 };
97 
99  private:
100  const char * message;
101 
102  public:
103  BROKEN_SYMMETRY_EXCEPT(const char * m) { message = m; }
104 
106 
107  const char *g_message(void) { return message; }
108 };
109 
110 }
BROKEN_SYMMETRY_EXCEPT(const char *m)
Definition: opt_except.h:103
~INTCO_EXCEPT()
Definition: opt_except.h:79
Definition: opt_except.h:98
const char * message
Definition: opt_except.h:88
const char * message
Definition: opt_except.h:100
BAD_STEP_EXCEPT(const char *m)
Definition: opt_except.h:91
INTCO_EXCEPT(const char *m, std::vector< int > l)
Definition: opt_except.h:65
bool really_quit
Definition: opt_except.h:44
void increment_dynamic_level(void)
Definition: opt_except.h:72
static int dynamic_level
Definition: opt_except.h:48
const char * message
Definition: opt_except.h:43
Definition: opt_except.h:86
~BAD_STEP_EXCEPT()
Definition: opt_except.h:93
const char * g_message(void)
Definition: opt_except.h:82
const char * g_message(void)
Definition: opt_except.h:95
INTCO_EXCEPT(const char *m, bool t)
Definition: opt_except.h:59
const char * g_message(void)
Definition: opt_except.h:107
INTCO_EXCEPT(const char *m)
Definition: opt_except.h:53
~BROKEN_SYMMETRY_EXCEPT()
Definition: opt_except.h:105
Exception class for problems with internal coordinates.
Definition: opt_except.h:41
static std::vector< int > linear_angles
Definition: opt_except.h:50
bool g_really_quit(void)
Definition: opt_except.h:83