Segmentation fault when using VoronoiFingerprint featurizer in site.py

Hello,

I’m attempting to use the VoronoiFingerprint featurizer, but receiving a segfault. Other site featurizers such as the AGNI fingerprint are functioning fine for my data frame. See example code below.

----------Code----------

import numpy as np

import pandas as pd

import json

from pymatgen.core.structure import Structure

if name == “main”:

descriptor = ‘AGNI’

descriptor_settings = {‘cutoff’:4.0, ‘directions’:[None]}

descriptor = 'VoronoiFingerprint'

descriptor_settings = {'cutoff':6.5}

df = pd.read_json(‘dataframe.json’)

df.sort_index(inplace=True)

Structures are retrieved as dictionaries but can easily be converted to pymatgen.core.Structure objects as shown.

df[‘structure_pymatgen_object’] = pd.Series([Structure.from_dict(df[‘structure’][i]) for i in range(df.shape[0])], df.index)

if descriptor == ‘AGNI’:

from matminer.featurizers.site import AGNIFingerprints

AGNIFingerprints_featurizer = AGNIFingerprints(**descriptor_settings)

df = AGNIFingerprints_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

if descriptor == ‘VoronoiFingerprint’:

from matminer.featurizers.site import VoronoiFingerprint 

VoronoiFingerprint_featurizer = VoronoiFingerprint(**descriptor_settings)

VoronoiFingerprint_featurizer.set_n_jobs(1)

df = VoronoiFingerprint_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

print(df.iloc[:,3:])

---------- End of Code -----------

---------Output---------------

VoronoiFingerprint: 0%| | 0/173 [00:00<?, ?it/s]

Segmentation fault: 11

----------- End of Output -----

Removing the “VoronoiFingerprint_featurizer.set_n_jobs(1)” will instead cause the progress bar to fill to 100%, but then hang indefinitely. Any idea what might be going wrong or advice to help debug this? I am running matminer 0.5.0 and anaconda’s python 3.6.4. Let me know if there’s any additional information I could send that would be helpful.

Thank you for your assistance!

Logan Williams

Hi Logan,

This is a known bug with the Voronoi calculation in scipy (see https://github.com/scipy/scipy/issues/8929).

It is caused when the cut-off radius is too small. From our testing, a cut-off of 13 is large enough to avoid any segmentation faults.

Best,

Alex

···

On Monday, January 28, 2019 at 1:31:30 PM UTC-8, ld…@umich.edu wrote:

Hello,

I’m attempting to use the VoronoiFingerprint featurizer, but receiving a segfault. Other site featurizers such as the AGNI fingerprint are functioning fine for my data frame. See example code below.

----------Code----------

import numpy as np

import pandas as pd

import json

from pymatgen.core.structure import Structure

if name == “main”:

descriptor = ‘AGNI’

descriptor_settings = {‘cutoff’:4.0, ‘directions’:[None]}

descriptor = 'VoronoiFingerprint'
descriptor_settings = {'cutoff':6.5}

df = pd.read_json(‘dataframe.json’)

df.sort_index(inplace=True)

Structures are retrieved as dictionaries but can easily be converted to pymatgen.core.Structure objects as shown.

df[‘structure_pymatgen_object’] = pd.Series([Structure.from_dict(df[‘structure’][i]) for i in range(df.shape[0])], df.index)

if descriptor == ‘AGNI’:

from matminer.featurizers.site import AGNIFingerprints
AGNIFingerprints_featurizer = AGNIFingerprints(**descriptor_settings)
df = AGNIFingerprints_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

if descriptor == ‘VoronoiFingerprint’:

from matminer.featurizers.site import VoronoiFingerprint 
VoronoiFingerprint_featurizer = VoronoiFingerprint(**descriptor_settings)
VoronoiFingerprint_featurizer.set_n_jobs(1)
df = VoronoiFingerprint_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

print(df.iloc[:,3:])

---------- End of Code -----------

---------Output---------------

VoronoiFingerprint: 0%| | 0/173 [00:00<?, ?it/s]

Segmentation fault: 11

----------- End of Output -----

Removing the “VoronoiFingerprint_featurizer.set_n_jobs(1)” will instead cause the progress bar to fill to 100%, but then hang indefinitely. Any idea what might be going wrong or advice to help debug this? I am running matminer 0.5.0 and anaconda’s python 3.6.4. Let me know if there’s any additional information I could send that would be helpful.

Thank you for your assistance!

Logan Williams

Hi Alex,

I get the same output at larger cutoff values as well. I’ve tested up to 55. Would you like my structure set to test with? (If so, I could send the .json to your email of choice.)

Best,

Logan

···

On Monday, January 28, 2019 at 4:58:28 PM UTC-5, [email protected] wrote:

Hi Logan,

This is a known bug with the Voronoi calculation in scipy (see https://github.com/scipy/scipy/issues/8929).

It is caused when the cut-off radius is too small. From our testing, a cut-off of 13 is large enough to avoid any segmentation faults.

Best,

Alex

On Monday, January 28, 2019 at 1:31:30 PM UTC-8, ld…@umich.edu wrote:

Hello,

I’m attempting to use the VoronoiFingerprint featurizer, but receiving a segfault. Other site featurizers such as the AGNI fingerprint are functioning fine for my data frame. See example code below.

----------Code----------

import numpy as np

import pandas as pd

import json

from pymatgen.core.structure import Structure

if name == “main”:

descriptor = ‘AGNI’

descriptor_settings = {‘cutoff’:4.0, ‘directions’:[None]}

descriptor = 'VoronoiFingerprint'
descriptor_settings = {'cutoff':6.5}

df = pd.read_json(‘dataframe.json’)

df.sort_index(inplace=True)

Structures are retrieved as dictionaries but can easily be converted to pymatgen.core.Structure objects as shown.

df[‘structure_pymatgen_object’] = pd.Series([Structure.from_dict(df[‘structure’][i]) for i in range(df.shape[0])], df.index)

if descriptor == ‘AGNI’:

from matminer.featurizers.site import AGNIFingerprints
AGNIFingerprints_featurizer = AGNIFingerprints(**descriptor_settings)
df = AGNIFingerprints_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

if descriptor == ‘VoronoiFingerprint’:

from matminer.featurizers.site import VoronoiFingerprint 
VoronoiFingerprint_featurizer = VoronoiFingerprint(**descriptor_settings)
VoronoiFingerprint_featurizer.set_n_jobs(1)
df = VoronoiFingerprint_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

print(df.iloc[:,3:])

---------- End of Code -----------

---------Output---------------

VoronoiFingerprint: 0%| | 0/173 [00:00<?, ?it/s]

Segmentation fault: 11

----------- End of Output -----

Removing the “VoronoiFingerprint_featurizer.set_n_jobs(1)” will instead cause the progress bar to fill to 100%, but then hang indefinitely. Any idea what might be going wrong or advice to help debug this? I am running matminer 0.5.0 and anaconda’s python 3.6.4. Let me know if there’s any additional information I could send that would be helpful.

Thank you for your assistance!

Logan Williams

Hi Logan,

That is strange. If you upload your structure here I will take a look.

Best,

Alex

···

On Tuesday, January 29, 2019 at 1:02:09 PM UTC-8, ld…@umich.edu wrote:

Hi Alex,

I get the same output at larger cutoff values as well. I’ve tested up to 55. Would you like my structure set to test with? (If so, I could send the .json to your email of choice.)

Best,

Logan

On Monday, January 28, 2019 at 4:58:28 PM UTC-5, [email protected] wrote:

Hi Logan,

This is a known bug with the Voronoi calculation in scipy (see https://github.com/scipy/scipy/issues/8929).

It is caused when the cut-off radius is too small. From our testing, a cut-off of 13 is large enough to avoid any segmentation faults.

Best,

Alex

On Monday, January 28, 2019 at 1:31:30 PM UTC-8, ld…@umich.edu wrote:

Hello,

I’m attempting to use the VoronoiFingerprint featurizer, but receiving a segfault. Other site featurizers such as the AGNI fingerprint are functioning fine for my data frame. See example code below.

----------Code----------

import numpy as np

import pandas as pd

import json

from pymatgen.core.structure import Structure

if name == “main”:

descriptor = ‘AGNI’

descriptor_settings = {‘cutoff’:4.0, ‘directions’:[None]}

descriptor = 'VoronoiFingerprint'
descriptor_settings = {'cutoff':6.5}

df = pd.read_json(‘dataframe.json’)

df.sort_index(inplace=True)

Structures are retrieved as dictionaries but can easily be converted to pymatgen.core.Structure objects as shown.

df[‘structure_pymatgen_object’] = pd.Series([Structure.from_dict(df[‘structure’][i]) for i in range(df.shape[0])], df.index)

if descriptor == ‘AGNI’:

from matminer.featurizers.site import AGNIFingerprints
AGNIFingerprints_featurizer = AGNIFingerprints(**descriptor_settings)
df = AGNIFingerprints_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

if descriptor == ‘VoronoiFingerprint’:

from matminer.featurizers.site import VoronoiFingerprint 
VoronoiFingerprint_featurizer = VoronoiFingerprint(**descriptor_settings)
VoronoiFingerprint_featurizer.set_n_jobs(1)
df = VoronoiFingerprint_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

print(df.iloc[:,3:])

---------- End of Code -----------

---------Output---------------

VoronoiFingerprint: 0%| | 0/173 [00:00<?, ?it/s]

Segmentation fault: 11

----------- End of Output -----

Removing the “VoronoiFingerprint_featurizer.set_n_jobs(1)” will instead cause the progress bar to fill to 100%, but then hang indefinitely. Any idea what might be going wrong or advice to help debug this? I am running matminer 0.5.0 and anaconda’s python 3.6.4. Let me know if there’s any additional information I could send that would be helpful.

Thank you for your assistance!

Logan Williams

(Hopefully this uploads properly…)

···

On Tuesday, January 29, 2019 at 4:08:02 PM UTC-5, [email protected] wrote:

Hi Logan,

That is strange. If you upload your structure here I will take a look.

Best,

Alex

On Tuesday, January 29, 2019 at 1:02:09 PM UTC-8, ld…@umich.edu wrote:

Hi Alex,

I get the same output at larger cutoff values as well. I’ve tested up to 55. Would you like my structure set to test with? (If so, I could send the .json to your email of choice.)

Best,

Logan

On Monday, January 28, 2019 at 4:58:28 PM UTC-5, [email protected] wrote:

Hi Logan,

This is a known bug with the Voronoi calculation in scipy (see https://github.com/scipy/scipy/issues/8929).

It is caused when the cut-off radius is too small. From our testing, a cut-off of 13 is large enough to avoid any segmentation faults.

Best,

Alex

On Monday, January 28, 2019 at 1:31:30 PM UTC-8, ld…@umich.edu wrote:

Hello,

I’m attempting to use the VoronoiFingerprint featurizer, but receiving a segfault. Other site featurizers such as the AGNI fingerprint are functioning fine for my data frame. See example code below.

----------Code----------

import numpy as np

import pandas as pd

import json

from pymatgen.core.structure import Structure

if name == “main”:

descriptor = ‘AGNI’

descriptor_settings = {‘cutoff’:4.0, ‘directions’:[None]}

descriptor = 'VoronoiFingerprint'
descriptor_settings = {'cutoff':6.5}

df = pd.read_json(‘dataframe.json’)

df.sort_index(inplace=True)

Structures are retrieved as dictionaries but can easily be converted to pymatgen.core.Structure objects as shown.

df[‘structure_pymatgen_object’] = pd.Series([Structure.from_dict(df[‘structure’][i]) for i in range(df.shape[0])], df.index)

if descriptor == ‘AGNI’:

from matminer.featurizers.site import AGNIFingerprints
AGNIFingerprints_featurizer = AGNIFingerprints(**descriptor_settings)
df = AGNIFingerprints_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

if descriptor == ‘VoronoiFingerprint’:

from matminer.featurizers.site import VoronoiFingerprint 
VoronoiFingerprint_featurizer = VoronoiFingerprint(**descriptor_settings)
VoronoiFingerprint_featurizer.set_n_jobs(1)
df = VoronoiFingerprint_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

print(df.iloc[:,3:])

---------- End of Code -----------

---------Output---------------

VoronoiFingerprint: 0%| | 0/173 [00:00<?, ?it/s]

Segmentation fault: 11

----------- End of Output -----

Removing the “VoronoiFingerprint_featurizer.set_n_jobs(1)” will instead cause the progress bar to fill to 100%, but then hang indefinitely. Any idea what might be going wrong or advice to help debug this? I am running matminer 0.5.0 and anaconda’s python 3.6.4. Let me know if there’s any additional information I could send that would be helpful.

Thank you for your assistance!

Logan Williams

Hi Logan,

Thanks for emailing me the dataset.

I’ve been running some tests and for me the featurization works perfectly. With the dataset you sent in the current directory, I ran:

import pandas as pd
from matminer.featurizers.site import VoronoiFingerprint
from monty.serialization import loadfn

df = pd.DataFrame(loadfn(‘dataframe.json’))

vf = VoronoiFingerprint()
vf.set_n_jobs(1)
vf.featurize_dataframe(df, [‘structure’, ‘site_index’])

``

I am using pymatgen version 2019.2.4 and matminer version 0.4.9.

If you are still seeing this error, can you upgrade your pymatgen and matminer versions and see if the error persists.

Best,

Alex

···

On Tuesday, January 29, 2019 at 1:11:59 PM UTC-8, ld…@umich.edu wrote:

(Hopefully this uploads properly…)

On Tuesday, January 29, 2019 at 4:08:02 PM UTC-5, [email protected] wrote:

Hi Logan,

That is strange. If you upload your structure here I will take a look.

Best,

Alex

On Tuesday, January 29, 2019 at 1:02:09 PM UTC-8, ld…@umich.edu wrote:

Hi Alex,

I get the same output at larger cutoff values as well. I’ve tested up to 55. Would you like my structure set to test with? (If so, I could send the .json to your email of choice.)

Best,

Logan

On Monday, January 28, 2019 at 4:58:28 PM UTC-5, [email protected] wrote:

Hi Logan,

This is a known bug with the Voronoi calculation in scipy (see https://github.com/scipy/scipy/issues/8929).

It is caused when the cut-off radius is too small. From our testing, a cut-off of 13 is large enough to avoid any segmentation faults.

Best,

Alex

On Monday, January 28, 2019 at 1:31:30 PM UTC-8, ld…@umich.edu wrote:

Hello,

I’m attempting to use the VoronoiFingerprint featurizer, but receiving a segfault. Other site featurizers such as the AGNI fingerprint are functioning fine for my data frame. See example code below.

----------Code----------

import numpy as np

import pandas as pd

import json

from pymatgen.core.structure import Structure

if name == “main”:

descriptor = ‘AGNI’

descriptor_settings = {‘cutoff’:4.0, ‘directions’:[None]}

descriptor = 'VoronoiFingerprint'
descriptor_settings = {'cutoff':6.5}

df = pd.read_json(‘dataframe.json’)

df.sort_index(inplace=True)

Structures are retrieved as dictionaries but can easily be converted to pymatgen.core.Structure objects as shown.

df[‘structure_pymatgen_object’] = pd.Series([Structure.from_dict(df[‘structure’][i]) for i in range(df.shape[0])], df.index)

if descriptor == ‘AGNI’:

from matminer.featurizers.site import AGNIFingerprints
AGNIFingerprints_featurizer = AGNIFingerprints(**descriptor_settings)
df = AGNIFingerprints_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

if descriptor == ‘VoronoiFingerprint’:

from matminer.featurizers.site import VoronoiFingerprint 
VoronoiFingerprint_featurizer = VoronoiFingerprint(**descriptor_settings)
VoronoiFingerprint_featurizer.set_n_jobs(1)
df = VoronoiFingerprint_featurizer.featurize_dataframe(df, ['structure_pymatgen_object', 'site_index'])

print(df.iloc[:,3:])

---------- End of Code -----------

---------Output---------------

VoronoiFingerprint: 0%| | 0/173 [00:00<?, ?it/s]

Segmentation fault: 11

----------- End of Output -----

Removing the “VoronoiFingerprint_featurizer.set_n_jobs(1)” will instead cause the progress bar to fill to 100%, but then hang indefinitely. Any idea what might be going wrong or advice to help debug this? I am running matminer 0.5.0 and anaconda’s python 3.6.4. Let me know if there’s any additional information I could send that would be helpful.

Thank you for your assistance!

Logan Williams