@mat3ra/wode 2026.7.29-1 → 2026.8.13-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/dist/js/Subworkflow.d.ts +21 -20
- package/dist/js/Subworkflow.js +8 -7
- package/dist/js/Workflow.d.ts +11 -10
- package/dist/js/Workflow.js +7 -3
- package/dist/js/context/mixins/MaterialContextMixin.d.ts +1 -4
- package/dist/js/context/providers/CollinearMagnetizationDataManager.js +1 -1
- package/dist/js/context/providers/Hubbard/HubbardContextProvider.d.ts +6 -4
- package/dist/js/context/providers/Hubbard/HubbardContextProvider.js +12 -7
- package/dist/js/context/providers/NonCollinearMagnetizationDataManager.js +1 -1
- package/dist/js/context/providers/PointsGrid/PointsGridFormDataProvider.d.ts +6 -4
- package/dist/js/context/providers/PointsGrid/PointsGridFormDataProvider.js +10 -5
- package/dist/js/context/providers/PointsPath/PointsPathFormDataProvider.d.ts +3 -4
- package/dist/js/context/providers/PointsPath/PointsPathFormDataProvider.js +3 -2
- package/dist/js/context/providers/by_application/espresso/QEPWXInputDataManager.js +2 -1
- package/dist/js/context/providers/by_application/nwchem/NWChemInputDataManager.js +1 -1
- package/dist/js/generated/AssertionUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/AssignmentUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/BaseUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/BaseUnitSchemaMixin.js +6 -18
- package/dist/js/generated/ConditionUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ErrorUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ExecutionUnitInputSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ExecutionUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/IOUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/MapUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ReduceUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/StatusTrackSchemaMixin.d.ts +5 -0
- package/dist/js/generated/{StatusSchemaMixin.js → StatusTrackSchemaMixin.js} +2 -8
- package/dist/js/generated/SubworkflowSchemaMixin.d.ts +2 -2
- package/dist/js/generated/SubworkflowUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/WorkflowSchemaMixin.d.ts +2 -2
- package/dist/js/units/AssertionUnit.d.ts +4 -7
- package/dist/js/units/AssignmentUnit.d.ts +4 -7
- package/dist/js/units/BaseUnit.d.ts +13 -12
- package/dist/js/units/BaseUnit.js +14 -11
- package/dist/js/units/ConditionUnit.d.ts +4 -7
- package/dist/js/units/ErrorUnit.d.ts +4 -7
- package/dist/js/units/ExecutionUnit.d.ts +4 -7
- package/dist/js/units/ExecutionUnit.js +6 -6
- package/dist/js/units/ExecutionUnitInput.d.ts +3 -7
- package/dist/js/units/IOUnit.d.ts +4 -7
- package/dist/js/units/MapUnit.d.ts +4 -7
- package/dist/js/units/MapUnit.js +1 -1
- package/dist/js/units/ReduceUnit.d.ts +4 -7
- package/dist/js/units/SubworkflowUnit.d.ts +4 -7
- package/package.json +8 -9
- package/src/js/Subworkflow.ts +42 -32
- package/src/js/Workflow.ts +28 -16
- package/src/js/context/mixins/MaterialContextMixin.ts +1 -2
- package/src/js/context/providers/CollinearMagnetizationDataManager.ts +1 -1
- package/src/js/context/providers/Hubbard/HubbardContextProvider.ts +17 -8
- package/src/js/context/providers/NonCollinearMagnetizationDataManager.ts +1 -1
- package/src/js/context/providers/PointsGrid/PointsGridFormDataProvider.ts +14 -12
- package/src/js/context/providers/PointsPath/PointsPathFormDataProvider.ts +9 -6
- package/src/js/context/providers/by_application/espresso/QEPWXInputDataManager.ts +4 -3
- package/src/js/context/providers/by_application/nwchem/NWChemInputDataManager.ts +1 -1
- package/src/js/generated/AssertionUnitSchemaMixin.ts +11 -6
- package/src/js/generated/AssignmentUnitSchemaMixin.ts +12 -7
- package/src/js/generated/BaseUnitSchemaMixin.ts +17 -26
- package/src/js/generated/ConditionUnitSchemaMixin.ts +15 -10
- package/src/js/generated/ErrorUnitSchemaMixin.ts +7 -5
- package/src/js/generated/ExecutionUnitInputSchemaMixin.ts +12 -8
- package/src/js/generated/ExecutionUnitSchemaMixin.ts +14 -9
- package/src/js/generated/IOUnitSchemaMixin.ts +7 -7
- package/src/js/generated/MapUnitSchemaMixin.ts +6 -6
- package/src/js/generated/ReduceUnitSchemaMixin.ts +8 -6
- package/src/js/generated/StatusTrackSchemaMixin.ts +24 -0
- package/src/js/generated/SubworkflowSchemaMixin.ts +12 -10
- package/src/js/generated/SubworkflowUnitSchemaMixin.ts +9 -4
- package/src/js/generated/WorkflowSchemaMixin.ts +10 -10
- package/src/js/units/AssertionUnit.ts +3 -7
- package/src/js/units/AssignmentUnit.ts +4 -7
- package/src/js/units/BaseUnit.ts +39 -29
- package/src/js/units/ConditionUnit.ts +3 -7
- package/src/js/units/ErrorUnit.ts +3 -7
- package/src/js/units/ExecutionUnit.ts +10 -15
- package/src/js/units/ExecutionUnitInput.ts +3 -10
- package/src/js/units/IOUnit.ts +3 -7
- package/src/js/units/MapUnit.ts +4 -10
- package/src/js/units/ReduceUnit.ts +3 -7
- package/src/js/units/SubworkflowUnit.ts +3 -7
- package/dist/js/WorkflowDesignerMaterial.d.ts +0 -21
- package/dist/js/WorkflowDesignerMaterial.js +0 -26
- package/dist/js/generated/StatusSchemaMixin.d.ts +0 -5
- package/dist/js/repair/createErrorUnitData.d.ts +0 -3
- package/dist/js/repair/createErrorUnitData.js +0 -25
- package/dist/js/repair/formatRepairReason.d.ts +0 -1
- package/dist/js/repair/formatRepairReason.js +0 -22
- package/dist/js/repair/types.d.ts +0 -16
- package/dist/js/repair/types.js +0 -2
- package/dist/js/subworkflows/convergence/enums.js +0 -15
- package/dist/js/subworkflows/convergence/factory.js +0 -36
- package/dist/js/subworkflows/subworkflow.js +0 -285
- package/dist/js/utils/subworkflow.d.ts +0 -2
- package/dist/js/utils/subworkflow.js +0 -29
- package/dist/js/utils/underscoreStringSlugify.d.ts +0 -6
- package/dist/js/utils/underscoreStringSlugify.js +0 -32
- package/dist/js/utils.js +0 -87
- package/dist/js/workflows/workflow.d.ts +0 -4404
- package/dist/js/workflows/workflow.js +0 -315
- package/src/js/generated/StatusSchemaMixin.ts +0 -28
package/src/js/Subworkflow.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { Application } from "@mat3ra/ade";
|
|
2
|
+
import { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
3
|
import {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@mat3ra/code/dist/js/entity";
|
|
7
|
-
import { defaultableEntityMixin } from "@mat3ra/code/dist/js/entity/mixins/DefaultableMixin";
|
|
4
|
+
type Defaultable,
|
|
5
|
+
defaultableEntityMixin,
|
|
6
|
+
} from "@mat3ra/code/dist/js/entity/mixins/DefaultableMixin";
|
|
8
7
|
import {
|
|
9
8
|
type HashedEntity,
|
|
10
9
|
hashedEntityMixin,
|
|
11
10
|
} from "@mat3ra/code/dist/js/entity/mixins/HashedEntityMixin";
|
|
12
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
type NamedEntity,
|
|
13
|
+
namedEntityMixin,
|
|
14
|
+
} from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin";
|
|
13
15
|
import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
|
|
14
|
-
import type {
|
|
15
|
-
|
|
16
|
+
import type {
|
|
17
|
+
AssignmentUnitSchema,
|
|
18
|
+
BaseInMemoryEntitySchema,
|
|
19
|
+
JobSchema,
|
|
20
|
+
SubworkflowSchema,
|
|
21
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
16
22
|
import { type ComputedEntityMixin, computedEntityMixin } from "@mat3ra/ide/dist/js/compute";
|
|
17
23
|
import type { Material } from "@mat3ra/made";
|
|
18
24
|
import { type PseudopotentialMethod, Model, ModelFactory } from "@mat3ra/mode";
|
|
@@ -46,15 +52,25 @@ type ConvergenceConfig = {
|
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
interface Subworkflow
|
|
49
|
-
extends
|
|
50
|
-
|
|
55
|
+
extends Defaultable,
|
|
56
|
+
NamedEntity,
|
|
51
57
|
SubworkflowSchemaMixin,
|
|
52
58
|
HashedEntity,
|
|
53
59
|
Omit<ComputedEntityMixin, "compute"> {}
|
|
54
60
|
|
|
55
61
|
type SubworkflowExternalContext = WorkflowRenderContext & WorkflowExternalContext;
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
function isAssignmentUnitSchema(
|
|
64
|
+
unit: SubworkflowSchema["units"][number],
|
|
65
|
+
): unit is AssignmentUnitSchema {
|
|
66
|
+
return unit.type === UnitType.assignment;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type SubworkflowEntity = SubworkflowSchema & BaseInMemoryEntitySchema;
|
|
70
|
+
|
|
71
|
+
type Schema = SubworkflowEntity;
|
|
72
|
+
|
|
73
|
+
class Subworkflow<S extends Schema = Schema> extends InMemoryEntity<S> {
|
|
58
74
|
private ModelFactory: typeof ModelFactory;
|
|
59
75
|
|
|
60
76
|
private applicationInstance: Application;
|
|
@@ -69,15 +85,12 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
69
85
|
|
|
70
86
|
declare static createDefault: () => Subworkflow;
|
|
71
87
|
|
|
72
|
-
declare toJSON: () => SubworkflowSchema & AnyObject;
|
|
73
|
-
|
|
74
|
-
declare _json: SubworkflowSchema & AnyObject;
|
|
75
|
-
|
|
76
88
|
static get jsonSchema() {
|
|
77
89
|
return JSONSchemasInterface.getSchemaById("workflow/subworkflow");
|
|
78
90
|
}
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
// NoInfer: keep default S (or an explicit type arg) instead of inferring S from the config literal.
|
|
93
|
+
constructor(config: NoInfer<S>, _ModelFactory = ModelFactory) {
|
|
81
94
|
super(config);
|
|
82
95
|
this.ModelFactory = _ModelFactory;
|
|
83
96
|
|
|
@@ -122,7 +135,8 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
122
135
|
postProcessors: [],
|
|
123
136
|
monitors: [],
|
|
124
137
|
results: [],
|
|
125
|
-
|
|
138
|
+
// Concrete id for graph linking ("" is a valid string but not a usable node id).
|
|
139
|
+
flowchartId: Utils.uuid.getUUID(),
|
|
126
140
|
});
|
|
127
141
|
}
|
|
128
142
|
|
|
@@ -156,18 +170,16 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
156
170
|
|
|
157
171
|
setModel(model: Model) {
|
|
158
172
|
this.modelInstance = model;
|
|
159
|
-
this.model = model.toJSON();
|
|
173
|
+
this.model = model.toJSON() as SubworkflowSchema["model"];
|
|
160
174
|
}
|
|
161
175
|
|
|
162
176
|
private buildExternalContext(context: SubworkflowExternalContext): ExternalContext {
|
|
163
|
-
const subworkflowContext = this.units
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
};
|
|
170
|
-
}, {} as AssignmentContext);
|
|
177
|
+
const subworkflowContext = this.units.filter(isAssignmentUnitSchema).reduce((acc, u) => {
|
|
178
|
+
return {
|
|
179
|
+
...acc,
|
|
180
|
+
[u.operand]: u.value,
|
|
181
|
+
};
|
|
182
|
+
}, {} as AssignmentContext);
|
|
171
183
|
|
|
172
184
|
return {
|
|
173
185
|
...context,
|
|
@@ -270,10 +282,8 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
270
282
|
return `units.${index}`;
|
|
271
283
|
}
|
|
272
284
|
|
|
273
|
-
private findAssignmentUnitWithTag(tag: UnitTag) {
|
|
274
|
-
return this.units
|
|
275
|
-
.filter((unit) => unit.type === UnitType.assignment)
|
|
276
|
-
.find((unit) => unit.tags?.includes(tag));
|
|
285
|
+
private findAssignmentUnitWithTag(tag: UnitTag): AssignmentUnitSchema | undefined {
|
|
286
|
+
return this.units.filter(isAssignmentUnitSchema).find((unit) => unit.tags?.includes(tag));
|
|
277
287
|
}
|
|
278
288
|
|
|
279
289
|
get hasConvergence() {
|
|
@@ -370,7 +380,7 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
370
380
|
});
|
|
371
381
|
|
|
372
382
|
this.modelInstance.setMethod(method);
|
|
373
|
-
this.model = this.modelInstance.toJSON();
|
|
383
|
+
this.model = this.modelInstance.toJSON() as SubworkflowSchema["model"];
|
|
374
384
|
});
|
|
375
385
|
|
|
376
386
|
// TODO: Try if/else instead of running both
|
|
@@ -381,7 +391,7 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
381
391
|
});
|
|
382
392
|
|
|
383
393
|
this.modelInstance.setMethod(method);
|
|
384
|
-
this.model = this.modelInstance.toJSON();
|
|
394
|
+
this.model = this.modelInstance.toJSON() as SubworkflowSchema["model"];
|
|
385
395
|
}
|
|
386
396
|
}
|
|
387
397
|
|
package/src/js/Workflow.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
2
|
import {
|
|
3
3
|
type Defaultable,
|
|
4
4
|
defaultableEntityMixin,
|
|
@@ -11,11 +11,17 @@ import {
|
|
|
11
11
|
type HashedEntity,
|
|
12
12
|
hashedEntityMixin,
|
|
13
13
|
} from "@mat3ra/code/dist/js/entity/mixins/HashedEntityMixin";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
type NamedEntity,
|
|
16
|
+
namedEntityMixin,
|
|
17
|
+
} from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin";
|
|
15
18
|
import { Taggable, taggableMixin } from "@mat3ra/code/dist/js/entity/mixins/TaggableMixin";
|
|
16
19
|
import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
|
|
17
|
-
import type {
|
|
18
|
-
|
|
20
|
+
import type {
|
|
21
|
+
ApplicationSchema,
|
|
22
|
+
BaseInMemoryEntitySchema,
|
|
23
|
+
SubworkflowSchema,
|
|
24
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
19
25
|
import { ComputedEntityMixin, computedEntityMixin } from "@mat3ra/ide/dist/js/compute";
|
|
20
26
|
import type { Material } from "@mat3ra/made";
|
|
21
27
|
import type { MetaPropertyHolder } from "@mat3ra/prode";
|
|
@@ -43,9 +49,13 @@ import {
|
|
|
43
49
|
import defaultWorkflowConfig from "./workflows/default";
|
|
44
50
|
import type { WorkflowSchema } from "./workflows/types";
|
|
45
51
|
|
|
52
|
+
export type WorkflowEntity = WorkflowSchema & BaseInMemoryEntitySchema;
|
|
53
|
+
|
|
54
|
+
type Schema = WorkflowEntity;
|
|
55
|
+
|
|
46
56
|
interface Workflow
|
|
47
57
|
extends Defaultable,
|
|
48
|
-
|
|
58
|
+
NamedEntity,
|
|
49
59
|
WorkflowSchemaMixin,
|
|
50
60
|
Taggable,
|
|
51
61
|
HashedEntity,
|
|
@@ -63,13 +73,11 @@ export type WorkflowRenderContext = MaterialExternalContext &
|
|
|
63
73
|
scopeGlobal?: Record<string, unknown>;
|
|
64
74
|
};
|
|
65
75
|
|
|
66
|
-
class Workflow extends InMemoryEntity implements WorkflowSchema {
|
|
76
|
+
class Workflow<S extends Schema = Schema> extends InMemoryEntity<S> implements WorkflowSchema {
|
|
67
77
|
declare createDefault: () => Workflow;
|
|
68
78
|
|
|
69
79
|
static readonly defaultConfig = defaultWorkflowConfig;
|
|
70
80
|
|
|
71
|
-
declare _json: WorkflowSchema & AnyObject;
|
|
72
|
-
|
|
73
81
|
static get jsonSchema() {
|
|
74
82
|
return JSONSchemasInterface.getSchemaById("workflow");
|
|
75
83
|
}
|
|
@@ -107,11 +115,15 @@ class Workflow extends InMemoryEntity implements WorkflowSchema {
|
|
|
107
115
|
return new this(config);
|
|
108
116
|
}
|
|
109
117
|
|
|
110
|
-
|
|
118
|
+
// NoInfer: keep default S (or an explicit type arg) instead of inferring S from the config literal.
|
|
119
|
+
constructor(config: NoInfer<S> & { applicationName?: string }) {
|
|
120
|
+
// Strip applicationName (fromSubworkflow helper); not part of WorkflowEntity.
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
|
+
const { applicationName, ...rest } = config;
|
|
111
123
|
super({
|
|
112
|
-
...
|
|
113
|
-
_id:
|
|
114
|
-
});
|
|
124
|
+
...rest,
|
|
125
|
+
_id: (rest as Partial<Schema>)._id || Utils.uuid.getUUID(),
|
|
126
|
+
} as S);
|
|
115
127
|
|
|
116
128
|
this.subworkflowInstances = this.subworkflows.map((x) => new Subworkflow(x));
|
|
117
129
|
this.workflowInstances = this.workflows?.map((x) => new Workflow(x)) || [];
|
|
@@ -119,11 +131,11 @@ class Workflow extends InMemoryEntity implements WorkflowSchema {
|
|
|
119
131
|
}
|
|
120
132
|
|
|
121
133
|
get workflows() {
|
|
122
|
-
return this.requiredProp
|
|
134
|
+
return this.requiredProp("workflows");
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
set workflows(value: WorkflowSchema[]) {
|
|
126
|
-
this.
|
|
138
|
+
(this._json as Schema).workflows = value;
|
|
127
139
|
}
|
|
128
140
|
|
|
129
141
|
addSubworkflow(subworkflow: Subworkflow, head = false, index = -1) {
|
|
@@ -207,7 +219,7 @@ class Workflow extends InMemoryEntity implements WorkflowSchema {
|
|
|
207
219
|
return getHumanReadableUsedModels(this);
|
|
208
220
|
}
|
|
209
221
|
|
|
210
|
-
toJSON():
|
|
222
|
+
toJSON(): S {
|
|
211
223
|
return {
|
|
212
224
|
...super.toJSON(),
|
|
213
225
|
name: this.name,
|
|
@@ -215,7 +227,7 @@ class Workflow extends InMemoryEntity implements WorkflowSchema {
|
|
|
215
227
|
units: this.unitInstances.map((x) => x.toJSON()),
|
|
216
228
|
subworkflows: this.subworkflowInstances.map((x) => x.toJSON()),
|
|
217
229
|
workflows: this.workflowInstances.map((x) => x.toJSON()),
|
|
218
|
-
};
|
|
230
|
+
} as S;
|
|
219
231
|
}
|
|
220
232
|
|
|
221
233
|
getHumanReadableProperties() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OrderedInMemoryEntityInSet } from "@mat3ra/code/dist/js/entity/set/ordered/OrderedInMemoryEntityInSetMixin";
|
|
2
|
-
import { Material } from "@mat3ra/made
|
|
2
|
+
import type { Material } from "@mat3ra/made";
|
|
3
3
|
|
|
4
4
|
import type ContextProvider from "../providers/base/ContextProvider";
|
|
5
5
|
|
|
@@ -9,7 +9,6 @@ export type MaterialContextMixin = {
|
|
|
9
9
|
readonly isMaterialCreatedDefault: boolean;
|
|
10
10
|
readonly isMaterialUpdated: boolean;
|
|
11
11
|
material: OrderedMaterial;
|
|
12
|
-
extraData?: { materialHash?: string };
|
|
13
12
|
initMaterialContextMixin(externalContext: MaterialExternalContext): void;
|
|
14
13
|
updateMaterialHash(): void;
|
|
15
14
|
};
|
|
@@ -53,7 +53,7 @@ class CollinearMagnetizationDataManager extends JSONSchemaDataProvider<Schema, E
|
|
|
53
53
|
this.initMaterialContextMixin(externalContext);
|
|
54
54
|
|
|
55
55
|
this.uniqueElementsWithLabels = [
|
|
56
|
-
...new Set(this.material?.
|
|
56
|
+
...new Set(this.material?.getBasis()?.elementsWithLabelsArray || []),
|
|
57
57
|
];
|
|
58
58
|
|
|
59
59
|
this.firstElement =
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
2
1
|
import type {
|
|
3
2
|
HubbardJContextItemSchema,
|
|
4
3
|
HubbardLegacyContextItemSchema,
|
|
@@ -20,13 +19,24 @@ type Schema =
|
|
|
20
19
|
|
|
21
20
|
export type HubbardExternalContext = JinjaExternalContext & MaterialExternalContext;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
interface MixinsHubbardContextProvider extends MaterialContextMixin, MaterialExternalContext {}
|
|
23
|
+
|
|
24
|
+
abstract class MixinsHubbardContextProvider extends JSONSchemaDataProvider<
|
|
25
|
+
Schema,
|
|
26
|
+
HubbardExternalContext
|
|
27
|
+
> {
|
|
28
|
+
constructor(contextItem: Partial<Schema>, externalContext: HubbardExternalContext) {
|
|
29
|
+
super(contextItem, externalContext);
|
|
30
|
+
this.initMaterialContextMixin(externalContext);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
materialContextMixin(MixinsHubbardContextProvider.prototype);
|
|
25
35
|
|
|
26
36
|
abstract class HubbardContextProvider<
|
|
27
37
|
S extends Schema,
|
|
28
38
|
EC extends HubbardExternalContext = HubbardExternalContext,
|
|
29
|
-
> extends
|
|
39
|
+
> extends MixinsHubbardContextProvider {
|
|
30
40
|
abstract readonly name: S["name"];
|
|
31
41
|
|
|
32
42
|
abstract getDefaultData(): S["data"];
|
|
@@ -64,10 +74,11 @@ abstract class HubbardContextProvider<
|
|
|
64
74
|
|
|
65
75
|
constructor(contextItem: Partial<S>, externalContext: EC) {
|
|
66
76
|
super(contextItem, externalContext);
|
|
67
|
-
this.initMaterialContextMixin(externalContext);
|
|
68
77
|
|
|
69
78
|
this.uniqueElementsWithLabels = [
|
|
70
|
-
...new Set(
|
|
79
|
+
...new Set(
|
|
80
|
+
(this.material.getBasis().elements || []).map((element) => String(element.value)),
|
|
81
|
+
),
|
|
71
82
|
];
|
|
72
83
|
|
|
73
84
|
this.firstElement =
|
|
@@ -80,6 +91,4 @@ abstract class HubbardContextProvider<
|
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
|
|
83
|
-
materialContextMixin(HubbardContextProvider.prototype);
|
|
84
|
-
|
|
85
94
|
export default HubbardContextProvider;
|
|
@@ -82,7 +82,7 @@ class NonCollinearMagnetizationDataManager extends JSONSchemaDataProvider<Schema
|
|
|
82
82
|
constrainType: "atomic direction" as const,
|
|
83
83
|
};
|
|
84
84
|
this.uniqueElementsWithLabels = [
|
|
85
|
-
...new Set(this.material?.
|
|
85
|
+
...new Set(this.material?.getBasis()?.elementsWithLabelsArray || []),
|
|
86
86
|
];
|
|
87
87
|
|
|
88
88
|
const jsonSchema = JSONSchemasInterface.getPatchedSchemaById(jsonSchemaId, {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Units } from "@mat3ra/code/dist/js/constants";
|
|
2
2
|
import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
|
|
3
|
-
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
4
3
|
import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
|
|
5
4
|
import type {
|
|
6
5
|
GridContextItemSchema,
|
|
@@ -22,11 +21,19 @@ type Schema = GridContextItemSchema;
|
|
|
22
21
|
type Data = PointsGridDataProviderSchema;
|
|
23
22
|
export type ExternalContext = JinjaExternalContext & MaterialExternalContext;
|
|
24
23
|
|
|
25
|
-
type Base = typeof JSONSchemaFormDataProvider<Schema, ExternalContext> &
|
|
26
|
-
Constructor<MaterialContextMixin>;
|
|
27
|
-
|
|
28
24
|
type GridMetricType = Data["gridMetricType"];
|
|
29
25
|
|
|
26
|
+
interface MixinsContextProvider extends MaterialContextMixin, MaterialExternalContext {}
|
|
27
|
+
|
|
28
|
+
abstract class MixinsContextProvider extends JSONSchemaFormDataProvider<Schema, ExternalContext> {
|
|
29
|
+
constructor(contextItem: Partial<Schema>, externalContext: ExternalContext) {
|
|
30
|
+
super(contextItem, externalContext);
|
|
31
|
+
this.initMaterialContextMixin(externalContext);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
materialContextMixin(MixinsContextProvider.prototype);
|
|
36
|
+
|
|
30
37
|
const vector = (
|
|
31
38
|
defaultValue: string | number | readonly number[] | readonly string[],
|
|
32
39
|
isStringType = false,
|
|
@@ -48,9 +55,7 @@ const vector = (
|
|
|
48
55
|
const defaultShift = 0;
|
|
49
56
|
const defaultShifts: Vector3DSchema = [defaultShift, defaultShift, defaultShift];
|
|
50
57
|
|
|
51
|
-
abstract class PointsGridFormDataProvider<
|
|
52
|
-
N extends Schema["name"],
|
|
53
|
-
> extends (JSONSchemaFormDataProvider as Base) {
|
|
58
|
+
abstract class PointsGridFormDataProvider<N extends Schema["name"]> extends MixinsContextProvider {
|
|
54
59
|
abstract readonly name: N;
|
|
55
60
|
|
|
56
61
|
readonly domain = "important" as const;
|
|
@@ -89,7 +94,6 @@ abstract class PointsGridFormDataProvider<
|
|
|
89
94
|
constructor(contextItem: Partial<Schema>, externalContext: ExternalContext, divisor: number) {
|
|
90
95
|
super(contextItem, externalContext);
|
|
91
96
|
this.divisor = divisor;
|
|
92
|
-
this.initMaterialContextMixin(externalContext);
|
|
93
97
|
this.initInstanceFields();
|
|
94
98
|
}
|
|
95
99
|
|
|
@@ -319,7 +323,7 @@ abstract class PointsGridFormDataProvider<
|
|
|
319
323
|
): Vector3DSchema {
|
|
320
324
|
switch (gridMetricType) {
|
|
321
325
|
case "KPPRA": {
|
|
322
|
-
const nAtoms = this.material ? this.material.
|
|
326
|
+
const nAtoms = this.material ? this.material.getBasis().nAtoms : 1;
|
|
323
327
|
return this.reciprocalLattice.getDimensionsFromPointsCount(
|
|
324
328
|
gridMetricValue / nAtoms,
|
|
325
329
|
);
|
|
@@ -337,7 +341,7 @@ abstract class PointsGridFormDataProvider<
|
|
|
337
341
|
private calculateGridMetric(gridMetricType: GridMetricType, dimensions: Vector3DSchema) {
|
|
338
342
|
switch (gridMetricType) {
|
|
339
343
|
case "KPPRA": {
|
|
340
|
-
const nAtoms = this.material ? this.material.
|
|
344
|
+
const nAtoms = this.material ? this.material.getBasis().nAtoms : 1;
|
|
341
345
|
return dimensions.reduce((a, b) => a * b) * nAtoms;
|
|
342
346
|
}
|
|
343
347
|
case "spacing":
|
|
@@ -390,6 +394,4 @@ abstract class PointsGridFormDataProvider<
|
|
|
390
394
|
}
|
|
391
395
|
}
|
|
392
396
|
|
|
393
|
-
materialContextMixin(PointsGridFormDataProvider.prototype);
|
|
394
|
-
|
|
395
397
|
export default PointsGridFormDataProvider;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
|
|
2
|
-
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
3
2
|
import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
|
|
4
3
|
import type { JSONSchema } from "@mat3ra/esse/dist/js/esse/utils";
|
|
5
4
|
import type {
|
|
@@ -36,11 +35,13 @@ type ExternalContext = PointsPathFormDataProviderExternalContext;
|
|
|
36
35
|
|
|
37
36
|
const jsonSchemaId = "context-providers-directory/points-path-data-provider";
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
Constructor<MaterialContextMixin> &
|
|
41
|
-
Constructor<ApplicationContextMixin>;
|
|
38
|
+
interface MixinsContextProvider extends MaterialContextMixin, ApplicationContextMixin {}
|
|
42
39
|
|
|
43
|
-
abstract class MixinsContextProvider extends
|
|
40
|
+
abstract class MixinsContextProvider extends JSONSchemaDataProvider<
|
|
41
|
+
Schema,
|
|
42
|
+
ExternalContext,
|
|
43
|
+
RenderingData
|
|
44
|
+
> {
|
|
44
45
|
constructor(contextItem: Partial<Schema>, externalContext: ExternalContext) {
|
|
45
46
|
super(contextItem, externalContext);
|
|
46
47
|
this.initMaterialContextMixin(externalContext);
|
|
@@ -79,10 +80,12 @@ abstract class PointsPathFormDataProvider<N extends Schema["name"]> extends Mixi
|
|
|
79
80
|
|
|
80
81
|
super.updateMaterialHash();
|
|
81
82
|
|
|
83
|
+
const currentMaterialHash = this.extraData?.materialHash;
|
|
84
|
+
|
|
82
85
|
// Reset path only when the material actually changed (hash). Do not clear `isEdited` just
|
|
83
86
|
// because the material has no id (common default material in designers): that ran every
|
|
84
87
|
// render, wiped isEdited, and savePersistentContext dropped k-path/Q-path from `unit.context`.
|
|
85
|
-
if (previousMaterialHash && previousMaterialHash !==
|
|
88
|
+
if (previousMaterialHash && previousMaterialHash !== currentMaterialHash) {
|
|
86
89
|
this.isEdited = false;
|
|
87
90
|
}
|
|
88
91
|
}
|
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
InputContextItemSchema,
|
|
6
6
|
QEPwxContextProviderSchema,
|
|
7
7
|
} from "@mat3ra/esse/dist/js/types";
|
|
8
|
-
import type { Material } from "@mat3ra/made";
|
|
9
8
|
import type { AtomicElementValue } from "@mat3ra/made/dist/js/basis/elements";
|
|
10
9
|
import type { JSONSchema7 } from "json-schema";
|
|
11
10
|
import path from "path";
|
|
@@ -13,6 +12,7 @@ import path from "path";
|
|
|
13
12
|
import materialContextMixin, {
|
|
14
13
|
type MaterialContextMixin,
|
|
15
14
|
type MaterialExternalContext,
|
|
15
|
+
type OrderedMaterial,
|
|
16
16
|
} from "../../../mixins/MaterialContextMixin";
|
|
17
17
|
import materialsContextMixin, {
|
|
18
18
|
type MaterialsContextMixin,
|
|
@@ -94,8 +94,9 @@ class QEPWXInputDataManager extends JSONSchemaDataProvider<Schema, ExternalConte
|
|
|
94
94
|
this.jsonSchema = jsonSchema;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
private buildQEPWXContext(material:
|
|
98
|
-
const
|
|
97
|
+
private buildQEPWXContext(material: OrderedMaterial): Data {
|
|
98
|
+
const basis = material.getBasis();
|
|
99
|
+
const lattice = material.getLattice();
|
|
99
100
|
const { jobHasParent, workflowHasRelaxation } = this;
|
|
100
101
|
|
|
101
102
|
const ATOMIC_SPECIES = basis.uniqueElements.map((symbol) => {
|
|
@@ -61,7 +61,7 @@ class NWChemInputDataManager extends JSONSchemaDataProvider<Schema, ExternalCont
|
|
|
61
61
|
* TODO: Create ability for user to define CHARGE, MULT, BASIS and FUNCTIONAL parameters.
|
|
62
62
|
*/
|
|
63
63
|
getDefaultData() {
|
|
64
|
-
const basis = this.material.
|
|
64
|
+
const basis = this.material.getBasis();
|
|
65
65
|
|
|
66
66
|
const NTYP = basis.uniqueElements.length;
|
|
67
67
|
const ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS = basis.atomicPositions.join("\n") || "";
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AssertionUnitMixinSchema,
|
|
4
|
+
BaseInMemoryEntitySchema,
|
|
5
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
3
6
|
|
|
4
7
|
export type AssertionUnitSchemaMixin = AssertionUnitMixinSchema;
|
|
5
8
|
|
|
6
|
-
export type AssertionUnitInMemoryEntity = InMemoryEntity
|
|
9
|
+
export type AssertionUnitInMemoryEntity = InMemoryEntity<
|
|
10
|
+
BaseInMemoryEntitySchema & AssertionUnitSchemaMixin
|
|
11
|
+
>;
|
|
7
12
|
|
|
8
13
|
export function assertionUnitSchemaMixin<T extends InMemoryEntity>(
|
|
9
14
|
item: InMemoryEntity,
|
|
10
15
|
): asserts item is T & AssertionUnitSchemaMixin {
|
|
11
16
|
// @ts-expect-error
|
|
12
|
-
const properties: InMemoryEntity & AssertionUnitSchemaMixin = {
|
|
17
|
+
const properties: InMemoryEntity<AssertionUnitSchemaMixin> & AssertionUnitSchemaMixin = {
|
|
13
18
|
get type() {
|
|
14
|
-
return this.prop
|
|
19
|
+
return this.prop("type");
|
|
15
20
|
},
|
|
16
21
|
set type(value: AssertionUnitMixinSchema["type"]) {
|
|
17
22
|
this.setProp("type", value);
|
|
18
23
|
},
|
|
19
24
|
get statement() {
|
|
20
|
-
return this.requiredProp
|
|
25
|
+
return this.requiredProp("statement");
|
|
21
26
|
},
|
|
22
27
|
set statement(value: AssertionUnitMixinSchema["statement"]) {
|
|
23
28
|
this.setProp("statement", value);
|
|
24
29
|
},
|
|
25
30
|
get errorMessage() {
|
|
26
|
-
return this.prop
|
|
31
|
+
return this.prop("errorMessage");
|
|
27
32
|
},
|
|
28
33
|
set errorMessage(value: AssertionUnitMixinSchema["errorMessage"]) {
|
|
29
34
|
this.setProp("errorMessage", value);
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AssignmentUnitMixinSchema,
|
|
4
|
+
BaseInMemoryEntitySchema,
|
|
5
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
3
6
|
|
|
4
7
|
export type AssignmentUnitSchemaMixin = AssignmentUnitMixinSchema;
|
|
5
8
|
|
|
6
|
-
export type AssignmentUnitInMemoryEntity = InMemoryEntity
|
|
9
|
+
export type AssignmentUnitInMemoryEntity = InMemoryEntity<
|
|
10
|
+
BaseInMemoryEntitySchema & AssignmentUnitSchemaMixin
|
|
11
|
+
>;
|
|
7
12
|
|
|
8
13
|
export function assignmentUnitSchemaMixin<T extends InMemoryEntity>(
|
|
9
14
|
item: InMemoryEntity,
|
|
10
15
|
): asserts item is T & AssignmentUnitSchemaMixin {
|
|
11
16
|
// @ts-expect-error
|
|
12
|
-
const properties: InMemoryEntity & AssignmentUnitSchemaMixin = {
|
|
17
|
+
const properties: InMemoryEntity<AssignmentUnitSchemaMixin> & AssignmentUnitSchemaMixin = {
|
|
13
18
|
get type() {
|
|
14
|
-
return this.prop
|
|
19
|
+
return this.prop("type");
|
|
15
20
|
},
|
|
16
21
|
set type(value: AssignmentUnitMixinSchema["type"]) {
|
|
17
22
|
this.setProp("type", value);
|
|
18
23
|
},
|
|
19
24
|
get input() {
|
|
20
|
-
return this.prop
|
|
25
|
+
return this.prop("input");
|
|
21
26
|
},
|
|
22
27
|
set input(value: AssignmentUnitMixinSchema["input"]) {
|
|
23
28
|
this.setProp("input", value);
|
|
24
29
|
},
|
|
25
30
|
get operand() {
|
|
26
|
-
return this.requiredProp
|
|
31
|
+
return this.requiredProp("operand");
|
|
27
32
|
},
|
|
28
33
|
set operand(value: AssignmentUnitMixinSchema["operand"]) {
|
|
29
34
|
this.setProp("operand", value);
|
|
30
35
|
},
|
|
31
36
|
get value() {
|
|
32
|
-
return this.requiredProp
|
|
37
|
+
return this.requiredProp("value");
|
|
33
38
|
},
|
|
34
39
|
set value(value: AssignmentUnitMixinSchema["value"]) {
|
|
35
40
|
this.setProp("value", value);
|
|
@@ -1,63 +1,54 @@
|
|
|
1
1
|
import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
BaseInMemoryEntitySchema,
|
|
4
|
+
WorkflowBaseUnitMixinSchema,
|
|
5
|
+
} from "@mat3ra/esse/dist/js/types";
|
|
3
6
|
|
|
4
7
|
export type BaseUnitSchemaMixin = WorkflowBaseUnitMixinSchema;
|
|
5
8
|
|
|
6
|
-
export type BaseUnitInMemoryEntity = InMemoryEntity & BaseUnitSchemaMixin
|
|
9
|
+
export type BaseUnitInMemoryEntity = InMemoryEntity<BaseInMemoryEntitySchema & BaseUnitSchemaMixin>;
|
|
7
10
|
|
|
8
11
|
export function baseUnitSchemaMixin<T extends InMemoryEntity>(
|
|
9
12
|
item: InMemoryEntity,
|
|
10
13
|
): asserts item is T & BaseUnitSchemaMixin {
|
|
11
14
|
// @ts-expect-error
|
|
12
|
-
const properties: InMemoryEntity & BaseUnitSchemaMixin = {
|
|
15
|
+
const properties: InMemoryEntity<BaseUnitSchemaMixin> & BaseUnitSchemaMixin = {
|
|
13
16
|
get isDraft() {
|
|
14
|
-
return this.prop
|
|
17
|
+
return this.prop("isDraft");
|
|
15
18
|
},
|
|
16
19
|
set isDraft(value: WorkflowBaseUnitMixinSchema["isDraft"]) {
|
|
17
20
|
this.setProp("isDraft", value);
|
|
18
21
|
},
|
|
19
|
-
get type() {
|
|
20
|
-
return this.requiredProp<WorkflowBaseUnitMixinSchema["type"]>("type");
|
|
21
|
-
},
|
|
22
|
-
set type(value: WorkflowBaseUnitMixinSchema["type"]) {
|
|
23
|
-
this.setProp("type", value);
|
|
24
|
-
},
|
|
25
|
-
get name() {
|
|
26
|
-
return this.prop<WorkflowBaseUnitMixinSchema["name"]>("name");
|
|
27
|
-
},
|
|
28
|
-
set name(value: WorkflowBaseUnitMixinSchema["name"]) {
|
|
29
|
-
this.setProp("name", value);
|
|
30
|
-
},
|
|
31
|
-
get status() {
|
|
32
|
-
return this.prop<WorkflowBaseUnitMixinSchema["status"]>("status");
|
|
33
|
-
},
|
|
34
|
-
set status(value: WorkflowBaseUnitMixinSchema["status"]) {
|
|
35
|
-
this.setProp("status", value);
|
|
36
|
-
},
|
|
37
22
|
get head() {
|
|
38
|
-
return this.prop
|
|
23
|
+
return this.prop("head");
|
|
39
24
|
},
|
|
40
25
|
set head(value: WorkflowBaseUnitMixinSchema["head"]) {
|
|
41
26
|
this.setProp("head", value);
|
|
42
27
|
},
|
|
43
28
|
get flowchartId() {
|
|
44
|
-
return this.requiredProp
|
|
29
|
+
return this.requiredProp("flowchartId");
|
|
45
30
|
},
|
|
46
31
|
set flowchartId(value: WorkflowBaseUnitMixinSchema["flowchartId"]) {
|
|
47
32
|
this.setProp("flowchartId", value);
|
|
48
33
|
},
|
|
49
34
|
get next() {
|
|
50
|
-
return this.prop
|
|
35
|
+
return this.prop("next");
|
|
51
36
|
},
|
|
52
37
|
set next(value: WorkflowBaseUnitMixinSchema["next"]) {
|
|
53
38
|
this.setProp("next", value);
|
|
54
39
|
},
|
|
55
40
|
get enableRender() {
|
|
56
|
-
return this.prop
|
|
41
|
+
return this.prop("enableRender");
|
|
57
42
|
},
|
|
58
43
|
set enableRender(value: WorkflowBaseUnitMixinSchema["enableRender"]) {
|
|
59
44
|
this.setProp("enableRender", value);
|
|
60
45
|
},
|
|
46
|
+
get status() {
|
|
47
|
+
return this.prop("status");
|
|
48
|
+
},
|
|
49
|
+
set status(value: WorkflowBaseUnitMixinSchema["status"]) {
|
|
50
|
+
this.setProp("status", value);
|
|
51
|
+
},
|
|
61
52
|
};
|
|
62
53
|
|
|
63
54
|
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
|