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
2 general base classes for workflows #3
Conversation
(Something is going on with the pipeline, it seems it cannot install dependencies, tho I didn't touch anything but here). |
My opinion is it is not necessary to put a suffix because it is clear from the inheritance tree. You can perhaps put an alias or modify the description. |
The problem is with inheritance: if I have two classes with the same named attributes, one of the classes attrs will overwrite the other, hence the "_dft" and "_gw". |
This is an indication of a bad hierarchy design then, In DMFTResults, I am not sure why it would inherit from both TB and DFT results. I think you should define these separately, dos_quantity = Quantity(type=References(Dos))
class FirstPrinciplesResults(SimulationWorkflowResults):
dos = dos_quantity
class DFTResults(FirstPrinciplesResults):
pass
class TBResults(FirstPrinciplesResults):
pass
class DMFTResults(SimulationWorkflowResults):
dos_dft = dos_quantity
dos_tb = dos_quantity |
This is again inheritance vs composition. In any case, I think in this case inheritance is the way of going, because we can reuse the base DFT, TB, DMFT, GW... results in multiple standard workflows. This is because it is easier to define these than rather compose from two sections. I will keep it then to maintain base Results sections with the "_" naming, and then inherit from the workflow Results sections. |
The tree should reflect the relationship between workflows. In this case, dmft is not a kind of dft and tb workflow but composed of them. The base class for this should be BeyondDFT which contains references to the dft and tb workflow results. |
Yes, I think composition makes sense, you are totally right. I was confused by the previous structure, so I am trying again composing sub-sections inside each of the workflow results (using the I will push something after lunch, thanks for the feedback. |
@ladinesa new version (sorry I also formatted the testing with Ruff)
I also understand that, under What do you think? |
Ok, I had to add As this is part of the merge regarding NMR, I am thinking whether it is better if I directly merge #1 here, then merge this branch and update the reference to the plugin accordingly. Sorry for the mesh, I was working in parallel and realized that there were more changes here and in #1. |
simulationworkflowschema/general.py
Outdated
workflow_name = [] | ||
for task in self.tasks: | ||
workflow_name.append(task.name) | ||
self.name = "+".join(workflow_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be problematic if task.name is None. do '+'.join([task.name for task in self.tasks if task.name])
1c05f0a
to
eab3897
Compare
Sorry I am waiting for the review from @JFRudzinski , but I can also merge this right away. |
@ladinesa sorry I somehow missed the request. I see you merged anyway, but I took a look. Thanks for notifying me. |
I am now done fixing the develop branch. There is one lingering error that I commented out in test_xs_workflow. Can you have a look @JosePizarro3 ? |
53e7b36
to
194c65f
Compare
Well, I investigated a bit, but I think it makes sense if I pass the ball to you back. It seems that the After some debugging, it seems that the first time that the Thus, @ladinesa do you mind checking again this normalization? This is why I wanted to send the ball back to you, because you know much more the details and ordering of normalization. Let me know if you need some extra help. |
the workflow normalizer also calls the normalize function. I will provide a hot fix |
Thanks 🙌🏻 |
Reformatted dmft.py
Reformatted and inheritance in maxent.py
Reformat tb.py
* Added MagneticOutputs in general.py * Added more imports for usage in __init__
Added Alvin comments
76017c8
to
6053935
Compare
Hey @ladinesa ,
I applied some changes for inheritance to my workflows. I also reformatted with Ruff those files. Can you please review this? I'd like to merge this before working on #1 .
Btw, regarding classes and attributes: is there any way to rewrite attributes with a different naming in a class? I could imagine defining some
FirstPrinciplesCalculation
which encodes DFT and GW, and then inherit from them inDFTOutputs
andGWOutputs
, but overwritting the names of the attributes (band_gap, dos, band_structure) adding "_dft" and "_gw" respectively. I was checking the metainfo.py but I could not find this, and I am not sure whether it is a good practice at all.This is related with the magres MR in Gitlab.