Skip to content

Simpler Workflow instantiation #158

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

Merged
merged 10 commits into from
Jul 14, 2022
Merged

Conversation

elinscott
Copy link
Collaborator

@elinscott elinscott commented Jul 11, 2022

Workflow instantiation

Makes the creation of Workflow objects more flexible by accepting kwargs that can be workflow/calculator/plotting parameters e.g.

wf = SinglepointWorkflow(atoms, functional='ki', ecutwfc=40.0)

whereas previously this would have to be

wf = SinglepointWorkflow(atoms, parameters={'functional': 'ki}, master_calc_params={'kcp': {'ecutwfc': 40.0}, 'pw': {'ecutwfc': 40}})

Closes #145

Changes to running subworkflows

This PR also introduces the @classmethod fromparent to the Workflow class and deprecated Workflow.wf_kwargs and Workflow.run_subworkflow(). Previously to create and run a subworkflow one had to do something like

subwf = Workflow(**self.kwargs)
self.run_subworkflow(subwf)

but instead now we do

subwf = Workflow.fromparent(self)
subwf.run()

which is cleaner and more pythonic

Documentation

Added the docstrings of the Workflow class to the docs module using autodoc and numpydoc. This starts to address (but does not fully resolve) #147

@elinscott elinscott added the enhancement New feature or request label Jul 11, 2022
@elinscott elinscott self-assigned this Jul 11, 2022
@elinscott elinscott marked this pull request as draft July 11, 2022 15:58
@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2022

Codecov Report

Merging #158 (0b7064d) into master (ff0de12) will decrease coverage by 0.04%.
The diff coverage is 87.91%.

@@            Coverage Diff             @@
##           master     #158      +/-   ##
==========================================
- Coverage   77.43%   77.39%   -0.05%     
==========================================
  Files          62       62              
  Lines        5062     5110      +48     
==========================================
+ Hits         3920     3955      +35     
- Misses       1142     1155      +13     
Impacted Files Coverage Δ
koopmans/utils/_io.py 62.17% <45.16%> (-3.57%) ⬇️
koopmans/workflows/_workflow.py 84.57% <95.19%> (+0.54%) ⬆️
koopmans/calculators/_utils.py 73.33% <100.00%> (ø)
koopmans/pseudopotentials.py 90.81% <100.00%> (ø)
koopmans/settings/_utils.py 83.24% <100.00%> (ø)
koopmans/utils/_misc.py 75.00% <100.00%> (ø)
koopmans/workflows/_convergence.py 69.91% <100.00%> (-0.53%) ⬇️
koopmans/workflows/_koopmans_dfpt.py 85.79% <100.00%> (ø)
koopmans/workflows/_koopmans_dscf.py 83.33% <100.00%> (+0.02%) ⬆️
koopmans/workflows/_singlepoint.py 86.88% <100.00%> (-0.62%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff0de12...0b7064d. Read the comment docs.

@pep8-speaks-bot
Copy link
Collaborator

pep8-speaks-bot commented Jul 13, 2022

Hello @elinscott! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-07-14 08:24:15 UTC

@elinscott elinscott marked this pull request as ready for review July 13, 2022 15:57
@elinscott elinscott requested a review from degennar July 13, 2022 16:09
Copy link
Collaborator

@degennar degennar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not fully understand this story of fromparent, but as usual I guess it will become more clear next time that I will have to implement something. Thanks Edward!

@elinscott elinscott merged commit 5b0bf6f into master Jul 14, 2022
@elinscott elinscott deleted the simpler_workflow_instantiation branch July 14, 2022 08:37
@elinscott
Copy link
Collaborator Author

This closed #90 (but that issue was not tagged at the time)

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

Successfully merging this pull request may close these issues.

Clean way to set ecutwfc and other similar settings when initialising a workflow
4 participants