httk.io.cif.cif_parser¶
Classes¶
Metadata returned by |
Functions¶
Parse a CIF numeric field. |
|
|
Convert a CIF numeric token (e.g., '123(4)', '3E2', '1.0E3') to an int using the central value. |
|
expr: e.g. 'x-y', '-z+1/2', 'x', 'y', 'z-1', 'x-2y', '3x+1/2' |
|
op: e.g. 'x-y,x,-z+1/2' |
|
|
|
|
|
Extract structural superspace modulation information from a standard CIF. |
|
|
Module Contents¶
- class httk.io.cif.cif_parser.CifMeta[source]¶
Bases:
TypedDictMetadata returned by
parse_cif_float()whenmeta=True.
- httk.io.cif.cif_parser.parse_cif_float(token: str, *, meta: Literal[False] = ..., pragmatic: bool = ...) float | None[source]¶
- httk.io.cif.cif_parser.parse_cif_float(token: str, *, meta: Literal[True], pragmatic: bool = ...) tuple[float | None, CifMeta]
Parse a CIF numeric field.
- If meta=False:
return float_value or None.
- If meta=True:
return (float_value_or_None, {‘esd’: esd_or_None, ‘resolution’: float_resolution}).
- httk.io.cif.cif_parser.parse_cif_int(token: str, *, strict: bool = True, allow_round: bool = False) int[source]¶
Convert a CIF numeric token (e.g., ‘123(4)’, ‘3E2’, ‘1.0E3’) to an int using the central value. - strict=True: require the value to be exactly integral; otherwise raise ValueError. - allow_round=True (only if strict=False): round half-even to the nearest int.
- httk.io.cif.cif_parser.parse_linear_expr(expr, use_fractions=False)[source]¶
expr: e.g. ‘x-y’, ‘-z+1/2’, ‘x’, ‘y’, ‘z-1’, ‘x-2y’, ‘3x+1/2’ Returns (row, const) where row is [ax, ay, az] (integers or Fractions), and const is a float or Fraction depending on use_fractions.
- httk.io.cif.cif_parser.parse_xyz_op(op, use_fractions=False)[source]¶
op: e.g. ‘x-y,x,-z+1/2’ Returns (R, t) where R is 3x3 (list of rows), t is length-3 float list
- httk.io.cif.cif_parser.parse_structural_modulation(cifblock)[source]¶
Extract structural superspace modulation information from a standard CIF.
Returns a tuple
(structural_q, mod_dim, has_struct_mod, struct_mod_atoms)wherestructural_qis a list of q-vectors orNone,mod_dimis the modulation dimension (0 if absent),has_struct_modis a bool, andstruct_mod_atomsis a sorted list of atom-site labels.