Description
The issue is that our database of elements doesn't have structure factors for ions, such as Ba2+ but element info is often stored in cif files this way.
We are currently cleaning these manually or using the pavol trick:
from diffpy.structure import loadStructure
batio3 = loadStructure('BaTiO3.cif')
batio3.element = batio3.element.rstrip('+-012345678')
We don't want "magic" in the program which will confuse users, e.g. having hte code automatically change element information, however, I think that when we make a call to the existing database of element scattering factors, it would be ok to automatically strip the ion information before making the call to the db, without permanently resetting the element information. In the future, if we get a new database, this is easy to revert.
We could also try and be a bit clever and do our best effort to parse the element info, so if we find Ba2+ we could get the scattering factor for Xe (which is the neutral element with the same number of electrons as Ba2+. This may or may not work well, so should of course be tested.
I am just saving this here to return to in future if we need to.