Number of atoms per unit cell

Hello matsci readers,

I was wandering if there’s a way to extract the number of atoms per unit cell from a specific compound. I have searched the mapi documentation and the files on github as well as the sub-threads here but i could not find a satisfying answer.

Is the nsites property what i’m searching for?

-Aris

Hi @Aris_K ,

you are correct. nsites is what you are looking for. In pymatgen structures this would be num_sites, so there is a little discrepancy there.

Here is a little code example to get you started:

from pymatgen.ext.matproj import MPRester
with MPRester() as mpr:
    id_list = mpr.query(criteria={'pretty_formula': "FeO"},
                        properties=['material_id', 'nsites'])

The id_list will give you the mp-ids alongside the number of atoms in the cell for all entries to the database with “FeO” as the pretty formula:

[{'material_id': 'mp-849689', 'nsites': 24},
 {'material_id': 'mp-754765', 'nsites': 8},
 {'material_id': 'mp-1178239', 'nsites': 8},
 {'material_id': 'mp-1279742', 'nsites': 8},
 {'material_id': 'mp-1283030', 'nsites': 8},
 {'material_id': 'mp-1178232', 'nsites': 8},
 {'material_id': 'mp-753682', 'nsites': 8},
 {'material_id': 'mp-1244983', 'nsites': 80},
 {'material_id': 'mp-1245001', 'nsites': 80},
 {'material_id': 'mp-1181437', 'nsites': 2},
 {'material_id': 'mp-715262', 'nsites': 4},
 {'material_id': 'mp-1178247', 'nsites': 24},
 {'material_id': 'mp-756436', 'nsites': 4},
 {'material_id': 'mp-18905', 'nsites': 8},
 {'material_id': 'mp-755189', 'nsites': 4},
 {'material_id': 'mp-1245168', 'nsites': 80}]
1 Like

Thank you very much @mwo really appreciate it! :smiley: