Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion aiidalab_widgets_base/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ def _convert_to_structure_node(self, structure):
structure_node = structure_node_type(ase=structure)
if "smiles" in structure.info:
structure_node.base.extras.set("smiles", structure.info["smiles"])
if "fixed_atoms" in structure.arrays:
structure_node.base.attributes.all["fixed_atoms"] = structure.arrays[
"fixed_atoms"
]
return structure_node

# If the input_structure trait is set to AiiDA node, check what type
Expand Down Expand Up @@ -340,7 +344,12 @@ def _observe_input_structure(self, change):
str_io, format="cif", reader="ase", store_tags=True
)
elif isinstance(change["new"], StructureData):
self.structure = change["new"].get_ase()
structure = change["new"].get_ase()
if "fixed_atoms" in change["new"].base.attributes.all:
structure.arrays["fixed_atoms"] = np.array(
change["new"].base.attributes.all["fixed_atoms"]
)
self.structure = structure

else:
self.structure = None
Expand Down
Loading