Skip to content
Closed
Show file tree
Hide file tree
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 Dec 5, 2025
71b640b
update: add tests
VsevolodX Dec 5, 2025
cda0113
update: use esse
VsevolodX Dec 5, 2025
87c2ad5
update: import esse
VsevolodX Dec 5, 2025
503316d
update: add post, pre processors in tests
VsevolodX Dec 5, 2025
5792c8e
update: correct order
VsevolodX Dec 5, 2025
4181504
update: use mode, ade
VsevolodX Dec 5, 2025
d2fc284
update: use mode, ade classes
VsevolodX Dec 5, 2025
805cc0c
update: add all types of units
VsevolodX Dec 6, 2025
b955deb
update: type
VsevolodX Dec 7, 2025
373bd4d
update: minimal methods
VsevolodX Dec 8, 2025
82a8409
chore: min plan md
VsevolodX Dec 8, 2025
3b6ad8a
update: cleanup to have useful
VsevolodX Dec 8, 2025
989454c
update: min md
VsevolodX Dec 8, 2025
e10d4be
chore: linting like in Made
VsevolodX Dec 8, 2025
86434fd
chore: lint fix
VsevolodX Dec 8, 2025
3885d8a
chore: precommit
VsevolodX Dec 8, 2025
ad4f10e
update: adjust tests
VsevolodX Dec 8, 2025
a2a9bbc
chore: cleanup
VsevolodX Dec 8, 2025
4073d20
Merge branch 'feature/SOF-7766' into feature/SOF-7766-1
VsevolodX Dec 8, 2025
df65c96
update: export from top level
VsevolodX Dec 8, 2025
046dfd9
chore: remove unnecessary
VsevolodX Dec 8, 2025
b0ec1c0
update: add methods to units (cursor)
VsevolodX Dec 8, 2025
9ec390f
tmp: add units to md
VsevolodX Dec 8, 2025
c0a0251
chore: revert
VsevolodX Dec 8, 2025
045e382
update: use esse models
VsevolodX Dec 9, 2025
b7d4f9a
chore: ignore dist for ruff
VsevolodX Dec 9, 2025
3cc6d70
update: add tests for units
VsevolodX Dec 9, 2025
50200d2
update: defaults for units
VsevolodX Dec 9, 2025
0aab8b6
update: fix tests
VsevolodX Dec 9, 2025
27f34f4
chore: lint fix
VsevolodX Dec 9, 2025
e786c74
chore: revert
VsevolodX Dec 9, 2025
36fb501
update: use ade
VsevolodX Dec 9, 2025
e49e454
update: address pr comments
VsevolodX Dec 11, 2025
d1fdc9d
Merge branch 'feature/SOF-7766' into feature/SOF-7766-1
VsevolodX Dec 11, 2025
45cf6d9
update: esse
VsevolodX Dec 11, 2025
26ea534
chore: remove
VsevolodX Dec 11, 2025
5eb2238
update: io units subtypes based on esse
VsevolodX Dec 12, 2025
34c9239
update: adjust tests
VsevolodX Dec 12, 2025
f20a9a8
update: add qe, kgrid providers
VsevolodX Dec 12, 2025
d1ef8e7
update: first CP point grid
VsevolodX Dec 9, 2025
341348d
update: add unit logic
VsevolodX Dec 9, 2025
bd495bc
update: add wf logic
VsevolodX Dec 9, 2025
f50dd9e
update: add wf logic - relax
VsevolodX Dec 9, 2025
01e1e4b
update: move common unit logic
VsevolodX Dec 9, 2025
63e5777
update: add swf logic + utils
VsevolodX Dec 9, 2025
733c523
update: render methdos
VsevolodX Dec 9, 2025
75a7e59
update: isolate method
VsevolodX Dec 9, 2025
d3d6763
chore: cleanup
VsevolodX Dec 10, 2025
57103b7
update: add context providers classes
VsevolodX Dec 10, 2025
7f2fb4d
chore: lint fix
VsevolodX Dec 10, 2025
55ca089
update: get relaxation + test
VsevolodX Dec 10, 2025
b8739c9
chore: generalize
VsevolodX Dec 10, 2025
6ac27a6
update: grid cp
VsevolodX Dec 10, 2025
62d8595
chore: remove
VsevolodX Dec 12, 2025
7072956
chore: lint fix
VsevolodX Dec 12, 2025
9eb5741
chore: rename
VsevolodX Dec 12, 2025
93e414b
update: add flowchart unit class
VsevolodX Dec 12, 2025
e92fc3e
update: remove local enums
VsevolodX Dec 12, 2025
45f14ab
chore: move function to class
VsevolodX Dec 12, 2025
35552eb
update: unit already sufficient
VsevolodX Dec 12, 2025
07b7672
chore: cleanup tests
VsevolodX Dec 12, 2025
25ff337
update: remove conflicting properties field
VsevolodX Dec 12, 2025
ac665e6
update: separate io units
VsevolodX Dec 12, 2025
f1830d7
Merge branch 'feature/SOF-7766-1' into feature/SOF-7766-3
VsevolodX Dec 12, 2025
cf9192f
update: add to list
VsevolodX Dec 12, 2025
4b520b5
update: fix find unit + test
VsevolodX Dec 12, 2025
1c6d90d
update: replace self
VsevolodX Dec 12, 2025
1f7d90e
chore: cleanup
VsevolodX Dec 12, 2025
949676d
update: default data
VsevolodX Dec 12, 2025
7c1bdf5
update: handle default data
VsevolodX Dec 12, 2025
fe4f112
chore: lint fix
VsevolodX Dec 12, 2025
935eeed
update: test flowchart units manager
VsevolodX Dec 13, 2025
3565b4c
chore: simplify
VsevolodX Dec 13, 2025
49f846e
update: esse utils
VsevolodX Dec 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
"@babel/plugin-proposal-class-properties"
]
}

1 change: 0 additions & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
"src/**/*.jsx"
]
}

26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
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
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
"trailingComma": "all",
"tabWidth": 4
}

26 changes: 0 additions & 26 deletions .yamllint.yml

This file was deleted.

65 changes: 65 additions & 0 deletions 00_IMPLEMENTATION_CHECKLIST_MIN.md
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
Copy link
Member

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


## `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"]
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ classifiers = [
]
dependencies = [
"numpy",
"mat3ra-utils",
"mat3ra-esse @ git+https://github.com/Exabyte-io/esse.git@5fd47adb825854ac1fc4b0133cc5d0210e18a5bb",
"mat3ra-mode",
"mat3ra-ade @ git+https://github.com/Exabyte-io/ade.git@7b5bdbae13a1ef87ee64dec7e98ac7fd5661959b",
"mat3ra-standata"
]

[project.optional-dependencies]
Expand Down Expand Up @@ -62,13 +67,15 @@ extend-exclude = '''
tests\/fixtures*,
examples\/.*\/.*\.py
| other\/.*\/.*\.(py|ipynb)
| dist\/.*
)
'''

[tool.ruff]
extend-exclude = [
"src/js",
"tests/fixtures"
"tests/fixtures",
"dist"
]
line-length = 120
target-version = "py310"
Expand All @@ -80,6 +87,7 @@ target-version = "py310"
profile = "black"
multi_line_output = 3
include_trailing_comma = true
extend_skip_glob = ["dist/*"]

[tool.pytest.ini_options]
pythonpath = [
Expand All @@ -88,4 +96,3 @@ pythonpath = [
testpaths = [
"tests/py"
]

3 changes: 1 addition & 2 deletions src/py/mat3ra/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"""mat3ra namespace package."""

__path__ = __import__("pkgutil").extend_path(__path__, __name__)
40 changes: 35 additions & 5 deletions src/py/mat3ra/wode/__init__.py
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.
3 changes: 3 additions & 0 deletions src/py/mat3ra/wode/context/providers/__init__.py
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# TODO: We need periodic_table.js equivalent in Python
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

The 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
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 src/py/mat3ra/wode/context/providers/points_grid_data_provider.py
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
4 changes: 4 additions & 0 deletions src/py/mat3ra/wode/mixins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .flowchart_units_manager import FlowchartUnitsManager

__all__ = ["FlowchartUnitsManager"]

Loading
Loading