vibesketcher.document.solid_build¶
Typed build recipes for periodic structures, shared by the SDK, CLI, REST and MCP.
A recipe names one construction step (crystal, cell choice, …) and its parameters; apply_recipe runs it against a document and returns the new structure. Recipes are recorded in the structure’s provenance, so the document schema does not change.
Functions
|
Run one recipe; the new identifier must not exist yet. |
|
Apply a recipe and add its structure to a copy of the document. |
|
|
|
|
|
Expand a primitive cell to the conventional cell of its Bravais type. |
|
Classes
|
A molecule placed on a slab: from SMILES, a document species or explicit atoms. |
|
|
|
A cell choice of an existing structure: primitive, conventional, supercell, WS. |
|
A prototype from the library, or a Bravais type with parameters and a motif. |
|
Vacancies, substitutions and interstitials with an explicit charge and spin (#191). |
|
|
|
|
|
A slab cut from a 3-D bulk structure (#190). |
- class vibesketcher.document.solid_build.SiteSpec(*, symbol, fractional)[source]¶
Bases:
_Recipe- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.CrystalRecipe(*, kind='crystal', identifier, prototype=None, template=None, bravais=None, space_group=None, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, vacuum=None, sites=<factory>, operations=<factory>, cell='primitive', species_map=<factory>)[source]¶
Bases:
_RecipeA prototype from the library, or a Bravais type with parameters and a motif.
- Parameters:
kind (Literal['crystal'])
identifier (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
prototype (str | None)
template (str | None)
bravais (str | None)
a (float | None)
b (float | None)
c (float | None)
alpha (float | None)
beta (float | None)
gamma (float | None)
cell (Literal['primitive', 'conventional'])
- kind: Literal['crystal']¶
- identifier: _ID¶
- template: str | None¶
A standard crystal from the template library, by name, alias or formula (#231).
- space_group: str | int | None¶
A space group given by its ITA index, Hermann-Mauguin or Hall symbol, with
:H,:R,:1or:2for the setting;sitesare then its asymmetric unit (#199).
- cell: Literal['primitive', 'conventional']¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.CellRecipe(*, kind='cell', identifier, source, choice, matrix=None, bravais=None, symprec=0.001, idealize=False)[source]¶
Bases:
_RecipeA cell choice of an existing structure: primitive, conventional, supercell, WS.
- Parameters:
kind (Literal['cell'])
identifier (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
source (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
choice (Literal['primitive', 'conventional', 'supercell', 'wigner_seitz', 'wigner_seitz_supercell', 'standard_conventional', 'standard_primitive', 'niggli', 'delaunay'])
bravais (str | None)
idealize (bool)
- kind: Literal['cell']¶
- identifier: _ID¶
- source: _ID¶
- choice: CellName¶
- symprec: float¶
the length tolerance (angstrom) and whether to idealise positions.
- Type:
Standard cells
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.SlabRecipe(*, kind='slab', identifier, source=None, template=None, template_a=None, template_c=None, allow_polar=None, miller, layers, layer_unit='stoichiometric', termination=None, vacuum=15.0, repeat=<factory>, fixed_layers=0, periodicity='2d', surface_cell='primitive')[source]¶
Bases:
_RecipeA slab cut from a 3-D bulk structure (#190).
- Parameters:
kind (Literal['slab'])
identifier (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
source (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])] | None)
template (str | None)
allow_polar (bool | None)
layer_unit (Literal['stoichiometric', 'plane', 'cell'])
periodicity (Literal['2d', '3d'])
surface_cell (Literal['primitive', 'given'])
- kind: Literal['slab']¶
- identifier: _ID¶
- template: str | None¶
A crystal template (see
crystal_templates); the slab is cut from its conventional cell, somillerrefers to that cell (hexagonal axes for R).
- allow_polar: bool | None¶
Admit a slab with a formal-charge dipole or net charge (binary ionic crystals only); the default refuses polar slabs only when cut from a template.
- layer_unit: Literal['stoichiometric', 'plane', 'cell']¶
- termination: int | None¶
The bottom plane; without it, 0, or for a template slab the first nonpolar termination where polarity is known.
- periodicity: Literal['2d', '3d']¶
- surface_cell: Literal['primitive', 'given']¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.AtomSpec(*, symbol, xyz)[source]¶
Bases:
_Recipe- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.AdsorbateRecipe(*, kind='adsorbate', identifier, source, smiles=None, species=None, atoms=<factory>, site='top', anchor=None, position=None, height=2.5, orientation='flat', rotate=0.0, attach=None, min_distance=1.2)[source]¶
Bases:
_RecipeA molecule placed on a slab: from SMILES, a document species or explicit atoms.
- Parameters:
kind (Literal['adsorbate'])
identifier (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
source (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
smiles (str | None)
species (str | None)
site (Literal['top', 'bridge', 'hollow', 'position'])
anchor (str | None)
orientation (Literal['flat', 'upright', 'as-is'])
rotate (float)
attach (int | None)
- kind: Literal['adsorbate']¶
- identifier: _ID¶
- source: _ID¶
- site: Literal['top', 'bridge', 'hollow', 'position']¶
- orientation: Literal['flat', 'upright', 'as-is']¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.DefectSpec(*, kind, site=None, symbol=None, fractional=None)[source]¶
Bases:
_Recipe- Parameters:
- kind: Literal['vacancy', 'substitution', 'interstitial']¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.solid_build.DefectRecipe(*, kind='defect', identifier, source, defects, charge=None, multiplicity=None)[source]¶
Bases:
_RecipeVacancies, substitutions and interstitials with an explicit charge and spin (#191).
- Parameters:
kind (Literal['defect'])
identifier (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
source (Annotated[str, _PydanticGeneralMetadata(pattern='^[A-Za-z][A-Za-z0-9_-]{0,63}$')])
defects (Annotated[list[DefectSpec], MinLen(min_length=1), MaxLen(max_length=1000)])
charge (int | None)
- kind: Literal['defect']¶
- identifier: _ID¶
- source: _ID¶
- defects: list[DefectSpec]¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- vibesketcher.document.solid_build.build_crystal(recipe)[source]¶
- Parameters:
recipe (CrystalRecipe)
- Return type:
- vibesketcher.document.solid_build.conventional_cell(structure, bravais, *, identifier)[source]¶
Expand a primitive cell to the conventional cell of its Bravais type.
- Parameters:
structure (PeriodicStructure)
bravais (str)
identifier (str)
- Return type:
- vibesketcher.document.solid_build.cell_variant(recipe, source)[source]¶
- Parameters:
recipe (CellRecipe)
source (PeriodicStructure)
- Return type:
- vibesketcher.document.solid_build.apply_recipe(document, recipe)[source]¶
Run one recipe; the new identifier must not exist yet.
- Parameters:
document (Document)
recipe (CrystalRecipe | CellRecipe | SlabRecipe | AdsorbateRecipe | DefectRecipe | NanotubeRecipe | FrameworkRecipe | RolledNanotubeRecipe)
- Return type:
- vibesketcher.document.solid_build.build(document, recipe)[source]¶
Apply a recipe and add its structure to a copy of the document.
- Parameters:
document (Document)
recipe (CrystalRecipe | CellRecipe | SlabRecipe | AdsorbateRecipe | DefectRecipe | NanotubeRecipe | FrameworkRecipe | RolledNanotubeRecipe)
- Return type:
- vibesketcher.document.solid_build.parse_recipe(data)[source]¶
- Parameters:
- Return type:
CrystalRecipe | CellRecipe | SlabRecipe | AdsorbateRecipe | DefectRecipe | NanotubeRecipe | FrameworkRecipe | RolledNanotubeRecipe