geom.gui.structure_gui ====================== .. py:module:: geom.gui.structure_gui .. autoapi-nested-parse:: Native Qt GUI for creating and visualizing GEOM XYZ structures. Attributes ---------- .. autoapisummary:: geom.gui.structure_gui.missing_dependency geom.gui.structure_gui.APP_TITLE geom.gui.structure_gui.SUPPORTED_VIEWER_SUFFIXES geom.gui.structure_gui.CHATGPT_GREEN geom.gui.structure_gui.TEXT geom.gui.structure_gui.MUTED geom.gui.structure_gui.SURFACE geom.gui.structure_gui.CANVAS geom.gui.structure_gui.BORDER geom.gui.structure_gui.SIDEBAR geom.gui.structure_gui.SOFT_BORDER geom.gui.structure_gui.PANEL geom.gui.structure_gui.ACCENT_VIOLET geom.gui.structure_gui.ACCENT_INDIGO geom.gui.structure_gui.ACCENT_SOFT geom.gui.structure_gui.GL_COLOR_BUFFER_BIT geom.gui.structure_gui.GL_DEPTH_BUFFER_BIT geom.gui.structure_gui.GL_TRIANGLE_STRIP geom.gui.structure_gui.GL_COMPILE geom.gui.structure_gui.GL_LEQUAL geom.gui.structure_gui.GL_FRONT_AND_BACK geom.gui.structure_gui.GL_FRONT geom.gui.structure_gui.GL_BACK geom.gui.structure_gui.GL_CULL_FACE geom.gui.structure_gui.GL_DEPTH_TEST geom.gui.structure_gui.GL_LIGHTING geom.gui.structure_gui.GL_LIGHT0 geom.gui.structure_gui.GL_COLOR_MATERIAL geom.gui.structure_gui.GL_NORMALIZE geom.gui.structure_gui.GL_POLYGON_OFFSET_FILL geom.gui.structure_gui.GL_LINE geom.gui.structure_gui.GL_FILL geom.gui.structure_gui.GL_MODELVIEW geom.gui.structure_gui.GL_PROJECTION geom.gui.structure_gui.GL_AMBIENT geom.gui.structure_gui.GL_DIFFUSE geom.gui.structure_gui.GL_POSITION geom.gui.structure_gui.GL_SPECULAR geom.gui.structure_gui.GL_SHININESS geom.gui.structure_gui.GL_AMBIENT_AND_DIFFUSE geom.gui.structure_gui.GL_SMOOTH geom.gui.structure_gui.VMD_ELEMENT_LABELS geom.gui.structure_gui.VMD_VDW_RADII geom.gui.structure_gui.VDW_RADII geom.gui.structure_gui.DEFAULT_VMD_PINK geom.gui.structure_gui.ELEMENT_COLORS geom.gui.structure_gui.CPK_COLORS geom.gui.structure_gui.CPK_DEFAULT geom.gui.structure_gui.METAL_ELEMENTS geom.gui.structure_gui.COVALENT_RADII geom.gui.structure_gui.STRUCTURES geom.gui.structure_gui.GRAPHENE_VARIANTS Classes ------- .. autoapisummary:: geom.gui.structure_gui.ProjectedAtom geom.gui.structure_gui.ProjectedBond geom.gui.structure_gui.GenerationWorker geom.gui.structure_gui.VdwCanvas geom.gui.structure_gui.ViewerStepper geom.gui.structure_gui.ViewerTabBar geom.gui.structure_gui.StructureWindow Functions --------- .. autoapisummary:: geom.gui.structure_gui.atom_matches_selection geom.gui.structure_gui._normalize_selection_expression geom.gui.structure_gui._evaluate_selection_node geom.gui.structure_gui._compare_selection_values geom.gui.structure_gui.main Module Contents --------------- .. py:data:: missing_dependency .. py:data:: APP_TITLE :value: 'GEOM Structure Studio' .. py:data:: SUPPORTED_VIEWER_SUFFIXES .. py:data:: CHATGPT_GREEN :value: '#10A37F' .. py:data:: TEXT :value: '#202123' .. py:data:: MUTED :value: '#6E6E80' .. py:data:: SURFACE :value: '#FFFFFF' .. py:data:: CANVAS :value: '#F7F7F8' .. py:data:: BORDER :value: '#D9D9E3' .. py:data:: SIDEBAR :value: '#ECECF1' .. py:data:: SOFT_BORDER :value: '#ECECF1' .. py:data:: PANEL :value: '#FFFFFF' .. py:data:: ACCENT_VIOLET :value: '#4F00B5' .. py:data:: ACCENT_INDIGO :value: '#0600A0' .. py:data:: ACCENT_SOFT :value: '#F4F0FF' .. py:data:: GL_COLOR_BUFFER_BIT :value: 16384 .. py:data:: GL_DEPTH_BUFFER_BIT :value: 256 .. py:data:: GL_TRIANGLE_STRIP :value: 5 .. py:data:: GL_COMPILE :value: 4864 .. py:data:: GL_LEQUAL :value: 515 .. py:data:: GL_FRONT_AND_BACK :value: 1032 .. py:data:: GL_FRONT :value: 1028 .. py:data:: GL_BACK :value: 1029 .. py:data:: GL_CULL_FACE :value: 2884 .. py:data:: GL_DEPTH_TEST :value: 2929 .. py:data:: GL_LIGHTING :value: 2896 .. py:data:: GL_LIGHT0 :value: 16384 .. py:data:: GL_COLOR_MATERIAL :value: 2903 .. py:data:: GL_NORMALIZE :value: 2977 .. py:data:: GL_POLYGON_OFFSET_FILL :value: 32823 .. py:data:: GL_LINE :value: 6913 .. py:data:: GL_FILL :value: 6914 .. py:data:: GL_MODELVIEW :value: 5888 .. py:data:: GL_PROJECTION :value: 5889 .. py:data:: GL_AMBIENT :value: 4608 .. py:data:: GL_DIFFUSE :value: 4609 .. py:data:: GL_POSITION :value: 4611 .. py:data:: GL_SPECULAR :value: 4610 .. py:data:: GL_SHININESS :value: 5633 .. py:data:: GL_AMBIENT_AND_DIFFUSE :value: 5634 .. py:data:: GL_SMOOTH :value: 7425 .. py:data:: VMD_ELEMENT_LABELS :value: ('X', 'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S',... .. py:data:: VMD_VDW_RADII :value: (1.5, 1.0, 1.4, 1.82, 2.0, 2.0, 1.7, 1.55, 1.52, 1.47, 1.54, 1.36, 1.18, 2.0, 2.1, 1.8, 1.8,... .. py:data:: VDW_RADII .. py:data:: DEFAULT_VMD_PINK .. py:data:: ELEMENT_COLORS .. py:data:: CPK_COLORS .. py:data:: CPK_DEFAULT .. py:data:: METAL_ELEMENTS .. py:data:: COVALENT_RADII .. py:data:: STRUCTURES .. py:data:: GRAPHENE_VARIANTS .. py:class:: ProjectedAtom .. py:attribute:: index :type: int .. py:attribute:: element :type: str .. py:attribute:: x :type: float .. py:attribute:: y :type: float .. py:attribute:: z :type: float .. py:attribute:: radius :type: float .. py:attribute:: depth_radius :type: float .. py:attribute:: cpk :type: bool .. py:attribute:: ox :type: float .. py:attribute:: oy :type: float .. py:attribute:: oz :type: float .. py:class:: ProjectedBond .. py:attribute:: first :type: ProjectedAtom .. py:attribute:: second :type: ProjectedAtom .. py:attribute:: z :type: float .. py:attribute:: width :type: float .. py:function:: atom_matches_selection(atom: geom.gui.structure_generator.AtomRecord, expression: str) -> bool Evaluate a VMD-like coordinate selection expression for one atom. .. py:function:: _normalize_selection_expression(expression: str) -> str .. py:function:: _evaluate_selection_node(node: ast.AST, values: dict[str, float | str]) -> bool | float | str .. py:function:: _compare_selection_values(left: bool | float | str, operator: ast.cmpop, right: bool | float | str) -> bool .. py:class:: GenerationWorker(command_args: list[str], output_root: pathlib.Path, parent=None) Bases: :py:obj:`PySide6.QtCore.QThread` .. py:attribute:: generated .. py:attribute:: failed .. py:attribute:: command_args .. py:attribute:: output_root .. py:method:: run() .. py:class:: VdwCanvas(parent=None) Bases: :py:obj:`PySide6.QtOpenGLWidgets.QOpenGLWidget` .. py:attribute:: files_dropped .. py:attribute:: atoms :type: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis] :value: () .. py:attribute:: source_atoms :type: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis] :value: () .. py:attribute:: selection_expression :value: '' .. py:attribute:: rotation_x :value: 0.0 .. py:attribute:: rotation_y :value: 0.0 .. py:attribute:: zoom :value: 1.0 .. py:attribute:: pan_x :value: 0.0 .. py:attribute:: pan_y :value: 0.0 .. py:attribute:: vdw_scale :value: 1.45 .. py:attribute:: bond_width_scale :value: 1.65 .. py:attribute:: render_resolution :value: 1 .. py:attribute:: translate_mode :value: False .. py:attribute:: _is_interacting :value: False .. py:attribute:: _last_pos :type: PySide6.QtCore.QPoint | None :value: None .. py:attribute:: _sphere_cache :type: dict[tuple[str, int, int, bool], PySide6.QtGui.QPixmap] .. py:attribute:: _gl :value: None .. py:attribute:: _sphere_list :value: 0 .. py:attribute:: _sphere_mesh :value: [] .. py:attribute:: _interaction_timer .. py:method:: set_atoms(atoms: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis]) .. py:method:: set_visible_atoms(atoms: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis]) .. py:method:: reset_view() .. py:method:: set_vdw_scale(value: float) .. py:method:: set_bond_width_scale(value: float) .. py:method:: set_render_resolution(value: int) .. py:method:: _begin_interaction() .. py:method:: _finish_interaction() .. py:method:: mousePressEvent(event) .. py:method:: mouseMoveEvent(event) .. py:method:: mouseReleaseEvent(event) .. py:method:: wheelEvent(event) .. py:method:: keyPressEvent(event) .. py:method:: _is_reset_view_key(event) -> bool .. py:method:: dragEnterEvent(event) .. py:method:: dropEvent(event) .. py:method:: _structure_paths_from_event(event) -> list[pathlib.Path] .. py:method:: initializeGL() .. py:method:: resizeGL(width: int, height: int) .. py:method:: paintGL() .. py:method:: _make_painter(fine_render: bool) -> PySide6.QtGui.QPainter .. py:method:: _paint_axes_overlay() .. py:method:: _paint_background(painter: PySide6.QtGui.QPainter) .. py:method:: _project_atoms() -> list[ProjectedAtom] .. py:method:: _atom_uses_cpk(element: str) -> bool .. py:method:: _scene_has_cpk() -> bool .. py:method:: _uses_vdw_opengl(projected: list[ProjectedAtom]) -> bool .. py:method:: _uses_mixed_vdw_cpk(projected: list[ProjectedAtom]) -> bool .. py:method:: _paint_mixed_vdw_cpk(projected: list[ProjectedAtom]) .. py:method:: _paint_bonds_and_atoms(painter: PySide6.QtGui.QPainter, bond_source: list[ProjectedAtom], atoms: list[ProjectedAtom]) .. py:method:: _paint_vdw_opengl(projected: list[ProjectedAtom]) .. py:method:: _build_sphere_mesh(stacks: int, slices: int) -> list[list[tuple[float, float, float]]] .. py:method:: _draw_unit_sphere(gl) .. py:method:: _draw_unit_sphere_mesh(gl) .. py:method:: _uses_vdw_impostors(projected: list[ProjectedAtom]) -> bool .. py:method:: _uses_vdw_surface_buffer(projected: list[ProjectedAtom]) -> bool .. py:method:: _paint_vdw_surface_buffer(painter: PySide6.QtGui.QPainter, projected: list[ProjectedAtom]) .. py:method:: _vdw_surface_render_scale(width: int, height: int, atom_count: int) -> float .. py:method:: _paint_vdw_impostors(painter: PySide6.QtGui.QPainter, projected: list[ProjectedAtom]) .. py:method:: _sphere_pixmap(atom: ProjectedAtom) -> PySide6.QtGui.QPixmap .. py:method:: _paint_vdw_depth_buffer(painter: PySide6.QtGui.QPainter, projected: list[ProjectedAtom]) .. py:method:: _vdw_depth_render_scale(width: int, height: int, atom_count: int) -> float .. py:method:: _view_light_vector() -> tuple[float, float, float] .. py:method:: _projected_bonds(projected: list[ProjectedAtom]) -> list[ProjectedBond] .. py:method:: _paint_bond(painter: PySide6.QtGui.QPainter, bond: ProjectedBond) .. py:method:: _paint_atom(painter: PySide6.QtGui.QPainter, atom: ProjectedAtom) .. py:method:: _use_lit_atom_rendering(atom: ProjectedAtom) -> bool .. py:method:: _rotate_point(x: float, y: float, z: float) -> tuple[float, float, float] .. py:method:: _paint_axes(painter: PySide6.QtGui.QPainter) .. py:class:: ViewerStepper(value: int, minimum: int, maximum: int, suffix: str, parent=None) Bases: :py:obj:`PySide6.QtWidgets.QWidget` .. py:attribute:: valueChanged .. py:attribute:: spin .. py:attribute:: up_button .. py:attribute:: down_button .. py:method:: setValue(value: int) .. py:method:: value() -> int .. py:class:: ViewerTabBar(parent=None) Bases: :py:obj:`PySide6.QtWidgets.QTabBar` Compact tab bar with drag reordering and wheel navigation. .. py:method:: wheelEvent(event) .. py:class:: StructureWindow Bases: :py:obj:`PySide6.QtWidgets.QMainWindow` .. py:attribute:: worker :type: GenerationWorker | None :value: None .. py:attribute:: current_result :type: geom.gui.structure_generator.StructureResult | None :value: None .. py:attribute:: output_root :type: pathlib.Path | None :value: None .. py:attribute:: empty_canvas :type: VdwCanvas | None :value: None .. py:attribute:: pending_generation_meta :type: dict[str, object] .. py:attribute:: vdw_scale :value: 1.45 .. py:attribute:: bond_width_scale :value: 1.65 .. py:attribute:: render_resolution :value: 1 .. py:method:: _build_ui() .. py:method:: _field_label(text: str) -> PySide6.QtWidgets.QLabel .. py:method:: _configure_dropdown_popups() .. py:method:: _section_label(text: str) -> PySide6.QtWidgets.QLabel .. py:method:: _make_canvas() -> VdwCanvas .. py:method:: _make_viewer_spin(value: int, minimum: int, maximum: int, suffix: str) -> ViewerStepper .. py:method:: reset_current_view() .. py:method:: keyPressEvent(event) .. py:method:: _make_manipulator_spin(value: float, minimum: float, maximum: float, suffix: str) -> PySide6.QtWidgets.QDoubleSpinBox .. py:method:: _make_option_spin(value: float, minimum: float, maximum: float) -> PySide6.QtWidgets.QDoubleSpinBox .. py:method:: _material_items() -> list[str] .. py:method:: _refresh_material_controls() .. py:method:: _available_structures_for_material(material: str) -> list[str] .. py:method:: _refresh_structure_controls() .. py:method:: _configure_parameter_widget(label: PySide6.QtWidgets.QLabel, spin: PySide6.QtWidgets.QDoubleSpinBox, text: str, value: float, minimum: float, maximum: float) .. py:method:: _ordered_metals(metals: list[str]) -> list[str] .. py:method:: _refresh_option_controls() .. py:method:: _set_optional_row_enabled(widgets, enabled: bool) .. py:method:: _apply_atom_selection(*_args) .. py:method:: _sync_atom_selection_input() .. py:method:: _set_atom_selection_invalid(invalid: bool) .. py:method:: _set_vdw_scale_from_input(value: int) .. py:method:: _set_render_resolution_from_input(value: int) .. py:method:: _set_bond_width_from_input(value: int) .. py:method:: _refresh_smiles_button_state() .. py:method:: _all_canvases() -> list[VdwCanvas] .. py:method:: _apply_styles() .. py:method:: create_structure() .. py:method:: load_files_from_dialog() .. py:method:: load_files(paths: list[pathlib.Path]) .. py:method:: load_smiles_from_input() .. py:method:: _add_structure_tab(title: str, atoms: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis], path: pathlib.Path | None = None, metadata: dict[str, object] | None = None) .. py:method:: _install_tab_menu(tab_index: int, canvas: VdwCanvas) .. py:method:: save_structure(canvas: VdwCanvas) .. py:method:: _save_source_for_canvas(canvas: VdwCanvas) -> pathlib.Path | None | bool .. py:method:: _write_xyz(path: pathlib.Path, atoms: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis]) .. py:method:: delete_structure_tab(canvas: VdwCanvas) .. py:method:: _refresh_manipulator_sources(sync_to_current_tab: bool = False) .. py:method:: _refresh_manipulator_actions(*_args) .. py:method:: _center_to_origin_available() -> bool .. py:method:: _current_viewer_tab_is_joint() -> bool .. py:method:: _atoms_are_centered(atoms: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis], tolerance: float = 1e-06) -> bool .. py:method:: _selected_manipulator_path() -> pathlib.Path .. py:method:: _run_manipulation(command_builder) .. py:method:: center_selected_structure() .. py:method:: mirror_selected_structure() .. py:method:: rotate_selected_structure() .. py:method:: translate_selected_structure() .. py:method:: translate_pair_selected_structures() .. py:method:: _minimum_distance(first: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis], second: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis]) -> float .. py:method:: _short_tab_title(title: str) -> str .. py:method:: _sync_current_tab_meta() .. py:method:: _generation_metadata() -> dict[str, object] .. py:method:: _metadata_for_generated_atoms(atoms: tuple[geom.gui.structure_generator.AtomRecord, Ellipsis]) -> dict[str, object] .. py:method:: _build_command_args() -> list[str] .. py:method:: _fmt(value: float) -> str .. py:method:: _structure_ready(result: geom.gui.structure_generator.StructureResult) .. py:method:: _structure_failed(details: str) .. py:method:: closeEvent(event) .. py:function:: main() -> int