-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating convergence machinery (#205)
This PR updates the machinery behind convergence calculations to make them much more flexible and much less dependent on what has been implemented inside of `koopmans`. Users can now perform arbitrary convergence tests by defining their own `ConvergenceVariable`s and/or defining an `observable` function that tells `koopmans` how to extract the observable from the subworkflow. The custom `ConvergenceWorkflow` can easily be generated using the new `ConvergenceWorkflowFactory`. For example, see the new `custom_convergence.py` script in Tutorial 4.
- Loading branch information
Showing
885 changed files
with
540,356 additions
and
523,049 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<table id="convTable" style="width:100%; text-align:left"> | ||
<tr> | ||
<th>Keyword</th> | ||
<th>Description</th> | ||
<th>Type</th> | ||
<th>Default</th> | ||
</tr> | ||
<tr> | ||
<td><code>observable</code></td> | ||
<td>System observable of interest which we converge</td> | ||
<td><code>str</code></td> | ||
<td><code>total energy</code></td> | ||
</tr> | ||
<tr> | ||
<td><code>threshold</code></td> | ||
<td>threshold for the convergence of the observable of interest</td> | ||
<td><code>str</code>/<code>float</code></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td><code>variables</code></td> | ||
<td>The observable of interest will be converged with respect to this (these) simulation variable(s)</td> | ||
<td><code>list</code>/<code>str</code></td> | ||
<td><code>['ecutwfc']</code></td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Valid keywords | ||
============== | ||
|
||
.. raw:: html | ||
|
||
<center> | ||
<input type="text" id="convInput" onkeyup="lookupTable(convInput, convTable)" placeholder="Search for keywords...", style="width:50%"> | ||
</center> | ||
<br> | ||
|
||
.. raw:: html | ||
:file: ../_static/keywords/convergence_keywords.html | ||
|
||
.. raw:: html | ||
:file: ../_static/keywords/lookup_table.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
from pathlib import Path | ||
from typing import Any | ||
|
||
from koopmans import pseudopotentials | ||
|
||
from ._utils import Setting, SettingsDictWithChecks | ||
|
||
|
||
class ConvergenceSettingsDict(SettingsDictWithChecks): | ||
|
||
def __init__(self, **kwargs) -> None: | ||
settings = [ | ||
Setting('observable', | ||
'System observable of interest which we converge', | ||
str, 'total energy', None), | ||
Setting('threshold', | ||
'threshold for the convergence of the observable of interest', | ||
(str, float), None, None), | ||
Setting('variables', | ||
'The observable of interest will be converged with respect to this (these) ' | ||
'simulation variable(s)', | ||
(list, str), ['ecutwfc'], None)] | ||
|
||
super().__init__(settings=settings, physicals=['threshold'], **kwargs) | ||
|
||
@property | ||
def _other_valid_keywords(self): | ||
return [] | ||
|
||
def __setitem__(self, key: str, value: Any): | ||
# Convert parameters to a list | ||
if key == 'parameters' and isinstance(value, str): | ||
value = [value] | ||
|
||
return super().__setitem__(key, value) |
Oops, something went wrong.