iotbx.shelx

Overview

API documentation

iotbx.shelx.parse_smtbx_refinement_model(file=None, filename=None, strictly_shelxl=True)
iotbx.shelx.crystal_symmetry_from_ins.extract_from(file_name=None, file=None, max_characters=100000, close_file=True)
iotbx.shelx.hklf.miller_array_export_as_shelx_hklf(miller_array, file_object=None, normalise_if_format_overflow=False, full_dynamic_range=False, scale_range=None)

For the full_dynamic_range option, normalise data outside the range that fits into 8.6g format, regardless of settings for normalise_if_format_overflow or scale_range Otherwise, if the maximum data value does not fit into the f8.2/f8.0 format:

normalise_if_format_overflow=False: RuntimeError is thrown normalise_if_format_overflow=True: data is normalised to the largest

number to fit f8.2/f8.0 format or within specified scale_range

class iotbx.shelx.hklf.reader(file_object=None, file_name=None)
alphas((hklf_reader)arg1) int :
C++ signature :

scitbx::af::shared<int> alphas(iotbx::shelx::hklf_reader {lvalue})

as_miller_arrays(crystal_symmetry=None, force_symmetry=False, merge_equivalents=True, base_array_info=None, anomalous=None)
batch_numbers((hklf_reader)arg1) int :
C++ signature :

scitbx::af::shared<int> batch_numbers(iotbx::shelx::hklf_reader {lvalue})

wavelengths((hklf_reader)arg1) double :
C++ signature :

scitbx::af::shared<double> wavelengths(iotbx::shelx::hklf_reader {lvalue})

class iotbx.shelx.tokens.atomname_token(name, symmetry=None, residue_number=None, plus_minus=None)

An atomname token that can be passed to a SHELXL instruction

name
plus_minus
residue_number
symmetry
class iotbx.shelx.tokens.element_token(element, residue_number=None, plus_minus=None)

An element name may also be passed to a SHELXL instruction in place of an atom name

element
plus_minus
residue_number
class iotbx.shelx.tokens.residue_token(class_=None, number=None)
class_
number

Parsing of ins/res files

class iotbx.shelx.lexer.command_stream(file=None, filename=None, close_when_deleted=True)

An ins/res file parsed as a stream of commands

commands_allowing_atom_names = {'ANIS': 1, 'BIND': 1, 'BLOC': 1, 'BOND': 1, 'CHIV': 1, 'CONF': 1, 'CONN': 1, 'DANG': 1, 'DELU': 1, 'DFIX': 1, 'EADP': 1, 'EXYZ': 1, 'FLAT': 1, 'FREE': 1, 'HFIX': 1, 'HTAB': 1, 'ISOR': 1, 'MPLA': 1, 'NCSY': 1, 'OMIT': 1, 'RIGU': 1, 'RTAB': 1, 'SADI': 1, 'SAME': 1, 'SIMU': 1}
shelx_commands = {'ACTA': 1, 'AFIX': 1, 'ANIS': 1, 'BASF': 1, 'BIND': 1, 'BLOC': 1, 'BOND': 1, 'BUMP': 1, 'CELL': 1, 'CGLS': 1, 'CHIV': 1, 'CONF': 1, 'CONN': 1, 'DAMP': 1, 'DANG': 1, 'DEFS': 1, 'DELU': 1, 'DFIX': 1, 'DISP': 1, 'EADP': 1, 'END': 1, 'EQIV': 1, 'EXTI': 1, 'EXYZ': 1, 'FEND': 1, 'FLAT': 1, 'FMAP': 1, 'FRAG': 1, 'FREE': 1, 'FVAR': 1, 'GRID': 1, 'HFIX': 1, 'HKLF': 1, 'HOPE': 1, 'HTAB': 1, 'ISOR': 1, 'L.S.': 1, 'LATT': 1, 'LAUE': 1, 'LIST': 1, 'MERG': 1, 'MOLE': 1, 'MORE': 1, 'MOVE': 1, 'MPLA': 1, 'MUST': 1, 'NCSY': 1, 'OMIT': 1, 'PART': 1, 'PLAN': 1, 'REM': 1, 'RESI': 1, 'RIGU': 1, 'RTAB': 1, 'SADI': 1, 'SAME': 1, 'SFAC': 1, 'SHEL': 1, 'SIMU': 1, 'SIZE': 1, 'SPEC': 1, 'STIR': 1, 'SUMP': 1, 'SWAT': 1, 'SYMM': 1, 'TEMP': 1, 'TIME': 1, 'TITL': 1, 'TWIN': 1, 'UNIT': 1, 'WGHT': 1, 'WPDB': 1, 'ZERR': 1}
symm_space = re.compile('\n    (?<! , ) \\s+\n    ', re.IGNORECASE|re.VERBOSE)

Lexing of ins/res files

class iotbx.shelx.parsers.afix_parser(command_stream, builder=None)

It must be before an atom parser

constraints = {1: ('tertiary_xh_site', -1), 2: ('secondary_xh2_sites', -1), 3: ('staggered_terminal_tetrahedral_xh3_sites', -1), 4: ('secondary_planar_xh_site', -1), 8: ('staggered_terminal_tetrahedral_xh_site', -1), 9: ('terminal_planar_xh2_sites', -1), 13: ('terminal_tetrahedral_xh3_sites', -1), 14: ('terminal_tetrahedral_xh_site', -1), 15: ('polyhedral_bh_site', -1), 16: ('terminal_linear_ch_site', -1)}
filtered_commands()
class iotbx.shelx.parsers.atom_parser(command_stream, builder=None, strictly_shelxl=True)

A parser pulling out the scatterer info from a command stream.

Since the SHELX format intertwine parameter values with some of the constrained on them, this parser does also handle those constraints, specifically constrained occupancies and u_iso bound to the u_eq of another scatterer. The parser tests whether the builder passed at construction time handles those constraints, and if it does not so, they get ignored.

filtered_commands()
lex_scatterer(args, scatterer_index)
process_occupancies_depending_on_free_variable()
process_possible_constrained_occupancy(scatterer_index, scatterer, occupancy_behaviour)
process_possible_u_iso_constraints(u_iso_scatterer_idx, u_iso_behaviour)
class iotbx.shelx.parsers.crystal_symmetry_parser(command_stream, builder=None)

A parser pulling out the crystal symmetry info from a command stream

filtered_commands()

Yields those command in self.command_stream that this parser is not concerned with. On the contrary, LATT, SYMM are swallowed (CELL is yielded because it carries the wavelength too).

parse()
iotbx.shelx.parsers.decode_variables(free_variable, coded_variables, u_iso_idx=None, line=None, strictly_shelxl=True, variable_decoder=None)
class iotbx.shelx.parsers.instruction_parser(command_stream, builder=None)

A parser for extracting from the command stream miscellaneous shelxl commands that do not concern other parsers.

If this parser is constructed with a real builder, the wt and m arguments to HKLF are not supported.

This parser is unusual in that it does not rely entirely on its builder: it builds a dictionary containing the parsed information.

filtered_commands()
issue_merohedral_twinning()
class iotbx.shelx.parsers.parser(command_stream, builder=None)
parse()
class iotbx.shelx.parsers.restraint_parser(command_stream, builder=None)

It must be after an atom parser

cache_restraint(cmd, cmd_residue, line, args)
filtered_commands()
i_seqs_from_atoms(atoms, residue_number)
parse_restraints()
restraint_types = {'CHIV': 'chirality', 'DANG': 'bond', 'DELU': 'rigid_bond', 'DFIX': 'bond', 'FLAT': 'planarity', 'ISOR': 'isotropic_adp', 'RIGU': 'rigu', 'SADI': 'bond_similarity', 'SIMU': 'adp_similarity'}
class iotbx.shelx.parsers.variable_decoder
decode_one_variable(coded_variable, u_iso_idx=None)
decode_variables(coded_variables, u_iso_idx=None)
class iotbx.shelx.parsers.wavelength_parser(command_stream, builder=None)

A parser pulling out the wavelength info from a command stream

filtered_commands()
iotbx.shelx.writer.generator(xray_structure, data_are_intensities=True, title=None, wavelength=None, temperature=None, full_matrix_least_squares_cycles=None, conjugate_gradient_least_squares_cycles=None, overall_scale_factor=None, weighting_scheme_params=None, sort_scatterers=True, unit_cell_dims=None, unit_cell_esds=None)
iotbx.shelx.write_ins.LATT_SYMM(s, space_group, decimal=False)
iotbx.shelx.write_ins.shelxd(s, title, crystal_symmetry, n_sites, scattering_type, d_min, mind_mdis=-3.5, mind_mdeq=None)