| 1 |
package Xray::Feff::Path; |
| 2 |
|
| 3 |
use Moose; |
| 4 |
use MooseX::NonMoose; |
| 5 |
use MooseX::Aliases; |
| 6 |
extends 'Xray::Feff::PathWrapper'; |
| 7 |
|
| 8 |
use List::MoreUtils qw(any); |
| 9 |
|
| 10 |
our $VERSION = '1.00'; # Inline::MakeMake uses /^\d.\d\d$/ as the |
| 11 |
# pattern for the version number -- note the |
| 12 |
# two digits to the right of the dot |
| 13 |
|
| 14 |
has 'wrapper' => ( |
| 15 |
is => 'ro', |
| 16 |
#traits => [qw(NoClone)], |
| 17 |
isa => 'Xray::Feff::PathWrapper', |
| 18 |
init_arg => undef, |
| 19 |
default => sub{ Xray::Feff::PathWrapper->new() }, |
| 20 |
#lazy => 1, |
| 21 |
#builder => '_build_object', |
| 22 |
); |
| 23 |
|
| 24 |
has 'errorcode' => (is => 'rw', isa => 'Int', default => 0,); |
| 25 |
has 'errormessage' => (is => 'rw', isa => 'Str', default => q{},); |
| 26 |
|
| 27 |
## constants from feffpath.h |
| 28 |
has 'nex' => (is => 'ro', isa => 'Int', default => sub{ Xray::Feff::PathWrapper->_nex }); |
| 29 |
has 'nphx' => (is => 'ro', isa => 'Int', default => sub{ Xray::Feff::PathWrapper->_nphx }); |
| 30 |
has 'npatx' => (is => 'ro', isa => 'Int', default => sub{ Xray::Feff::PathWrapper->_npatx }); |
| 31 |
has 'legtot' => (is => 'ro', isa => 'Int', default => sub{ Xray::Feff::PathWrapper->_legtot }); |
| 32 |
has 'bohr' => (is => 'ro', isa => 'Num', default => sub{ Xray::Feff::PathWrapper->_bohr }); |
| 33 |
has 'ryd' => (is => 'ro', isa => 'Num', default => sub{ Xray::Feff::PathWrapper->_ryd }); |
| 34 |
has 'hart' => (is => 'ro', isa => 'Num', default => sub{ Xray::Feff::PathWrapper->_hart }); |
| 35 |
|
| 36 |
## location of phase.pad file |
| 37 |
has 'phpad' => (is => 'rw', isa => 'Str', default => 'phase.pad', trigger => sub{pushback(@_, 'phpad' )}, |
| 38 |
alias => 'phbin'); |
| 39 |
|
| 40 |
## basic path parameters |
| 41 |
has 'Index' => (is => 'rw', isa => 'Int', default => 9999, trigger => sub{pushback(@_, 'Index' )},); |
| 42 |
has 'nleg' => (is => 'rw', isa => 'Int', default => 0, trigger => sub{pushback(@_, 'nleg' )},); |
| 43 |
has 'degen' => (is => 'rw', isa => 'Num', default => 1.0, trigger => sub{pushback(@_, 'degen' )}, |
| 44 |
alias => 'degeneracy'); |
| 45 |
has 'iorder' => (is => 'rw', isa => 'Int', default => 2, trigger => sub{pushback(@_, 'iorder' )},); |
| 46 |
|
| 47 |
## output and verbosity control |
| 48 |
has 'nnnn' => (is => 'rw', isa => 'Bool', default => 0, trigger => sub{pushback(@_, 'nnnn' )},); |
| 49 |
has 'xdi' => (is => 'rw', isa => 'Bool', default => 0, trigger => sub{pushback(@_, 'xdi' )},); |
| 50 |
has 'verbose' => (is => 'rw', isa => 'Bool', default => 0, trigger => sub{pushback(@_, 'verbose')},); |
| 51 |
|
| 52 |
## header information from feffNNNN.dat |
| 53 |
has 'edge' => (is => 'rw', isa => 'Num', default => 0.0); |
| 54 |
has 'gam_ch' => (is => 'rw', isa => 'Num', default => 0.0); |
| 55 |
has 'kf' => (is => 'rw', isa => 'Num', default => 0.0); |
| 56 |
has 'mu' => (is => 'rw', isa => 'Num', default => 0.0); |
| 57 |
has 'rnorman' => (is => 'rw', isa => 'Num', default => 0.0); |
| 58 |
has 'rs_int' => (is => 'rw', isa => 'Num', default => 0.0); |
| 59 |
has 'vint' => (is => 'rw', isa => 'Num', default => 0.0); |
| 60 |
has 'exch' => (is => 'rw', isa => 'Str', default => ''); |
| 61 |
has 'version' => (is => 'rw', isa => 'Str', default => ''); |
| 62 |
|
| 63 |
## polarization |
| 64 |
has 'ipol' => (is => 'rw', isa => 'Int', default => 0, trigger => sub{pushback(@_, 'ipol' )},); |
| 65 |
has 'elpty' => (is => 'rw', isa => 'Num', default => 0.0, trigger => sub{pushback(@_, 'elpty' )}, |
| 66 |
alias => 'ellipticity'); |
| 67 |
has 'evec' => (traits => ['Array'], |
| 68 |
is => 'rw', |
| 69 |
isa => 'ArrayRef[Num]', |
| 70 |
default => sub { [0,0,0] }, |
| 71 |
trigger => \&evec_set, ); |
| 72 |
has 'xivec' => (traits => ['Array'], |
| 73 |
is => 'rw', |
| 74 |
isa => 'ArrayRef[Num]', |
| 75 |
default => sub { [0,0,0] }, |
| 76 |
trigger => \&xivec_set, ); |
| 77 |
|
| 78 |
## geometry table |
| 79 |
has 'absorber' => (is => 'rw', isa => 'ArrayRef', default => sub{[0,0,0]}); |
| 80 |
has 'ipot' => (traits => ['Array'], is => 'rw', isa => 'ArrayRef[Int]', default => sub { [] }, |
| 81 |
handles => {clear_ipot => 'clear', push_ipot => 'push', }); |
| 82 |
has 'rat' => (traits => ['Array'], is => 'rw', isa => 'ArrayRef[ArrayRef[Num]]', default => sub { [] }, |
| 83 |
handles => {clear_rat => 'clear', push_rat => 'push', }); |
| 84 |
has 'iz' => (traits => ['Array'], is => 'rw', isa => 'ArrayRef[Int]', default => sub { [] }, |
| 85 |
handles => {clear_iz => 'clear', push_iz => 'push', }); |
| 86 |
has 'reff' => (is => 'rw', isa => 'Num', default => 0.0); |
| 87 |
has 'ri' => (traits => ['Array'], is => 'rw', isa => 'ArrayRef[Str]', default => sub { [] }, |
| 88 |
handles => {clear_ri => 'clear', push_ri => 'push', }); |
| 89 |
has 'beta' => (traits => ['Array'], is => 'rw', isa => 'ArrayRef[Str]', default => sub { [] }, |
| 90 |
handles => {clear_beta => 'clear', push_beta => 'push', }); |
| 91 |
has 'eta' => (traits => ['Array'], is => 'rw', isa => 'ArrayRef[Str]', default => sub { [] }, |
| 92 |
handles => {clear_eta => 'clear', push_eta => 'push', }); |
| 93 |
|
| 94 |
## data table |
| 95 |
has 'ne' => (is => 'rw', isa => 'Int', default => 0); |
| 96 |
has 'k' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}, alias => 'kgrid'); |
| 97 |
has 'real_phc' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}); |
| 98 |
has 'mag_feff' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}); |
| 99 |
has 'pha_feff' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}); |
| 100 |
has 'red_fact' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}); |
| 101 |
has 'lam' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}, alias => 'lambda'); |
| 102 |
has 'rep' => (is => 'rw', isa => 'ArrayRef', default => sub{[]}, alias => 'realp'); |
| 103 |
|
| 104 |
|
| 105 |
sub BUILD { |
| 106 |
my ($self) = @_; |
| 107 |
$self->wrapper->_create_path; |
| 108 |
return $self; |
| 109 |
}; |
| 110 |
|
| 111 |
sub DEMOLISH { |
| 112 |
my ($self) = @_; |
| 113 |
#print "in my DEMOLISH\n"; |
| 114 |
#print $self->wrapper, $/; |
| 115 |
$self->wrapper->_cleanup; |
| 116 |
return $self; |
| 117 |
}; |
| 118 |
|
| 119 |
|
| 120 |
## ------------------------------------------------------------ |
| 121 |
## trigger methods |
| 122 |
|
| 123 |
sub pushback { |
| 124 |
my ($self, $new, $old, $which) = @_; |
| 125 |
return if (any {$_ eq $which} qw(nleg ne edge gam_ch kf mu rnorman version exch rs_int vint)); |
| 126 |
my $method = '_set_' . lc($which); |
| 127 |
if ($self->meta->get_attribute($which)->type_constraint eq 'Num') { |
| 128 |
$self->wrapper->$method(1.0*$new); |
| 129 |
} elsif ($self->meta->get_attribute($which)->type_constraint eq 'Bool') { |
| 130 |
my $val = ($new) ? 1 : 0; |
| 131 |
$self->wrapper->$method($val); |
| 132 |
} else { |
| 133 |
$self->wrapper->$method($new); |
| 134 |
}; |
| 135 |
$self->ipol(1) if (($which eq 'elpty') and $self->wrapper->_elpty); |
| 136 |
}; |
| 137 |
|
| 138 |
sub evec_set { |
| 139 |
my ($self, $vec) = @_; |
| 140 |
$self->wrapper->_set_evec(1.0*$vec->[0], 1.0*$vec->[1], 1.0*$vec->[2]); |
| 141 |
return $self; |
| 142 |
}; |
| 143 |
sub xivec_set { |
| 144 |
my ($self, $vec) = @_; |
| 145 |
$self->wrapper->_set_xivec(1.0*$vec->[0], 1.0*$vec->[1], 1.0*$vec->[2]); |
| 146 |
return $self; |
| 147 |
}; |
| 148 |
|
| 149 |
|
| 150 |
## ------------------------------------------------------------ |
| 151 |
## main methods |
| 152 |
|
| 153 |
sub clear { |
| 154 |
my ($self) = @_; |
| 155 |
$self->wrapper->_clear_path; |
| 156 |
foreach my $att (map {$_->name} $self->meta->get_all_attributes) { # iterate over all attribute names |
| 157 |
next if (not $self->meta->get_attribute($att)->get_write_method); # skip ro attributes, see Class/MOP/Attribute.pm#Informational |
| 158 |
next if ($self->meta->get_attribute($att)->type_constraint =~ m{Feff::Path}); # skip wrapper |
| 159 |
my $method = '_'.lc($att); |
| 160 |
|
| 161 |
if ($att =~ m{(?:(?:e|xi)vec|absorber)}) { # 3-vec attributes |
| 162 |
$self->$att([0,0,0]) |
| 163 |
|
| 164 |
} elsif ($self->meta->get_attribute($att)->type_constraint =~ m{ArrayRef}) { # array valued attributes |
| 165 |
$self->$att([]) |
| 166 |
|
| 167 |
} elsif ($self->meta->get_attribute($att)->type_constraint =~ m{Bool}) { # boolean valued attributes |
| 168 |
my $val = $self->wrapper->$method || 0; |
| 169 |
$self->$att($val); |
| 170 |
|
| 171 |
} else { # all the rest |
| 172 |
my $val = $self->wrapper->$method || 0; |
| 173 |
$self->$att($val); |
| 174 |
}; |
| 175 |
}; |
| 176 |
return $self; |
| 177 |
}; |
| 178 |
|
| 179 |
sub atom { |
| 180 |
my ($self, $x, $y, $z, $ip) = @_; |
| 181 |
my $message; |
| 182 |
my $xx = $x - $self->absorber->[0]; |
| 183 |
my $yy = $y - $self->absorber->[1]; |
| 184 |
my $zz = $z - $self->absorber->[2]; |
| 185 |
my $err = $self->wrapper->_add_scatterer($xx, $yy, $zz, $ip); |
| 186 |
$self->errorcode($err); |
| 187 |
my $em = $self->wrapper->_errormessage; |
| 188 |
$em =~ s{add_scatterer}{atom method}; |
| 189 |
$self->errormessage($em); |
| 190 |
$self->nleg($self->wrapper->_nleg); |
| 191 |
$self->push_ipot($ip); |
| 192 |
$self->push_rat([$x, $y, $z]); |
| 193 |
return $err; |
| 194 |
}; |
| 195 |
|
| 196 |
sub path { |
| 197 |
my ($self) = @_; |
| 198 |
$self->push_ipot(0); |
| 199 |
$self->push_rat($self->absorber); |
| 200 |
my $err = $self->wrapper->_make_path; |
| 201 |
$self->errorcode($err); |
| 202 |
my $em = $self->wrapper->_errormessage; |
| 203 |
$em =~ s{make_path}{path method}; |
| 204 |
$self->errormessage($em); |
| 205 |
if (not $err) { |
| 206 |
|
| 207 |
## grab scalar output |
| 208 |
foreach my $a (qw(reff ne edge gam_ch kf mu rnorman rs_int vint exch version)) { |
| 209 |
my $method = '_'.$a; |
| 210 |
$self->$a($self->wrapper->$method); |
| 211 |
}; |
| 212 |
|
| 213 |
## grab data table |
| 214 |
foreach my $a (qw(k real_phc mag_feff pha_feff red_fact lam rep)) { |
| 215 |
my $method = '_' . $a . '_array'; |
| 216 |
my @array = $self->wrapper->$method; |
| 217 |
$self->$a(\@array); |
| 218 |
}; |
| 219 |
|
| 220 |
## grab geometry table |
| 221 |
foreach my $a (qw(ri beta eta iz)) { |
| 222 |
my $method = '_' . $a . '_array'; |
| 223 |
my @array = $self->wrapper->$method; |
| 224 |
$self->$a(\@array); |
| 225 |
}; |
| 226 |
}; |
| 227 |
return $err; |
| 228 |
}; |
| 229 |
|
| 230 |
|
| 231 |
no Moose; |
| 232 |
__PACKAGE__->meta->make_immutable; |
| 233 |
1; |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
=head1 NAME |
| 238 |
|
| 239 |
Xray::Feff::Path - Moose wrapper around an Inline::C interface to libfeffpath |
| 240 |
|
| 241 |
=head1 VERSION |
| 242 |
|
| 243 |
1.00 |
| 244 |
|
| 245 |
=head1 SYNOPSIS |
| 246 |
|
| 247 |
This provides a simple object oriented interface to the C<feffpath> |
| 248 |
wrapper around Feff's C<onepath> subroutine. C<onepath> combines the |
| 249 |
F-matrix calculation in F<GENFMT/genfmt.f> with the construction of the |
| 250 |
common presentation of F-effective from F<FF2X/feffdt.f>. |
| 251 |
|
| 252 |
Given the geometry of a scattering path in the form of Cartesian |
| 253 |
coordinates of atoms making up the path, along with some additional |
| 254 |
information such as the degeneracy, compute F-effective for that |
| 255 |
scattering path. |
| 256 |
|
| 257 |
This replaces the need to read a F<feffNNNN.dat> file. Given a |
| 258 |
scattering geometry, the equivalent data can be computed directly. |
| 259 |
|
| 260 |
The following computes the columns of the F<feff0004.dat> file for |
| 261 |
copper metal: |
| 262 |
|
| 263 |
#!/usr/bin/perl |
| 264 |
use strict; |
| 265 |
use warnings; |
| 266 |
use Xray::Feff::Path; |
| 267 |
|
| 268 |
my $path = Xray::Feff::Path->new(); |
| 269 |
$path->degen(48); |
| 270 |
$path->Index(4); |
| 271 |
$path->phpad('../fortran/phase.pad'); |
| 272 |
$path->atom(0, 0, -3.61, 1); |
| 273 |
$path->atom(-1.805, 0, -1.805, 1); |
| 274 |
$path->path; |
| 275 |
my @kgrid = @{ $path->k }; |
| 276 |
my @caps = @{ $path->real_phc }; |
| 277 |
my @amff = @{ $path->mag_feff }; |
| 278 |
my @phff = @{ $path->pha_feff }; |
| 279 |
my @redfac = @{ $path->red_fact }; |
| 280 |
my @lambda = @{ $path->lam }; |
| 281 |
my @rep = @{ $path->rep }; |
| 282 |
undef $path |
| 283 |
|
| 284 |
=head1 INSTALLATION |
| 285 |
|
| 286 |
After you have built and installed I<feff85exafs>, do the following: |
| 287 |
|
| 288 |
perl Makefile.PL |
| 289 |
make |
| 290 |
make test |
| 291 |
sudo make install |
| 292 |
|
| 293 |
That's it! Note, though, that building this wrapper B<requires> that |
| 294 |
the fortran and C code I<feff85exafs> be completely compiled and that |
| 295 |
the resulting libraries (and other files) be successfully installed. |
| 296 |
|
| 297 |
=head1 METHODS |
| 298 |
|
| 299 |
=over 4 |
| 300 |
|
| 301 |
=item C<new> |
| 302 |
|
| 303 |
Create the Feff::Path object |
| 304 |
|
| 305 |
my $path = Xray::Feff::Path->new(); |
| 306 |
|
| 307 |
=item C<atom> |
| 308 |
|
| 309 |
Add an atom to the scattering path, supplying the Cartesian |
| 310 |
coordiantes of the atom and its unique potential index. |
| 311 |
|
| 312 |
$nleg = $path->atom($x, $y, $z, $ipot); |
| 313 |
|
| 314 |
This returns the current number of legs in the path. To make a SS |
| 315 |
paths do: |
| 316 |
|
| 317 |
$path->atom($x, $y, $z, $ipot1); |
| 318 |
print $path->nleg, $/; |
| 319 |
# ==prints===> 2 |
| 320 |
|
| 321 |
To make a MS path do: |
| 322 |
|
| 323 |
$path->atom($x1, $y1, $z1, $ipot1); |
| 324 |
$path->atom($x2, $y2, $z2, $ipot2); |
| 325 |
$path->atom($x3, $y3, $z3, $ipot3); |
| 326 |
print $path->nleg, $/; |
| 327 |
# ==prints===> 4 |
| 328 |
|
| 329 |
Note that there is no setter method for the nleg attribute. Rather, |
| 330 |
C<nleg> is incremented by each call to the C<atom> method. |
| 331 |
|
| 332 |
=item C<path> |
| 333 |
|
| 334 |
Compute the scattering path |
| 335 |
|
| 336 |
$path->path; |
| 337 |
|
| 338 |
=item C<clear> |
| 339 |
|
| 340 |
Reinitialize the scattering path |
| 341 |
|
| 342 |
$path->clear; |
| 343 |
|
| 344 |
=back |
| 345 |
|
| 346 |
To destroy a Feff::Path object, simply |
| 347 |
|
| 348 |
undef $path; |
| 349 |
|
| 350 |
=head1 ATTRIBUTES |
| 351 |
|
| 352 |
Each of the members of the FEFFPATH struct is wrapped in a getter |
| 353 |
method of the same name. Each of the following exists: |
| 354 |
|
| 355 |
=head2 Scalar valued attributes |
| 356 |
|
| 357 |
=over 4 |
| 358 |
|
| 359 |
=item C<phpad> (character, default = phase.pad) |
| 360 |
|
| 361 |
The path to the F<phase.pad> file. This gets right-padded with spaces |
| 362 |
to 256 characters, which is the length of the parameter in the |
| 363 |
underlying Fortran library. Therefore, the value returned by the |
| 364 |
getter will be right-padded. |
| 365 |
|
| 366 |
=item C<Index> (integer, default = 9999) |
| 367 |
|
| 368 |
The path index, used for form the name of the output F<feffNNNN.dat> |
| 369 |
file. |
| 370 |
|
| 371 |
Accessing this and other scalar-values attributes works in the typical |
| 372 |
Moose-y way: |
| 373 |
|
| 374 |
$path->Index(4); |
| 375 |
print $path->Index, $/; |
| 376 |
## ==prints==> 4 |
| 377 |
|
| 378 |
Note that this attribute (but only this one) is capitalized to avoid |
| 379 |
confusion with the built-in C<index> function. |
| 380 |
|
| 381 |
=item C<degen> (float, default = 0) |
| 382 |
|
| 383 |
The path degeneracy. This is required input for a calculation. |
| 384 |
|
| 385 |
=item C<nleg> (integer, default = 0) |
| 386 |
|
| 387 |
The number of legs in the path. This should never be set by hand. It |
| 388 |
gets incremented by calls to the C<atom> method. |
| 389 |
|
| 390 |
=item C<iorder> (integer, default = 2) |
| 391 |
|
| 392 |
Order of approximation for multiple scattering paths. |
| 393 |
|
| 394 |
=item C<nnnn> (boolean, default = 0) |
| 395 |
|
| 396 |
Flag for writing F<feffNNNN.dat> file. |
| 397 |
|
| 398 |
=item C<xdi> (boolean, default = 0) |
| 399 |
|
| 400 |
Flag for writing F<feffNNNN.xdi> file. |
| 401 |
|
| 402 |
=item C<verbose> (integer, default = 0) |
| 403 |
|
| 404 |
Flag for writing screen messages as files are written. |
| 405 |
|
| 406 |
=item C<ipol> (boolean, default = 0) |
| 407 |
|
| 408 |
Perform polarization calculation. This gets toggled to true whenever |
| 409 |
any of C<elpty>, C<evec>, or C<xivec> are set. |
| 410 |
|
| 411 |
=item C<elpty> (integer, default = 0) |
| 412 |
|
| 413 |
Ellipticity for use in polarization calculation. |
| 414 |
|
| 415 |
=item C<reff> (float, default = 0) |
| 416 |
|
| 417 |
Half path length. This should never be set by hand. It |
| 418 |
gets set correctly when the C<path> method is called. |
| 419 |
|
| 420 |
=item C<ne> (integer, default = 0) |
| 421 |
|
| 422 |
Number of outpit k grid point. This should never be set by hand. It |
| 423 |
gets set correctly when the C<path> method is called. |
| 424 |
|
| 425 |
=back |
| 426 |
|
| 427 |
=head2 Error reporting |
| 428 |
|
| 429 |
=over 4 |
| 430 |
|
| 431 |
=item C<errorcode> (integer) |
| 432 |
|
| 433 |
An integer error code from either C<atom> or C<path>. Check for |
| 434 |
non-zero value. For a non-zero return from C<atom>, calling C<path> |
| 435 |
is likely to cause a problem in the genfmt calculation. For a |
| 436 |
non-zero return from C<path>, the genfmt calculation was skipped. See |
| 437 |
C<errormessage> for an explanation of the problem. |
| 438 |
|
| 439 |
=item C<errormessage> (string) |
| 440 |
|
| 441 |
A explanation of words of the problem found during C<atom> or C<path>. |
| 442 |
|
| 443 |
$path->degen(-48); |
| 444 |
$path->atom(0, 0, 3.61, 1); |
| 445 |
$path->path; |
| 446 |
if ($path->errorcode) { |
| 447 |
print $path->errormessage; |
| 448 |
}; |
| 449 |
## ==prints==> |
| 450 |
Error in make_path |
| 451 |
path degeneracy (-48.00) is negative |
| 452 |
|
| 453 |
=back |
| 454 |
|
| 455 |
=head2 Attributes related to the potential model |
| 456 |
|
| 457 |
Several parameters are captured by the C struct (and therefore |
| 458 |
available via the perl wrapper) which are related to how Feff's |
| 459 |
potential model was calculated. This information is written to the |
| 460 |
F<feffNNNN.dat> header. |
| 461 |
|
| 462 |
=over 4 |
| 463 |
|
| 464 |
=item C<version> |
| 465 |
|
| 466 |
A string identifying the version number and the `feffpath` wrapper |
| 467 |
revision. |
| 468 |
|
| 469 |
=item C<exch> |
| 470 |
|
| 471 |
A string identifying the type of potential model used. The |
| 472 |
possibilities are |
| 473 |
|
| 474 |
H-L exch (the default) |
| 475 |
D-H exch |
| 476 |
Gd state |
| 477 |
DH - HL |
| 478 |
DH + HL |
| 479 |
val=s+d |
| 480 |
sigmd(r) |
| 481 |
sigmd=c |
| 482 |
|
| 483 |
See the description of the EXCHANGE keyword in the Feff document |
| 484 |
L<http://feffproject.org/feff/Docs/feff9/feff90/feff90_users_guide.pdf> |
| 485 |
at page 92. |
| 486 |
|
| 487 |
=item C<edge> |
| 488 |
|
| 489 |
A poor estimate of the energy threshold relative to the atomic value, in eV. |
| 490 |
|
| 491 |
=item C<gam_ch> |
| 492 |
|
| 493 |
The core-hole lifetime, in eV. |
| 494 |
|
| 495 |
=item C<kf> |
| 496 |
|
| 497 |
The k value at the Fermi energy, in inverse Angstroms. |
| 498 |
|
| 499 |
=item C<mu> |
| 500 |
|
| 501 |
The Fermi energy, in eV. |
| 502 |
|
| 503 |
=item C<rnorman> |
| 504 |
|
| 505 |
The average Norman radius. |
| 506 |
|
| 507 |
=item C<rs_int> |
| 508 |
|
| 509 |
An estimate of the interstitial radius. |
| 510 |
|
| 511 |
=item C<vint> |
| 512 |
|
| 513 |
The interstitial potential, in eV. |
| 514 |
|
| 515 |
=back |
| 516 |
|
| 517 |
=head2 Constants from feffpath.h |
| 518 |
|
| 519 |
The following constants are captured from the feffpath header file: |
| 520 |
|
| 521 |
=over 4 |
| 522 |
|
| 523 |
=item C<nex> (150) |
| 524 |
|
| 525 |
The maximum number of points in the energy grid. |
| 526 |
|
| 527 |
=item C<nphx> (11) |
| 528 |
|
| 529 |
The maximum number of unique potentials. |
| 530 |
|
| 531 |
=item C<npatx> (8) |
| 532 |
|
| 533 |
The maximum number of path atoms |
| 534 |
|
| 535 |
=item C<legtot> (9) |
| 536 |
|
| 537 |
The maximum number of legs in a path (npatx + 1) |
| 538 |
|
| 539 |
=item C<bohr> (0.529177249) |
| 540 |
|
| 541 |
A unit of length, in Angstrom. |
| 542 |
|
| 543 |
=item C<ryd> (13.605698) |
| 544 |
|
| 545 |
A Rydberg, a unit of energy, in eV. |
| 546 |
|
| 547 |
=item C<hart> (27.211396) |
| 548 |
|
| 549 |
A Hartree, a unit of energy, in eV. |
| 550 |
|
| 551 |
=back |
| 552 |
|
| 553 |
=head2 Attributes with values of array-reference |
| 554 |
|
| 555 |
=over 4 |
| 556 |
|
| 557 |
=item C<absorber> |
| 558 |
|
| 559 |
The Cartesian coordinates of the absober atom. By default the |
| 560 |
absorber is placed at (0,0,0). |
| 561 |
|
| 562 |
=item C<ipot> |
| 563 |
|
| 564 |
A list of the unique potentials of the scatterers in a path. This is |
| 565 |
populated by the calls to the C<atom> method. |
| 566 |
|
| 567 |
=item C<rat> |
| 568 |
|
| 569 |
A list of lists of the Cartesian coordinates of the scatterers in a |
| 570 |
path. This is populated by the calls to the C<atom> method. |
| 571 |
|
| 572 |
=item C<evec> |
| 573 |
|
| 574 |
The electric vector of the incident beam for the polarization |
| 575 |
calculation. Note that the setter's argument is an array reference as |
| 576 |
is the getter's return value. |
| 577 |
|
| 578 |
$path->evec([0,0,1]); |
| 579 |
$evec_ref = $path->evec; |
| 580 |
print join(", ", @$evec_ref); |
| 581 |
## ==prints==> 0, 0, 1 |
| 582 |
|
| 583 |
Setting C<evec> will also set C<ipol> to true. |
| 584 |
|
| 585 |
=item C<xivec> |
| 586 |
|
| 587 |
The Poynting vector of the incident beam for the ellipticity |
| 588 |
calculation. Note that the setter's argument is an array reference as |
| 589 |
is the getter's return value. |
| 590 |
|
| 591 |
$path->xivec([1,1,0]); |
| 592 |
$xivec_ref = $path->xivec; |
| 593 |
print join(", ", @$xivec_ref); |
| 594 |
## ==prints==> 1, 1, 0 |
| 595 |
|
| 596 |
Setting C<xivec> will also set C<ipol> to true. |
| 597 |
|
| 598 |
=item C<ri> |
| 599 |
|
| 600 |
The leg lengths (in Angstroms) of the specified path. This gets set |
| 601 |
when C<path> is called. It returns an reference to an array with |
| 602 |
C<nleg> elements. |
| 603 |
|
| 604 |
=item C<beta> |
| 605 |
|
| 606 |
The Eulerian beta angles (in degrees) of the specified path. This |
| 607 |
gets set when C<path> is called. It returns a reference to an array |
| 608 |
with C<nleg> elements. |
| 609 |
|
| 610 |
=item C<eta> |
| 611 |
|
| 612 |
The Eulerian eta angles (in degrees) of the specified path. This gets |
| 613 |
set when C<path> is called. It returns a reference to an array with |
| 614 |
C<nleg> elements. |
| 615 |
|
| 616 |
=item C<k> |
| 617 |
|
| 618 |
A reference to an array containing the k grid of the calculation. |
| 619 |
This is column 1 from F<feffNNNN.dat>. |
| 620 |
|
| 621 |
=item C<real_phc> |
| 622 |
|
| 623 |
A reference to an array containing the central atom phase shifts. |
| 624 |
This is column 2 from F<feffNNNN.dat>. |
| 625 |
|
| 626 |
=item C<mag_feff> |
| 627 |
|
| 628 |
A reference to an array containing the magnitude of F-effective. This |
| 629 |
is column 3 from F<feffNNNN.dat>. |
| 630 |
|
| 631 |
=item C<pha_feff> |
| 632 |
|
| 633 |
A reference to an array containing the phase of F-effective. This is |
| 634 |
column 4 from F<feffNNNN.dat>. |
| 635 |
|
| 636 |
=item C<red_fact> |
| 637 |
|
| 638 |
A reference to an array containing the reduction factor. This is |
| 639 |
column 5 from F<feffNNNN.dat>. |
| 640 |
|
| 641 |
=item C<lam> |
| 642 |
|
| 643 |
A reference to an array containing lambda, the mean free path. This is |
| 644 |
column 6 from F<feffNNNN.dat>. |
| 645 |
|
| 646 |
=item C<rep> |
| 647 |
|
| 648 |
A reference to an array containing the real part of the complex |
| 649 |
momentum. This is column 7 from F<feffNNNN.dat>. |
| 650 |
|
| 651 |
=back |
| 652 |
|
| 653 |
=head1 Error codes |
| 654 |
|
| 655 |
The error codes returned by the C<atom> and C<path> methods are the |
| 656 |
sums of the codes actually found by the method call, thus the returned |
| 657 |
error codes are meant to be interpreted bitwise. |
| 658 |
|
| 659 |
=head2 C<atom> method |
| 660 |
|
| 661 |
If any of these are triggered, it is very likely that a call to |
| 662 |
C<path> will return unreliable results or may crash the program. |
| 663 |
|
| 664 |
=over 4 |
| 665 |
|
| 666 |
=item I<1> |
| 667 |
|
| 668 |
ipot argument to add_scatterer is less than 0 |
| 669 |
|
| 670 |
=item I<2> |
| 671 |
|
| 672 |
ipot argument to add_scatterer is greater than 7 |
| 673 |
|
| 674 |
=item I<4> |
| 675 |
|
| 676 |
coordinates are for an atom too close to the previous atom in the path |
| 677 |
|
| 678 |
=item I<8> |
| 679 |
|
| 680 |
nlegs greater than legtot |
| 681 |
|
| 682 |
=back |
| 683 |
|
| 684 |
=head2 C<path> method |
| 685 |
|
| 686 |
If any of these are triggered, genfmt will not be called and all |
| 687 |
output arrays will be zero-filled. |
| 688 |
|
| 689 |
=over 4 |
| 690 |
|
| 691 |
=item I<1> |
| 692 |
|
| 693 |
the first atom specified is the absorber |
| 694 |
|
| 695 |
=item I<2> |
| 696 |
|
| 697 |
the last atom specified is the absorber |
| 698 |
|
| 699 |
=item I<4> |
| 700 |
|
| 701 |
path degeneracy is negative |
| 702 |
|
| 703 |
=item I<8> |
| 704 |
|
| 705 |
path index not between 0 and 9999 |
| 706 |
|
| 707 |
=item I<16> |
| 708 |
|
| 709 |
ellipticity not between 0 and 1 |
| 710 |
|
| 711 |
=item I<32> |
| 712 |
|
| 713 |
iorder not between 0 and 10 |
| 714 |
|
| 715 |
=item I<64> |
| 716 |
|
| 717 |
F<phase.pad> cannot be found or cannot be read |
| 718 |
|
| 719 |
=back |
| 720 |
|
| 721 |
|
| 722 |
=head1 EXTERNAL DEPENDENCIES |
| 723 |
|
| 724 |
=over 4 |
| 725 |
|
| 726 |
=item * |
| 727 |
|
| 728 |
L<Inline>, and L<Inline::C> |
| 729 |
|
| 730 |
=item * |
| 731 |
|
| 732 |
L<Moose> |
| 733 |
|
| 734 |
=item * |
| 735 |
|
| 736 |
L<MooseX::NonMoose> and L<MooseX::Aliases> |
| 737 |
|
| 738 |
=back |
| 739 |
|
| 740 |
=head1 BUGS AND LIMITATIONS |
| 741 |
|
| 742 |
=over 4 |
| 743 |
|
| 744 |
=item * |
| 745 |
|
| 746 |
Setting a boolean unsets phpad at Inline::C level. Weird! |
| 747 |
Work-around is at line 130. |
| 748 |
|
| 749 |
=item * |
| 750 |
|
| 751 |
Polarization test is quite trivial. Should test against an actual |
| 752 |
calculation. |
| 753 |
|
| 754 |
=item * |
| 755 |
|
| 756 |
C<ipol> and C<rat> not accessed via wrapper. That said, |
| 757 |
Xray::Feff::Path keeps those attributes current. |
| 758 |
|
| 759 |
=back |
| 760 |
|
| 761 |
Please report problems to Bruce Ravel (bravel AT bnl DOT gov) |
| 762 |
|
| 763 |
Patches are welcome. |
| 764 |
|
| 765 |
=head1 AUTHOR |
| 766 |
|
| 767 |
Bruce Ravel (bravel AT bnl DOT gov) |
| 768 |
|
| 769 |
L<https://github.com/bruceravel> |
| 770 |
|
| 771 |
=head1 LICENSE AND COPYRIGHT |
| 772 |
|
| 773 |
To the extent possible, the authors have waived all rights granted by |
| 774 |
copyright law and related laws for the code and documentation that |
| 775 |
make up the Perl Interface to the feffpath library. While information |
| 776 |
about Authorship may be retained in some files for historical reasons, |
| 777 |
this work is hereby placed in the Public Domain. This work is |
| 778 |
published from: United States. |
| 779 |
|
| 780 |
Note that the feffpath and onepath libraries themselves are NOT public |
| 781 |
domain, nor is the Fortran source code for Feff that it relies upon. |
| 782 |
|
| 783 |
Author: Bruce Ravel (bravel AT bnl DOT gov). |
| 784 |
Last update: 13 February, 2015 |
| 785 |
|
| 786 |
=cut |