pyxem / diffsims

An open-source Python library providing utilities for simulating diffraction
https://diffsims.readthedocs.io
GNU General Public License v3.0
46 stars 26 forks source link

Allow ions instead of atoms in CIF files #222

Open DorianDepriester opened 5 months ago

DorianDepriester commented 5 months ago

Is your feature request related to a problem? Please describe. In some CIF files, atoms are given by their ionic names (e.g. Fe2+ instead of Fe). This is (sometimes) the case for generated files from The Materials Project. This actually results in failure of get_element_id_from_string().

Describe the solution you'd like A simple regexp to automatically trim the atom names.

Describe alternatives you've considered The user can edit the CIF file to remove the exponents.

CSSFrancis commented 5 months ago

@DorianDepriester I think ions result in slightly different atomic scattering factors.

I got fairly far on adding them but just never did. If this is something you are interested in I can prioritize this!

DorianDepriester commented 5 months ago

From my point of view, it would indeed be an interesting feature 😉

CSSFrancis commented 5 months ago

From my point of view, it would indeed be an interesting feature 😉

I'll see if I can make the PR later this week and we can think about making a new release!