schrodinger.application.models.datamodels.model_tree module

class schrodinger.application.models.datamodels.model_tree.ModelTree(definition: ModelDefinition, configs: list[ModelConfiguration])

Bases: object

Object that manages the relationships between a model definition and all of its configurations.

__init__(definition: ModelDefinition, configs: list[ModelConfiguration]) None
getOrderedConfigs() list[ModelConfiguration]

Return a flat list of configurations in display order for faketree

getDefinition() ModelDefinition

Return the model definition at the root of the tree.

getConfigDepth(config: ModelConfiguration) int

Return the depth of the given configuration in the tree. Top-level configs have depth 0.

getChildren(model: ModelInterface) list[ModelConfiguration]

Return a list of the immediate child configs of the given model object. No particular sort order is guaranteed.

getParent(model: ModelInterface) ModelInterface | None

Return the parent of the given model object, or None if it is the root.

getDescendants(model: ModelInterface) list[ModelConfiguration]

Return a list of all descendant configs of the given model object. No particular sort order is guaranteed.

buildComposite(model: ModelInterface) CompositeModel

Build a CompositeModel from a definition or configuration.

validate() ValidationSummary

Validate the entire model tree and return a summary of violations.

propagateConstraints(modified_config: ModelConfiguration) IdSet[ModelConfiguration]

Propagate all changed constraints to all descendant configs.

Parameters:

config – The config whose constraints should be propagated.

Returns:

Set of configs that were modified.

Raises:

KeyError – If input_name doesn’t exist on config or a descendant.