Varying results with get_primitive_structure

Hi all,

I was playing around with the oriented unit cells and noticed something interesting. I have a Structure that I’m running the get_primitive_structure() on, with some constraints. For some reason though, I get two different results depending on very small decimal differences in the constraints. You can reproduce this with the Structure in the json file I’m attaching with the following script;
fe310.json (4.9 KB)

from pymatgen.core.structure import Structure
import json

with open('fe310.json', 'r') as test:
    fe310 = Structure.from_dict(json.load(test))

constraints1 = {'a': 2.831331845647057,
                'b': 4.695232694497869,
                'gamma': 107.5484006137923}

constraints2 = {'a': 2.831331845647057,
                'b': 4.69523269449787,
                'gamma': 107.5484006137923}

prim1 = fe310.get_primitive_structure(constrain_latt=constraints1)
prim2 = fe310.get_primitive_structure(constrain_latt=constraints2)

The resulting primitive structures are quite different, even though the difference in the constraints is negligibly small. Does anyone have an idea why this might be happening?

1 Like

Fixed in Slightly relax the constraint satisfy condition of get_primitive_structure() by fyalcin · Pull Request #3285 · materialsproject/pymatgen · GitHub. Thanks @firaty! :+1:

1 Like