pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

SpacegroupAnalyzer: Segmentation fault

Open pbenner opened this issue 3 years ago • 3 comments

from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from matbench.bench import MatbenchBenchmark

## ----------------------------------------------------------------------------

def get_matbench_task(name):
    mb = MatbenchBenchmark(autoload=False)
    task = mb.tasks_map[f'matbench_{name}']
    task.load()
    return task

## ----------------------------------------------------------------------------

df = get_matbench_task('log_gvrh').df
s  = df['structure'][1117]
print(s)

## ----------------------------------------------------------------------------

sga = SpacegroupAnalyzer(s)
sga._get_symmetry()

Returns the following error:

> python debug.py
Full Formula (Cu1 Br2)
Reduced Formula: CuBr2
abc   :   3.492558   4.223779   6.451834
angles:  87.282014  74.296218  65.578883
pbc   :       True       True       True
Sites (3)
  #  SP           a         b         c    magmom
---  ----  --------  --------  --------  --------
  0  Cu    0         0         0            0.005
  1  Br    0.267375  0.223251  0.241999     0.002
  2  Br    0.732625  0.776749  0.758001     0.002
Segmentation fault

Versions:

pymatgen            2022.8.23
spglib              2.0.0
matbench            0.6
python              3.10.4

pbenner avatar Aug 30 '22 13:08 pbenner

The likely reason is that you have to change the tolerance. Given that I don't have matbench installed, I can't verify the error.

shyuep avatar Aug 30 '22 14:08 shyuep

It seems the segmentation fault is caused by magmom and high symprec(~=1e-2) from spglib. I've opened the corresponding issue page linked above. For now, dropping magmom entries from Structure will suppress the error.

lan496 avatar Aug 31 '22 00:08 lan496

Now, I believe this issue will be solved with spglib==2.0.1.

lan496 avatar Aug 31 '22 07:08 lan496

Related issues: https://github.com/spglib/spglib/issues/194 and https://github.com/spglib/spglib/issues/197. Not sure about 2.0.1 but definitely fixed in spglib 2.0.2 so closing.

janosh avatar May 22 '23 17:05 janosh