generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/SOF-7766-3 Update: methods implementation for MIN NB to run #121
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
Closed
Closed
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
da3a675
update: add wf, swf, unit classes
VsevolodX 71b640b
update: add tests
VsevolodX cda0113
update: use esse
VsevolodX 87c2ad5
update: import esse
VsevolodX 503316d
update: add post, pre processors in tests
VsevolodX 5792c8e
update: correct order
VsevolodX 4181504
update: use mode, ade
VsevolodX d2fc284
update: use mode, ade classes
VsevolodX 805cc0c
update: add all types of units
VsevolodX b955deb
update: type
VsevolodX 373bd4d
update: minimal methods
VsevolodX 82a8409
chore: min plan md
VsevolodX 3b6ad8a
update: cleanup to have useful
VsevolodX 989454c
update: min md
VsevolodX e10d4be
chore: linting like in Made
VsevolodX 86434fd
chore: lint fix
VsevolodX 3885d8a
chore: precommit
VsevolodX ad4f10e
update: adjust tests
VsevolodX a2a9bbc
chore: cleanup
VsevolodX 4073d20
Merge branch 'feature/SOF-7766' into feature/SOF-7766-1
VsevolodX df65c96
update: export from top level
VsevolodX 046dfd9
chore: remove unnecessary
VsevolodX b0ec1c0
update: add methods to units (cursor)
VsevolodX 9ec390f
tmp: add units to md
VsevolodX c0a0251
chore: revert
VsevolodX 045e382
update: use esse models
VsevolodX b7d4f9a
chore: ignore dist for ruff
VsevolodX 3cc6d70
update: add tests for units
VsevolodX 50200d2
update: defaults for units
VsevolodX 0aab8b6
update: fix tests
VsevolodX 27f34f4
chore: lint fix
VsevolodX e786c74
chore: revert
VsevolodX 36fb501
update: use ade
VsevolodX e49e454
update: address pr comments
VsevolodX d1fdc9d
Merge branch 'feature/SOF-7766' into feature/SOF-7766-1
VsevolodX 45cf6d9
update: esse
VsevolodX 26ea534
chore: remove
VsevolodX 5eb2238
update: io units subtypes based on esse
VsevolodX 34c9239
update: adjust tests
VsevolodX f20a9a8
update: add qe, kgrid providers
VsevolodX d1ef8e7
update: first CP point grid
VsevolodX 341348d
update: add unit logic
VsevolodX bd495bc
update: add wf logic
VsevolodX f50dd9e
update: add wf logic - relax
VsevolodX 01e1e4b
update: move common unit logic
VsevolodX 63e5777
update: add swf logic + utils
VsevolodX 733c523
update: render methdos
VsevolodX 75a7e59
update: isolate method
VsevolodX d3d6763
chore: cleanup
VsevolodX 57103b7
update: add context providers classes
VsevolodX 7f2fb4d
chore: lint fix
VsevolodX 55ca089
update: get relaxation + test
VsevolodX b8739c9
chore: generalize
VsevolodX 6ac27a6
update: grid cp
VsevolodX 62d8595
chore: remove
VsevolodX 7072956
chore: lint fix
VsevolodX 9eb5741
chore: rename
VsevolodX 93e414b
update: add flowchart unit class
VsevolodX e92fc3e
update: remove local enums
VsevolodX 45f14ab
chore: move function to class
VsevolodX 35552eb
update: unit already sufficient
VsevolodX 07b7672
chore: cleanup tests
VsevolodX 25ff337
update: remove conflicting properties field
VsevolodX ac665e6
update: separate io units
VsevolodX f1830d7
Merge branch 'feature/SOF-7766-1' into feature/SOF-7766-3
VsevolodX cf9192f
update: add to list
VsevolodX 4b520b5
update: fix find unit + test
VsevolodX 1c6d90d
update: replace self
VsevolodX 1f7d90e
chore: cleanup
VsevolodX 949676d
update: default data
VsevolodX 7c1bdf5
update: handle default data
VsevolodX fe4f112
chore: lint fix
VsevolodX 935eeed
update: test flowchart units manager
VsevolodX 3565b4c
chore: simplify
VsevolodX 49f846e
update: esse utils
VsevolodX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -14,4 +14,3 @@ | |
| "@babel/plugin-proposal-class-properties" | ||
| ] | ||
| } | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,4 +5,3 @@ | |
| "src/**/*.jsx" | ||
| ] | ||
| } | ||
|
|
||
This file contains hidden or 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 @@ | ||
| repos: | ||
| - repo: https://github.com/Exabyte-io/pre-commit-hooks | ||
| rev: 2023.6.28 | ||
| hooks: | ||
| - id: ruff | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - id: black | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - id: isort | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - id: mypy | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - id: check-yaml | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - id: end-of-file-fixer | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - id: trailing-whitespace | ||
| exclude: ^tests/fixtures*|^dist* | ||
| - repo: local | ||
| hooks: | ||
| - id: lint-staged | ||
| name: lint-staged | ||
| language: node | ||
| entry: npx lint-staged | ||
| verbose: true | ||
| pass_filenames: false |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,4 +4,3 @@ | |
| "trailingComma": "all", | ||
| "tabWidth": 4 | ||
| } | ||
|
|
||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,65 @@ | ||
| # MVP Implementation Checklist - Minimal for Notebook | ||
|
|
||
| ## `src/py/mat3ra/wode/workflows/workflow.py` | ||
|
|
||
| ### Class: `Workflow` | ||
|
|
||
| - `add_subworkflow(subworkflow, head=False, index=-1)` | ||
| - `add_relaxation()` | ||
| - `subworkflows` [property] | ||
| - `create(config)` [classmethod] - Create workflow from standata config | ||
| - `get_unit_by_name(name=None, name_regex=None)` - Search units across all subworkflows | ||
| - `set_unit(unit=None, unit_flowchart_id=None, new_unit=None)` - Replace unit in workflow | ||
|
|
||
| ## `src/py/mat3ra/wode/subworkflows/subworkflow.py` | ||
|
|
||
| ### Class: `Subworkflow` | ||
|
|
||
| - `units` [property] | ||
| - `get_as_unit()` | ||
| - `get_unit_by_name(name=None, name_regex=None)` - Search units within subworkflow | ||
| - `model` [property with setter] - Ensure model can be set directly | ||
|
|
||
| ## `src/py/mat3ra/wode/units/unit.py` | ||
|
|
||
| ### Class: `Unit` (Base) | ||
|
|
||
| - `flowchartId` [field] | ||
| - `name` [field] - inherited | ||
| - `context` [field: Dict] - Context data dict | ||
| - `add_context(new_context)` - Update context data | ||
| - `get_context(key, default)` - Get context value | ||
| - `remove_context(key)` - Remove context value | ||
| - `clear_context()` - Clear all context | ||
|
|
||
| ## `src/py/mat3ra/wode/units/io.py` | ||
|
|
||
| ### Class: `IOUnit` | ||
|
|
||
| - `set_materials(materials)` - Set materials | ||
| - `add_feature(feature)` - Add feature | ||
| - `remove_feature(feature)` - Remove feature | ||
| - `add_target(target)` - Add target | ||
| - `remove_target(target)` - Remove target | ||
| - `has_feature(feature)` - Check feature exists | ||
| - `has_target(target)` - Check target exists | ||
|
|
||
| ## `src/py/mat3ra/wode/units/map.py` | ||
|
|
||
| ### Class: `MapUnit` | ||
|
|
||
| - `set_workflow_id(id)` - Set workflow ID | ||
|
|
||
| ## `src/py/mat3ra/wode/units/processing.py` | ||
|
|
||
| ### Class: `ProcessingUnit` | ||
|
|
||
| - `set_operation(op)` - Set operation | ||
| - `set_operation_type(type)` - Set operation type | ||
| - `set_input(input)` - Set input | ||
|
|
||
| ## `src/py/mat3ra/wode/units/factory.py` | ||
|
|
||
| ### Class: `UnitFactory` | ||
|
|
||
| - `create(config)` [staticmethod] - Factory to instantiate correct unit type based on config["type"] | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| """mat3ra namespace package.""" | ||
|
|
||
| __path__ = __import__("pkgutil").extend_path(__path__, __name__) |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,36 @@ | ||
| import numpy as np | ||
|
|
||
|
|
||
| def get_length(vec: np.ndarray) -> float: | ||
| return float(np.linalg.norm(vec)) | ||
| from .mixins import FlowchartUnitsManager | ||
| from .subworkflows import Subworkflow | ||
| from .units import ( | ||
| AssertionUnit, | ||
| AssignmentUnit, | ||
| ConditionUnit, | ||
| ExecutionUnit, | ||
| IOUnit, | ||
| MapUnit, | ||
| ProcessingUnit, | ||
| ReduceUnit, | ||
| SubworkflowUnit, | ||
| Unit, | ||
| UnitFactory, | ||
| ) | ||
| from .utils import find_by_name_or_regex, generate_uuid | ||
| from .workflows import Workflow | ||
|
|
||
| __all__ = [ | ||
| "Unit", | ||
| "ExecutionUnit", | ||
| "AssignmentUnit", | ||
| "IOUnit", | ||
| "ConditionUnit", | ||
| "AssertionUnit", | ||
| "ProcessingUnit", | ||
| "MapUnit", | ||
| "ReduceUnit", | ||
| "SubworkflowUnit", | ||
| "Subworkflow", | ||
| "Workflow", | ||
| "UnitFactory", | ||
| "FlowchartUnitsManager", | ||
| "find_by_name_or_regex", | ||
| "generate_uuid", | ||
| ] |
Empty file.
This file contains hidden or 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,3 @@ | ||
| from .points_grid_data_provider import PointsGridDataProvider | ||
|
|
||
| __all__ = ["PointsGridDataProvider"] |
Empty file.
Empty file.
87 changes: 87 additions & 0 deletions
87
src/py/mat3ra/wode/context/providers/by_application/espresso/qe_pwx_context_provider.py
This file contains hidden or 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,87 @@ | ||
| # TODO: We need periodic_table.js equivalent in Python | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This meant to be changed in the task for Context Providers. This is just a comment to implement that |
||
| # TODO: We need all mixins equivalent in Python | ||
|
|
||
| from typing import Any, Dict, List | ||
|
|
||
| from ..executable_context_provider import ExecutableContextProvider | ||
| from mat3ra.esse.models.context_providers_directory.by_application.qe_pwx_context_provider import ( | ||
| QEPwxContextProviderSchema, | ||
| ) | ||
|
|
||
|
|
||
| class QEPWXContextProvider(QEPwxContextProviderSchema, ExecutableContextProvider): | ||
| """ | ||
| Context provider for Quantum ESPRESSO pw.x settings. | ||
| """ | ||
|
|
||
| # self.init_materials_context_mixin() | ||
| # self.init_method_data_context_mixin() | ||
| # self.init_workflow_context_mixin() | ||
| # self.init_job_context_mixin() | ||
| # self.init_material_context_mixin() | ||
| _material: Any = None | ||
| _materials: List[Any] = [] | ||
|
|
||
| @staticmethod | ||
| def atom_symbols(material: Any) -> List[str]: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def unique_elements_with_labels(material: Any) -> List[str]: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def atomic_positions_with_constraints(material: Any) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def atomic_positions(material: Any) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def nat(material: Any) -> int: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def ntyp(material: Any) -> int: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def ntyp_with_labels(material: Any) -> int: | ||
| raise NotImplementedError | ||
|
|
||
| def build_qe_pwx_context(self, material: Any) -> Dict[str, Any]: | ||
| raise NotImplementedError | ||
|
|
||
| def get_data_per_material(self) -> Dict[str, Any]: | ||
| raise NotImplementedError | ||
|
|
||
| def get_data(self) -> Dict[str, Any]: | ||
| raise NotImplementedError | ||
|
|
||
| @property | ||
| def restart_mode(self) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| def get_pseudo_by_symbol(self, symbol: str) -> Any: | ||
| raise NotImplementedError | ||
|
|
||
| def atomic_species(self, material: Any) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| def atomic_species_with_labels(self, material: Any) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def cell_parameters(material: Any) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def symbol_to_atomic_specie(symbol: str, pseudo: Any) -> str: | ||
| raise NotImplementedError | ||
|
|
||
| @staticmethod | ||
| def element_and_pseudo_to_atomic_specie_with_labels( | ||
| symbol: str, pseudo: Any, label: str = "" | ||
| ) -> str: | ||
| raise NotImplementedError | ||
8 changes: 8 additions & 0 deletions
8
src/py/mat3ra/wode/context/providers/by_application/executable_context_provider.py
This file contains hidden or 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,8 @@ | ||
| from mat3ra.ade.context.context_provider import ContextProvider | ||
|
|
||
|
|
||
| class ExecutableContextProvider(ContextProvider): | ||
| """ | ||
| Context provider for executable settings. | ||
| """ | ||
| domain: str = "executable" |
55 changes: 55 additions & 0 deletions
55
src/py/mat3ra/wode/context/providers/points_grid_data_provider.py
This file contains hidden or 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,55 @@ | ||
| from typing import Any, Dict, List | ||
|
|
||
| from mat3ra.ade.context.context_provider import ContextProvider | ||
| from mat3ra.esse.models.context_providers_directory.enum import ContextProviderNameEnum | ||
| from mat3ra.esse.models.context_providers_directory.points_grid_data_provider import GridMetricType, \ | ||
| PointsGridDataProviderSchema | ||
| from pydantic import Field | ||
|
|
||
|
|
||
| # TODO: GlobalSetting for default KPPRA value | ||
| class PointsGridDataProvider(PointsGridDataProviderSchema, ContextProvider): | ||
| """ | ||
| Context provider for k-point/q-point grid configuration. | ||
|
|
||
| Handles grid dimensions and shifts for reciprocal space sampling. | ||
| """ | ||
| # TODO: Verify the correctness of the name | ||
| name: ContextProviderNameEnum = ContextProviderNameEnum.KGridFormDataManager | ||
| divisor: int = Field(default=1) | ||
| dimensions: List[int] = Field(default_factory=lambda: [1, 1, 1]) | ||
| shifts: List[float] = Field(default_factory=lambda: [0.0, 0.0, 0.0]) | ||
| grid_metric_type: str = Field(default=GridMetricType.KPPRA) | ||
|
|
||
| # TODO: handle presence of material | ||
| @property | ||
| def default_data(self) -> Dict[str, Any]: | ||
| return { | ||
| "dimensions": self.dimensions, | ||
| "shifts": self.shifts, | ||
| "gridMetricType": self.grid_metric_type, | ||
| "divisor": self.divisor, | ||
| } | ||
|
|
||
| # TODO: add a test to verify context and templates are the same as from JS implementation | ||
| def get_default_grid_metric_value(self, metric: str) -> float: | ||
| raise NotImplementedError | ||
|
|
||
| def calculate_dimensions( | ||
| self, | ||
| grid_metric_type: str, | ||
| grid_metric_value: float, | ||
| units: str = "angstrom" | ||
| ) -> List[int]: | ||
| raise NotImplementedError | ||
|
|
||
| def calculate_grid_metric( | ||
| self, | ||
| grid_metric_type: str, | ||
| dimensions: List[int], | ||
| units: str = "angstrom" | ||
| ) -> float: | ||
| raise NotImplementedError | ||
|
|
||
| def transform_data(self, data: Dict[str, Any]) -> Dict[str, Any]: | ||
| raise NotImplementedError |
This file contains hidden or 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,4 @@ | ||
| from .flowchart_units_manager import FlowchartUnitsManager | ||
|
|
||
| __all__ = ["FlowchartUnitsManager"] | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove the functions that we don't have