Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read 'structure' of the figshare training data #51

Open
funihang opened this issue Jan 13, 2023 · 2 comments
Open

Cannot read 'structure' of the figshare training data #51

funihang opened this issue Jan 13, 2023 · 2 comments

Comments

@funihang
Copy link

Hello, I am trying to use your training data from figshare, and I use your code to read it.

import pickle

with open('block_0.p', 'rb') as f:

    data = pickle.load(f)

with open('block_1.p', 'rb') as f:

    data.update(pickle.load(f))

But when I get the data dict and want to get access to the structure (like using data['mp-770840']['structure']), it reports the error:

File ~/mambaforge/lib/python3.10/site-packages/pymatgen/core/structure.py:2244, in IStructure.__repr__(self)
   2243 def __repr__(self):
-> 2244     outs = ["Structure Summary", repr(self.lattice)]
   2245     if self._charge:
   2246         if self._charge >= 0:

File ~/mambaforge/lib/python3.10/site-packages/pymatgen/core/lattice.py:940, in Lattice.__repr__(self)
    931 def __repr__(self):
    932     outs = [
    933         "Lattice",
    934         "    abc : " + " ".join(map(repr, self.lengths)),
    935         " angles : " + " ".join(map(repr, self.angles)),
    936         " volume : " + repr(self.volume),
    937         "      A : " + " ".join(map(repr, self._matrix[0])),
    938         "      B : " + " ".join(map(repr, self._matrix[1])),
    939         "      C : " + " ".join(map(repr, self._matrix[2])),
--> 940         "    pbc : " + " ".join(map(repr, self._pbc)),
    941     ]
    942     return "\n".join(outs)

AttributeError: 'Lattice' object has no attribute '_pbc'

The version of my pymatgen is 2023.1.9.

Could you help me to solve this problem? Thanks.

@JiQi535
Copy link

JiQi535 commented Jan 22, 2023

@funihang Would you use older versions of pymatgen, i.e., earlier than to overcome this issue? The _pbc attribute is added into Lattice from version 2022.7.8. Any earlier versions of pymatgen will work, for example, v2022.5.26. The exact reason of the issue is discussed in this post.

@funihang
Copy link
Author

I try v2022.5.26, and it works. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants