# Is there a relation between the ionization energy and the electron affinity?

I am aware of the definition and equation of IE and EA. I was wondering if there is a direct relation between this two quantities with the energy of the neutral specie.

Okay, here's what I did (and I highly encourage everybody to do this along with this tutorial-style answer, just so you get the feel for prepping and looking at data from the world wild web).

## Data Acquisition

First, I went and copied the data from the tables at Wikipedia: This one for the ionization energies and this one for the electron affinities.

Next I had to clean up this data somewhat. For the electron affinity data I first had to get rid of all the unnecessary data columns. This was quickly done with awk:

   awk '{print $1,$2, $4}' raw-affinity.dat > affinity.dat  Next, I filtered out all the lines containing "-" and "?" using inverse search with grep:  grep -v "?" affinity.dat | grep -v "-" > affinity2.dat  And finally I got rid of all these pesky statistical uncertainties with either one or two numbers between parentheses with sed:  sed -e 's/(.)//g' -e 's/(..)//g' affinity2.dat > affinity3.dat  Now the data file looks somewhat like this: 1 H 0.754195 3 Li 0.618049 5 B 0.279723 6 C 1.262118  Now for the ionization data file. Since we only want to look at the first ionization energy we can scrap all the other data. Again, we'll use awk for this:  awk '{print$1, \$2}' raw-ionization.dat > ionization1.dat


Next we'll filter out all the data we don't want in there (again with grep and inverse searches):

    cat ionization1.dat | grep -v "use" | grep -v "WEL" | grep -v "talk" > ionization2.dat


In this file we still have some nasty linebreaks... So I loaded the file in vim and substituted the line break + "CRC" with nothing and saved it as ionization3.dat:

    :%s/\nCRC//g
:saveas ionization3.dat


I also corrected the value for At manually in vim while I was at it, because it wasn't entered like all the other data in the Wikipedia table.

The ionization data file now looks like this:

1 H  13.59844
2 He 24.58741
3 Li 5.39172
4 Be 9.3227


All right, so we have the data nicely prepared and we're ready for the next step, which is

## Data Analysis Shenanigans

I did everything in python using the numpy and matplotlib packages. The code used can be found here.

I didn't really notice some large trend of something you might expect. The plot gets pretty messy somehow. The darker the scatter points, the heavier the element.

Maybe someone else notices a pattern that I'm missing right now.