FSPath object

Sometimes DEMETER is just too much. A simple, first shell, single scattering problem should have a simple solution. The FSPath, or “first shell path”, is intended to be that simple solution.

You provide the element symbol of the absorber and scatterer, their distance apart, and the absorption edge. DEMETER will then construct a simple FEFF input file, run FEFF, return the single scattering path at the specified distance, and even create a set of guess parameters for you. It's pretty simple. In this example, we create an oxygen scattering shell at 2 Å around an iron absorber and use it to fit some iron oxide data contained in an ATHENA project file.

  1. #!/usr/bin/perl
  2. use Demeter;
  3. my $prj = Demeter::Data::Prj->new(file => 'FeO.prj');
  4. my $data = $prj -> record(1);
  5. my $fspath = Demeter::FSPath->new(abs       => 'Fe',
  6.                                   scat      => 'O',
  7.                                   edge      => 'K',
  8.                                   distance  => 2.0,
  9.                                   data      => $data,
  10.                                   workspace => "/path/to/work/space",
  11.                                  );
  12. my $fit = Demeter::Fit->new(data  => [$data_object],
  13.                             paths => [$fspath],
  14.                             gds   => $fspath->gds);
  15. ## now do something with the results of the fit ...

When the object if created, DEMETER will construct a feff.inp for a simple cubic structure containing the absorber and scatterer. The lattice constant of this notional crystal is such that the first neighbor distance is as specified. The edge can be asserted explicitly, but it can usually be guessed from the atomic species of the absorber -- the K edge is assumed for elements lighter than La, otherwise the LIII edge is assumed.

Like a normal Path, the FSPath must be associated with a Data object via its data attribute. Because, a FEFF calculation is done behind the scenes, a workspace attribute must be specified so that DEMETER has a place to perform the calculation.

All the details of the FEFF calculation are handled automatically. The FSPath will always be up-to-date for use in a plot or a fit.

Also behind the scenes, a set of guess parameters is created. For the example shown, these parameters will be named aa_fe_o, ee_fe_o, dr_fe_o, and ss_fe_o. The second and third parts of those names are taken from the element symbols of the abosorber and scatterer. The new method can also take use_third and use_fourth as arguments. When true, additional guess parameters will be made to represent the third and fourth cumulants and will be called c3_fe_o and c4_fe_o. These parameters are then used as the math expressions for the appropriate pathparameters of the path. If you choose to use this simple parameterization of the FSPath, you are then ready to begin fitting.

The gds method, shown at line 14, returns a list containing the GDS objects associated with the automatically generated parameters. Because the FSPath is derived from the Path object, it behaves in every other way like a normal Path object. Thus, if you want to overwrite the path parameter math expressions, simply set them the way you would for any Path object.


      $fspath -> set(s02 => '(1-x)*amp', enot=>'enot_o');

The values of the scat and abs attributes can be the one- or two-letter symbols, the full English names of the elements, or the Z number. The absorber and scatterer attributes are filled automatically with the resolved one- or two-letter atomic symbols.

There are a couple more methods involved with the automatically generated parameters. The parameter method is used to obtain the GDS objects that were automatically created. It takes a single argument for identifying the parameter being queried. Here is every possible example of its use. In each case, the reference to the GDS object is returned.


      my $amp_gds    = $fspath->parameter('s02');
      my $e0_gds     = $fspath->parameter('e0');
      my $delr_gds   = $fspath->parameter('delr');
      my $sigma2_gds = $fspath->parameter('sigma2');
      my $third_gds  = $fspath->parameter('third');
      my $fourth_gds = $fspath->parameter('fourth');

Finally, the unset_parameters method is used to clear the autogenerated path parameters, setting them all literally to 0 -- except for s02, which is set literally to 1. This is useful in a situation where you wish to use the quick first shell scattering path in some other context than the quick first shell fit.