Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_species() 'error'? #1

Open
george-ts-github opened this issue Oct 15, 2021 · 3 comments
Open

get_species() 'error'? #1

george-ts-github opened this issue Oct 15, 2021 · 3 comments

Comments

@george-ts-github
Copy link

mp.get_species('YbTiO3') gives:
OrderedDict([('Yb', '1'), ('TiO3', '1')])
instead of :
OrderedDict([('Yb', '1'), ('Ti','1'), ('O','3')])

whereas
mp.get_species('YbMnO3') gives:
OrderedDict([('Yb', '1'), ('Mn', '1'), ('O', '3')])

This happens in the case of a few elements. Is there a workaround for this issue?

@OlgaGKononova
Copy link
Contributor

Hi! Technically, the correct answer for species in both cases should be OrderedDict([('Yb', '1'), ('TiO3', '1')]) and OrderedDict([('Yb', '1'), ('MnO3', '1')]). Because TiO3 and MnO3 are both anions. OrderedDict([('Yb', '1'), ('Ti','1'), ('O','3')]) and OrderedDict([('Yb', '1'), ('Mn', '1'), ('O', '3')]) should be the output "elements".
The species identification is based on a dictionary (ions_dictionary.json in resources folder). You can customize it to obtain the desired result.

@george-ts-github
Copy link
Author

Thanks Olga. Made it work by commenting the oxide species.
BTW, are there other functions, other than get_species, which could be used to call up individual elements(and not anions/cations/species) and their composition?

@OlgaGKononova
Copy link
Contributor

If you run

mp = ParserPipelineBuilder() \
    .set_regex_parser(RegExParser)\
    .build()

mp.parse(chem_string).to_dict()

the output of mp.parse will be dictionary, the attribute elements contain all the composition per element.
Sorry, I haven't updated the docs yet. Manuscript is on the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants