-
Notifications
You must be signed in to change notification settings - Fork 192
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
Define KpointsData via constructor #3287
Comments
I would be all for this. There are multiple open issues related to the usability of the |
Hi! I was looking at this, and indeed it would be very nice to be able to define this via the constructor. Thinking about the use cases, I think besides the mesh as suggested by @ltalirz , one should see if it is also possible to define via the constructor using the k-points density, i.e. if we pass structure = StructureData(ase=ase_structure)
kpoints = KpointsData(structure=structure, density=0.1) Maybe it is a bit of overkill, but that kind of functionality could make aiida easier to use. What do you think? |
@JPchico I fully agree this would be very useful functionality to have, but in line with my rant in https://github.com/orgs/aiidateam/discussions/5976 1 I would avoid adding arguments to the constructor signature. Rather, the constructor should be complete but minimal. Instead of adding the structure = StructureData(ase=ase_structure) # <-- This should also be StructureData.from_ase, but that's a fight for another day
kpoints = KpointsData.from_structure(structure=structure, density=0.1) A few notes:
Point [2] is definitely beyond the original scope of the issue though, so I won't go into more detail and further derail the conversation. I'll add my further comments on the constructor by getting involved in the review of #5942. Footnotes
|
This is definitely possible. You can generate
This might solve this problem for this example, but don't think this will be applicable in general. I think that having two subclasses makes perfect sense and should be the preferred solution. An interface can decide to support both by accepting the base class
I agree that provenance-purism-and-zealotry is to be avoided. In this case, I think the required functionality required a function (since the implementation is not a trivial one-liner) and at that point we thought we might as well just slap the |
True, but that is something most users will only find out about approx 2 years in. 😉 As an avid AiiDA user, I love the idea of the
I agree, and I think I was arguing for that? 😅 But let's not derail the constructor discussion further, I'll open an issue elsewhere to discuss the
Oh, of course, the Footnotes
|
structure = StructureData(ase=ase_structure) # <-- This should also be StructureData.from_ase, but that's a fight for another day
kpoints = KpointsData.from_structure(structure=structure, density=0.1) I think that the solution that you propose @mbercx is ideal, as having the provenance with the density and structure directly when you are creating the kpoints would be a much nicer solution. Sure having it in the constructor is not the best, but with a nice method like that I think that would solve a lot of the issues when generating kpoints. |
It should be possible to set the properties of a
KpointsData
directly in the constructor. Instead of having to writeone should be able to write
The text was updated successfully, but these errors were encountered: