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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
use thiserror::Error;
use super::types::{FeffExecutionMode, FeffFlavor};
#[derive(Error, Debug, Clone)]
/// Failures encountered while loading paths, evaluating models, fitting, or running backends.
/// This describes an operation failure; a successful fit result can separately
/// report numerical nonconvergence in its solver report.
pub enum FittingError {
#[error("unsupported FEFF flavor for this build: {flavor:?}")]
/// The selected path-file parser flavor is unavailable.
UnsupportedFeffFlavor {
/// Requested path-file format selector.
flavor: FeffFlavor,
},
#[error("failed to parse FEFF path file '{path}': {reason}")]
/// A path file could not be read or parsed.
ParseFailed {
/// Source or destination filesystem path associated with the failure.
path: String,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("invalid FEFF path data: {reason}")]
/// Parsed path arrays or geometry are unusable for model evaluation.
InvalidFeffData {
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("expression evaluation failed for '{expr}': {reason}")]
/// A mathematical expression could not be parsed or evaluated finitely.
ExpressionFailed {
/// Expression text that could not be evaluated.
expr: String,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("undefined symbol in expression: {symbol}")]
/// An expression refers to a variable with no resolved value.
UndefinedSymbol {
/// Named parameter involved in the unresolved or cyclic dependency.
symbol: String,
},
#[error("cyclic variable expression dependency detected at: {symbol}")]
/// Variable expressions depend cyclically on one another.
CyclicExpression {
/// Named parameter involved in the unresolved or cyclic dependency.
symbol: String,
},
#[error("invalid fit transform configuration: {reason}")]
/// The requested transform or residual-selection settings are unusable.
InvalidTransform {
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("invalid fit dataset: {reason}")]
/// Input arrays or fit parameter values fail a required consistency check.
InvalidDataset {
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("fitting requires at least one active FEFF path")]
/// No enabled theoretical paths are available to sum or fit.
EmptyPaths,
#[error("fitting requires at least one varying variable")]
/// Legacy error variant for a fitting request without varying parameters.
NoVaryingVariables,
#[error("nonlinear solver failed: {reason}")]
/// A numerical solver or its execution environment failed.
SolverFailed {
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("invalid FEFF executable path '{path}': {reason}")]
/// The configured external executable path is invalid.
InvalidExecutablePath {
/// Source or destination filesystem path associated with the failure.
path: String,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("FEFF workspace path does not exist or is not a directory: '{path}'")]
/// The requested calculation workspace is absent or is not a directory.
WorkspaceNotFound {
/// Source or destination filesystem path associated with the failure.
path: String,
},
#[error("FEFF input file was not found: '{path}'")]
/// The requested scattering input file could not be located.
FeffInputNotFound {
/// Source or destination filesystem path associated with the failure.
path: String,
},
#[error("required FEFF module executable could not be resolved: {module}")]
/// A required external calculation stage could not be resolved.
ExecutableNotFound {
/// Calculation stage or backend name associated with the failure.
module: String,
},
#[error("requested FEFF execution mode is not available in this build: {mode:?} ({reason})")]
/// The requested calculation backend is disabled in this build.
UnsupportedExecutionMode {
/// Requested scattering backend.
mode: FeffExecutionMode,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("failed to spawn FEFF module '{module}' using '{executable}': {reason}")]
/// An external calculation stage could not be started.
ProcessSpawnFailed {
/// Calculation stage or backend name associated with the failure.
module: String,
/// External executable path that could not be started.
executable: String,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("FEFF module '{module}' exited with non-zero status {code}")]
/// An external calculation stage returned a failing exit status.
ProcessFailed {
/// Calculation stage or backend name associated with the failure.
module: String,
/// Recorded process exit code; may use a sentinel if the platform supplies none.
code: i32,
},
#[error("FEFF module '{module}' timed out after {timeout_sec}s")]
/// A calculation stage or cooperative backend run exceeded its requested limit.
ProcessTimedOut {
/// Calculation stage or backend name associated with the failure.
module: String,
/// Requested timeout interval in seconds.
timeout_sec: u64,
},
#[error("failed to read FEFF module output for '{module}': {reason}")]
/// Output from an external calculation stage could not be read.
OutputReadFailed {
/// Calculation stage or backend name associated with the failure.
module: String,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("FEFF10 pipeline failed: {reason}")]
/// The FEFF10 backend failed to configure or complete a calculation.
Feff10PipelineFailed {
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("ReFEFF pipeline failed: {reason}")]
/// The ReFEFF backend failed to configure or complete a calculation.
RefeffPipelineFailed {
/// Explanation of the failed validation or underlying operation.
reason: String,
},
#[error("FEFF execution produced no path output files (feffNNNN.dat) in '{workspace}'")]
/// A completed calculation did not produce loadable path files.
NoPathOutputs {
/// Workspace that was inspected for generated path files.
workspace: String,
},
#[error("I/O failure during {action} for '{path}': {reason}")]
/// A filesystem operation failed while preparing or collecting a calculation.
IOFailed {
/// Description of the attempted filesystem operation.
action: String,
/// Source or destination filesystem path associated with the failure.
path: String,
/// Explanation of the failed validation or underlying operation.
reason: String,
},
}