@mat3ra/mode 2026.8.18-0 → 2026.10.9-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/model.js CHANGED
@@ -7,6 +7,7 @@ exports.Model = void 0;
7
7
  const entity_1 = require("@mat3ra/code/dist/js/entity");
8
8
  const HashedEntityMixin_1 = require("@mat3ra/code/dist/js/entity/mixins/HashedEntityMixin");
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
+ const default_methods_1 = require("./default_methods");
10
11
  const default_models_1 = require("./default_models");
11
12
  const ModelSchemaMixin_1 = require("./generated/ModelSchemaMixin");
12
13
  const method_1 = require("./method");
@@ -15,7 +16,11 @@ const tree_1 = require("./tree");
15
16
  const EMPTY_BRANCH = { methods: {} };
16
17
  class Model extends entity_1.InMemoryEntity {
17
18
  constructor(config) {
18
- const { application, method = method_1.Method.defaultConfig, ...entityConfig } = config;
19
+ const { application, method: methodFromConfig, ...entityConfig } = config;
20
+ // Method.defaultConfig is a pseudopotential method. An unknown model has no method tree,
21
+ // so it must not inherit that default or the workflow designer offers pseudopotential
22
+ // selection for applications that have no model.
23
+ const method = methodFromConfig !== null && methodFromConfig !== void 0 ? methodFromConfig : (config.type === "unknown" ? default_methods_1.UnknownMethodConfig : method_1.Method.defaultConfig);
19
24
  super({ ...entityConfig, method });
20
25
  this._application = application;
21
26
  this._MethodFactory = factory_1.MethodFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mat3ra/mode",
3
- "version": "2026.8.18-0",
3
+ "version": "2026.10.9-0",
4
4
  "description": "MOdel and method DEfinitions",
5
5
  "scripts": {
6
6
  "test": "nyc --reporter=text mocha --recursive --bail",
package/src/js/model.ts CHANGED
@@ -13,6 +13,7 @@ import type {
13
13
  } from "@mat3ra/esse/dist/js/types";
14
14
  import lodash from "lodash";
15
15
 
16
+ import { UnknownMethodConfig } from "./default_methods";
16
17
  import { DFTModelConfig } from "./default_models";
17
18
  import { type ModelSchemaMixin, modelSchemaMixin } from "./generated/ModelSchemaMixin";
18
19
  import { Method } from "./method";
@@ -41,7 +42,13 @@ export class Model extends InMemoryEntity<ModelEntity> implements BaseModel {
41
42
  protected _method?: Method;
42
43
 
43
44
  constructor(config: ModelConfig) {
44
- const { application, method = Method.defaultConfig, ...entityConfig } = config;
45
+ const { application, method: methodFromConfig, ...entityConfig } = config;
46
+ // Method.defaultConfig is a pseudopotential method. An unknown model has no method tree,
47
+ // so it must not inherit that default or the workflow designer offers pseudopotential
48
+ // selection for applications that have no model.
49
+ const method =
50
+ methodFromConfig ??
51
+ (config.type === "unknown" ? UnknownMethodConfig : Method.defaultConfig);
45
52
  super({ ...entityConfig, method } as ModelEntity);
46
53
  this._application = application;
47
54
  this._MethodFactory = MethodFactory;