NAME

Ifeffit::Demeter::Tools - Utility methods for the Demeter class


VERSION

This documentation refers to Ifeffit::Demeter version 0.0.1


DESCRIPTION

This module contains a number of methods that work better (in Bruce's opinion) as class methods than as object methods.


EXPORTED FUNCTIONs

distance

This returns the Cartesian distance between two points.

   my $d = distance(@point1, @point2);

Each of the arrays passed to this function must be exactly three elements long and are assumed to contain the x, y, and z Cartesian coordinates, in that order.


METHODS

random_string

Generate a random string of lowercase alphabetic characters. The argument is the length of the string.

   $string = Ifeffit::Demeter::Tools->random_string(4);
now

This returns a string with the current date and time in a convenient, human-readable format.

   print "The time is: ", $fitobject -> now, $/;
environment

This returns a string showing the version numbers of Demeter and perl, and the identifier string for your operating system.

   print "You are running: ", $fitobject -> environment, $/;
who

This makes a halfhearted attempt to figure out who you are. On a unix machine, it returns a concatination of the USER and HOST environment variables. On Windows it currently returns the fairly stupid ``you@your.computer''.

   print "You are: ", $fitobject -> who, $/;
check_parens

Return 0 if a string has matching round braces (parentheses). A positive (negative) return value indicates the number of excess open (close) round braces. This can be used a boolean check on a string.

  $is_mismatched = Ifeffit::Demeter::Tools->check_parens($string);

This only matches round braces. It ignores square, curly, or angle braces, none of which serve a purpose in Ifeffit math expressions.

simpleGDS

This is syntactic sugar for the GDS object constructor. The following are equivalent:

  $gdsobject = Ifeffit::Demeter::GDS ->
                  new({type    => 'guess',
                       name    => 'alpha',
                       mathexp => 0,
                      });
  $gdsobject = Ifeffit::Demeter::Tools ->
                  simpleGDS("guess alpha = 0");

If you use the nifty aliased module, this can be syntactically sweeter:

  use aliased "Ifeffit::Demeter::Tools";
     ... later
  $gdsobject = Tools->simpleGDS("guess alpha = 0");

The text string that is the argument for this wrapper is parsed identically to how a guess parameter in a `feffit.inp' file is parsed.

is_windows

Return true if running on a Windows machine.

  my $is_win = $object -> is_windows;
is_osx

Return true if running on a Macintosh OSX machine.

  my $is_mac = Ifeffit::Demeter::Tools -> is_osx;
halflength

Given a list of references to arrays -- each of which contains the x, y, and z coordinates of an atom -- return the half length of the path. The half length is the sum of the individual legs dividied by 2. The first item in the list is assumed to the absorber at and is tacked onto the end of the list to close the path.

  my $hl = Ifeffit::Demeter::Tools ->
         halflength(\@coords1, \@coords2, ... \@coordsN);


CONFIGURATION AND ENVIRONMENT

See the Ifeffit::Demeter manpage for a description of the configuration system.


BUGS AND LIMITATIONS

The who method should poke at the registry on Windows.

Please report problems to Bruce Ravel (bravel AT anl DOT gov)

Patches are welcome.


AUTHOR

Bruce Ravel (bravel AT anl DOT gov)

http://cars9.uchicago.edu/~ravel/software/


LICENCE AND COPYRIGHT

Copyright (c) 2006-2007 Bruce Ravel (bravel AT anl DOT gov). All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.