@mat3ra/wode 2026.8.26-1 → 2026.8.27-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.
@@ -8,7 +8,7 @@ import { type ComputedEntityMixin } from "@mat3ra/ide/dist/js/compute";
8
8
  import type { Material } from "@mat3ra/made";
9
9
  import { Model, ModelFactory } from "@mat3ra/mode";
10
10
  import type { MetaPropertyHolder } from "@mat3ra/prode";
11
- import type { WorkflowExternalContext } from "./context/providers/by_application/espresso/QEPWXInputDataManager";
11
+ import type { WorkflowExternalContext } from "./context/providers/base/ContextProvider";
12
12
  import { type SubworkflowSchemaMixin } from "./generated/SubworkflowSchemaMixin";
13
13
  import { SubworkflowUnit } from "./units";
14
14
  import type { AnySubworkflowUnit } from "./units/factory";
@@ -11,7 +11,7 @@ import type { MetaPropertyHolder } from "@mat3ra/prode";
11
11
  import type { MaterialExternalContext } from "./context/mixins/MaterialContextMixin";
12
12
  import type { MaterialsExternalContext } from "./context/mixins/MaterialsContextMixin";
13
13
  import type { MaterialsSetExternalContext } from "./context/mixins/MaterialsSetContextMixin";
14
- import type { JobExternalContext } from "./context/providers/by_application/espresso/QEPWXInputDataManager";
14
+ import type { JobExternalContext } from "./context/providers/base/ContextProvider";
15
15
  import { UnitType } from "./enums";
16
16
  import { type WorkflowSchemaMixin } from "./generated/WorkflowSchemaMixin";
17
17
  import Subworkflow from "./Subworkflow";
@@ -16,6 +16,13 @@ export type Domain = "executable" | "important";
16
16
  export type EntityName = "unit" | "subworkflow";
17
17
  /** Minimal bound for provider external context; the full contract is ExternalContext in context/providers/index.ts */
18
18
  export type BaseExternalContext = object;
19
+ /** Application-agnostic external context, set by Workflow / Subworkflow for any provider to consume. */
20
+ export type JobExternalContext = {
21
+ jobHasParent: boolean;
22
+ };
23
+ export type WorkflowExternalContext = {
24
+ workflowHasRelaxation: boolean;
25
+ };
19
26
  /**
20
27
  * Context providers expose three data layers. Keep them separate.
21
28
  *
@@ -3,9 +3,9 @@ import type { JSONSchema7 } from "json-schema";
3
3
  import { type MaterialContextMixin, type MaterialExternalContext } from "../../../mixins/MaterialContextMixin";
4
4
  import { type MaterialsContextMixin, type MaterialsExternalContext } from "../../../mixins/MaterialsContextMixin";
5
5
  import { type MaterialsSetContextMixin, type MaterialsSetExternalContext } from "../../../mixins/MaterialsSetContextMixin";
6
- import type { UnitContext } from "../../base/ContextProvider";
6
+ import type { JobExternalContext, UnitContext, WorkflowExternalContext } from "../../base/ContextProvider";
7
7
  import JSONSchemaDataProvider, { type JinjaExternalContext } from "../../base/JSONSchemaDataProvider";
8
- import { type JobExternalContext, type MethodDataExternalContext, type WorkflowExternalContext } from "./QEPWXInputDataManager";
8
+ import { type MethodDataExternalContext } from "./QEPWXInputDataManager";
9
9
  type Data = QENEBContextProviderSchema;
10
10
  type Schema = InputContextItemSchema & {
11
11
  data: Data;
@@ -3,7 +3,7 @@ import type { AtomicElementValue } from "@mat3ra/made/dist/js/basis/elements";
3
3
  import type { JSONSchema7 } from "json-schema";
4
4
  import { type MaterialContextMixin, type MaterialExternalContext } from "../../../mixins/MaterialContextMixin";
5
5
  import { type MaterialsContextMixin, type MaterialsExternalContext } from "../../../mixins/MaterialsContextMixin";
6
- import type { UnitContext } from "../../base/ContextProvider";
6
+ import type { JobExternalContext, UnitContext, WorkflowExternalContext } from "../../base/ContextProvider";
7
7
  import JSONSchemaDataProvider, { type JinjaExternalContext } from "../../base/JSONSchemaDataProvider";
8
8
  type MethodData = BaseMethod["data"] & {
9
9
  pseudo?: {
@@ -15,12 +15,6 @@ type MethodData = BaseMethod["data"] & {
15
15
  export type MethodDataExternalContext = {
16
16
  methodData?: MethodData;
17
17
  };
18
- export type JobExternalContext = {
19
- jobHasParent: boolean;
20
- };
21
- export type WorkflowExternalContext = {
22
- workflowHasRelaxation: boolean;
23
- };
24
18
  type Data = QEPwxContextProviderSchema;
25
19
  type Schema = InputContextItemSchema & {
26
20
  data: Data;
@@ -1,13 +1,13 @@
1
1
  import type { InputContextItemSchema, NWChemTotalEnergyContextProviderSchema } from "@mat3ra/esse/dist/js/types";
2
2
  import type { JSONSchema7 } from "json-schema";
3
3
  import { type MaterialContextMixin, type MaterialExternalContext } from "../../../mixins/MaterialContextMixin";
4
- import type { UnitContext } from "../../base/ContextProvider";
4
+ import type { JobExternalContext, UnitContext, WorkflowExternalContext } from "../../base/ContextProvider";
5
5
  import JSONSchemaDataProvider, { type JinjaExternalContext } from "../../base/JSONSchemaDataProvider";
6
6
  type Data = NWChemTotalEnergyContextProviderSchema;
7
7
  type Schema = InputContextItemSchema & {
8
8
  data: Data;
9
9
  };
10
- type ExternalContext = JinjaExternalContext & MaterialExternalContext;
10
+ type ExternalContext = JinjaExternalContext & MaterialExternalContext & WorkflowExternalContext & JobExternalContext;
11
11
  interface NWChemInputDataManager extends MaterialContextMixin {
12
12
  }
13
13
  declare class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, ExternalContext> {
@@ -15,6 +15,7 @@ declare class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, Exte
15
15
  readonly domain: "executable";
16
16
  readonly entityName: "unit";
17
17
  isEdited: boolean;
18
+ workflowHasRelaxation: boolean;
18
19
  static createFromUnitContext(unitContext: UnitContext, externalContext: ExternalContext): NWChemInputDataManager;
19
20
  readonly contextProviderName: "nwchem-total-energy";
20
21
  readonly jsonSchema: JSONSchema7;
@@ -30,6 +31,7 @@ declare class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, Exte
30
31
  ATOMIC_SPECIES: string;
31
32
  FUNCTIONAL: string;
32
33
  CARTESIAN: boolean;
34
+ RESTART: boolean;
33
35
  contextProviderName: "nwchem-total-energy";
34
36
  };
35
37
  }
@@ -21,6 +21,7 @@ class NWChemInputDataManager extends JSONSchemaDataProvider_1.default {
21
21
  this.isEdited = false;
22
22
  this.contextProviderName = "nwchem-total-energy";
23
23
  this.initMaterialContextMixin(externalContext);
24
+ this.workflowHasRelaxation = externalContext.workflowHasRelaxation;
24
25
  const jsonSchema = JSONSchemasInterface_1.default.getSchemaById(jsonSchemaId);
25
26
  if (!jsonSchema) {
26
27
  throw new Error("Failed to get JSON schema");
@@ -32,6 +33,7 @@ class NWChemInputDataManager extends JSONSchemaDataProvider_1.default {
32
33
  */
33
34
  getDefaultData() {
34
35
  const basis = this.material.getBasis();
36
+ const { workflowHasRelaxation } = this;
35
37
  const NTYP = basis.uniqueElements.length;
36
38
  const ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS = basis.atomicPositions.join("\n") || "";
37
39
  const ATOMIC_SPECIES = basis.uniqueElements
@@ -50,6 +52,12 @@ class NWChemInputDataManager extends JSONSchemaDataProvider_1.default {
50
52
  ATOMIC_SPECIES,
51
53
  FUNCTIONAL: "B3LYP",
52
54
  CARTESIAN: basis.toCartesian !== undefined,
55
+ // Continue from the previous unit's RTDB, which carries its optimized geometry. Units of
56
+ // one job share a work_dir, so nwchem.db is already there. Deliberately NOT
57
+ // `jobHasParent || ...` as espresso does: rupy's nwchem prepare_restart symlinks only the
58
+ // parent's perm/, while nwchem.db sits at the work-dir root, so a child job would render
59
+ // `restart` with no database to restart from.
60
+ RESTART: Boolean(workflowHasRelaxation),
53
61
  contextProviderName: this.contextProviderName,
54
62
  };
55
63
  }
@@ -3,11 +3,11 @@ import type { ApplicationExternalContext } from "../mixins/ApplicationContextMix
3
3
  import type { MaterialExternalContext } from "../mixins/MaterialContextMixin";
4
4
  import type { MaterialsExternalContext } from "../mixins/MaterialsContextMixin";
5
5
  import type { MaterialsSetExternalContext } from "../mixins/MaterialsSetContextMixin";
6
- import type { UnitContext } from "./base/ContextProvider";
6
+ import type { JobExternalContext, UnitContext, WorkflowExternalContext } from "./base/ContextProvider";
7
7
  import type { JinjaExternalContext } from "./base/JSONSchemaDataProvider";
8
8
  import BoundaryConditionsFormDataManager from "./BoundaryConditionsFormDataManager";
9
9
  import QENEBInputDataManager from "./by_application/espresso/QENEBInputDataManager";
10
- import QEPWXInputDataManager, { type JobExternalContext, type MethodDataExternalContext, type WorkflowExternalContext } from "./by_application/espresso/QEPWXInputDataManager";
10
+ import QEPWXInputDataManager, { type MethodDataExternalContext } from "./by_application/espresso/QEPWXInputDataManager";
11
11
  import NWChemInputDataManager from "./by_application/nwchem/NWChemInputDataManager";
12
12
  import VASPInputDataManager from "./by_application/vasp/VASPInputDataManager";
13
13
  import VASPNEBInputDataManager from "./by_application/vasp/VASPNEBInputDataManager";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mat3ra/wode",
3
- "version": "2026.8.26-1",
3
+ "version": "2026.8.27-0",
4
4
  "description": "WOrkflow DEfinitions",
5
5
  "scripts": {
6
6
  "test": "mocha --recursive --bail --require ts-node/register 'tests/js/**/*.ts'",
@@ -27,7 +27,7 @@ import { ApplicationRegistry, setUnitLinks } from "@mat3ra/standata";
27
27
  import { Utils } from "@mat3ra/utils";
28
28
 
29
29
  import type { AssignmentContext, ExternalContext } from "./context/providers";
30
- import type { WorkflowExternalContext } from "./context/providers/by_application/espresso/QEPWXInputDataManager";
30
+ import type { WorkflowExternalContext } from "./context/providers/base/ContextProvider";
31
31
  import { createConvergenceParameter } from "./convergence/factory";
32
32
  import { UnitTag, UnitType } from "./enums";
33
33
  import {
@@ -31,7 +31,7 @@ import { Utils } from "@mat3ra/utils";
31
31
  import type { MaterialExternalContext } from "./context/mixins/MaterialContextMixin";
32
32
  import type { MaterialsExternalContext } from "./context/mixins/MaterialsContextMixin";
33
33
  import type { MaterialsSetExternalContext } from "./context/mixins/MaterialsSetContextMixin";
34
- import type { JobExternalContext } from "./context/providers/by_application/espresso/QEPWXInputDataManager";
34
+ import type { JobExternalContext } from "./context/providers/base/ContextProvider";
35
35
  import { UnitType } from "./enums";
36
36
  import { type WorkflowSchemaMixin, workflowSchemaMixin } from "./generated/WorkflowSchemaMixin";
37
37
  import Subworkflow from "./Subworkflow";
@@ -30,6 +30,15 @@ export type EntityName = "unit" | "subworkflow";
30
30
  /** Minimal bound for provider external context; the full contract is ExternalContext in context/providers/index.ts */
31
31
  export type BaseExternalContext = object;
32
32
 
33
+ /** Application-agnostic external context, set by Workflow / Subworkflow for any provider to consume. */
34
+ export type JobExternalContext = {
35
+ jobHasParent: boolean;
36
+ };
37
+
38
+ export type WorkflowExternalContext = {
39
+ workflowHasRelaxation: boolean;
40
+ };
41
+
33
42
  const nunjucksEnvironment = setupNunjucksEnvironment(new nunjucks.Environment());
34
43
 
35
44
  const parseNumericStrings = (_key: string, value: unknown) => {
@@ -17,15 +17,15 @@ import materialsSetContextMixin, {
17
17
  type MaterialsSetContextMixin,
18
18
  type MaterialsSetExternalContext,
19
19
  } from "../../../mixins/MaterialsSetContextMixin";
20
- import type { UnitContext } from "../../base/ContextProvider";
20
+ import type {
21
+ JobExternalContext,
22
+ UnitContext,
23
+ WorkflowExternalContext,
24
+ } from "../../base/ContextProvider";
21
25
  import JSONSchemaDataProvider, {
22
26
  type JinjaExternalContext,
23
27
  } from "../../base/JSONSchemaDataProvider";
24
- import QEPWXInputDataManager, {
25
- type JobExternalContext,
26
- type MethodDataExternalContext,
27
- type WorkflowExternalContext,
28
- } from "./QEPWXInputDataManager";
28
+ import QEPWXInputDataManager, { type MethodDataExternalContext } from "./QEPWXInputDataManager";
29
29
 
30
30
  const jsonSchemaId = "context-providers-directory/by-application/qe-neb-context-provider";
31
31
 
@@ -18,7 +18,11 @@ import materialsContextMixin, {
18
18
  type MaterialsContextMixin,
19
19
  type MaterialsExternalContext,
20
20
  } from "../../../mixins/MaterialsContextMixin";
21
- import type { UnitContext } from "../../base/ContextProvider";
21
+ import type {
22
+ JobExternalContext,
23
+ UnitContext,
24
+ WorkflowExternalContext,
25
+ } from "../../base/ContextProvider";
22
26
  import JSONSchemaDataProvider, {
23
27
  type JinjaExternalContext,
24
28
  } from "../../base/JSONSchemaDataProvider";
@@ -32,14 +36,6 @@ export type MethodDataExternalContext = {
32
36
  methodData?: MethodData;
33
37
  };
34
38
 
35
- export type JobExternalContext = {
36
- jobHasParent: boolean;
37
- };
38
-
39
- export type WorkflowExternalContext = {
40
- workflowHasRelaxation: boolean;
41
- };
42
-
43
39
  type Data = QEPwxContextProviderSchema;
44
40
  type Schema = InputContextItemSchema & { data: Data };
45
41
  type ExternalContext = JinjaExternalContext &
@@ -10,14 +10,21 @@ import materialContextMixin, {
10
10
  type MaterialContextMixin,
11
11
  type MaterialExternalContext,
12
12
  } from "../../../mixins/MaterialContextMixin";
13
- import type { UnitContext } from "../../base/ContextProvider";
13
+ import type {
14
+ JobExternalContext,
15
+ UnitContext,
16
+ WorkflowExternalContext,
17
+ } from "../../base/ContextProvider";
14
18
  import JSONSchemaDataProvider, {
15
19
  type JinjaExternalContext,
16
20
  } from "../../base/JSONSchemaDataProvider";
17
21
 
18
22
  type Data = NWChemTotalEnergyContextProviderSchema;
19
23
  type Schema = InputContextItemSchema & { data: Data };
20
- type ExternalContext = JinjaExternalContext & MaterialExternalContext;
24
+ type ExternalContext = JinjaExternalContext &
25
+ MaterialExternalContext &
26
+ WorkflowExternalContext &
27
+ JobExternalContext;
21
28
 
22
29
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
23
30
  interface NWChemInputDataManager extends MaterialContextMixin {}
@@ -34,6 +41,8 @@ class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, ExternalCont
34
41
 
35
42
  isEdited = false;
36
43
 
44
+ workflowHasRelaxation: boolean;
45
+
37
46
  static createFromUnitContext(unitContext: UnitContext, externalContext: ExternalContext) {
38
47
  const contextItem = this.findContextItem<Schema>(unitContext, "input");
39
48
 
@@ -48,6 +57,8 @@ class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, ExternalCont
48
57
  super(config, externalContext);
49
58
  this.initMaterialContextMixin(externalContext);
50
59
 
60
+ this.workflowHasRelaxation = externalContext.workflowHasRelaxation;
61
+
51
62
  const jsonSchema = JSONSchemasInterface.getSchemaById(jsonSchemaId);
52
63
 
53
64
  if (!jsonSchema) {
@@ -62,6 +73,7 @@ class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, ExternalCont
62
73
  */
63
74
  getDefaultData() {
64
75
  const basis = this.material.getBasis();
76
+ const { workflowHasRelaxation } = this;
65
77
 
66
78
  const NTYP = basis.uniqueElements.length;
67
79
  const ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS = basis.atomicPositions.join("\n") || "";
@@ -83,6 +95,12 @@ class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, ExternalCont
83
95
  ATOMIC_SPECIES,
84
96
  FUNCTIONAL: "B3LYP",
85
97
  CARTESIAN: basis.toCartesian !== undefined,
98
+ // Continue from the previous unit's RTDB, which carries its optimized geometry. Units of
99
+ // one job share a work_dir, so nwchem.db is already there. Deliberately NOT
100
+ // `jobHasParent || ...` as espresso does: rupy's nwchem prepare_restart symlinks only the
101
+ // parent's perm/, while nwchem.db sits at the work-dir root, so a child job would render
102
+ // `restart` with no database to restart from.
103
+ RESTART: Boolean(workflowHasRelaxation),
86
104
  contextProviderName: this.contextProviderName,
87
105
  };
88
106
  }
@@ -4,14 +4,16 @@ import type { ApplicationExternalContext } from "../mixins/ApplicationContextMix
4
4
  import type { MaterialExternalContext } from "../mixins/MaterialContextMixin";
5
5
  import type { MaterialsExternalContext } from "../mixins/MaterialsContextMixin";
6
6
  import type { MaterialsSetExternalContext } from "../mixins/MaterialsSetContextMixin";
7
- import type { UnitContext } from "./base/ContextProvider";
7
+ import type {
8
+ JobExternalContext,
9
+ UnitContext,
10
+ WorkflowExternalContext,
11
+ } from "./base/ContextProvider";
8
12
  import type { JinjaExternalContext } from "./base/JSONSchemaDataProvider";
9
13
  import BoundaryConditionsFormDataManager from "./BoundaryConditionsFormDataManager";
10
14
  import QENEBInputDataManager from "./by_application/espresso/QENEBInputDataManager";
11
15
  import QEPWXInputDataManager, {
12
- type JobExternalContext,
13
16
  type MethodDataExternalContext,
14
- type WorkflowExternalContext,
15
17
  } from "./by_application/espresso/QEPWXInputDataManager";
16
18
  import NWChemInputDataManager from "./by_application/nwchem/NWChemInputDataManager";
17
19
  import VASPInputDataManager from "./by_application/vasp/VASPInputDataManager";