Gnumeric/python/dacapo

The most recent versions of gnumeric support "experimental" python plugins. I downloaded the source for version 1.0.11 and compiled it (the rpms I found were compiled against python 1.5.2, this way I got it compiled against python 2.2).  

There are two tutorials for writing the plugins:
one is included in gnumeric-1.0.11/doc/python-gnumeric.txt and is as complete as you might hope for.  The other is at http://grub.ath.cx/gnumeric-python/ and is also slightly helpful.

You should download
gnumeric_python.tar, from https://sourceforge.net/projects/dacapo-scripts/  in the gnumeric-python-dacapo package, which contains the following files:
gnumeric_python/__init__.py
gnumeric_python/gnumeric_dacapo.py
rc.py

The gnumeric_python directory should be placed on your python path.  You should create a .gnumeric directory in your home directory, and place the rc.py file there.  The gnumeric documentation suggests that all user defined functions be placed in the rc.py file, but I dodn't like that, so I have the rc.py file import everything in the gnumeric_python directory. All the dacapo specific functions are in gnumeric_dacapo.py.  If you want to add additional files to the gnumeric_python directory, you will need to modify the __all__ variable in the __init__.py file of gnumeric_python. Or you can just add to rc.py or to gnumeric_dacapo.py.

You should read
gnumeric-dacapo/gnumeric-dacapo.py for documentation of the functions.  If everything is installed correctly, when you run gnumeric, there will be a new function category in the function selector called dacapo, as shown below:



when you run gnumeric, you can use the functions in the cells, either by using the function selector (which has some documentation in it), or by typing the function names and arguments into the cells.

An example spreadsheet is shown below:

The cells in column A are strings for files located in the directory of the gnumeric worksheet.  You can just as easily put the entire path to the files if you prefer.
The formula in cell B2 is GetDbandCenter(A2,"1,2,3,4","short")
The formula in cell C2 is GetDbandFilling(A2,"1,2,3,4","short")/4  (so it is the number of d-electrons/atom)
The formula in cell D2 is GetTotalEnergy(A2,"PW91")
The formula in cell E2 is GetTotalEnergy(A2,"RPBE")