molforge-studio 7.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- main.py +71 -0
- molforge/__init__.py +19 -0
- molforge/ai/__init__.py +15 -0
- molforge/ai/deepseek_harness.py +185 -0
- molforge/ai/mcp/desktop_client.py +38 -0
- molforge/ai/mcp/desktop_service.py +121 -0
- molforge/ai/mcp/mcp_server.py +780 -0
- molforge/ai/mcp_bridge.py +945 -0
- molforge/ai/observation.py +152 -0
- molforge/ai/tools.py +455 -0
- molforge/application/__init__.py +22 -0
- molforge/application/ai/__init__.py +1 -0
- molforge/application/ai/deepseek_client.py +293 -0
- molforge/application/ai/observation.py +161 -0
- molforge/application/ai/tools.py +200 -0
- molforge/application/ai_proposals.py +166 -0
- molforge/application/bio_selection.py +143 -0
- molforge/application/builtin_commands.py +1445 -0
- molforge/application/calculators/__init__.py +10 -0
- molforge/application/calculators/base.py +143 -0
- molforge/application/calculators/calchem_engine.py +67 -0
- molforge/application/calculators/calchem_subprocess_worker.py +109 -0
- molforge/application/calculators/gaussian_engine.py +59 -0
- molforge/application/calculators/gaussian_job_spec.py +240 -0
- molforge/application/calculators/orca_engine.py +92 -0
- molforge/application/calculators/qc_input_generator.py +300 -0
- molforge/application/calculators/registry.py +29 -0
- molforge/application/calculators/rest_engine.py +262 -0
- molforge/application/command_bus.py +139 -0
- molforge/application/commands.py +55 -0
- molforge/application/conformers.py +143 -0
- molforge/application/document_session.py +156 -0
- molforge/application/events.py +74 -0
- molforge/application/fragment_catalog.py +422 -0
- molforge/application/fragment_commands.py +268 -0
- molforge/application/geometry_commands.py +84 -0
- molforge/application/history.py +105 -0
- molforge/application/internal_coordinates.py +293 -0
- molforge/application/invalidation.py +1174 -0
- molforge/application/jobs.py +185 -0
- molforge/application/measurement.py +167 -0
- molforge/application/measurement_targets.py +264 -0
- molforge/application/modeling_commands.py +61 -0
- molforge/application/plugins.py +197 -0
- molforge/application/ports/editor2d.py +85 -0
- molforge/application/reaction.py +75 -0
- molforge/application/selection.py +164 -0
- molforge/application/selection_commands.py +31 -0
- molforge/application/trajectory.py +120 -0
- molforge/application/trajectory_analysis.py +231 -0
- molforge/application/workspace_registry.py +226 -0
- molforge/core/__init__.py +12 -0
- molforge/core/conformer.py +45 -0
- molforge/core/molecule.py +150 -0
- molforge/core/orbital.py +33 -0
- molforge/core/properties.py +43 -0
- molforge/domain/__init__.py +12 -0
- molforge/domain/biomolecule.py +99 -0
- molforge/domain/chemical_summary.py +129 -0
- molforge/domain/chemistry.py +13 -0
- molforge/domain/coordinate_store.py +164 -0
- molforge/domain/coordination.py +133 -0
- molforge/domain/custom_fragments.py +255 -0
- molforge/domain/document.py +469 -0
- molforge/domain/element_reference.json +598 -0
- molforge/domain/elements.py +188 -0
- molforge/domain/ids.py +58 -0
- molforge/domain/massive_system.py +246 -0
- molforge/domain/periodic.py +116 -0
- molforge/domain/provenance.py +115 -0
- molforge/domain/topology.py +364 -0
- molforge/infrastructure/__init__.py +23 -0
- molforge/infrastructure/hpc/cluster_config.py +122 -0
- molforge/infrastructure/hpc/remote_executor.py +212 -0
- molforge/infrastructure/hpc/slurm_generator.py +93 -0
- molforge/io/__init__.py +35 -0
- molforge/io/calchem_bridge.py +407 -0
- molforge/io/calculators.py +893 -0
- molforge/io/cclib_adapter.py +422 -0
- molforge/io/conformers.py +183 -0
- molforge/io/cube_reader.py +215 -0
- molforge/io/custom_fragments.py +79 -0
- molforge/io/format_matrix.py +157 -0
- molforge/io/gemmi_adapter.py +150 -0
- molforge/io/history_skill.py +46 -0
- molforge/io/mdanalysis_adapter.py +155 -0
- molforge/io/mforge_storage.py +261 -0
- molforge/io/multiwfn_driver.py +614 -0
- molforge/io/openbabel_adapter.py +265 -0
- molforge/io/openbabel_handler.py +33 -0
- molforge/io/rdkit_adapter.py +1865 -0
- molforge/io/readers/__init__.py +10 -0
- molforge/io/readers/cube_reader.py +71 -0
- molforge/io/readers/gjf_reader.py +110 -0
- molforge/io/readers/glog_reader.py +45 -0
- molforge/io/readers/mol2_reader.py +36 -0
- molforge/io/readers/mol_reader.py +56 -0
- molforge/io/readers/pdb_reader.py +39 -0
- molforge/io/readers/smi_reader.py +40 -0
- molforge/io/readers/xyz_reader.py +47 -0
- molforge/io/registry.py +128 -0
- molforge/io/writers/__init__.py +7 -0
- molforge/io/writers/gjf_writer.py +68 -0
- molforge/io/writers/pdb_writer.py +37 -0
- molforge/io/writers/png_writer.py +31 -0
- molforge/io/writers/svg_writer.py +111 -0
- molforge/io/writers/xyz_writer.py +39 -0
- molforge/rendering/__init__.py +21 -0
- molforge/rendering/benchmark.py +121 -0
- molforge/rendering/bridge.py +60 -0
- molforge/rendering/contracts.py +119 -0
- molforge/rendering/glyph_scene.py +279 -0
- molforge/rendering/ketcher_bridge.py +131 -0
- molforge/rendering/ketcher_id_mapping.py +110 -0
- molforge/rendering/materials.py +127 -0
- molforge/rendering/molstar_backend.py +245 -0
- molforge/rendering/native_labels.py +134 -0
- molforge/rendering/orbitals.py +139 -0
- molforge/rendering/vtk_backend.py +2294 -0
- molforge/runtime.py +29 -0
- molforge/server/__init__.py +1 -0
- molforge/server/api_bridge.py +947 -0
- molforge/ui/__init__.py +1 -0
- molforge/ui/assets/caffeine_2d.svg +150 -0
- molforge/ui/assets/caffeine_3d_preview.svg +209 -0
- molforge/ui/assets/caffeine_preview.json +302 -0
- molforge/ui/assets/icons/atom.svg +1 -0
- molforge/ui/assets/icons/bond.svg +1 -0
- molforge/ui/assets/icons/cleanup.svg +1 -0
- molforge/ui/assets/icons/export.svg +1 -0
- molforge/ui/assets/icons/fragments.svg +1 -0
- molforge/ui/assets/icons/history.svg +1 -0
- molforge/ui/assets/icons/jobs.svg +1 -0
- molforge/ui/assets/icons/measure.svg +1 -0
- molforge/ui/assets/icons/molecules.svg +1 -0
- molforge/ui/assets/icons/overview.svg +1 -0
- molforge/ui/assets/icons/ring.svg +1 -0
- molforge/ui/assets/icons/search.svg +1 -0
- molforge/ui/assets/icons/select.svg +1 -0
- molforge/ui/assets/icons/settings.svg +1 -0
- molforge/ui/assets/icons/templates.svg +1 -0
- molforge/ui/assets/molforge_logo.ico +0 -0
- molforge/ui/assets/molforge_logo.png +0 -0
- molforge/ui/atom_labels.py +92 -0
- molforge/ui/bio_structure_dialog.py +57 -0
- molforge/ui/conformer_dialog.py +151 -0
- molforge/ui/dialogs/__init__.py +2 -0
- molforge/ui/dialogs/aim_qtaim_dialog.py +533 -0
- molforge/ui/dialogs/calchem_orbitals_dialog.py +287 -0
- molforge/ui/dialogs/element_fragments.py +130 -0
- molforge/ui/dialogs/gaussian_calculation_setup.py +308 -0
- molforge/ui/dialogs/hpc_job_dialog.py +427 -0
- molforge/ui/dialogs/vibrational_spectrum_dialog.py +381 -0
- molforge/ui/editor2d_widget.py +1803 -0
- molforge/ui/element_picker.py +218 -0
- molforge/ui/gmv_window_manager.py +65 -0
- molforge/ui/gromacs_job_dialog.py +47 -0
- molforge/ui/hotkeys.py +107 -0
- molforge/ui/i18n.py +237 -0
- molforge/ui/live_llm_dialog.py +135 -0
- molforge/ui/llm_config_dialog.py +103 -0
- molforge/ui/modeling_actions.py +176 -0
- molforge/ui/molstar_widget.py +98 -0
- molforge/ui/molstar_window.py +85 -0
- molforge/ui/panels.py +2966 -0
- molforge/ui/qc_result_dialog.py +1924 -0
- molforge/ui/render3d_widget.py +1579 -0
- molforge/ui/scrolling.py +52 -0
- molforge/ui/settings_panel.py +330 -0
- molforge/ui/shells/__init__.py +4 -0
- molforge/ui/shells/base_shell.py +72 -0
- molforge/ui/shells/document_tabs.py +715 -0
- molforge/ui/shells/studio_2d.py +339 -0
- molforge/ui/shells/studio_3d.py +401 -0
- molforge/ui/shells/studio_split.py +370 -0
- molforge/ui/shells/workflow_inputs.py +698 -0
- molforge/ui/theme.py +719 -0
- molforge/ui/trajectory_window.py +333 -0
- molforge/ui/views.py +892 -0
- molforge/ui/vtk_multiview_widget.py +141 -0
- molforge/ui/welcome_window.py +223 -0
- molforge/ui/window.py +3320 -0
- molforge/workflows/__init__.py +25 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/01-MD/delete_solvent.py +216 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/02-RDF/extract_atoms.py +60 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/02-RDF/extract_atoms_example.py +22 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/03-/342/225/244/320/225/342/225/250/342/226/221/342/225/250/320/246/342/225/244/320/227/342/225/250/342/225/226/342/225/250/342/224/220/342/225/244/320/225/342/225/250/320/247/342/225/250/342/226/221/342/225/244/320/224/321/202/320/245/320/254/342/225/250/320/265/analysis_mol.py +244 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/04-/342/225/244/320/224/321/202/320/245/320/241/342/225/250/320/254/342/225/244/320/227/321/202/320/245/320/247/321/202/320/244/320/264/342/225/244/320/225/342/225/250/342/224/220/342/225/250/320/246/342/225/244/320/225/321/202/320/245/320/241/342/225/250/342/225/242/rms_roughness.py +33 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/04-/342/225/244/320/224/321/202/320/245/320/241/342/225/250/320/254/342/225/244/320/227/321/202/320/245/320/247/321/202/320/244/320/264/342/225/244/320/225/342/225/250/342/224/220/342/225/250/320/246/342/225/244/320/225/321/202/320/245/320/241/342/225/250/342/225/242/xpm_2.py +117 -0
- molforge/workflows/assets/OSC_MD_workflows/templates/09-/342/225/244/320/231/342/225/250/320/240/342/225/250/320/277/342/225/244/320/227/342/225/250/320/256/342/225/250/320/247/marcus_rate.py +60 -0
- molforge/workflows/assets/esp-surface-analysis/scripts/compute_descriptors.py +134 -0
- molforge/workflows/assets/esp-surface-analysis/scripts/parse_surfanalysis.py +58 -0
- molforge/workflows/assets/esp-surface-analysis/scripts/plot_esp_hist.py +115 -0
- molforge/workflows/assets/homo-lumo-plot/extract_orb_energy.py +57 -0
- molforge/workflows/assets/homo-lumo-plot/make_level_plot.py +76 -0
- molforge/workflows/assets/homo-lumo-plot/run_pipeline.py +84 -0
- molforge/workflows/assets/osc-energy-level-diagram/scripts/extract_levels.py +60 -0
- molforge/workflows/assets/osc-energy-level-diagram/scripts/make_editable_pptx.py +122 -0
- molforge/workflows/assets/osc-energy-level-diagram/scripts/make_energy_table.py +66 -0
- molforge/workflows/assets/osc-energy-level-diagram/scripts/make_level_lines_diagram.py +148 -0
- molforge/workflows/assets/osc-energy-level-diagram/scripts/make_rectangle_diagram.py +148 -0
- molforge/workflows/assets/osc-energy-level-diagram/scripts/verify_from_log.py +45 -0
- molforge/workflows/dipole_analysis.py +32 -0
- molforge/workflows/esp_surface.py +36 -0
- molforge/workflows/gromacs_submit.py +167 -0
- molforge/workflows/homo_lumo_plot.py +59 -0
- molforge/workflows/igmh_interaction.py +111 -0
- molforge/workflows/md_rdf_analysis.py +134 -0
- molforge/workflows/md_studio.py +255 -0
- molforge/workflows/osc_energy_diagram.py +24 -0
- molforge/workflows/planarity_analysis.py +66 -0
- molforge/workflows/reorganization_energy.py +166 -0
- molforge/workflows/scientific_workflows.py +650 -0
- molforge_studio-7.4.3.dist-info/METADATA +215 -0
- molforge_studio-7.4.3.dist-info/RECORD +219 -0
- molforge_studio-7.4.3.dist-info/WHEEL +5 -0
- molforge_studio-7.4.3.dist-info/entry_points.txt +3 -0
- molforge_studio-7.4.3.dist-info/licenses/LICENSE +93 -0
- molforge_studio-7.4.3.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ui/dialogs/aim_qtaim_dialog.py - Multiwfn 量化波函数与电子结构深度分析工作台
|
|
3
|
+
========================================================================
|
|
4
|
+
集成 Tian Lu 教授 Multiwfn 核心模块:
|
|
5
|
+
1. QTAIM 拓扑临界点 (BCP/RCP/CCP) 与 3D 梯度键径
|
|
6
|
+
2. NCI / RDG 弱相互作用 (从头算波函数或原初分子密度近似)
|
|
7
|
+
3. ELF / LOL / ESP 空间网格等值面
|
|
8
|
+
4. ADCH / Hirshfeld 原子净电荷与分子偶极
|
|
9
|
+
5. Mayer 键级分析与原子总价
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import threading
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Any, Optional
|
|
17
|
+
|
|
18
|
+
import numpy as np
|
|
19
|
+
from PyQt6.QtCore import Qt, QTimer, pyqtSignal, QObject
|
|
20
|
+
from PyQt6.QtWidgets import (
|
|
21
|
+
QDialog, QWidget, QVBoxLayout, QHBoxLayout, QTabWidget, QLabel,
|
|
22
|
+
QPushButton, QTableWidget, QTableWidgetItem, QHeaderView, QComboBox,
|
|
23
|
+
QDoubleSpinBox, QMessageBox, QFileDialog, QGroupBox, QProgressBar
|
|
24
|
+
)
|
|
25
|
+
from PyQt6.QtGui import QColor
|
|
26
|
+
|
|
27
|
+
from molforge.io.multiwfn_driver import MultiwfnDriver, QTAIMResult, NCIResult, PopulationResult, MayerBondOrderResult
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class _MultiwfnWorker(QObject):
|
|
31
|
+
finished = pyqtSignal(object)
|
|
32
|
+
error = pyqtSignal(str)
|
|
33
|
+
|
|
34
|
+
def __init__(self, task_fn):
|
|
35
|
+
super().__init__()
|
|
36
|
+
self.task_fn = task_fn
|
|
37
|
+
|
|
38
|
+
def run(self):
|
|
39
|
+
try:
|
|
40
|
+
res = self.task_fn()
|
|
41
|
+
self.finished.emit(res)
|
|
42
|
+
except Exception as e:
|
|
43
|
+
self.error.emit(str(e))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class AIMQTAIMDialog(QDialog):
|
|
47
|
+
"""Multiwfn 波函数分析控制面板。"""
|
|
48
|
+
|
|
49
|
+
def __init__(self, main_window, document=None, parent=None):
|
|
50
|
+
super().__init__(parent or main_window)
|
|
51
|
+
self.main_window = main_window
|
|
52
|
+
self.document = document
|
|
53
|
+
self.driver = MultiwfnDriver()
|
|
54
|
+
|
|
55
|
+
self.loaded_file: Optional[Path] = None
|
|
56
|
+
self.qtaim_result: Optional[QTAIMResult] = None
|
|
57
|
+
self.nci_result: Optional[NCIResult] = None
|
|
58
|
+
self.pop_result: Optional[PopulationResult] = None
|
|
59
|
+
self.bo_result: Optional[MayerBondOrderResult] = None
|
|
60
|
+
|
|
61
|
+
doc_name = getattr(document, "name", "当前分子")
|
|
62
|
+
self.setWindowTitle(f"Multiwfn 波函数与电子结构深度分析 · {doc_name}")
|
|
63
|
+
self.resize(880, 640)
|
|
64
|
+
self.setMinimumSize(780, 520)
|
|
65
|
+
|
|
66
|
+
self._build_ui()
|
|
67
|
+
|
|
68
|
+
def _build_ui(self):
|
|
69
|
+
root = QVBoxLayout(self)
|
|
70
|
+
root.setContentsMargins(12, 12, 12, 12)
|
|
71
|
+
root.setSpacing(10)
|
|
72
|
+
|
|
73
|
+
# 顶部文件与环境状态条
|
|
74
|
+
top_bar = QHBoxLayout()
|
|
75
|
+
self.lbl_exec = QLabel()
|
|
76
|
+
if self.driver.is_available:
|
|
77
|
+
self.lbl_exec.setText(f"🟢 Multiwfn: {self.driver.executable_path.name}")
|
|
78
|
+
self.lbl_exec.setStyleSheet("color: #4CAF50; font-size: 11px;")
|
|
79
|
+
else:
|
|
80
|
+
self.lbl_exec.setText("🔴 未检测到 Multiwfn.exe (可在系统 PATH 或 D:\\Multiwfn\\ 配置)")
|
|
81
|
+
self.lbl_exec.setStyleSheet("color: #F44336; font-size: 11px;")
|
|
82
|
+
top_bar.addWidget(self.lbl_exec)
|
|
83
|
+
top_bar.addSpacing(12)
|
|
84
|
+
|
|
85
|
+
self.btn_select_file = QPushButton("📁 打开波函数文件 (.wfn / .fchk / .molden / .xyz)...")
|
|
86
|
+
self.btn_select_file.clicked.connect(self._select_file)
|
|
87
|
+
top_bar.addWidget(self.btn_select_file)
|
|
88
|
+
|
|
89
|
+
self.btn_use_current = QPushButton("⚛ 使用当前画布分子 (Promolecular)")
|
|
90
|
+
self.btn_use_current.clicked.connect(self._use_current_doc)
|
|
91
|
+
top_bar.addWidget(self.btn_use_current)
|
|
92
|
+
top_bar.addStretch()
|
|
93
|
+
|
|
94
|
+
root.addLayout(top_bar)
|
|
95
|
+
|
|
96
|
+
self.lbl_active_file = QLabel("当前输入源: 尚未指定")
|
|
97
|
+
self.lbl_active_file.setStyleSheet("color: #90CAF9; font-weight: bold; font-size: 12px;")
|
|
98
|
+
root.addWidget(self.lbl_active_file)
|
|
99
|
+
|
|
100
|
+
self.progress_bar = QProgressBar()
|
|
101
|
+
self.progress_bar.setVisible(False)
|
|
102
|
+
self.progress_bar.setRange(0, 0)
|
|
103
|
+
root.addWidget(self.progress_bar)
|
|
104
|
+
|
|
105
|
+
# 选项卡分类
|
|
106
|
+
self.tabs = QTabWidget()
|
|
107
|
+
self.tabs.addTab(self._build_qtaim_tab(), "1. QTAIM 拓扑临界点与键径")
|
|
108
|
+
self.tabs.addTab(self._build_nci_tab(), "2. NCI / RDG 弱相互作用")
|
|
109
|
+
self.tabs.addTab(self._build_elf_tab(), "3. ELF / LOL 空间网格")
|
|
110
|
+
self.tabs.addTab(self._build_pop_tab(), "4. ADCH / 赫氏电荷与偶极")
|
|
111
|
+
self.tabs.addTab(self._build_bo_tab(), "5. Mayer 键级分析")
|
|
112
|
+
root.addWidget(self.tabs, 1)
|
|
113
|
+
|
|
114
|
+
# 底部状态条
|
|
115
|
+
bot_bar = QHBoxLayout()
|
|
116
|
+
self.lbl_status = QLabel("就绪。请选择输入文件或当前画布结构后点击对应功能运行。")
|
|
117
|
+
self.lbl_status.setStyleSheet("color: #888; font-size: 11px;")
|
|
118
|
+
bot_bar.addWidget(self.lbl_status)
|
|
119
|
+
bot_bar.addStretch()
|
|
120
|
+
|
|
121
|
+
btn_close = QPushButton("关闭")
|
|
122
|
+
btn_close.clicked.connect(self.accept)
|
|
123
|
+
bot_bar.addWidget(btn_close)
|
|
124
|
+
root.addLayout(bot_bar)
|
|
125
|
+
|
|
126
|
+
# ---------------- 1. QTAIM 拓扑选项卡 ----------------
|
|
127
|
+
def _build_qtaim_tab(self) -> QWidget:
|
|
128
|
+
tab = QWidget()
|
|
129
|
+
lay = QVBoxLayout(tab)
|
|
130
|
+
lay.setContentsMargins(8, 8, 8, 8)
|
|
131
|
+
lay.setSpacing(8)
|
|
132
|
+
|
|
133
|
+
ctrl = QHBoxLayout()
|
|
134
|
+
btn_run = QPushButton("🚀 运行 QTAIM 拓扑全分析 (搜索 CPs & 积分键径)")
|
|
135
|
+
btn_run.setProperty("role", "action")
|
|
136
|
+
btn_run.clicked.connect(self._run_qtaim)
|
|
137
|
+
ctrl.addWidget(btn_run)
|
|
138
|
+
|
|
139
|
+
btn_view_3d = QPushButton("👁 3D 视口显示临界点与键径")
|
|
140
|
+
btn_view_3d.clicked.connect(self._render_qtaim_3d)
|
|
141
|
+
ctrl.addWidget(btn_view_3d)
|
|
142
|
+
|
|
143
|
+
btn_clear_3d = QPushButton("❌ 清除 3D 标记")
|
|
144
|
+
btn_clear_3d.clicked.connect(self._clear_qtaim_3d)
|
|
145
|
+
ctrl.addWidget(btn_clear_3d)
|
|
146
|
+
ctrl.addStretch()
|
|
147
|
+
lay.addLayout(ctrl)
|
|
148
|
+
|
|
149
|
+
self.table_cps = QTableWidget(0, 8)
|
|
150
|
+
self.table_cps.setHorizontalHeaderLabels([
|
|
151
|
+
"序号", "类型", "对应核", "坐标 (X, Y, Z Å)",
|
|
152
|
+
"电子密度 ρ", "拉普拉斯 ∇²ρ", "能量密度 H(r)", "椭圆度 ε"
|
|
153
|
+
])
|
|
154
|
+
self.table_cps.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
|
|
155
|
+
lay.addWidget(self.table_cps, 1)
|
|
156
|
+
|
|
157
|
+
self.lbl_qtaim_summary = QLabel()
|
|
158
|
+
self.lbl_qtaim_summary.setStyleSheet("color: #AAA; font-size: 11px;")
|
|
159
|
+
lay.addWidget(self.lbl_qtaim_summary)
|
|
160
|
+
return tab
|
|
161
|
+
|
|
162
|
+
# ---------------- 2. NCI / RDG 选项卡 ----------------
|
|
163
|
+
def _build_nci_tab(self) -> QWidget:
|
|
164
|
+
tab = QWidget()
|
|
165
|
+
lay = QVBoxLayout(tab)
|
|
166
|
+
lay.setContentsMargins(8, 8, 8, 8)
|
|
167
|
+
lay.setSpacing(8)
|
|
168
|
+
|
|
169
|
+
ctrl = QHBoxLayout()
|
|
170
|
+
ctrl.addWidget(QLabel("网格精度:"))
|
|
171
|
+
self.nci_grid_combo = QComboBox()
|
|
172
|
+
self.nci_grid_combo.addItem("低精度 Low (快速预览)", 1)
|
|
173
|
+
self.nci_grid_combo.addItem("中精度 Medium (推荐)", 2)
|
|
174
|
+
self.nci_grid_combo.addItem("高精度 High (发表级)", 3)
|
|
175
|
+
self.nci_grid_combo.setCurrentIndex(0)
|
|
176
|
+
ctrl.addWidget(self.nci_grid_combo)
|
|
177
|
+
|
|
178
|
+
ctrl.addSpacing(12)
|
|
179
|
+
btn_run_nci = QPushButton("🚀 运行 NCI / RDG 相互作用分析")
|
|
180
|
+
btn_run_nci.setProperty("role", "action")
|
|
181
|
+
btn_run_nci.clicked.connect(self._run_nci)
|
|
182
|
+
ctrl.addWidget(btn_run_nci)
|
|
183
|
+
|
|
184
|
+
btn_render_nci = QPushButton("👁 3D 视口渲染 NCI 等值面")
|
|
185
|
+
btn_render_nci.clicked.connect(self._render_nci_3d)
|
|
186
|
+
ctrl.addWidget(btn_render_nci)
|
|
187
|
+
ctrl.addStretch()
|
|
188
|
+
lay.addLayout(ctrl)
|
|
189
|
+
|
|
190
|
+
self.lbl_nci_info = QLabel(
|
|
191
|
+
"NCI (Non-Covalent Interactions) 特性:\n"
|
|
192
|
+
" - 蓝色等值面 (sign(λ₂)ρ < -0.01): 强吸引相互作用 (氢键、卤键)\n"
|
|
193
|
+
" - 绿色等值面 (-0.01 < sign(λ₂)ρ < 0.01): 范德华弱色散相互作用\n"
|
|
194
|
+
" - 红色等值面 (sign(λ₂)ρ > 0.01): 位阻排斥 (环中心/笼中心位阻碰撞)"
|
|
195
|
+
)
|
|
196
|
+
self.lbl_nci_info.setStyleSheet("color: #90CAF9; font-size: 11px; padding: 6px; background: rgba(30, 41, 59, 0.5); border-radius: 4px;")
|
|
197
|
+
lay.addWidget(self.lbl_nci_info)
|
|
198
|
+
lay.addStretch()
|
|
199
|
+
return tab
|
|
200
|
+
|
|
201
|
+
# ---------------- 3. ELF / LOL 选项卡 ----------------
|
|
202
|
+
def _build_elf_tab(self) -> QWidget:
|
|
203
|
+
tab = QWidget()
|
|
204
|
+
lay = QVBoxLayout(tab)
|
|
205
|
+
lay.setContentsMargins(8, 8, 8, 8)
|
|
206
|
+
lay.setSpacing(8)
|
|
207
|
+
|
|
208
|
+
ctrl = QHBoxLayout()
|
|
209
|
+
ctrl.addWidget(QLabel("函数类型:"))
|
|
210
|
+
self.combo_grid_func = QComboBox()
|
|
211
|
+
self.combo_grid_func.addItem("电子定域化函数 (ELF)", 9)
|
|
212
|
+
self.combo_grid_func.addItem("局域轨道定位器 (LOL)", 10)
|
|
213
|
+
self.combo_grid_func.addItem("静电势 (ESP)", 12)
|
|
214
|
+
self.combo_grid_func.addItem("全电子密度 (ρ)", 1)
|
|
215
|
+
ctrl.addWidget(self.combo_grid_func)
|
|
216
|
+
|
|
217
|
+
ctrl.addSpacing(12)
|
|
218
|
+
btn_run_elf = QPushButton("⚡ 计算 3D 空间网格")
|
|
219
|
+
btn_run_elf.setProperty("role", "action")
|
|
220
|
+
btn_run_elf.clicked.connect(self._run_elf)
|
|
221
|
+
ctrl.addWidget(btn_run_elf)
|
|
222
|
+
ctrl.addStretch()
|
|
223
|
+
lay.addLayout(ctrl)
|
|
224
|
+
|
|
225
|
+
self.lbl_elf_status = QLabel("尚未计算空间网格。")
|
|
226
|
+
self.lbl_elf_status.setStyleSheet("color: #888; font-size: 11px;")
|
|
227
|
+
lay.addWidget(self.lbl_elf_status)
|
|
228
|
+
lay.addStretch()
|
|
229
|
+
return tab
|
|
230
|
+
|
|
231
|
+
# ---------------- 4. 原子电荷与偶极选项卡 ----------------
|
|
232
|
+
def _build_pop_tab(self) -> QWidget:
|
|
233
|
+
tab = QWidget()
|
|
234
|
+
lay = QVBoxLayout(tab)
|
|
235
|
+
lay.setContentsMargins(8, 8, 8, 8)
|
|
236
|
+
lay.setSpacing(8)
|
|
237
|
+
|
|
238
|
+
ctrl = QHBoxLayout()
|
|
239
|
+
ctrl.addWidget(QLabel("布居方法:"))
|
|
240
|
+
self.combo_pop_method = QComboBox()
|
|
241
|
+
self.combo_pop_method.addItem("ADCH (原子偶极校正赫氏电荷, 强烈推荐)", "ADCH")
|
|
242
|
+
self.combo_pop_method.addItem("Hirshfeld (经典赫氏电荷)", "Hirshfeld")
|
|
243
|
+
self.combo_pop_method.addItem("CM5 (Charge Model 5)", "CM5")
|
|
244
|
+
self.combo_pop_method.addItem("RESP (力场电荷)", "RESP")
|
|
245
|
+
ctrl.addWidget(self.combo_pop_method)
|
|
246
|
+
|
|
247
|
+
ctrl.addSpacing(12)
|
|
248
|
+
btn_run_pop = QPushButton("🚀 计算原子净电荷与偶极")
|
|
249
|
+
btn_run_pop.setProperty("role", "action")
|
|
250
|
+
btn_run_pop.clicked.connect(self._run_population)
|
|
251
|
+
ctrl.addWidget(btn_run_pop)
|
|
252
|
+
ctrl.addStretch()
|
|
253
|
+
lay.addLayout(ctrl)
|
|
254
|
+
|
|
255
|
+
self.table_pop = QTableWidget(0, 3)
|
|
256
|
+
self.table_pop.setHorizontalHeaderLabels(["原子序号", "元素符号", "净电荷 (e)"])
|
|
257
|
+
self.table_pop.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
|
|
258
|
+
lay.addWidget(self.table_pop, 1)
|
|
259
|
+
|
|
260
|
+
self.lbl_dipole = QLabel("分子偶极矩: 未计算")
|
|
261
|
+
self.lbl_dipole.setStyleSheet("font-weight: bold; color: #40C4FF; font-size: 12px;")
|
|
262
|
+
lay.addWidget(self.lbl_dipole)
|
|
263
|
+
return tab
|
|
264
|
+
|
|
265
|
+
# ---------------- 5. Mayer 键级选项卡 ----------------
|
|
266
|
+
def _build_bo_tab(self) -> QWidget:
|
|
267
|
+
tab = QWidget()
|
|
268
|
+
lay = QVBoxLayout(tab)
|
|
269
|
+
lay.setContentsMargins(8, 8, 8, 8)
|
|
270
|
+
lay.setSpacing(8)
|
|
271
|
+
|
|
272
|
+
ctrl = QHBoxLayout()
|
|
273
|
+
btn_run_bo = QPushButton("🚀 计算 Mayer 键级与原子总价 (需 .fchk / .molden)")
|
|
274
|
+
btn_run_bo.setProperty("role", "action")
|
|
275
|
+
btn_run_bo.clicked.connect(self._run_mayer_bo)
|
|
276
|
+
ctrl.addWidget(btn_run_bo)
|
|
277
|
+
ctrl.addStretch()
|
|
278
|
+
lay.addLayout(ctrl)
|
|
279
|
+
|
|
280
|
+
self.table_bo = QTableWidget(0, 4)
|
|
281
|
+
self.table_bo.setHorizontalHeaderLabels(["原子对 A", "原子对 B", "Mayer 键级", "成键特征"])
|
|
282
|
+
self.table_bo.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
|
|
283
|
+
lay.addWidget(self.table_bo, 1)
|
|
284
|
+
|
|
285
|
+
self.lbl_bo_summary = QLabel()
|
|
286
|
+
self.lbl_bo_summary.setStyleSheet("color: #AAA; font-size: 11px;")
|
|
287
|
+
lay.addWidget(self.lbl_bo_summary)
|
|
288
|
+
return tab
|
|
289
|
+
|
|
290
|
+
# ---------------- 输入源管理 ----------------
|
|
291
|
+
|
|
292
|
+
def _select_file(self):
|
|
293
|
+
fn, _ = QFileDialog.getOpenFileName(
|
|
294
|
+
self, "选择波函数或分子结构文件", "",
|
|
295
|
+
"Wavefunction & Structures (*.wfn *.fchk *.molden *.xyz *.pdb *.mwfn);;All Files (*.*)"
|
|
296
|
+
)
|
|
297
|
+
if not fn:
|
|
298
|
+
return
|
|
299
|
+
self.loaded_file = Path(fn)
|
|
300
|
+
self.lbl_active_file.setText(f"当前输入源: 外部文件 · {self.loaded_file.name}")
|
|
301
|
+
self.lbl_status.setText(f"已载入文件: {self.loaded_file}")
|
|
302
|
+
|
|
303
|
+
def _use_current_doc(self):
|
|
304
|
+
if not self.document or len(self.document.topology.atoms) == 0:
|
|
305
|
+
QMessageBox.warning(self, "提示", "当前画布无有效分子结构。")
|
|
306
|
+
return
|
|
307
|
+
xyz_path = self.driver.export_document_xyz(self.document, "current_canvas.xyz")
|
|
308
|
+
self.loaded_file = xyz_path
|
|
309
|
+
self.lbl_active_file.setText(f"当前输入源: 画布分子 · {self.document.name} (临时 XYZ)")
|
|
310
|
+
self.lbl_status.setText(f"已从画布导出临时结构至: {xyz_path}")
|
|
311
|
+
|
|
312
|
+
def _ensure_input(self) -> Optional[Path]:
|
|
313
|
+
if not self.loaded_file or not self.loaded_file.is_file():
|
|
314
|
+
if self.document and len(self.document.topology.atoms) > 0:
|
|
315
|
+
self._use_current_doc()
|
|
316
|
+
else:
|
|
317
|
+
QMessageBox.warning(self, "提示", "请先选择波函数文件或载入当前画布分子。")
|
|
318
|
+
return None
|
|
319
|
+
return self.loaded_file
|
|
320
|
+
|
|
321
|
+
def _start_worker(self, fn, on_success):
|
|
322
|
+
if not self.driver.is_available:
|
|
323
|
+
QMessageBox.critical(self, "错误", "未检测到 Multiwfn.exe。请检查安装路径。")
|
|
324
|
+
return
|
|
325
|
+
self.progress_bar.setVisible(True)
|
|
326
|
+
self.lbl_status.setText("正在后台安全调用 Multiwfn 进行计算,请稍候...")
|
|
327
|
+
|
|
328
|
+
def _runner():
|
|
329
|
+
try:
|
|
330
|
+
res = fn()
|
|
331
|
+
QTimer.singleShot(0, lambda: self._on_worker_done(res, on_success))
|
|
332
|
+
except Exception as e:
|
|
333
|
+
err = str(e)
|
|
334
|
+
QTimer.singleShot(0, lambda: self._on_worker_err(err))
|
|
335
|
+
|
|
336
|
+
t = threading.Thread(target=_runner, daemon=True)
|
|
337
|
+
t.start()
|
|
338
|
+
|
|
339
|
+
def _on_worker_done(self, res, on_success):
|
|
340
|
+
self.progress_bar.setVisible(False)
|
|
341
|
+
self.lbl_status.setText("计算完成。")
|
|
342
|
+
on_success(res)
|
|
343
|
+
|
|
344
|
+
def _on_worker_err(self, err: str):
|
|
345
|
+
self.progress_bar.setVisible(False)
|
|
346
|
+
self.lbl_status.setText(f"❌ 计算失败: {err}")
|
|
347
|
+
QMessageBox.critical(self, "执行失败", f"Multiwfn 运行异常:\n{err}")
|
|
348
|
+
|
|
349
|
+
# ---------------- 业务逻辑触发器 ----------------
|
|
350
|
+
|
|
351
|
+
def _run_qtaim(self):
|
|
352
|
+
inp = self._ensure_input()
|
|
353
|
+
if not inp:
|
|
354
|
+
return
|
|
355
|
+
self._start_worker(
|
|
356
|
+
lambda: self.driver.run_qtaim_analysis(inp),
|
|
357
|
+
self._display_qtaim
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
def _display_qtaim(self, res: QTAIMResult):
|
|
361
|
+
self.qtaim_result = res
|
|
362
|
+
cps = res.critical_points
|
|
363
|
+
self.table_cps.setRowCount(len(cps))
|
|
364
|
+
for r, cp in enumerate(cps):
|
|
365
|
+
self.table_cps.setItem(r, 0, QTableWidgetItem(f"CP #{cp.index}"))
|
|
366
|
+
self.table_cps.setItem(r, 1, QTableWidgetItem(cp.type_name))
|
|
367
|
+
self.table_cps.setItem(r, 2, QTableWidgetItem(cp.nucleus or "--"))
|
|
368
|
+
pos_str = f"({cp.coords_angstrom[0]:.3f}, {cp.coords_angstrom[1]:.3f}, {cp.coords_angstrom[2]:.3f})"
|
|
369
|
+
self.table_cps.setItem(r, 3, QTableWidgetItem(pos_str))
|
|
370
|
+
self.table_cps.setItem(r, 4, QTableWidgetItem(f"{cp.rho:.4e}"))
|
|
371
|
+
self.table_cps.setItem(r, 5, QTableWidgetItem(f"{cp.laplacian:.4e}"))
|
|
372
|
+
self.table_cps.setItem(r, 6, QTableWidgetItem(f"{cp.energy_density_H:.4e}"))
|
|
373
|
+
self.table_cps.setItem(r, 7, QTableWidgetItem(f"{cp.ellipticity:.4f}"))
|
|
374
|
+
|
|
375
|
+
n_bcp = len(res.bcps)
|
|
376
|
+
n_att = len(res.attractors)
|
|
377
|
+
n_rcp = len(res.ring_cps)
|
|
378
|
+
n_ccp = len(res.cage_cps)
|
|
379
|
+
self.lbl_qtaim_summary.setText(
|
|
380
|
+
f"共找到 {len(cps)} 个临界点: {n_att} 个核引力中心 (3,-3), {n_bcp} 个键临界点 (3,-1), "
|
|
381
|
+
f"{n_rcp} 个环中心 (3,+1), {n_ccp} 个笼中心 (3,+3) | 键径条数: {len(res.paths)}"
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
def _render_qtaim_3d(self):
|
|
385
|
+
if not self.qtaim_result:
|
|
386
|
+
QMessageBox.information(self, "提示", "请先运行 QTAIM 分析。")
|
|
387
|
+
return
|
|
388
|
+
view = getattr(self.main_window, "workspace", None)
|
|
389
|
+
renderer = None
|
|
390
|
+
if view and hasattr(view, "view3d_real") and hasattr(view.view3d_real, "renderer"):
|
|
391
|
+
renderer = view.view3d_real.renderer
|
|
392
|
+
elif hasattr(self.main_window, "renderer"):
|
|
393
|
+
renderer = self.main_window.renderer
|
|
394
|
+
|
|
395
|
+
if renderer and hasattr(renderer, "set_qtaim"):
|
|
396
|
+
renderer.set_qtaim(self.qtaim_result.critical_points, self.qtaim_result.paths)
|
|
397
|
+
self.lbl_status.setText(f"已在 3D 视口渲染 {len(self.qtaim_result.bcps)} 个 BCP 临界点与 {len(self.qtaim_result.paths)} 条梯度键径。")
|
|
398
|
+
else:
|
|
399
|
+
QMessageBox.warning(self, "视口不可用", "当前 3D 视口渲染器未就绪。")
|
|
400
|
+
|
|
401
|
+
def _clear_qtaim_3d(self):
|
|
402
|
+
view = getattr(self.main_window, "workspace", None)
|
|
403
|
+
renderer = None
|
|
404
|
+
if view and hasattr(view, "view3d_real") and hasattr(view.view3d_real, "renderer"):
|
|
405
|
+
renderer = view.view3d_real.renderer
|
|
406
|
+
elif hasattr(self.main_window, "renderer"):
|
|
407
|
+
renderer = self.main_window.renderer
|
|
408
|
+
|
|
409
|
+
if renderer and hasattr(renderer, "clear_qtaim"):
|
|
410
|
+
renderer.clear_qtaim()
|
|
411
|
+
self.lbl_status.setText("已清除 3D 视口 QTAIM 标记。")
|
|
412
|
+
|
|
413
|
+
def _run_nci(self):
|
|
414
|
+
inp = self._ensure_input()
|
|
415
|
+
if not inp:
|
|
416
|
+
return
|
|
417
|
+
q = int(self.nci_grid_combo.currentData())
|
|
418
|
+
self._start_worker(
|
|
419
|
+
lambda: self.driver.run_nci_analysis(inp, grid_quality=q),
|
|
420
|
+
self._display_nci
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
def _display_nci(self, res: NCIResult):
|
|
424
|
+
self.nci_result = res
|
|
425
|
+
mode_str = "分子原初密度近似 (Promolecular)" if res.is_promolecular else "从头算波函数 (Ab initio)"
|
|
426
|
+
self.lbl_status.setText(f"NCI 分析完成 ({mode_str})。已生成 Cube 体数据网格。")
|
|
427
|
+
QMessageBox.information(self, "完成", f"NCI / RDG 网格计算成功!\n模式: {mode_str}\n点击「3D 视口渲染 NCI 等值面」即可在画布查看!")
|
|
428
|
+
|
|
429
|
+
def _render_nci_3d(self):
|
|
430
|
+
if not self.nci_result or not self.nci_result.sign_lambda2_rho_cube:
|
|
431
|
+
QMessageBox.information(self, "提示", "请先运行 NCI / RDG 分析以生成网格。")
|
|
432
|
+
return
|
|
433
|
+
view = getattr(self.main_window, "workspace", None)
|
|
434
|
+
renderer = None
|
|
435
|
+
if view and hasattr(view, "view3d_real") and hasattr(view.view3d_real, "renderer"):
|
|
436
|
+
renderer = view.view3d_real.renderer
|
|
437
|
+
elif hasattr(self.main_window, "renderer"):
|
|
438
|
+
renderer = self.main_window.renderer
|
|
439
|
+
|
|
440
|
+
if renderer and hasattr(renderer, "set_orbital"):
|
|
441
|
+
# 渲染 sign(λ₂)ρ 双相位等值面:正为位阻排斥 (红),负为氢键吸引 (蓝)
|
|
442
|
+
renderer.set_orbital(
|
|
443
|
+
self.nci_result.sign_lambda2_rho_cube,
|
|
444
|
+
isovalue=0.015,
|
|
445
|
+
pos_color=(0.95, 0.25, 0.25),
|
|
446
|
+
neg_color=(0.25, 0.55, 0.95),
|
|
447
|
+
)
|
|
448
|
+
self.lbl_status.setText("已在 3D 视口渲染 NCI 弱相互作用等值面!")
|
|
449
|
+
|
|
450
|
+
def _run_elf(self):
|
|
451
|
+
inp = self._ensure_input()
|
|
452
|
+
if not inp:
|
|
453
|
+
return
|
|
454
|
+
func = int(self.combo_grid_func.currentData())
|
|
455
|
+
self._start_worker(
|
|
456
|
+
lambda: self.driver.run_grid_calculation(inp, func_type=func, grid_quality=1),
|
|
457
|
+
self._display_elf
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
def _display_elf(self, cube):
|
|
461
|
+
if cube:
|
|
462
|
+
self.lbl_elf_status.setText(f"网格计算成功: 尺寸 {cube.dims},已成功载入。")
|
|
463
|
+
view = getattr(self.main_window, "workspace", None)
|
|
464
|
+
renderer = None
|
|
465
|
+
if view and hasattr(view, "view3d_real") and hasattr(view.view3d_real, "renderer"):
|
|
466
|
+
renderer = view.view3d_real.renderer
|
|
467
|
+
elif hasattr(self.main_window, "renderer"):
|
|
468
|
+
renderer = self.main_window.renderer
|
|
469
|
+
if renderer and hasattr(renderer, "set_orbital"):
|
|
470
|
+
renderer.set_orbital(cube, isovalue=0.75, pos_color=(0.2, 0.85, 0.6), neg_color=(0.8, 0.3, 0.3))
|
|
471
|
+
self.lbl_status.setText("已在 3D 视口渲染 ELF/LOL 空间等值面!")
|
|
472
|
+
else:
|
|
473
|
+
self.lbl_elf_status.setText("网格导出失败。")
|
|
474
|
+
|
|
475
|
+
def _run_population(self):
|
|
476
|
+
inp = self._ensure_input()
|
|
477
|
+
if not inp:
|
|
478
|
+
return
|
|
479
|
+
m = str(self.combo_pop_method.currentData())
|
|
480
|
+
self._start_worker(
|
|
481
|
+
lambda: self.driver.run_population_analysis(inp, method=m),
|
|
482
|
+
self._display_population
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
def _display_population(self, res: PopulationResult):
|
|
486
|
+
self.pop_result = res
|
|
487
|
+
charges = res.charges
|
|
488
|
+
self.table_pop.setRowCount(len(charges))
|
|
489
|
+
for r, (aidx, val) in enumerate(sorted(charges.items())):
|
|
490
|
+
lbl = res.atom_labels.get(aidx, "X")
|
|
491
|
+
self.table_pop.setItem(r, 0, QTableWidgetItem(str(aidx)))
|
|
492
|
+
self.table_pop.setItem(r, 1, QTableWidgetItem(lbl))
|
|
493
|
+
item_val = QTableWidgetItem(f"{val:+.4f}")
|
|
494
|
+
if val > 0.05:
|
|
495
|
+
item_val.setForeground(QColor("#40C4FF"))
|
|
496
|
+
elif val < -0.05:
|
|
497
|
+
item_val.setForeground(QColor("#FF5252"))
|
|
498
|
+
self.table_pop.setItem(r, 2, item_val)
|
|
499
|
+
|
|
500
|
+
if res.dipole_debye is not None:
|
|
501
|
+
norm_d = float(np.linalg.norm(res.dipole_debye))
|
|
502
|
+
self.lbl_dipole.setText(
|
|
503
|
+
f"分子偶极矩: {norm_d:.3f} Debye (X={res.dipole_debye[0]:.2f}, Y={res.dipole_debye[1]:.2f}, Z={res.dipole_debye[2]:.2f})"
|
|
504
|
+
)
|
|
505
|
+
else:
|
|
506
|
+
self.lbl_dipole.setText("分子偶极矩: 未输出")
|
|
507
|
+
|
|
508
|
+
def _run_mayer_bo(self):
|
|
509
|
+
inp = self._ensure_input()
|
|
510
|
+
if not inp:
|
|
511
|
+
return
|
|
512
|
+
if inp.suffix.lower() not in [".fchk", ".molden", ".mwfn"]:
|
|
513
|
+
QMessageBox.warning(self, "提示", "Mayer 键级分析需要基函数重叠积分,请选择 .fchk 或 .molden 文件。")
|
|
514
|
+
return
|
|
515
|
+
self._start_worker(
|
|
516
|
+
lambda: self.driver.run_mayer_bond_order(inp),
|
|
517
|
+
self._display_mayer_bo
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
def _display_mayer_bo(self, res: MayerBondOrderResult):
|
|
521
|
+
self.bo_result = res
|
|
522
|
+
bos = res.bond_orders
|
|
523
|
+
self.table_bo.setRowCount(len(bos))
|
|
524
|
+
for r, ((a1, a2), bo) in enumerate(sorted(bos.items(), key=lambda x: -x[1])):
|
|
525
|
+
sym1 = res.atom_labels.get(a1, "")
|
|
526
|
+
sym2 = res.atom_labels.get(a2, "")
|
|
527
|
+
self.table_bo.setItem(r, 0, QTableWidgetItem(f"Atom {a1} ({sym1})"))
|
|
528
|
+
self.table_bo.setItem(r, 1, QTableWidgetItem(f"Atom {a2} ({sym2})"))
|
|
529
|
+
self.table_bo.setItem(r, 2, QTableWidgetItem(f"{bo:.4f}"))
|
|
530
|
+
charac = "单键" if bo < 1.3 else ("双键" if bo < 2.3 else "三键")
|
|
531
|
+
self.table_bo.setItem(r, 3, QTableWidgetItem(charac))
|
|
532
|
+
|
|
533
|
+
self.lbl_bo_summary.setText(f"共识别出 {len(bos)} 对显著共价作用 (Mayer 键级 >= 0.05)。")
|