@mat3ra/wode 2026.5.23-0 → 2026.6.5-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +1 -1
- package/dist/js/Subworkflow.d.ts +714 -0
- package/dist/js/Subworkflow.js +397 -0
- package/dist/js/Workflow.d.ts +82 -0
- package/dist/js/Workflow.js +286 -0
- package/dist/js/WorkflowDesignerMaterial.d.ts +21 -0
- package/dist/js/WorkflowDesignerMaterial.js +26 -0
- package/dist/js/context/mixins/ApplicationContextMixin.d.ts +10 -0
- package/dist/js/context/mixins/ApplicationContextMixin.js +10 -17
- package/dist/js/context/mixins/MaterialContextMixin.d.ts +18 -0
- package/dist/js/context/mixins/MaterialContextMixin.js +14 -38
- package/dist/js/context/mixins/MaterialsContextMixin.d.ts +10 -0
- package/dist/js/context/mixins/MaterialsContextMixin.js +11 -17
- package/dist/js/context/mixins/MaterialsSetContextMixin.d.ts +14 -0
- package/dist/js/context/mixins/MaterialsSetContextMixin.js +21 -23
- package/dist/js/context/providers/BoundaryConditionsFormDataManager.d.ts +30 -0
- package/dist/js/context/providers/BoundaryConditionsFormDataManager.js +62 -0
- package/dist/js/context/providers/CollinearMagnetizationDataManager.d.ts +42 -0
- package/dist/js/context/providers/CollinearMagnetizationDataManager.js +101 -0
- package/dist/js/context/providers/Hubbard/HubbardContextManagerLegacy.d.ts +29 -0
- package/dist/js/context/providers/Hubbard/HubbardContextManagerLegacy.js +69 -0
- package/dist/js/context/providers/Hubbard/HubbardContextProvider.d.ts +20 -0
- package/dist/js/context/providers/Hubbard/HubbardContextProvider.js +47 -0
- package/dist/js/context/providers/Hubbard/HubbardJContextManager.d.ts +22 -0
- package/dist/js/context/providers/Hubbard/HubbardJContextManager.js +61 -0
- package/dist/js/context/providers/Hubbard/HubbardUContextManager.d.ts +22 -0
- package/dist/js/context/providers/Hubbard/HubbardUContextManager.js +57 -0
- package/dist/js/context/providers/Hubbard/HubbardVContextManager.d.ts +22 -0
- package/dist/js/context/providers/Hubbard/HubbardVContextManager.js +79 -0
- package/dist/js/context/providers/IonDynamicsDataManager.d.ts +27 -0
- package/dist/js/context/providers/IonDynamicsDataManager.js +48 -0
- package/dist/js/context/providers/MLSettingsDataManager.d.ts +24 -0
- package/dist/js/context/providers/MLSettingsDataManager.js +42 -0
- package/dist/js/context/providers/MLTrainTestSplitDataManager.d.ts +23 -0
- package/dist/js/context/providers/MLTrainTestSplitDataManager.js +40 -0
- package/dist/js/context/providers/NEBFormDataManager.d.ts +23 -0
- package/dist/js/context/providers/NEBFormDataManager.js +39 -0
- package/dist/js/context/providers/NonCollinearMagnetizationDataManager.d.ts +78 -0
- package/dist/js/context/providers/NonCollinearMagnetizationDataManager.js +181 -0
- package/dist/js/context/providers/PlanewaveCutoffDataManager.d.ts +26 -0
- package/dist/js/context/providers/PlanewaveCutoffDataManager.js +69 -0
- package/dist/js/context/providers/PointsGrid/IGridFormDataManager.d.ts +13 -0
- package/dist/js/context/providers/PointsGrid/IGridFormDataManager.js +23 -0
- package/dist/js/context/providers/PointsGrid/KGridFormDataManager.d.ts +15 -0
- package/dist/js/context/providers/PointsGrid/KGridFormDataManager.js +30 -0
- package/dist/js/context/providers/PointsGrid/PointsGridFormDataProvider.d.ts +171 -0
- package/dist/js/context/providers/PointsGrid/PointsGridFormDataProvider.js +270 -0
- package/dist/js/context/providers/PointsGrid/QGridFormDataManager.d.ts +13 -0
- package/dist/js/context/providers/PointsGrid/QGridFormDataManager.js +23 -0
- package/dist/js/context/providers/PointsPath/ExplicitKPath2PIBAFormDataManager.d.ts +10 -0
- package/dist/js/context/providers/PointsPath/ExplicitKPath2PIBAFormDataManager.js +19 -0
- package/dist/js/context/providers/PointsPath/ExplicitKPathFormDataManager.d.ts +9 -0
- package/dist/js/context/providers/PointsPath/ExplicitKPathFormDataManager.js +18 -0
- package/dist/js/context/providers/PointsPath/IPathFormDataManager.d.ts +8 -0
- package/dist/js/context/providers/PointsPath/IPathFormDataManager.js +17 -0
- package/dist/js/context/providers/PointsPath/KPathFormDataManager.d.ts +8 -0
- package/dist/js/context/providers/PointsPath/KPathFormDataManager.js +17 -0
- package/dist/js/context/providers/PointsPath/PointsPathFormDataProvider.d.ts +40 -0
- package/dist/js/context/providers/PointsPath/PointsPathFormDataProvider.js +125 -0
- package/dist/js/context/providers/PointsPath/QPathFormDataManager.d.ts +8 -0
- package/dist/js/context/providers/PointsPath/QPathFormDataManager.js +17 -0
- package/dist/js/context/providers/base/ContextProvider.d.ts +75 -0
- package/dist/js/context/providers/base/ContextProvider.js +87 -0
- package/dist/js/context/providers/base/JSONSchemaDataProvider.d.ts +16 -0
- package/dist/js/context/providers/base/JSONSchemaDataProvider.js +17 -0
- package/dist/js/context/providers/base/JSONSchemaFormDataProvider.d.ts +19 -0
- package/dist/js/context/providers/base/JSONSchemaFormDataProvider.js +32 -0
- package/dist/js/context/providers/by_application/espresso/QENEBInputDataManager.d.ts +26 -0
- package/dist/js/context/providers/by_application/espresso/QENEBInputDataManager.js +54 -0
- package/dist/js/context/providers/by_application/espresso/QEPWXInputDataManager.d.ts +78 -0
- package/dist/js/context/providers/by_application/espresso/QEPWXInputDataManager.js +104 -0
- package/dist/js/context/providers/by_application/nwchem/NWChemInputDataManager.d.ts +36 -0
- package/dist/js/context/providers/by_application/nwchem/NWChemInputDataManager.js +58 -0
- package/dist/js/context/providers/by_application/vasp/VASPInputDataManager.d.ts +36 -0
- package/dist/js/context/providers/by_application/vasp/VASPInputDataManager.js +56 -0
- package/dist/js/context/providers/by_application/vasp/VASPNEBInputDataManager.d.ts +30 -0
- package/dist/js/context/providers/by_application/vasp/VASPNEBInputDataManager.js +50 -0
- package/dist/js/context/providers/index.d.ts +92 -0
- package/dist/js/context/providers/index.js +107 -0
- package/dist/js/context/providers/settings.d.ts +7 -0
- package/dist/js/context/providers/settings.js +11 -33
- package/dist/js/convergence/ConvergenceParameter.d.ts +26 -0
- package/dist/js/convergence/ConvergenceParameter.js +13 -0
- package/dist/js/convergence/NonUniformKGridConvergence.d.ts +12 -0
- package/dist/js/convergence/NonUniformKGridConvergence.js +31 -0
- package/dist/js/convergence/UniformKGridConvergence.d.ts +8 -0
- package/dist/js/convergence/UniformKGridConvergence.js +22 -0
- package/dist/js/convergence/factory.d.ts +8 -0
- package/dist/js/convergence/factory.js +18 -0
- package/dist/js/enums.d.ts +62 -0
- package/dist/js/enums.js +66 -61
- package/dist/js/generated/AssertionUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/AssertionUnitSchemaMixin.js +27 -0
- package/dist/js/generated/AssignmentUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/AssignmentUnitSchemaMixin.js +33 -0
- package/dist/js/generated/BaseUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/BaseUnitSchemaMixin.js +57 -0
- package/dist/js/generated/ConditionUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/ConditionUnitSchemaMixin.js +51 -0
- package/dist/js/generated/ExecutionUnitInputSchemaMixin.d.ts +5 -0
- package/dist/js/generated/ExecutionUnitInputSchemaMixin.js +27 -0
- package/dist/js/generated/ExecutionUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/ExecutionUnitSchemaMixin.js +45 -0
- package/dist/js/generated/IOUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/IOUnitSchemaMixin.js +33 -0
- package/dist/js/generated/MapUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/MapUnitSchemaMixin.js +27 -0
- package/dist/js/generated/ReduceUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/ReduceUnitSchemaMixin.js +27 -0
- package/dist/js/generated/StatusSchemaMixin.d.ts +5 -0
- package/dist/js/generated/StatusSchemaMixin.js +21 -0
- package/dist/js/generated/SubworkflowSchemaMixin.d.ts +5 -0
- package/dist/js/generated/SubworkflowSchemaMixin.js +51 -0
- package/dist/js/generated/SubworkflowUnitSchemaMixin.d.ts +5 -0
- package/dist/js/generated/SubworkflowUnitSchemaMixin.js +15 -0
- package/dist/js/generated/WorkflowSchemaMixin.d.ts +5 -0
- package/dist/js/generated/WorkflowSchemaMixin.js +51 -0
- package/dist/js/index.d.ts +13 -0
- package/dist/js/index.js +66 -176
- package/dist/js/units/AssertionUnit.d.ts +20 -0
- package/dist/js/units/AssertionUnit.js +33 -0
- package/dist/js/units/AssignmentUnit.d.ts +17 -0
- package/dist/js/units/AssignmentUnit.js +35 -0
- package/dist/js/units/BaseUnit.d.ts +39 -0
- package/dist/js/units/BaseUnit.js +70 -0
- package/dist/js/units/ConditionUnit.d.ts +17 -0
- package/dist/js/units/ConditionUnit.js +37 -0
- package/dist/js/units/ExecutionUnit.d.ts +115 -0
- package/dist/js/units/ExecutionUnit.js +181 -0
- package/dist/js/units/ExecutionUnitInput.d.ts +22 -0
- package/dist/js/units/ExecutionUnitInput.js +47 -0
- package/dist/js/units/IOUnit.d.ts +16 -0
- package/dist/js/units/IOUnit.js +31 -0
- package/dist/js/units/MapUnit.d.ts +34 -0
- package/dist/js/units/MapUnit.js +46 -0
- package/dist/js/units/ReduceUnit.d.ts +16 -0
- package/dist/js/units/ReduceUnit.js +30 -0
- package/dist/js/units/SubworkflowUnit.d.ts +16 -0
- package/dist/js/units/SubworkflowUnit.js +28 -0
- package/dist/js/units/factory.d.ts +31 -0
- package/dist/js/units/factory.js +65 -47
- package/dist/js/units/index.d.ts +14 -0
- package/dist/js/units/index.js +25 -81
- package/dist/js/units/mixins/RuntimeItemsUILogicMixin.d.ts +26 -0
- package/dist/js/units/mixins/RuntimeItemsUILogicMixin.js +50 -0
- package/dist/js/utils/baseUnits.d.ts +2 -0
- package/dist/js/utils/baseUnits.js +11 -0
- package/dist/js/utils/index.d.ts +3 -0
- package/dist/js/utils/index.js +39 -0
- package/dist/js/utils/subworkflow.d.ts +2 -0
- package/dist/js/utils/subworkflow.js +29 -0
- package/dist/js/utils/underscoreStringSlugify.d.ts +6 -0
- package/dist/js/utils/underscoreStringSlugify.js +32 -0
- package/dist/js/utils/units.d.ts +4 -0
- package/dist/js/utils/units.js +16 -0
- package/dist/js/utils/workflow.d.ts +9 -0
- package/dist/js/utils/workflow.js +67 -0
- package/dist/js/workflows/default.d.ts +3 -0
- package/dist/js/workflows/default.js +43 -39
- package/dist/js/workflows/workflow.d.ts +4404 -0
- package/dist/js/workflows/workflow.js +310 -306
- package/package.json +56 -44
- package/src/js/Subworkflow.ts +532 -0
- package/src/js/Workflow.ts +390 -0
- package/src/js/context/mixins/ApplicationContextMixin.ts +21 -0
- package/src/js/context/mixins/MaterialContextMixin.ts +35 -0
- package/src/js/context/mixins/MaterialsContextMixin.ts +24 -0
- package/src/js/context/mixins/MaterialsSetContextMixin.ts +42 -0
- package/src/js/context/providers/BoundaryConditionsFormDataManager.ts +88 -0
- package/src/js/context/providers/CollinearMagnetizationDataManager.ts +140 -0
- package/src/js/context/providers/Hubbard/HubbardContextManagerLegacy.ts +93 -0
- package/src/js/context/providers/Hubbard/HubbardContextProvider.ts +85 -0
- package/src/js/context/providers/Hubbard/HubbardJContextManager.ts +82 -0
- package/src/js/context/providers/Hubbard/HubbardUContextManager.ts +78 -0
- package/src/js/context/providers/Hubbard/HubbardVContextManager.ts +100 -0
- package/src/js/context/providers/IonDynamicsDataManager.ts +64 -0
- package/src/js/context/providers/MLSettingsDataManager.ts +61 -0
- package/src/js/context/providers/MLTrainTestSplitDataManager.ts +59 -0
- package/src/js/context/providers/NEBFormDataManager.ts +57 -0
- package/src/js/context/providers/NonCollinearMagnetizationDataManager.ts +229 -0
- package/src/js/context/providers/PlanewaveCutoffDataManager.ts +110 -0
- package/src/js/context/providers/PointsGrid/IGridFormDataManager.ts +36 -0
- package/src/js/context/providers/PointsGrid/KGridFormDataManager.ts +46 -0
- package/src/js/context/providers/PointsGrid/PointsGridFormDataProvider.ts +371 -0
- package/src/js/context/providers/PointsGrid/QGridFormDataManager.ts +36 -0
- package/src/js/context/providers/PointsPath/ExplicitKPath2PIBAFormDataManager.ts +26 -0
- package/src/js/context/providers/PointsPath/ExplicitKPathFormDataManager.ts +24 -0
- package/src/js/context/providers/PointsPath/IPathFormDataManager.ts +22 -0
- package/src/js/context/providers/PointsPath/KPathFormDataManager.ts +22 -0
- package/src/js/context/providers/PointsPath/PointsPathFormDataProvider.ts +192 -0
- package/src/js/context/providers/PointsPath/QPathFormDataManager.ts +22 -0
- package/src/js/context/providers/base/ContextProvider.ts +150 -0
- package/src/js/context/providers/base/JSONSchemaDataProvider.ts +31 -0
- package/src/js/context/providers/base/JSONSchemaFormDataProvider.ts +38 -0
- package/src/js/context/providers/by_application/espresso/QENEBInputDataManager.ts +107 -0
- package/src/js/context/providers/by_application/espresso/QEPWXInputDataManager.ts +178 -0
- package/src/js/context/providers/by_application/nwchem/NWChemInputDataManager.ts +93 -0
- package/src/js/context/providers/by_application/vasp/VASPInputDataManager.ts +89 -0
- package/src/js/context/providers/by_application/vasp/VASPNEBInputDataManager.ts +92 -0
- package/src/js/context/providers/index.ts +155 -0
- package/src/js/context/providers/settings.ts +13 -0
- package/src/js/convergence/ConvergenceParameter.ts +37 -0
- package/src/js/convergence/NonUniformKGridConvergence.ts +38 -0
- package/src/js/convergence/UniformKGridConvergence.ts +26 -0
- package/src/js/convergence/factory.ts +18 -0
- package/src/js/{enums.js → enums.ts} +27 -22
- package/src/js/generated/AssertionUnitSchemaMixin.ts +34 -0
- package/src/js/generated/AssignmentUnitSchemaMixin.ts +40 -0
- package/src/js/generated/BaseUnitSchemaMixin.ts +64 -0
- package/src/js/generated/ConditionUnitSchemaMixin.ts +58 -0
- package/src/js/generated/ExecutionUnitInputSchemaMixin.ts +36 -0
- package/src/js/generated/ExecutionUnitSchemaMixin.ts +52 -0
- package/src/js/generated/IOUnitSchemaMixin.ts +40 -0
- package/src/js/generated/MapUnitSchemaMixin.ts +34 -0
- package/src/js/generated/ReduceUnitSchemaMixin.ts +34 -0
- package/src/js/generated/StatusSchemaMixin.ts +28 -0
- package/src/js/generated/SubworkflowSchemaMixin.ts +58 -0
- package/src/js/generated/SubworkflowUnitSchemaMixin.ts +22 -0
- package/src/js/generated/WorkflowSchemaMixin.ts +58 -0
- package/src/js/index.ts +44 -0
- package/src/js/units/AssertionUnit.ts +49 -0
- package/src/js/units/AssignmentUnit.ts +49 -0
- package/src/js/units/BaseUnit.ts +117 -0
- package/src/js/units/ConditionUnit.ts +52 -0
- package/src/js/units/ExecutionUnit.ts +274 -0
- package/src/js/units/ExecutionUnitInput.ts +71 -0
- package/src/js/units/IOUnit.ts +43 -0
- package/src/js/units/MapUnit.ts +59 -0
- package/src/js/units/ReduceUnit.ts +46 -0
- package/src/js/units/SubworkflowUnit.ts +44 -0
- package/src/js/units/factory.ts +131 -0
- package/src/js/units/index.ts +27 -0
- package/src/js/units/mixins/RuntimeItemsUILogicMixin.ts +81 -0
- package/src/js/utils/baseUnits.ts +11 -0
- package/src/js/utils/index.ts +3 -0
- package/src/js/utils/units.ts +23 -0
- package/src/js/utils/workflow.ts +69 -0
- package/src/js/workflows/{default.js → default.ts} +8 -1
- package/build_workflows.js +0 -65
- package/dist/js/context/context.js +0 -49
- package/dist/js/context/mixins/JobContextMixin.js +0 -39
- package/dist/js/context/mixins/MethodDataContextMixin.js +0 -48
- package/dist/js/context/mixins/WorkflowContextMixin.js +0 -28
- package/dist/js/context/providers/BoundaryConditionsFormDataProvider.js +0 -84
- package/dist/js/context/providers/CollinearMagnetizationContextProvider.js +0 -96
- package/dist/js/context/providers/HubbardContextProviderLegacy.js +0 -68
- package/dist/js/context/providers/HubbardJContextProvider.js +0 -67
- package/dist/js/context/providers/HubbardUContextProvider.js +0 -70
- package/dist/js/context/providers/HubbardVContextProvider.js +0 -92
- package/dist/js/context/providers/IonDynamicsContextProvider.js +0 -58
- package/dist/js/context/providers/MLSettingsContextProvider.js +0 -51
- package/dist/js/context/providers/MLTrainTestSplitContextProvider.js +0 -47
- package/dist/js/context/providers/NEBFormDataProvider.js +0 -42
- package/dist/js/context/providers/NonCollinearMagnetizationContextProvider.js +0 -187
- package/dist/js/context/providers/PlanewaveCutoffsContextProvider.js +0 -67
- package/dist/js/context/providers/PointsGridFormDataProvider.js +0 -263
- package/dist/js/context/providers/PointsPathFormDataProvider.js +0 -147
- package/dist/js/context/providers/by_application/ExecutableContextProvider.js +0 -25
- package/dist/js/context/providers/by_application/espresso/QENEBContextProvider.js +0 -61
- package/dist/js/context/providers/by_application/espresso/QEPWXContextProvider.js +0 -150
- package/dist/js/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +0 -85
- package/dist/js/context/providers/by_application/vasp/VASPContextProvider.js +0 -65
- package/dist/js/context/providers/by_application/vasp/VASPNEBContextProvider.js +0 -57
- package/dist/js/context/providers.js +0 -199
- package/dist/js/patch.js +0 -19
- package/dist/js/subworkflows/convergence/non_uniform_kgrid.js +0 -31
- package/dist/js/subworkflows/convergence/parameter.js +0 -70
- package/dist/js/subworkflows/convergence/uniform_kgrid.js +0 -26
- package/dist/js/subworkflows/convergence.js +0 -189
- package/dist/js/subworkflows/create.js +0 -293
- package/dist/js/subworkflows/dynamic/espresso/getQpointIrrep.js +0 -34
- package/dist/js/subworkflows/dynamic/index.js +0 -19
- package/dist/js/subworkflows/dynamic/surfaceEnergy.js +0 -67
- package/dist/js/subworkflows/index.js +0 -19
- package/dist/js/units/assertion.js +0 -37
- package/dist/js/units/assignment.js +0 -42
- package/dist/js/units/base.js +0 -91
- package/dist/js/units/builders/AssertionUnitConfigBuilder.js +0 -34
- package/dist/js/units/builders/AssignmentUnitConfigBuilder.js +0 -41
- package/dist/js/units/builders/ExecutionUnitConfigBuilder.js +0 -67
- package/dist/js/units/builders/IOUnitConfigBuilder.js +0 -54
- package/dist/js/units/builders/UnitConfigBuilder.js +0 -85
- package/dist/js/units/builders/index.js +0 -18
- package/dist/js/units/condition.js +0 -52
- package/dist/js/units/execution.js +0 -225
- package/dist/js/units/io.js +0 -148
- package/dist/js/units/map.js +0 -38
- package/dist/js/units/processing.js +0 -41
- package/dist/js/units/reduce.js +0 -24
- package/dist/js/units/subworkflow.js +0 -23
- package/dist/js/workflows/create.js +0 -318
- package/dist/js/workflows/index.js +0 -113
- package/dist/js/workflows/relaxation.js +0 -38
- package/src/js/context/context.js +0 -47
- package/src/js/context/mixins/ApplicationContextMixin.js +0 -19
- package/src/js/context/mixins/JobContextMixin.js +0 -36
- package/src/js/context/mixins/MaterialContextMixin.js +0 -41
- package/src/js/context/mixins/MaterialsContextMixin.js +0 -18
- package/src/js/context/mixins/MaterialsSetContextMixin.js +0 -24
- package/src/js/context/mixins/MethodDataContextMixin.js +0 -48
- package/src/js/context/mixins/WorkflowContextMixin.js +0 -25
- package/src/js/context/providers/BoundaryConditionsFormDataProvider.js +0 -72
- package/src/js/context/providers/CollinearMagnetizationContextProvider.js +0 -105
- package/src/js/context/providers/HubbardContextProviderLegacy.js +0 -67
- package/src/js/context/providers/HubbardJContextProvider.js +0 -65
- package/src/js/context/providers/HubbardUContextProvider.js +0 -95
- package/src/js/context/providers/HubbardVContextProvider.js +0 -96
- package/src/js/context/providers/IonDynamicsContextProvider.js +0 -44
- package/src/js/context/providers/MLSettingsContextProvider.js +0 -45
- package/src/js/context/providers/MLTrainTestSplitContextProvider.js +0 -43
- package/src/js/context/providers/NEBFormDataProvider.js +0 -33
- package/src/js/context/providers/NonCollinearMagnetizationContextProvider.js +0 -179
- package/src/js/context/providers/PlanewaveCutoffsContextProvider.js +0 -65
- package/src/js/context/providers/PointsGridFormDataProvider.js +0 -271
- package/src/js/context/providers/PointsPathFormDataProvider.js +0 -163
- package/src/js/context/providers/by_application/ExecutableContextProvider.js +0 -17
- package/src/js/context/providers/by_application/espresso/QENEBContextProvider.js +0 -58
- package/src/js/context/providers/by_application/espresso/QEPWXContextProvider.js +0 -168
- package/src/js/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +0 -89
- package/src/js/context/providers/by_application/vasp/VASPContextProvider.js +0 -58
- package/src/js/context/providers/by_application/vasp/VASPNEBContextProvider.js +0 -48
- package/src/js/context/providers/settings.js +0 -38
- package/src/js/context/providers.js +0 -140
- package/src/js/index.js +0 -57
- package/src/js/patch.js +0 -12
- package/src/js/subworkflows/convergence/enums.js +0 -12
- package/src/js/subworkflows/convergence/factory.js +0 -15
- package/src/js/subworkflows/convergence/non_uniform_kgrid.js +0 -28
- package/src/js/subworkflows/convergence/parameter.js +0 -58
- package/src/js/subworkflows/convergence/uniform_kgrid.js +0 -22
- package/src/js/subworkflows/convergence.js +0 -196
- package/src/js/subworkflows/create.js +0 -220
- package/src/js/subworkflows/dynamic/espresso/getQpointIrrep.js +0 -35
- package/src/js/subworkflows/dynamic/index.js +0 -8
- package/src/js/subworkflows/dynamic/surfaceEnergy.js +0 -124
- package/src/js/subworkflows/index.js +0 -2
- package/src/js/subworkflows/subworkflow.js +0 -345
- package/src/js/units/assertion.js +0 -29
- package/src/js/units/assignment.js +0 -34
- package/src/js/units/base.js +0 -97
- package/src/js/units/builders/AssertionUnitConfigBuilder.js +0 -28
- package/src/js/units/builders/AssignmentUnitConfigBuilder.js +0 -36
- package/src/js/units/builders/ExecutionUnitConfigBuilder.js +0 -59
- package/src/js/units/builders/IOUnitConfigBuilder.js +0 -53
- package/src/js/units/builders/UnitConfigBuilder.js +0 -92
- package/src/js/units/builders/index.js +0 -15
- package/src/js/units/condition.js +0 -47
- package/src/js/units/execution.js +0 -267
- package/src/js/units/factory.js +0 -53
- package/src/js/units/index.js +0 -25
- package/src/js/units/io.js +0 -163
- package/src/js/units/map.js +0 -33
- package/src/js/units/processing.js +0 -39
- package/src/js/units/reduce.js +0 -17
- package/src/js/units/subworkflow.js +0 -15
- package/src/js/utils.js +0 -73
- package/src/js/workflows/create.js +0 -227
- package/src/js/workflows/index.js +0 -98
- package/src/js/workflows/relaxation.js +0 -42
- package/src/js/workflows/workflow.js +0 -388
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { type NamedInMemoryEntity, InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
|
+
import {
|
|
3
|
+
type Defaultable,
|
|
4
|
+
defaultableEntityMixin,
|
|
5
|
+
} from "@mat3ra/code/dist/js/entity/mixins/DefaultableMixin";
|
|
6
|
+
import {
|
|
7
|
+
type HasDescription,
|
|
8
|
+
hasDescriptionMixin,
|
|
9
|
+
} from "@mat3ra/code/dist/js/entity/mixins/HasDescriptionMixin";
|
|
10
|
+
import {
|
|
11
|
+
type HashedEntity,
|
|
12
|
+
hashedEntityMixin,
|
|
13
|
+
} from "@mat3ra/code/dist/js/entity/mixins/HashedEntityMixin";
|
|
14
|
+
import { namedEntityMixin } from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin";
|
|
15
|
+
import { Taggable, taggableMixin } from "@mat3ra/code/dist/js/entity/mixins/TaggableMixin";
|
|
16
|
+
import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
|
|
17
|
+
import type { AnyObject } from "@mat3ra/esse/dist/js/esse/types";
|
|
18
|
+
import type {
|
|
19
|
+
ApplicationSchema,
|
|
20
|
+
SubworkflowSchema,
|
|
21
|
+
WorkflowSchema,
|
|
22
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
23
|
+
import { ComputedEntityMixin, computedEntityMixin } from "@mat3ra/ide/dist/js/compute";
|
|
24
|
+
import type { Material } from "@mat3ra/made";
|
|
25
|
+
import type { MetaPropertyHolder } from "@mat3ra/prode";
|
|
26
|
+
import { setUnitLinks, SubworkflowStandata } from "@mat3ra/standata";
|
|
27
|
+
import { Utils } from "@mat3ra/utils";
|
|
28
|
+
|
|
29
|
+
import type { MaterialExternalContext } from "./context/mixins/MaterialContextMixin";
|
|
30
|
+
import type { MaterialsExternalContext } from "./context/mixins/MaterialsContextMixin";
|
|
31
|
+
import type { MaterialsSetExternalContext } from "./context/mixins/MaterialsSetContextMixin";
|
|
32
|
+
import type { JobExternalContext } from "./context/providers/by_application/espresso/QEPWXInputDataManager";
|
|
33
|
+
import { UnitType } from "./enums";
|
|
34
|
+
import { type WorkflowSchemaMixin, workflowSchemaMixin } from "./generated/WorkflowSchemaMixin";
|
|
35
|
+
import Subworkflow from "./Subworkflow";
|
|
36
|
+
import { MapUnit } from "./units";
|
|
37
|
+
import { type AnyWorkflowUnit, UnitFactory } from "./units/factory";
|
|
38
|
+
import {
|
|
39
|
+
getDefaultDescription,
|
|
40
|
+
getHumanReadableProperties,
|
|
41
|
+
getHumanReadableUsedModels,
|
|
42
|
+
getProperties,
|
|
43
|
+
getSystemName,
|
|
44
|
+
getUsedApplications,
|
|
45
|
+
getUsedModels,
|
|
46
|
+
} from "./utils/workflow";
|
|
47
|
+
import defaultWorkflowConfig from "./workflows/default";
|
|
48
|
+
|
|
49
|
+
interface Workflow
|
|
50
|
+
extends Defaultable,
|
|
51
|
+
NamedInMemoryEntity,
|
|
52
|
+
WorkflowSchemaMixin,
|
|
53
|
+
Taggable,
|
|
54
|
+
HashedEntity,
|
|
55
|
+
ComputedEntityMixin,
|
|
56
|
+
HasDescription {
|
|
57
|
+
// TODO: fix ComputedEntityMixin and remove this
|
|
58
|
+
compute: WorkflowSchema["compute"];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Context passed to Workflow.render() before `workflowHasRelaxation` is injected for subworkflows. */
|
|
62
|
+
export type WorkflowRenderContext = MaterialExternalContext &
|
|
63
|
+
MaterialsExternalContext &
|
|
64
|
+
MaterialsSetExternalContext &
|
|
65
|
+
JobExternalContext;
|
|
66
|
+
|
|
67
|
+
class Workflow extends InMemoryEntity implements WorkflowSchema {
|
|
68
|
+
declare createDefault: () => Workflow;
|
|
69
|
+
|
|
70
|
+
static readonly defaultConfig = defaultWorkflowConfig;
|
|
71
|
+
|
|
72
|
+
declare _json: WorkflowSchema & AnyObject;
|
|
73
|
+
|
|
74
|
+
static get jsonSchema() {
|
|
75
|
+
return JSONSchemasInterface.getSchemaById("workflow");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
subworkflowInstances: Subworkflow[];
|
|
79
|
+
|
|
80
|
+
unitInstances!: AnyWorkflowUnit[];
|
|
81
|
+
|
|
82
|
+
workflowInstances: Workflow[];
|
|
83
|
+
|
|
84
|
+
repetition = 0;
|
|
85
|
+
|
|
86
|
+
totalRepetitions = 1;
|
|
87
|
+
|
|
88
|
+
setTotalRepetitions(totalRepetition: number) {
|
|
89
|
+
this.totalRepetitions = totalRepetition;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
setRepetition(repetition: number) {
|
|
93
|
+
this.repetition = repetition;
|
|
94
|
+
this.unitInstances.forEach((u) => u.setRepetition(repetition));
|
|
95
|
+
this.subworkflowInstances.forEach((sw) => sw.setRepetition(repetition));
|
|
96
|
+
this.workflowInstances.forEach((wf) => wf.setRepetition(repetition));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static fromSubworkflow(subworkflow: Subworkflow) {
|
|
100
|
+
const config = {
|
|
101
|
+
name: subworkflow.name,
|
|
102
|
+
subworkflows: [subworkflow.toJSON()],
|
|
103
|
+
units: [subworkflow.getAsUnit().toJSON()],
|
|
104
|
+
properties: subworkflow.properties,
|
|
105
|
+
applicationName: subworkflow.application.name,
|
|
106
|
+
workflows: [] as WorkflowSchema[],
|
|
107
|
+
};
|
|
108
|
+
return new this(config);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
constructor(config: WorkflowSchema & { applicationName?: string }) {
|
|
112
|
+
super({
|
|
113
|
+
...config,
|
|
114
|
+
_id: config._id || Utils.uuid.getUUID(),
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
this.subworkflowInstances = this.subworkflows.map((x) => new Subworkflow(x));
|
|
118
|
+
this.workflowInstances = this.workflows?.map((x) => new Workflow(x)) || [];
|
|
119
|
+
this.setUnits(this.units.map((unit) => UnitFactory.createInWorkflow(unit)));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
get workflows() {
|
|
123
|
+
return this.requiredProp<WorkflowSchema[]>("workflows");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
set workflows(value: WorkflowSchema[]) {
|
|
127
|
+
this.setProp("workflows", value);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
addSubworkflow(subworkflow: Subworkflow, head = false, index = -1) {
|
|
131
|
+
const subworkflowUnit = subworkflow.getAsUnit();
|
|
132
|
+
|
|
133
|
+
if (head) {
|
|
134
|
+
this.subworkflowInstances.unshift(subworkflow);
|
|
135
|
+
this.addUnit(subworkflowUnit, head, index);
|
|
136
|
+
} else {
|
|
137
|
+
this.subworkflowInstances.push(subworkflow);
|
|
138
|
+
this.addUnit(subworkflowUnit, head, index);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
updateMethodData(materials: Material[], metaProperties: MetaPropertyHolder[]) {
|
|
143
|
+
this.subworkflowInstances.forEach((sw) => {
|
|
144
|
+
sw.updateMethodData(materials, metaProperties);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
removeSubworkflow(id: string) {
|
|
149
|
+
const subworkflowUnit = this.unitInstances.find((u) => u.id === id);
|
|
150
|
+
|
|
151
|
+
if (subworkflowUnit) {
|
|
152
|
+
this.removeUnit(subworkflowUnit.flowchartId);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
setUnits(arr: AnyWorkflowUnit[]) {
|
|
157
|
+
this.unitInstances = setUnitLinks(arr);
|
|
158
|
+
this.units = this.unitInstances.map((u) => u.toJSON());
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A top-level subworkflow branch is represented twice: a {@link UnitType.subworkflow} unit in
|
|
163
|
+
* `unitInstances` (flowchart card) and a full {@link Subworkflow} in `subworkflowInstances`
|
|
164
|
+
* (linked by the same `id` as {@link Subworkflow.getAsUnit}). Their display names must match
|
|
165
|
+
* so `toJSON()` and editors stay consistent. Call this after mutating a subworkflow unit's
|
|
166
|
+
* `name` (and updating `unitInstances` via {@link setUnits}).
|
|
167
|
+
*/
|
|
168
|
+
syncLinkedSubworkflowNameFromUnit(unit: AnyWorkflowUnit): void {
|
|
169
|
+
if (unit.type !== UnitType.subworkflow) return;
|
|
170
|
+
const linked = this.subworkflowInstances.find((s) => s.id === unit.id);
|
|
171
|
+
linked?.setName(unit.name);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
render(context: WorkflowRenderContext) {
|
|
175
|
+
this.subworkflowInstances.forEach((sw) => {
|
|
176
|
+
sw.render({
|
|
177
|
+
...context,
|
|
178
|
+
workflowHasRelaxation: this.hasRelaxation,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
this.workflowInstances.forEach((wf) => {
|
|
182
|
+
wf.render(context);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
get usedApplications(): ApplicationSchema[] {
|
|
187
|
+
return getUsedApplications(this);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// return application names
|
|
191
|
+
get usedApplicationNames() {
|
|
192
|
+
return this.usedApplications.map((a) => a.name);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
get usedApplicationVersions() {
|
|
196
|
+
return this.usedApplications.map((a) => a.version);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
get usedApplicationNamesWithVersions() {
|
|
200
|
+
return this.usedApplications.map((a) => `${a.name} ${a.version}`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
getUsedModels() {
|
|
204
|
+
return getUsedModels(this);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
getHumanReadableUsedModels() {
|
|
208
|
+
return getHumanReadableUsedModels(this);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
toJSON(): WorkflowSchema & AnyObject {
|
|
212
|
+
return {
|
|
213
|
+
...super.toJSON(),
|
|
214
|
+
name: this.name,
|
|
215
|
+
properties: getProperties(this),
|
|
216
|
+
units: this.unitInstances.map((x) => x.toJSON()),
|
|
217
|
+
subworkflows: this.subworkflowInstances.map((x) => x.toJSON()),
|
|
218
|
+
workflows: this.workflowInstances.map((x) => x.toJSON()),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
getHumanReadableProperties() {
|
|
223
|
+
return getHumanReadableProperties(this);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
getProperties() {
|
|
227
|
+
return getProperties(this);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
getSystemName() {
|
|
231
|
+
return getSystemName(this);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
getDefaultDescription() {
|
|
235
|
+
return getDefaultDescription(this);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
private addUnit(unit: AnyWorkflowUnit, head = false, index = -1) {
|
|
239
|
+
const [...unitInstances] = this.unitInstances;
|
|
240
|
+
|
|
241
|
+
if (unitInstances.length === 0) {
|
|
242
|
+
this.setUnits([unit]);
|
|
243
|
+
} else {
|
|
244
|
+
if (head) {
|
|
245
|
+
unitInstances.unshift(unit);
|
|
246
|
+
} else if (index >= 0) {
|
|
247
|
+
unitInstances.splice(index, 0, unit);
|
|
248
|
+
} else {
|
|
249
|
+
unitInstances.push(unit);
|
|
250
|
+
}
|
|
251
|
+
this.setUnits(unitInstances);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
removeUnit(flowchartId: string) {
|
|
256
|
+
if (this.units.length < 2) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const unit = this.unitInstances.find((x) => x.flowchartId === flowchartId);
|
|
261
|
+
if (!unit) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const previousUnit = this.unitInstances.find((x) => x.next === unit.flowchartId);
|
|
266
|
+
if (previousUnit) {
|
|
267
|
+
delete previousUnit.next;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
this.subworkflowInstances = this.subworkflowInstances.filter((x) => x.id !== unit.id);
|
|
271
|
+
|
|
272
|
+
this.setUnits(this.unitInstances.filter((x) => x.flowchartId !== flowchartId));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/*
|
|
276
|
+
* @param type {String|Object} Unit type, map or subworkflow
|
|
277
|
+
* @param head {Boolean}
|
|
278
|
+
* @param index {Number} Index at which the unit will be added. -1 by default (ignored).
|
|
279
|
+
*/
|
|
280
|
+
addUnitType(type: UnitType, head = false, index = -1) {
|
|
281
|
+
switch (type) {
|
|
282
|
+
case UnitType.map: {
|
|
283
|
+
const mapWorkflowConfig = {
|
|
284
|
+
...defaultWorkflowConfig,
|
|
285
|
+
_id: Utils.uuid.getUUID(),
|
|
286
|
+
};
|
|
287
|
+
const mapUnit = new MapUnit({
|
|
288
|
+
workflowId: mapWorkflowConfig._id,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
this.workflows = [...(this.workflows || []), mapWorkflowConfig];
|
|
292
|
+
this.workflowInstances = this.workflows.map((x) => new Workflow(x));
|
|
293
|
+
|
|
294
|
+
this.addUnit(mapUnit, head, index);
|
|
295
|
+
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
case UnitType.subworkflow:
|
|
299
|
+
this.addSubworkflow(Subworkflow.createDefault(), head, index);
|
|
300
|
+
break;
|
|
301
|
+
default:
|
|
302
|
+
console.log(`unit_type=${type} unrecognized, skipping.`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
addMapUnit(mapUnit: MapUnit, mapWorkflow: Workflow) {
|
|
307
|
+
const mapWorkflowConfig = {
|
|
308
|
+
_id: Utils.uuid.getUUID(),
|
|
309
|
+
...mapWorkflow.toJSON(),
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
mapUnit.setWorkflowId(mapWorkflowConfig._id);
|
|
313
|
+
this.addUnit(mapUnit);
|
|
314
|
+
|
|
315
|
+
this.workflows = [...(this.workflows || []), mapWorkflowConfig];
|
|
316
|
+
this.workflowInstances = this.workflows.map((x) => new Workflow(x));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
get allSubworkflows() {
|
|
320
|
+
const subworkflowsList: Subworkflow[] = [];
|
|
321
|
+
this.subworkflowInstances.forEach((sw) => subworkflowsList.push(sw));
|
|
322
|
+
this.workflowInstances.forEach((workflow) => {
|
|
323
|
+
return Array.prototype.push.apply(subworkflowsList, workflow.allSubworkflows);
|
|
324
|
+
});
|
|
325
|
+
return subworkflowsList;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
get hasRelaxation() {
|
|
329
|
+
return Boolean(this.getRelaxationSubworkflow());
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
toggleRelaxation() {
|
|
333
|
+
const relaxSubworkflow = this.getRelaxationSubworkflow();
|
|
334
|
+
if (relaxSubworkflow?._id) {
|
|
335
|
+
this.removeSubworkflow(relaxSubworkflow._id);
|
|
336
|
+
} else {
|
|
337
|
+
const vcRelax = this.getStandataRelaxationSubworkflow();
|
|
338
|
+
if (vcRelax) {
|
|
339
|
+
this.addSubworkflow(new Subworkflow(vcRelax), true);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
getHashObject() {
|
|
345
|
+
return {
|
|
346
|
+
units: this.unitInstances.map((u) => u.calculateHash()).join(),
|
|
347
|
+
subworkflows: this.subworkflowInstances.map((sw) => sw.calculateHash()).join(),
|
|
348
|
+
workflows: this.workflowInstances.map((w) => w.calculateHash()).join(),
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
private getStandataRelaxationSubworkflow() {
|
|
353
|
+
// TODO: fix standata type
|
|
354
|
+
const subworkflow = new SubworkflowStandata().getRelaxationSubworkflowByApplication(
|
|
355
|
+
this.subworkflowInstances[0].application.name,
|
|
356
|
+
) as unknown as SubworkflowSchema | undefined;
|
|
357
|
+
|
|
358
|
+
if (!subworkflow) {
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const executionUnit = subworkflow.units.find((unit) => unit.type === UnitType.execution);
|
|
363
|
+
if (!executionUnit) {
|
|
364
|
+
throw new Error("Relaxation subworkflow is missing an execution unit");
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return {
|
|
368
|
+
...subworkflow,
|
|
369
|
+
application: executionUnit.application,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
private getRelaxationSubworkflow() {
|
|
374
|
+
const standataSubworkflow = this.getStandataRelaxationSubworkflow();
|
|
375
|
+
|
|
376
|
+
return this.subworkflowInstances.find((sw) => {
|
|
377
|
+
return standataSubworkflow && standataSubworkflow.systemName === sw.systemName;
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
namedEntityMixin(Workflow.prototype);
|
|
383
|
+
workflowSchemaMixin(Workflow.prototype);
|
|
384
|
+
taggableMixin(Workflow.prototype);
|
|
385
|
+
computedEntityMixin(Workflow.prototype);
|
|
386
|
+
defaultableEntityMixin(Workflow);
|
|
387
|
+
hashedEntityMixin(Workflow.prototype);
|
|
388
|
+
hasDescriptionMixin(Workflow.prototype);
|
|
389
|
+
|
|
390
|
+
export default Workflow;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ApplicationSchema } from "@mat3ra/esse/dist/js/types";
|
|
2
|
+
|
|
3
|
+
import type ContextProvider from "../providers/base/ContextProvider";
|
|
4
|
+
|
|
5
|
+
export type ApplicationContextMixin = {
|
|
6
|
+
application: ApplicationSchema;
|
|
7
|
+
initApplicationContextMixin(externalContext: ApplicationExternalContext): void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ApplicationExternalContext = { application: ApplicationSchema };
|
|
11
|
+
|
|
12
|
+
export default function applicationContextMixin(item: ContextProvider) {
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
const properties: ContextProvider & ApplicationContextMixin = {
|
|
15
|
+
initApplicationContextMixin(externalContext: ApplicationExternalContext) {
|
|
16
|
+
this.application = externalContext.application;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { OrderedInMemoryEntityInSet } from "@mat3ra/code/dist/js/entity/set/ordered/OrderedInMemoryEntityInSetMixin";
|
|
2
|
+
import { Material } from "@mat3ra/made/dist/js/material";
|
|
3
|
+
|
|
4
|
+
import type ContextProvider from "../providers/base/ContextProvider";
|
|
5
|
+
|
|
6
|
+
export type OrderedMaterial = OrderedInMemoryEntityInSet & Material;
|
|
7
|
+
|
|
8
|
+
export type MaterialContextMixin = {
|
|
9
|
+
readonly isMaterialCreatedDefault: boolean;
|
|
10
|
+
readonly isMaterialUpdated: boolean;
|
|
11
|
+
material: OrderedMaterial;
|
|
12
|
+
extraData?: { materialHash: string };
|
|
13
|
+
initMaterialContextMixin(externalContext: MaterialExternalContext): void;
|
|
14
|
+
updateMaterialHash(): void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type MaterialExternalContext = {
|
|
18
|
+
material: OrderedMaterial;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default function materialContextMixin(item: ContextProvider) {
|
|
22
|
+
// @ts-expect-error
|
|
23
|
+
const properties: ContextProvider & MaterialContextMixin = {
|
|
24
|
+
updateMaterialHash() {
|
|
25
|
+
this.extraData = { materialHash: this.material.hash };
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
initMaterialContextMixin(externalContext: MaterialExternalContext) {
|
|
29
|
+
this.material = externalContext.material;
|
|
30
|
+
this.updateMaterialHash();
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type ContextProvider from "../providers/base/ContextProvider";
|
|
2
|
+
import type { OrderedMaterial } from "./MaterialContextMixin";
|
|
3
|
+
|
|
4
|
+
export type MaterialsContextMixin = {
|
|
5
|
+
materials: OrderedMaterial[];
|
|
6
|
+
initMaterialsContextMixin(externalContext: MaterialsExternalContext): void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type MaterialsExternalContext = {
|
|
10
|
+
materials: OrderedMaterial[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default function materialsContextMixin(item: ContextProvider) {
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
const properties: ContextProvider & MaterialsContextMixin = {
|
|
16
|
+
materials: [],
|
|
17
|
+
|
|
18
|
+
initMaterialsContextMixin(externalContext: MaterialsExternalContext) {
|
|
19
|
+
this.materials = externalContext.materials;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { compareEntitiesInOrderedSetForSorting } from "@mat3ra/code/dist/js/entity/set/ordered/utils";
|
|
2
|
+
|
|
3
|
+
import type ContextProvider from "../providers/base/ContextProvider";
|
|
4
|
+
import type { OrderedMaterial } from "./MaterialContextMixin";
|
|
5
|
+
|
|
6
|
+
export type MaterialsSet = {
|
|
7
|
+
_id: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type MaterialsSetExternalContext = {
|
|
11
|
+
materialsSet?: MaterialsSet;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type MaterialsSetContextMixin = {
|
|
15
|
+
materialsSet?: MaterialsSet;
|
|
16
|
+
initMaterialsSetContextMixin(externalContext: MaterialsSetExternalContext): void;
|
|
17
|
+
sortMaterialsByIndexInSet(materials?: OrderedMaterial[]): OrderedMaterial[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default function materialsSetContextMixin(item: ContextProvider) {
|
|
21
|
+
// @ts-expect-error
|
|
22
|
+
const properties: ContextProvider & MaterialsSetContextMixin = {
|
|
23
|
+
initMaterialsSetContextMixin(externalContext: MaterialsSetExternalContext) {
|
|
24
|
+
this.materialsSet = externalContext.materialsSet;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
sortMaterialsByIndexInSet(materials: OrderedMaterial[] = []) {
|
|
28
|
+
const { materialsSet } = this;
|
|
29
|
+
|
|
30
|
+
if (!materialsSet) {
|
|
31
|
+
return materials;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// DO NOT SORT IN PLACE AS IT CHANGES THE ORDER IN `this.materials` AND HAS SIDE EFFECTS (MaterialViewer).
|
|
35
|
+
return [...materials].sort((a, b) => {
|
|
36
|
+
return compareEntitiesInOrderedSetForSorting(a, b, materialsSet._id, false);
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
|
|
42
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
|
|
2
|
+
import type { JSONSchema } from "@mat3ra/esse/dist/js/esse/utils";
|
|
3
|
+
import type {
|
|
4
|
+
BoundaryConditionsContextItemSchema,
|
|
5
|
+
MaterialMetadataBoundaryConditions,
|
|
6
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
7
|
+
|
|
8
|
+
import materialContextMixin, {
|
|
9
|
+
type MaterialContextMixin,
|
|
10
|
+
type MaterialExternalContext,
|
|
11
|
+
} from "../mixins/MaterialContextMixin";
|
|
12
|
+
import type { UnitContext } from "./base/ContextProvider";
|
|
13
|
+
import JSONSchemaDataProvider, { type JinjaExternalContext } from "./base/JSONSchemaDataProvider";
|
|
14
|
+
|
|
15
|
+
type Schema = BoundaryConditionsContextItemSchema;
|
|
16
|
+
type ExternalContext = JinjaExternalContext & MaterialExternalContext;
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
19
|
+
interface BoundaryConditionsFormDataManager extends MaterialContextMixin {}
|
|
20
|
+
|
|
21
|
+
const jsonSchemaId = "context-providers-directory/boundary-conditions-data-provider";
|
|
22
|
+
|
|
23
|
+
// TODO: move to esse
|
|
24
|
+
enum BoundaryConditionsType {
|
|
25
|
+
pbc = "pbc",
|
|
26
|
+
bc1 = "bc1",
|
|
27
|
+
bc2 = "bc2",
|
|
28
|
+
bc3 = "bc3",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class BoundaryConditionsFormDataManager extends JSONSchemaDataProvider<Schema, ExternalContext> {
|
|
32
|
+
readonly name = "boundaryConditions" as const;
|
|
33
|
+
|
|
34
|
+
readonly domain = "important" as const;
|
|
35
|
+
|
|
36
|
+
readonly entityName = "unit" as const;
|
|
37
|
+
|
|
38
|
+
static createFromUnitContext(unitContext: UnitContext, externalContext: ExternalContext) {
|
|
39
|
+
const contextItem = this.findContextItem<Schema>(unitContext, "boundaryConditions");
|
|
40
|
+
|
|
41
|
+
return new BoundaryConditionsFormDataManager(contextItem, externalContext);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
readonly humanName = "Boundary Conditions" as const;
|
|
45
|
+
|
|
46
|
+
readonly uiSchema = {
|
|
47
|
+
type: { "ui:disabled": true },
|
|
48
|
+
offset: { "ui:disabled": true },
|
|
49
|
+
electricField: {},
|
|
50
|
+
targetFermiEnergy: {},
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
constructor(contextItem: Partial<Schema>, externalContext: ExternalContext) {
|
|
54
|
+
super(contextItem, externalContext);
|
|
55
|
+
this.initMaterialContextMixin(externalContext);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getDefaultData(): Schema["data"] {
|
|
59
|
+
const metadata = this.material?.metadata as MaterialMetadataBoundaryConditions | undefined;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
type: metadata?.boundaryConditions?.type || BoundaryConditionsType.pbc,
|
|
63
|
+
offset: metadata?.boundaryConditions?.offset || 0,
|
|
64
|
+
electricField: 0,
|
|
65
|
+
targetFermiEnergy: 0,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get jsonSchema(): JSONSchema {
|
|
70
|
+
const defaults = this.getDefaultData();
|
|
71
|
+
const jsonSchema = JSONSchemasInterface.getPatchedSchemaById(jsonSchemaId, {
|
|
72
|
+
type: { default: defaults.type },
|
|
73
|
+
offset: { default: defaults.offset },
|
|
74
|
+
electricField: { default: defaults.electricField },
|
|
75
|
+
targetFermiEnergy: { default: defaults.targetFermiEnergy },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (!jsonSchema) {
|
|
79
|
+
throw new Error("Failed to get patched JSON schema");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return jsonSchema;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
materialContextMixin(BoundaryConditionsFormDataManager.prototype);
|
|
87
|
+
|
|
88
|
+
export default BoundaryConditionsFormDataManager;
|