Debian Codegraph @

lib/Ifeffit/ParseFeff.pm

raw
1 package Ifeffit::ParseFeff; # -*- cperl -*-
2 ######################################################################
3 ## Ifeffit::ParseFeff: Class methods for parsing Feff6L's runtime
4 ## messages
5 ##
6 ## Artemis is copyright (c) 2001-2006 Bruce Ravel
7 ## [email protected]
8 ## http://feff.phys.washington.edu/~ravel/
9 ##
10 ## Ifeffit is copyright (c) 1992-2006 Matt Newville
11 ## [email protected]
12 ## http://cars.uchicago.edu/~newville/ifeffit/
13 ##
14 ## Feff6L is Copyright (c) [2002] University of Washington
15 ## http://feff.phys.washington.edu/feff/
16 ##
17 ## The latest version of Artemis can always be found at
18 ## http://feff.phys.washington.edu/~ravel/software/exafs
19 ##
20 ## -------------------------------------------------------------------
21 ## All rights reserved. This program is free software; you can
22 ## redistribute it and/or modify it provided that the above notice
23 ## of copyright, these terms of use, and the disclaimer of
24 ## warranty below appear in the source code and documentation, and
25 ## that none of the names of Argonne National Laboratory, The
26 ## University of Chicago, University of Washington, or the authors
27 ## appear in advertising or endorsement of works derived from this
28 ## software without specific prior written permission from all
29 ## parties.
30 ##
31 ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 ## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
33 ## OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34 ## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
35 ## HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
36 ## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
37 ## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
38 ## OTHER DEALINGS IN THIS SOFTWARE.
39 ## -------------------------------------------------------------------
40 ######################################################################
41
42 use strict;
43 use vars qw($VERSION $nchecks @ISA @EXPORT @EXPORT_OK);
44
45 require Exporter;
46
47 @ISA = qw(Exporter AutoLoader);
48 # Items to export into callers namespace by default. Note: do not export
49 # names by default without a very good reason. Use EXPORT_OK instead.
50 # Do not simply export all your public functions/methods/constants.
51 @EXPORT_OK = qw();
52
53
54 ## attempt to recognize the problem with feff by recognizing some
55 ## phrase in its run time messages, return an index indicating the
56 ## problem
57 $nchecks = 12; # this must equal the number of checks in recognize
58 sub recognize {
59 shift;
60 my $text = $_[0];
61 return 1 if ($text =~ /No atoms or overlap cards/);
62 return 2 if ($text =~ /at PATHSD:\s+no input/);
63 return 3 if ($text =~ /not recognized as an internal/);
64 return 5 if ($text =~ /Too many atoms in ATOMS list/);
65 return 6 if ($text =~ /NO ATOMS CLOSE ENOUGH TO OVERLAP/);
66 return 7 if ($text =~ /No absorbing atom \(ipot=0\) defined/);
67 return 7 if ($text =~ /More than one absorbing atom \(ipot=0\)/);
68 return 8 if ($text =~ /Unique potential\s+\d+\s+not allowed/);
69 return 8 if ($text =~ /Unique potential index\s+\d+\s+out of range./);
70 return 8 if ($text =~ /Unique potentials must be between\s+\d+\s+and\s+\d+/);
71 return 9 if ($text =~ /TWO ATOMS VERY CLOSE TOGETHER/);
72 return 10 if ($text =~ /Error reading input, bad line follows/);
73 return 11 if ($text =~ /Internal path finder limit exceeded/);
74 return 12 if (0); # feff7, iprint4<>3
75 return 0;
76 };
77
78
79 ## return a lengthy diagnostic message based on the index returned by
80 ## the recognized method. mmmm.... closure-licious
81 sub describe {
82 shift;
83 my $err = $_[0];
84 my $exists = 0;
85 map {++$exists if ($err == $_)} (1 .. $nchecks);
86 return "" unless $exists;
87 return eval '&error_' . $err ;
88 };
89
90 ## this error happens when the potentials list contains atoms not
91 ## represented in the atoms list
92 sub error_1 {
93 return <<EOH1
94
95 This error may be due to the Atoms list in the the Feff input
96 file being too short to contain an example of each unique
97 potential.
98
99 Another possibility is that there are gaps in the Potentials
100 list. Every potential index defined in the Potentials list must
101 be used in the Atoms list, and you may not skip Potential
102 indeces.
103
104 Possible solutions include increasing the Rmax on the Atoms page
105 and re-running both Atoms and Feff, or editing the Potentials
106 and Atoms lists such that the indeces are sequential.
107
108 EOH1
109 ;
110 };
111
112 ## this error happens when Rmax is shorter than the nearest neighbor
113 sub error_2 {
114 return <<EOH2
115
116 This error is probably due to Rmax being too small
117 in the feff.inp file. Rmax should at least be larger
118 than the distance to the nearest atom.
119
120 Try increasing the Rmax on the feff.inp page and
121 re-running Feff.
122
123 EOH2
124 ;
125 };
126
127 ## this error happens when the feff->feff_executable variable is set
128 ## incorrectly on windows
129 sub error_3 {
130 return <<EOH3
131
132 This error is probably due to having Artemis configured
133 incorrectly and so it does not know how to run Feff on
134 your computer.
135
136 Try clicking on the Settings menu, then selecting
137 "Edit preferences". On the Preferences page, click on the
138 little plus sign next to the "Feff" category then select
139 "feff_executable" in the list. Then edit the value of this
140 variable to be the name of the Feff executable on your
141 computer. Finally, press the "Save changes" button at the
142 bottom of the page.
143
144 If you are using the version of Feff6 that comes with the
145 Ifeffit package, the correct value for this variable is
146 "feff6l" (that's the letter l, and not the number 1). If
147 you are using some other version of Feff, you should enter
148 the fully resolved (i.e. C:/path/to/feff.exe) filename
149 as the value for this parameter.
150
151 EOH3
152 ;
153 };
154
155 ## this error happens when the feff->feff_executable variable is set
156 ## incorrectly on unix-ish systems
157 sub error_4 {
158 return <<EOH4
159
160 This error is probably due to having Artemis configured
161 incorrectly and so it does not know how to run Feff on
162 your computer.
163
164 Try clicking on the Settings menu, then selecting
165 "Edit preferences". On the Preferences page, click on the
166 little plus sign next to the "Feff" category then select
167 "feff_executable" in the list. Then edit the value of this
168 variable to be the name of the Feff executable on your
169 computer. Finally, press the "Save changes" button at the
170 bottom of the page.
171
172 If you are using the version of Feff6 that comes with the
173 Ifeffit package, the correct value for this variable is
174 "feff6". If you are using some other version of Feff, you
175 will enter the fully resolved (i.e. /path/to/feff) filename
176 as the value for this parameter if that version of Feff is
177 not in the path.
178
179 EOH4
180 ;
181 };
182
183 ## this happens when the atoms list is too long for the way Feff is
184 ## compiled
185 sub error_5 {
186 return <<EOH5
187
188 This error is probably due to having a list of atoms in your
189 feff.inp file that is longer than the compiled-in length
190 allowed for the atoms list in your version of Feff. (The
191 limit in the version of Feff6 that comes with Ifeffit is 500.)
192 There are two possible resolutions to this problem. (1) Reduce
193 the Rmax parameter in Atoms and run Atoms again. (2) Manually
194 edit the atoms list in the feff.inp file to have fewer than 500
195 atoms and run Feff again.
196
197 EOH5
198 ;
199 };
200
201 ## this happens when the atoms are too far apart for overlapping to
202 ## work properly
203 sub error_6 {
204 return <<EOH6
205
206 This error is due to Feff finding atoms which are too far from
207 other atoms, resulting in a failure of the algorithm that
208 constructs the muffin-tin potential surface. Common causes of
209 this include lattice parameters in Atoms which are too large
210 and neglecting some items from the atoms list in Atoms. Often
211 the neglected atom is hydrogen, which is very hard to see in
212 EXAFS analysis, but which can be quite important when running
213 Feff.
214
215 To resolve this problem, verify that your cyrstal parameters are
216 valid, then rerun Atoms.
217
218 EOH6
219 ;
220 };
221
222 sub error_7 {
223 return <<EOH7
224
225 This error indicates that you have failed to set an absorbing
226 atom by not setting one and only one site in the Atoms list to
227 have potential index 0. It is an error in Feff to set no sites
228 to be potential index 0. It is also an error to set 2 or more
229 sites to be potential index 0.
230
231 To resolve this problem, choose one site in the Atoms list to
232 be the absorber and set the number in the fourth column to be 0.
233
234 EOH7
235 ;
236 };
237
238 sub error_8 {
239 return <<EOH8
240
241 This error indicates that you have attempted to set more than 7
242 unique potentials. 7 is Feff's hard-wired limit on the number of
243 potentials.
244
245 There are several situations that might lead to this problem.
246 If your material has more than 7 atomic species, you might
247 consider removing the hydrogen atoms or combining similar atoms
248 (such as O and N) into a single atom type.
249
250 If you are using an Atoms template file which uses site tags to
251 set the unique potentials, then you should combine atomic species
252 (for example all oxygen sites) into a single tag.
253
254 EOH8
255 ;
256 };
257
258
259 sub error_9 {
260 return <<EOH9
261
262 This warning indicates a problem in the Atoms list. For some
263 reason you have atoms that are separated by than 0.93 Angstroms
264 (or 1.75 Rydberg).
265
266 This may be due to the presence of hydrogen atoms in your feff.inp
267 file, in which case this is an innocuous warning and may be ignored.
268
269 However, this may indicate a problem constructing the Atoms
270 list. The most common cause of this problem is a mistake in the
271 crystallographic data used on the Atoms page. You may have
272 incorrect values for lattice constants or angles or incorrect
273 values for site coordinates. You may need a shift vector to move
274 the lattice into its standard setting.
275
276 Please be aware that Atoms works with 5 digits of precision.
277 Thus, if you have a site with a coordinate of 1/3, you should use
278 either "1/3" or "0.33333" on the Atoms page. Using insufficient
279 precision, say "0.333" is a common cause of this error message.
280
281 Artemis has continued on the possibility that the warning is
282 caused by hydrogen atoms, but be warned that the feff.inp may
283 require your attention.
284
285 EOH9
286 ;
287 };
288
289 sub error_10 {
290 return <<EOH10
291
292 This error indicates that Feff found a line in the input file that
293 it could not understand. Remove or fix the line indicated and run
294 Feff again.
295
296 EOH10
297 ;
298 };
299
300 sub error_11 {
301 return <<EOH11
302
303 Feff's path finder warned of reaching a memory limitation which
304 caused it not to compute the complete list of paths for your
305 cluster. There are two ways to avoid this problem when running
306 Feff. One is to decrease the size of the RMAX parameter in the
307 Feff input data. The other is to have the Feff calculation not
308 consider high order multiple scattering paths. Putting "NLEG 4"
309 in the Feff input data will limit Feff to compute only up to
310 four-legged (triple scattering) paths.
311
312 EOH11
313 ;
314 };
315
316 sub error_12 {
317 return <<EOH12
318
319 You just ran Feff but Artemis cannot find the feffNNNN.dat files.
320 You seem to be using Feff7. This is probably because the fourth
321 argument to Feff's PRINT keyword is not set to 3, like so:
322
323 PRINT 1 0 0 3
324
325 Fix this, then rerun Feff.
326
327 EOH12
328 ;
329 };
330
331 1;
332 __END__