forked from duartegroup/autodE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
130 lines (71 loc) · 3.75 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
class AutodeException(Exception):
"""Base autodE exception"""
# --------------------- Calculation exceptions --------------------------------
class CalculationException(AutodeException):
"""Base calculation exception when an external autodE calculation fails"""
class AtomsNotFound(CalculationException):
"""Exception for atomic coordinates/identities being found"""
class MethodUnavailable(CalculationException):
"""Exception for an autodE wrapped method not being available"""
class UnsupportedCalculationInput(CalculationException):
"""Exception for an autodE calculation input not being valid"""
def __init__(self, message="Parameters not supported"):
super().__init__(message)
class NoInputError(CalculationException):
"""Exception for a autodE calculation having no input e.g atoms"""
class NoCalculationOutput(CalculationException):
"""Exception for a calculation file that should exist not existing"""
class CouldNotGetProperty(CalculationException):
"""Exception for where a property e.g. energy cannot be found in a
calculation output file"""
def __init__(self, *args, name=None):
if name is not None:
super().__init__(f"Could not get {name}")
else:
super().__init__(*args)
class NotImplementedInMethod(CalculationException):
"""Exception for where a method is not implemented in a wrapped method"""
# -----------------------------------------------------------------------------
class NoAtomsInMolecule(AutodeException):
"""Exception for no atoms existing in a molecule"""
class NoConformers(AutodeException):
"""Exception for no conformers being present in a molecule"""
class SolventUnavailable(AutodeException):
"""Exception for a solvent not being available for a calculation"""
class UnbalancedReaction(AutodeException):
"""Exception for an autodE reaction not being balanced in e.g. N_atoms"""
class SolventNotFound(AutodeException):
"""Exception for a solvent not being in the list of available solvents"""
class SolventsDontMatch(AutodeException):
"""Exception for where the solvent in reactants is different to products"""
class BondsInSMILESAndGraphDontMatch(AutodeException):
"""Exception for a partially disjoint set of bonds in SMILES and a graph"""
class XYZfileDidNotExist(AutodeException, FileNotFoundError):
"""Exception for an xyz file not existing"""
class XYZfileWrongFormat(AutodeException):
"""Exception for an xyz being the wrong format"""
class ReactionFormationFailed(AutodeException):
"""Exception for where a reaction cannot be built. e.g. if there are no
reactants"""
class NoMapping(AutodeException):
"""Exception for where there is no mapping/bijection between two graphs"""
class NoMolecularGraph(AutodeException):
"""Exception for a molecule not having a set graph"""
class RDKitFailed(AutodeException):
"""Exception for where RDKit fails to generate conformers"""
class InvalidSmilesString(AutodeException):
"""Exception for a SMILES string being invalid"""
class SMILESBuildFailed(AutodeException):
"""Exception for where building an example 3D structure cannot be built
from a SMILES string"""
class FailedToSetRotationIdxs(AutodeException):
"""Exception for the atoms that need to be rotating in 3D building not
being found"""
class FailedToAdjustAngles(AutodeException):
"""Exception for when the internal angles in a ring cannot be adjusted"""
class CannotSplitAcrossBond(AutodeException):
"""A molecule cannot be partitioned by deleting one bond"""
class CouldNotPlotSmoothProfile(AutodeException):
"""A smooth reaction profile cannot be plotted"""
class TemplateLoadingFailed(AutodeException):
"""A template file was not in the correct format"""