You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`StructureData` is **immutable** and cannot be modified. Use `StructureBuilder` for modifications.
293
292
:::
294
293
295
-
### Creating a Mutable Structure
294
+
### Creating a Mutable Structure: the `StructureBuilder`
296
295
297
296
```python
298
297
from aiida_atomistic.data.structure import StructureBuilder
@@ -436,17 +435,20 @@ print(f"Magmoms after removal: {mutable.properties.magmoms}") # None
436
435
- See the full list of properties in the [Site API documentation](../reference/api/auto/aiida_atomistic/data/structure/site/index.rst)
437
436
:::
438
437
439
-
### Converting Between Mutable and Immutable
438
+
## Conversion Between `StructureBuilder` and `StructureData` (and viceversa)
439
+
440
+
The `StructureBuilder` object is a pure python class, any instance of it needs to be converted into the `StructureData` before being used in an AiiDA process.
441
+
It is possible to seamlessly convert between `StructureBuilder` and `StructureData` (and viceversa) using the defined `to_*` and `from_*` methods:
440
442
441
443
```python
442
-
# Mutable → Immutable (for storage in AiiDA)
443
-
immutable = StructureData(**mutable.to_dict())
444
+
# StructureBuilder → StructureData (for storage in AiiDA)
raiseValueError("The kinds defined in the structure do not match the generated kinds from the sites. Please run the 'generate_kinds' method to see the expected kinds.")
389
389
390
390
# TO methods:
391
-
defto_dict(self, exclude_kinds=False):
391
+
defto_dict(self):
392
392
"""
393
393
Convert the structure to a dictionary representation.
394
394
395
-
:param detect_kinds: Whether to detect and include the kinds of the structure.
0 commit comments