vibesketcher.document.solid_edit¶
Editing periodic structures: cell parameters, selected sites and slab layers.
Every edit returns a new validated PeriodicStructure and appends a record to
provenance["builder"]["edits"]; by default the edited structure replaces
its source under the same ID. Cell parameters follow the IUCr convention
(a, b, c in angstrom, alpha = angle(b, c), beta = angle(a, c),
gamma = angle(a, b) in degrees). The cell keeps its orientation: the new rows
are the standard rows of the new parameters carried by the same rotation that
maps the old standard rows onto the old cell.
Functions
|
Add |
|
Run one edit; without |
|
a, b, c (angstrom), alpha, beta, gamma (degrees) and the volume. |
|
Apply an edit and put its structure into a copy of the document. |
|
Change lattice lengths and angles, scale the cell, or set a slab's vacuum. |
|
Translate the selected sites by a vector (angstrom, or fractions of the cell). |
|
|
|
Rotate the selected sites by |
|
Site IDs matching every given criterion (all sites when none is given). |
|
Set positions ( |
Classes
|
|
|
|
|
|
|
|
|
- vibesketcher.document.solid_edit.cell_parameters(structure)[source]¶
a, b, c (angstrom), alpha, beta, gamma (degrees) and the volume.
- Parameters:
structure (PeriodicStructure)
- Return type:
- vibesketcher.document.solid_edit.edit_cell(structure, *, identifier=None, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, scale=None, vacuum=None, keep='fractional')[source]¶
Change lattice lengths and angles, scale the cell, or set a slab’s vacuum.
keep="fractional"moves the atoms with the cell (strain);"cartesian"leaves them in place. Along a nonperiodic direction atoms always keep their physical distance from the middle of that vector, so a layer is never stretched by a vacuum change.vacuumsets the gap between a 2-D slab’s top and its image along the normal.
- vibesketcher.document.solid_edit.select_sites(structure, *, sites=None, elements=None, layers=None, adsorbate=None, z_min=None, z_max=None)[source]¶
Site IDs matching every given criterion (all sites when none is given).
layersuses the slab builder’s layer numbers (0 is the bottom);adsorbatean index or label of a recorded adsorbate;z_min/z_maxCartesian heights in angstrom.
- vibesketcher.document.solid_edit.move_sites(structure, sites, translation, *, frame='cartesian', identifier=None)[source]¶
Translate the selected sites by a vector (angstrom, or fractions of the cell).
- Parameters:
- Return type:
- vibesketcher.document.solid_edit.rotate_sites(structure, sites, angle, *, axis=(0.0, 0.0, 1.0), centre=None, identifier=None)[source]¶
Rotate the selected sites by
angledegrees about an axis through a point.The default axis is z (the slab normal for builder slabs) through the selection’s centroid (Rodrigues’ rotation formula).
- vibesketcher.document.solid_edit.set_sites(structure, edits, *, identifier=None)[source]¶
Set positions (
fractionalorcartesian) and/or elements of named sites.- Parameters:
- Return type:
- vibesketcher.document.solid_edit.add_slab_layers(document, structure, count, *, identifier=None)[source]¶
Add
countlayers on top of a builder slab, under any adsorbates.The slab is cut again from its recorded bulk source with the same Miller index, layer unit, termination and repeat; the existing sites, including any moved or edited ones, stay where they are, the new layers’ atoms are added above the old top layer, adsorbate atoms move up with the surface and the normal vector grows by the added thickness.
- Parameters:
document (Document)
structure (PeriodicStructure)
count (int)
identifier (str | None)
- Return type:
- class vibesketcher.document.solid_edit.EditCellRecipe(*, kind='edit_cell', source, identifier=None, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, scale=None, vacuum=None, keep='fractional')[source]¶
Bases:
_Edit- Parameters:
kind (Literal['edit_cell'])
source (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
identifier (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])] | None)
a (float | None)
b (float | None)
c (float | None)
alpha (float | None)
beta (float | None)
gamma (float | None)
scale (float | None)
vacuum (float | None)
keep (Literal['fractional', 'cartesian'])
- kind: Literal['edit_cell']¶
- source: _ID¶
- keep: Keep¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_edit.Selection(*, sites=None, elements=None, layers=None, adsorbate=None, z_min=None, z_max=None)[source]¶
Bases:
_Edit- Parameters:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_edit.MoveSitesRecipe(*, kind='move_sites', source, identifier=None, select, translation=(0.0, 0.0, 0.0), frame='cartesian', rotate=None, axis=(0.0, 0.0, 1.0))[source]¶
Bases:
_Edit- Parameters:
kind (Literal['move_sites'])
source (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
identifier (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])] | None)
select (Selection)
frame (Literal['cartesian', 'fractional'])
rotate (float | None)
- kind: Literal['move_sites']¶
- source: _ID¶
- frame: Literal['cartesian', 'fractional']¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_edit.SetSitesRecipe(*, kind='set_sites', source, identifier=None, sites)[source]¶
Bases:
_Edit- Parameters:
kind (Literal['set_sites'])
source (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
identifier (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])] | None)
sites (Annotated[list[dict[str, Any]], MinLen(min_length=1), MaxLen(max_length=25000)])
- kind: Literal['set_sites']¶
- source: _ID¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_edit.AddLayersRecipe(*, kind='add_layers', source, identifier=None, count)[source]¶
Bases:
_Edit- Parameters:
- kind: Literal['add_layers']¶
- source: _ID¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- vibesketcher.document.solid_edit.apply_edit(document, recipe)[source]¶
Run one edit; without
identifierthe result replaces its source.- Parameters:
document (Document)
recipe (EditCellRecipe | MoveSitesRecipe | SetSitesRecipe | AddLayersRecipe)
- Return type:
- vibesketcher.document.solid_edit.parse_edit(data)[source]¶
- Parameters:
- Return type:
EditCellRecipe | MoveSitesRecipe | SetSitesRecipe | AddLayersRecipe
- vibesketcher.document.solid_edit.edit(document, recipe)[source]¶
Apply an edit and put its structure into a copy of the document.
- Parameters:
document (Document)
recipe (EditCellRecipe | MoveSitesRecipe | SetSitesRecipe | AddLayersRecipe)
- Return type: