package Ifeffit::ParseFeff; # -*- cperl -*- ###################################################################### ## Ifeffit::ParseFeff: Class methods for parsing Feff6L's runtime ## messages ## ## Artemis is copyright (c) 2001-2006 Bruce Ravel ## bravel@anl.gov ## http://feff.phys.washington.edu/~ravel/ ## ## Ifeffit is copyright (c) 1992-2006 Matt Newville ## newville@cars.uchicago.edu ## http://cars.uchicago.edu/~newville/ifeffit/ ## ## Feff6L is Copyright (c) [2002] University of Washington ## http://feff.phys.washington.edu/feff/ ## ## The latest version of Artemis can always be found at ## http://feff.phys.washington.edu/~ravel/software/exafs ## ## ------------------------------------------------------------------- ## All rights reserved. This program is free software; you can ## redistribute it and/or modify it provided that the above notice ## of copyright, these terms of use, and the disclaimer of ## warranty below appear in the source code and documentation, and ## that none of the names of Argonne National Laboratory, The ## University of Chicago, University of Washington, or the authors ## appear in advertising or endorsement of works derived from this ## software without specific prior written permission from all ## parties. ## ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ## OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ## HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ## OTHER DEALINGS IN THIS SOFTWARE. ## ------------------------------------------------------------------- ###################################################################### use strict; use vars qw($VERSION $nchecks @ISA @EXPORT @EXPORT_OK); require Exporter; @ISA = qw(Exporter AutoLoader); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @EXPORT_OK = qw(); ## attempt to recognize the problem with feff by recognizing some ## phrase in its run time messages, return an index indicating the ## problem $nchecks = 12; # this must equal the number of checks in recognize sub recognize { shift; my $text = $_[0]; return 1 if ($text =~ /No atoms or overlap cards/); return 2 if ($text =~ /at PATHSD:\s+no input/); return 3 if ($text =~ /not recognized as an internal/); return 5 if ($text =~ /Too many atoms in ATOMS list/); return 6 if ($text =~ /NO ATOMS CLOSE ENOUGH TO OVERLAP/); return 7 if ($text =~ /No absorbing atom \(ipot=0\) defined/); return 7 if ($text =~ /More than one absorbing atom \(ipot=0\)/); return 8 if ($text =~ /Unique potential\s+\d+\s+not allowed/); return 8 if ($text =~ /Unique potential index\s+\d+\s+out of range./); return 8 if ($text =~ /Unique potentials must be between\s+\d+\s+and\s+\d+/); return 9 if ($text =~ /TWO ATOMS VERY CLOSE TOGETHER/); return 10 if ($text =~ /Error reading input, bad line follows/); return 11 if ($text =~ /Internal path finder limit exceeded/); return 12 if (0); # feff7, iprint4<>3 return 0; }; ## return a lengthy diagnostic message based on the index returned by ## the recognized method. mmmm.... closure-licious sub describe { shift; my $err = $_[0]; my $exists = 0; map {++$exists if ($err == $_)} (1 .. $nchecks); return "" unless $exists; return eval '&error_' . $err ; }; ## this error happens when the potentials list contains atoms not ## represented in the atoms list sub error_1 { return <feff_executable variable is set ## incorrectly on windows sub error_3 { return <feff_executable variable is set ## incorrectly on unix-ish systems sub error_4 { return <