[Ifeffit] status: potential surface scanning

Matt Newville newville at cars.uchicago.edu
Mon Jul 28 10:26:24 CDT 2003

Hi Norbert, 

> If I just have one shell, everything is fine. The program iterates through all 
> possible variable combinations. 
> But... 
> if I have two shells I just manage to let him vary the shells independently. I 
> know there must be a way to tell the algorithm that if there are 2 shells it 
> needs to vary each of the eight parameters against each other and not two 
> times the four from each shell.

Maybe I'm missing something, but why not just iterate through all
pairs of variables, and not worry about assigning them to a
particular shell?
  for all variables:
      adjust value
      for all other variables: 
          adjust value
          run ff2chi(), etc. to generate model xafs spectra
          calculate goodness-of-fit with data
          store in chisquare(variable1,variable2)

I thought that's what you were doing. 

> I know there are some good PERL hackers around. So do you have an idea how to 
> do this? Recursion shurely helps - I experimented a lot with it but it still 
> does not do what I need it to do. Just for your convenience: I stored the 
> parameters in an array of hashes, so that I can have something like
> $shell[0]{E0} = $something
> $shell[0]{dr} = $somethingelse...
> So the loop for one shell is just looping through the hashkeys of element 0 of 
> this array...
I'd think of variables as different from the formal path parameters, 
so that
   $shell[0]{E0} = $variables{'e0'};
   $shell[0]{dr} = $variables{'dr0'};

and the perl %variable hash mapped perl names to Ifeffit variable
names.  Maybe you'd want a variable structure that contained 'perl
name', 'Ifeffit variable name', and 'value' for each variable, and a
path parameter structure that contained 'definition' and 'value'.
These structures could definitely be classes.

Another potential thing to try is to use perl's Tie mechanism to
make a setting/retrieving a perl variable automatically set/get an
Ifeffit program variable.  That could simplify the process of
iterating over variables in perl and having the right Ifeffit
variable get automatically updated.  At least something like
  $variable{'e0'} = 1.0 ;
could replace
  $variable{'e0'}['value'] = 1.0 ; 

(don't trust my perl syntax!!!).  That's closely associated with
having a 'Ifeffit_variable' class, but that might be the right thing
for this job (and others).  I think that would not be too difficult
to do, and would be a generally useful addition to Ifeffit.pm.

Hope that helps,


More information about the Ifeffit mailing list