Hello everybody!
I am trying to make some slabs in a FireWorks workflow. Initially I am getting the structures from the MaterialsProject, which has the nice feature that the magnetic moments are included as site_properties of the structure. E.g. if I search for the NiO structure with the lowest total energy I get the rocksalt prototype with the correct AFM-2 magnetic ordering and 4 atoms in the unit cell:
from pymatgen import MPRester
struct = MPRester().get_structure_by_material_id('mp-19009')
struct.sites
Out[3]:
[PeriodicSite: Ni (0.0000, 0.0000, 0.0000) [0.0000, 0.0000, 0.0000],
PeriodicSite: Ni (0.0022, -2.1073, -2.1072) [0.5000, 0.5000, 0.5000],
PeriodicSite: O (0.0011, -2.1083, 0.0011) [0.2500, 0.7500, 0.2500],
PeriodicSite: O (0.0032, -2.1062, -4.2156) [0.7500, 0.2500, 0.7500]]
struct.site_properties
Out[4]: {'magmom': [-1.742, 1.742, 0.0, 0.0]}
If I now want to generate a slab using the SlabGenerator
of pymatgen.core.surface
, I should use a conventional unit cell, so that the miller indices are what one would expect. I can do this by using the get_conventional_standard_structure
method of the SpacegroupAnalyzer
class, but the site_properties are not transfered!
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
conv_struct = SpacegroupAnalyzer(struct).get_conventional_standard_structure()
conv_struct.sites
Out[6]:
[PeriodicSite: Ni (0.0000, 0.0000, 0.0000) [0.0000, 0.0000, 0.0000],
PeriodicSite: Ni (0.0000, 2.1083, 2.1083) [0.0000, 0.5000, 0.5000],
PeriodicSite: Ni (2.1083, 0.0000, 2.1083) [0.5000, 0.0000, 0.5000],
PeriodicSite: Ni (2.1083, 2.1083, 0.0000) [0.5000, 0.5000, 0.0000],
PeriodicSite: O (2.1083, 0.0000, 0.0000) [0.5000, 0.0000, 0.0000],
PeriodicSite: O (2.1083, 2.1083, 2.1083) [0.5000, 0.5000, 0.5000],
PeriodicSite: O (0.0000, 0.0000, 2.1083) [0.0000, 0.0000, 0.5000],
PeriodicSite: O (0.0000, 2.1083, 0.0000) [0.0000, 0.5000, 0.0000]]
conv_struct.site_properties
Out[7]: {}
Is there a way the magnetic moments stored in the magmom key of the site_properties could be transferred to the conventional cell? Is there another way to get the conventional cell, or to transfer the miller indices to the corresponding ones for the primitive structure? Since the SlabGenerator does transfer the site_properties correctly, it would be much easier to create slabs with complex magentic structures if this would work somehow.
BTW, If I use conventional_unit_cell=True to get the initial structure, the site_properties are empty as well:
struct = MPRester().get_structure_by_material_id('mp-19009', conventional_unit_cell=True)
struct.site_properties
Out[5]: {}