vibe-sketcherDocumentation

vibesketcher.document.cif_import

Experimental CIF import with space-group expansion (#228).

A small pure-Python CIF 1.1 reader: it needs no compiled dependency, so it works wherever the sketcher does (Gemmi does not install on Python 3.15 yet, #210). It reads the cell with its standard uncertainties, the symmetry operations (or, without them, the Hall or Hermann-Mauguin symbol), the atom sites with occupancies and disorder groups, and expands the asymmetric unit to the full conventional cell. Partial occupancy is refused unless the caller chooses how to resolve it; every choice and merge is recorded.

The lossless P1 interchange in vibesketcher.document.periodic is unchanged; this module is for files from experiments and databases.

Syntax: S. R. Hall, F. H. Allen, I. D. Brown, Acta Cryst. A47, 655 (1991).

Functions

add_to_document(document, text, *, ...)

A copy of document with the imported crystal added; the ID must be new.

import_cif(text, *, identifier[, block, ...])

The full conventional cell of one CIF data block (#228).

number(text, tag)

A CIF number and its standard uncertainty, e.g. 4.7602(3) -> (4.7602, 0.0003).

parse(text)

The data blocks of a CIF 1.1 text (tags lower-cased).

Classes

Block(name, items, loops)

class vibesketcher.document.cif_import.Block(name: 'str', items: 'dict[str, str]', loops: 'list[dict[str, list[str]]]')[source]

Bases: object

Parameters:
name: str
items: dict[str, str]
loops: list[dict[str, list[str]]]
value(*tags)[source]
Parameters:

tags (str)

Return type:

str | None

column(*tags)[source]
Parameters:

tags (str)

Return type:

tuple[dict[str, list[str]], list[str]] | None

vibesketcher.document.cif_import.parse(text)[source]

The data blocks of a CIF 1.1 text (tags lower-cased).

Parameters:

text (str)

Return type:

list[Block]

vibesketcher.document.cif_import.number(text, tag)[source]

A CIF number and its standard uncertainty, e.g. 4.7602(3) -> (4.7602, 0.0003).

Parameters:
Return type:

tuple[float, float | None]

vibesketcher.document.cif_import.import_cif(text, *, identifier, block=None, disorder='refuse', disorder_group=None, setting=None, merge_tolerance=0.01, occupancy_tolerance=0.01)[source]

The full conventional cell of one CIF data block (#228).

disorder decides partially occupied and disordered sites: "refuse" (default), "group" keeps disorder_group and drops the other groups, "majority" keeps the most occupied group of each disorder assembly and, on a mixed or partially vacant site, the most occupied species. Kept sites are written fully occupied; every decision is recorded. setting names the space-group setting when the file has no operations and its symbol is ambiguous (e.g. "Fd-3m:1"). Images closer than merge_tolerance angstrom are merged.

Parameters:
  • text (str)

  • identifier (str)

  • block (str | None)

  • disorder (Literal['refuse', 'majority', 'group'])

  • disorder_group (str | None)

  • setting (str | None)

  • merge_tolerance (float)

  • occupancy_tolerance (float)

Return type:

PeriodicStructure

vibesketcher.document.cif_import.add_to_document(document, text, *, identifier, **options)[source]

A copy of document with the imported crystal added; the ID must be new.

Parameters:
Return type:

Any