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

StructureData.cell in dir() but raises AttributeError #12

Open
mbercx opened this issue Apr 19, 2024 · 2 comments
Open

StructureData.cell in dir() but raises AttributeError #12

mbercx opened this issue Apr 19, 2024 · 2 comments

Comments

@mbercx
Copy link
Member

mbercx commented Apr 19, 2024

I was playing around with the basic StructureData and found some very strange behavior. Running the following:

from aiida_atomistic.data.structure import StructureData

properties_dict = {
    "cell":{"value":[[3.5, 0.0, 0.0], [0.0, 3.5, 0.0], [0.0, 0.0, 3.5]]},
    "pbc":{"value":[True,True,True]},
    "positions":{"value":[[0.0, 0.0, 0.0],[1.5, 1.5, 1.5]]},
    "symbols":{"value":["Li","Li"]},
    }

structure = StructureData(properties = properties_dict)

print('cell' in dir(structure))
structure.cell

prints True, but then raises an AttributeError when I try to access cell. 😅

@mikibonacci
Copy link
Collaborator

yes, for now I have not deleted direct attributes like cell, pbc and so on, which are of the old StructureData. But this are no more working and are not related to the properties. I just left them there because I am not sure we really want to put everything under the properties attribute. In that case, the true structuredata node will be contained in the properties attribute, and nothing else is left outside (apart the Data methods)

@mbercx
Copy link
Member Author

mbercx commented Apr 19, 2024

I just left them there because I am not sure we really want to put everything under the properties attribute. In that case, the true structuredata node will be contained in the properties attribute, and nothing else is left outside (apart the Data methods)

Yes, this is also an observation I was making, and would make certain operations more cumbersome than they have to be. My first inclination is that I would really like to have structure.cell. But then if we treat all properties equally, all of them should have a corresponding attribute. And maybe that's ok, but then what's the point of the properties namespace?

I'm not even considering the implementation here. Just the API.

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