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,302 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Caffeine",
|
|
3
|
+
"smiles": "Cn1cnc2c1c(=O)n(C)c(=O)n2C",
|
|
4
|
+
"atoms": [
|
|
5
|
+
{
|
|
6
|
+
"element": "C",
|
|
7
|
+
"Z": 6,
|
|
8
|
+
"x": 542.58,
|
|
9
|
+
"y": 283.04,
|
|
10
|
+
"z": 1.168
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"element": "N",
|
|
14
|
+
"Z": 7,
|
|
15
|
+
"x": 475.62,
|
|
16
|
+
"y": 230.94,
|
|
17
|
+
"z": 1.021
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"element": "C",
|
|
21
|
+
"Z": 6,
|
|
22
|
+
"x": 467.11,
|
|
23
|
+
"y": 158.63,
|
|
24
|
+
"z": 1.555
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"element": "N",
|
|
28
|
+
"Z": 7,
|
|
29
|
+
"x": 397.77,
|
|
30
|
+
"y": 124.64,
|
|
31
|
+
"z": 1.24
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"element": "C",
|
|
35
|
+
"Z": 6,
|
|
36
|
+
"x": 362.71,
|
|
37
|
+
"y": 179.36,
|
|
38
|
+
"z": 0.477
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"element": "C",
|
|
42
|
+
"Z": 6,
|
|
43
|
+
"x": 408.89,
|
|
44
|
+
"y": 243.02,
|
|
45
|
+
"z": 0.344
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"element": "C",
|
|
49
|
+
"Z": 6,
|
|
50
|
+
"x": 383.97,
|
|
51
|
+
"y": 306.89,
|
|
52
|
+
"z": -0.398
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"element": "O",
|
|
56
|
+
"Z": 8,
|
|
57
|
+
"x": 427.56,
|
|
58
|
+
"y": 365.75,
|
|
59
|
+
"z": -0.541
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"element": "N",
|
|
63
|
+
"Z": 7,
|
|
64
|
+
"x": 310.82,
|
|
65
|
+
"y": 304.01,
|
|
66
|
+
"z": -0.969
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"element": "C",
|
|
70
|
+
"Z": 6,
|
|
71
|
+
"x": 282.7,
|
|
72
|
+
"y": 370.07,
|
|
73
|
+
"z": -1.781
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"element": "C",
|
|
77
|
+
"Z": 6,
|
|
78
|
+
"x": 265.13,
|
|
79
|
+
"y": 237.61,
|
|
80
|
+
"z": -0.837
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"element": "O",
|
|
84
|
+
"Z": 8,
|
|
85
|
+
"x": 198.68,
|
|
86
|
+
"y": 234.92,
|
|
87
|
+
"z": -1.387
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"element": "N",
|
|
91
|
+
"Z": 7,
|
|
92
|
+
"x": 291.29,
|
|
93
|
+
"y": 174.22,
|
|
94
|
+
"z": -0.114
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"element": "C",
|
|
98
|
+
"Z": 6,
|
|
99
|
+
"x": 242.08,
|
|
100
|
+
"y": 104.7,
|
|
101
|
+
"z": 0.069
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"element": "H",
|
|
105
|
+
"Z": 1,
|
|
106
|
+
"x": 588.36,
|
|
107
|
+
"y": 255.26,
|
|
108
|
+
"z": 1.796
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"element": "H",
|
|
112
|
+
"Z": 1,
|
|
113
|
+
"x": 567.78,
|
|
114
|
+
"y": 296.12,
|
|
115
|
+
"z": 0.17
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"element": "H",
|
|
119
|
+
"Z": 1,
|
|
120
|
+
"x": 523.83,
|
|
121
|
+
"y": 338.25,
|
|
122
|
+
"z": 1.655
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"element": "H",
|
|
126
|
+
"Z": 1,
|
|
127
|
+
"x": 510.9,
|
|
128
|
+
"y": 130.55,
|
|
129
|
+
"z": 2.171
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"element": "H",
|
|
133
|
+
"Z": 1,
|
|
134
|
+
"x": 218.36,
|
|
135
|
+
"y": 376.87,
|
|
136
|
+
"z": -1.691
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"element": "H",
|
|
140
|
+
"Z": 1,
|
|
141
|
+
"x": 308.66,
|
|
142
|
+
"y": 426.2,
|
|
143
|
+
"z": -1.443
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"element": "H",
|
|
147
|
+
"Z": 1,
|
|
148
|
+
"x": 298.12,
|
|
149
|
+
"y": 360.24,
|
|
150
|
+
"z": -2.846
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"element": "H",
|
|
154
|
+
"Z": 1,
|
|
155
|
+
"x": 198.36,
|
|
156
|
+
"y": 115.97,
|
|
157
|
+
"z": 0.866
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"element": "H",
|
|
161
|
+
"Z": 1,
|
|
162
|
+
"x": 277.47,
|
|
163
|
+
"y": 52.82,
|
|
164
|
+
"z": 0.35
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"element": "H",
|
|
168
|
+
"Z": 1,
|
|
169
|
+
"x": 211.23,
|
|
170
|
+
"y": 89.94,
|
|
171
|
+
"z": -0.876
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"bonds": [
|
|
175
|
+
{
|
|
176
|
+
"a": 0,
|
|
177
|
+
"b": 1,
|
|
178
|
+
"order": 1
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"a": 1,
|
|
182
|
+
"b": 2,
|
|
183
|
+
"order": 1
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"a": 2,
|
|
187
|
+
"b": 3,
|
|
188
|
+
"order": 1
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"a": 3,
|
|
192
|
+
"b": 4,
|
|
193
|
+
"order": 1
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"a": 4,
|
|
197
|
+
"b": 5,
|
|
198
|
+
"order": 1
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"a": 5,
|
|
202
|
+
"b": 6,
|
|
203
|
+
"order": 1
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"a": 6,
|
|
207
|
+
"b": 7,
|
|
208
|
+
"order": 2
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"a": 6,
|
|
212
|
+
"b": 8,
|
|
213
|
+
"order": 1
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"a": 8,
|
|
217
|
+
"b": 9,
|
|
218
|
+
"order": 1
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"a": 8,
|
|
222
|
+
"b": 10,
|
|
223
|
+
"order": 1
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"a": 10,
|
|
227
|
+
"b": 11,
|
|
228
|
+
"order": 2
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"a": 10,
|
|
232
|
+
"b": 12,
|
|
233
|
+
"order": 1
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"a": 12,
|
|
237
|
+
"b": 13,
|
|
238
|
+
"order": 1
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"a": 5,
|
|
242
|
+
"b": 1,
|
|
243
|
+
"order": 1
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"a": 12,
|
|
247
|
+
"b": 4,
|
|
248
|
+
"order": 1
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"a": 0,
|
|
252
|
+
"b": 14,
|
|
253
|
+
"order": 1
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"a": 0,
|
|
257
|
+
"b": 15,
|
|
258
|
+
"order": 1
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"a": 0,
|
|
262
|
+
"b": 16,
|
|
263
|
+
"order": 1
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"a": 2,
|
|
267
|
+
"b": 17,
|
|
268
|
+
"order": 1
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"a": 9,
|
|
272
|
+
"b": 18,
|
|
273
|
+
"order": 1
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"a": 9,
|
|
277
|
+
"b": 19,
|
|
278
|
+
"order": 1
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"a": 9,
|
|
282
|
+
"b": 20,
|
|
283
|
+
"order": 1
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"a": 13,
|
|
287
|
+
"b": 21,
|
|
288
|
+
"order": 1
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"a": 13,
|
|
292
|
+
"b": 22,
|
|
293
|
+
"order": 1
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"a": 13,
|
|
297
|
+
"b": 23,
|
|
298
|
+
"order": 1
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"note": "Visual demo only. All coordinates were generated from RDKit; display style is illustrative."
|
|
302
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="6.5"/><circle cx="12" cy="12" r="2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 18 20 6M6 21 22 9"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-7"/><path d="M3 4v7h7"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v12m-5-7 5-5 5 5"/><path d="M4 15v6h16v-6"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="7" r="3"/><circle cx="18" cy="6" r="3"/><circle cx="12" cy="18" r="3"/><path d="m8.5 8.5 7 0M8 10l3 5m5-6-3 6"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 11a9 9 0 1 1 3 8"/><path d="M3 5v6h6"/><path d="M12 7v5l3 2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M12 6v6l4 2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 17 17 3l4 4L7 21Z"/><path d="m10 10 3 3m0-6 3 3m-9 3 3 3"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2 21 7v10l-9 5-9-5V7l9-5Z"/><path d="m3 7 9 5 9-5M12 12v10"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2 22 12 12 22 2 12Z"/><path d="m8 12 4 4 5-6"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m12 2 9 5v10l-9 5-9-5V7l9-5Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="6"/><path d="m16 16 5 5"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 3 5 20l5-5 3 7 3-2-4-6 8-1Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3.5"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2m10 10 2 2M19 5l-2 2M7 17l-2 2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#9FC7D1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="7" rx="1"/><rect x="14" y="4" width="7" height="7" rx="1"/><rect x="3" y="15" width="7" height="7" rx="1"/><rect x="14" y="15" width="7" height="7" rx="1"/></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Qt screen labels above the VTK surface, with no molecular coordinate changes."""
|
|
2
|
+
from PyQt6.QtCore import Qt, QPoint, QPointF
|
|
3
|
+
from PyQt6.QtGui import QPainter, QColor, QFont, QPainterPath, QPen
|
|
4
|
+
from PyQt6.QtWidgets import QWidget
|
|
5
|
+
from ..domain.elements import get_element
|
|
6
|
+
import math
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AtomLabelOverlay(QWidget):
|
|
10
|
+
def __init__(self, owner, parent):
|
|
11
|
+
super().__init__(parent)
|
|
12
|
+
self.owner = owner
|
|
13
|
+
self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)
|
|
14
|
+
self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
|
|
15
|
+
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
|
16
|
+
self.scope = "heavy"
|
|
17
|
+
self.last_labels = []
|
|
18
|
+
self.last_label_rects = []
|
|
19
|
+
|
|
20
|
+
def labels(self):
|
|
21
|
+
backend = self.owner.renderer
|
|
22
|
+
if not (backend.show_labels or backend.show_symbols):
|
|
23
|
+
return []
|
|
24
|
+
coords = backend._coordinates
|
|
25
|
+
ren = getattr(self.owner.plotter, 'renderer', None)
|
|
26
|
+
if coords is None or ren is None:
|
|
27
|
+
return []
|
|
28
|
+
width, height = ren.GetRenderWindow().GetSize()
|
|
29
|
+
if width <= 0 or height <= 0:
|
|
30
|
+
return []
|
|
31
|
+
viewport = ren.GetViewport()
|
|
32
|
+
left, right = viewport[0]*self.width(), viewport[2]*self.width()
|
|
33
|
+
top, bottom = (1-viewport[3])*self.height(), (1-viewport[1])*self.height()
|
|
34
|
+
result = []
|
|
35
|
+
for i, (pos, aid) in enumerate(zip(coords, backend._atom_ids)):
|
|
36
|
+
z = int(backend._atomic_numbers[i])
|
|
37
|
+
if self.scope == "selected" and aid not in backend._selected:
|
|
38
|
+
continue
|
|
39
|
+
if self.scope == "heavy" and z == 1 and aid not in backend._selected:
|
|
40
|
+
continue
|
|
41
|
+
if z == 1 and not backend.show_hydrogens:
|
|
42
|
+
continue
|
|
43
|
+
ren.SetWorldPoint(float(pos[0]), float(pos[1]), float(pos[2]), 1.)
|
|
44
|
+
ren.WorldToDisplay()
|
|
45
|
+
x, y, depth = ren.GetDisplayPoint()
|
|
46
|
+
x, y = x*self.width()/width, (height-y)*self.height()/height
|
|
47
|
+
if not (0 <= depth <= 1 and left <= x <= right and top <= y <= bottom):
|
|
48
|
+
continue
|
|
49
|
+
element = get_element(z)
|
|
50
|
+
text = element.symbol if backend.show_symbols and element else ''
|
|
51
|
+
if backend.show_labels:
|
|
52
|
+
text += str(aid.value + 1)
|
|
53
|
+
result.append((x, y, text))
|
|
54
|
+
return result
|
|
55
|
+
|
|
56
|
+
def paintEvent(self, event):
|
|
57
|
+
self.last_labels = self.labels()
|
|
58
|
+
painter = QPainter(self)
|
|
59
|
+
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
|
60
|
+
painter.setFont(QFont('Arial', 9, QFont.Weight.Normal))
|
|
61
|
+
placed = []
|
|
62
|
+
for x, y, text in self.last_labels:
|
|
63
|
+
base = painter.fontMetrics().boundingRect(text).adjusted(-4, -2, 4, 2)
|
|
64
|
+
candidates = []
|
|
65
|
+
for radius in (18, 34, 52, 74, 100):
|
|
66
|
+
for angle in (-45, 45, -135, 135, 0, 90, 180, -90):
|
|
67
|
+
rect = type(base)(base)
|
|
68
|
+
rect.moveCenter(QPoint(int(x+radius*math.cos(math.radians(angle))),
|
|
69
|
+
int(y+radius*math.sin(math.radians(angle)))))
|
|
70
|
+
rect.moveLeft(max(0, min(rect.left(), self.width()-rect.width())))
|
|
71
|
+
rect.moveTop(max(0, min(rect.top(), self.height()-rect.height())))
|
|
72
|
+
overlap = sum(rect.adjusted(-2,-2,2,2).intersected(r).width() *
|
|
73
|
+
rect.adjusted(-2,-2,2,2).intersected(r).height()
|
|
74
|
+
for r, *_ in placed if rect.adjusted(-2,-2,2,2).intersects(r))
|
|
75
|
+
candidates.append((overlap, radius, rect))
|
|
76
|
+
rect = min(candidates, key=lambda item: (item[0], item[1]))[2]
|
|
77
|
+
placed.append((rect, x, y, text))
|
|
78
|
+
self.last_label_rects = [rect for rect, *_ in placed]
|
|
79
|
+
painter.setPen(QColor(170, 200, 220, 170))
|
|
80
|
+
for rect, x, y, text in placed:
|
|
81
|
+
if math.hypot(rect.center().x()-x,rect.center().y()-y)>28:
|
|
82
|
+
painter.drawLine(QPointF(x, y), QPointF(rect.center()))
|
|
83
|
+
for rect, x, y, text in placed:
|
|
84
|
+
path = QPainterPath()
|
|
85
|
+
fm = painter.fontMetrics()
|
|
86
|
+
path.addText(rect.center().x()-fm.horizontalAdvance(text)/2,
|
|
87
|
+
rect.center().y()+(fm.ascent()-fm.descent())/2, painter.font(), text)
|
|
88
|
+
painter.setBrush(QColor('#F3F7FA'))
|
|
89
|
+
painter.setPen(QPen(QColor(12,24,38,210),1.8,Qt.PenStyle.SolidLine,Qt.PenCapStyle.RoundCap,Qt.PenJoinStyle.RoundJoin))
|
|
90
|
+
painter.strokePath(path,painter.pen())
|
|
91
|
+
painter.fillPath(path,QColor('#F3F7FA'))
|
|
92
|
+
painter.end()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""生物结构浏览对话框:显示 model / chain / residue 层级树与统计。"""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from PyQt6.QtWidgets import (
|
|
5
|
+
QDialog, QVBoxLayout, QTreeWidget, QTreeWidgetItem, QLabel, QPushButton,
|
|
6
|
+
QHBoxLayout)
|
|
7
|
+
from PyQt6.QtCore import Qt
|
|
8
|
+
|
|
9
|
+
from molforge.io.gemmi_adapter import BioStructure
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BioStructureDialog(QDialog):
|
|
13
|
+
def __init__(self, bio: BioStructure, parent=None):
|
|
14
|
+
super().__init__(parent)
|
|
15
|
+
self.setWindowTitle("生物结构层级")
|
|
16
|
+
self.resize(560, 620)
|
|
17
|
+
layout = QVBoxLayout(self)
|
|
18
|
+
|
|
19
|
+
summary = (
|
|
20
|
+
f"<b>{bio.name}</b> 模型 {len(bio.models)} "
|
|
21
|
+
f"链 {bio.chain_count()} 原子 {bio.atom_count()} "
|
|
22
|
+
f"配体 {len(bio.ligand_residues)}")
|
|
23
|
+
layout.addWidget(QLabel(summary))
|
|
24
|
+
|
|
25
|
+
tree = QTreeWidget()
|
|
26
|
+
tree.setHeaderLabels(["层级", "类型 / 数量"])
|
|
27
|
+
for m in bio.models:
|
|
28
|
+
mit = QTreeWidgetItem(tree, [f"模型 {m.model_num}",
|
|
29
|
+
f"{len(m.chains)} 条链"])
|
|
30
|
+
for c in m.chains:
|
|
31
|
+
n_aa = sum(1 for r in c.residues if r.is_amino)
|
|
32
|
+
n_w = sum(1 for r in c.residues if r.is_water)
|
|
33
|
+
n_l = sum(1 for r in c.residues if r.is_ligand)
|
|
34
|
+
cit = QTreeWidgetItem(mit, [
|
|
35
|
+
f"链 {c.chain_id}",
|
|
36
|
+
f"残基 {n_aa} · 水 {n_w} · 配体 {n_l}"])
|
|
37
|
+
for r in c.residues:
|
|
38
|
+
if r.is_amino:
|
|
39
|
+
tag = "氨基酸"
|
|
40
|
+
elif r.is_nucleotide:
|
|
41
|
+
tag = "核苷酸"
|
|
42
|
+
elif r.is_water:
|
|
43
|
+
tag = "水"
|
|
44
|
+
else:
|
|
45
|
+
tag = "配体(RDKit)"
|
|
46
|
+
rit = QTreeWidgetItem(cit, [
|
|
47
|
+
f"{r.name} {r.seqid_num}{r.icode}",
|
|
48
|
+
f"{tag} · {len(r.atoms)} 原子"])
|
|
49
|
+
tree.expandToDepth(1)
|
|
50
|
+
layout.addWidget(tree)
|
|
51
|
+
|
|
52
|
+
btns = QHBoxLayout()
|
|
53
|
+
btns.addStretch()
|
|
54
|
+
close = QPushButton("关闭")
|
|
55
|
+
close.clicked.connect(self.accept)
|
|
56
|
+
btns.addWidget(close)
|
|
57
|
+
layout.addLayout(btns)
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""构象浏览与聚类分析对话框:列出构象能量,支持 Kabsch RMSD 结构聚类与多构象预览。"""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Optional, List, Dict
|
|
5
|
+
import numpy as np
|
|
6
|
+
from PyQt6.QtWidgets import (
|
|
7
|
+
QDialog, QVBoxLayout, QHBoxLayout, QLabel, QListWidget, QListWidgetItem,
|
|
8
|
+
QPushButton, QWidget, QDoubleSpinBox, QMessageBox, QGroupBox
|
|
9
|
+
)
|
|
10
|
+
from PyQt6.QtCore import Qt, QTimer
|
|
11
|
+
|
|
12
|
+
from molforge.application.trajectory_analysis import cluster_conformer_ensemble
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ConformerDialog(QDialog):
|
|
16
|
+
def __init__(self, parent, ensemble, on_apply, on_preview=None):
|
|
17
|
+
super().__init__(parent)
|
|
18
|
+
self.setWindowTitle("构象浏览与 RMSD 聚类分析 · ETKDG")
|
|
19
|
+
self.setMinimumSize(480, 580)
|
|
20
|
+
self.ensemble = ensemble
|
|
21
|
+
self.on_apply = on_apply
|
|
22
|
+
self.on_preview = on_preview
|
|
23
|
+
self.cluster_result: Optional[dict] = None
|
|
24
|
+
|
|
25
|
+
lay = QVBoxLayout(self)
|
|
26
|
+
head = QLabel(
|
|
27
|
+
f"共 {ensemble.count} 个构象 · 方法 {ensemble.method} · 种子 {ensemble.seed}"
|
|
28
|
+
+ (f" · 力场 {ensemble.forcefield}" if ensemble.forcefield else ""))
|
|
29
|
+
head.setWordWrap(True)
|
|
30
|
+
lay.addWidget(head)
|
|
31
|
+
|
|
32
|
+
if ensemble.failures:
|
|
33
|
+
warn = QLabel("提示:" + ";".join(ensemble.failures))
|
|
34
|
+
warn.setStyleSheet("color:#D8B679;")
|
|
35
|
+
warn.setWordWrap(True)
|
|
36
|
+
lay.addWidget(warn)
|
|
37
|
+
|
|
38
|
+
# 聚类控制条
|
|
39
|
+
cluster_grp = QGroupBox("RMSD 结构聚类 (Kabsch 对偶距离矩阵)")
|
|
40
|
+
c_lay = QHBoxLayout(cluster_grp)
|
|
41
|
+
c_lay.addWidget(QLabel("截断半径 (Å):"))
|
|
42
|
+
self.spin_thresh = QDoubleSpinBox()
|
|
43
|
+
self.spin_thresh.setRange(0.1, 5.0)
|
|
44
|
+
self.spin_thresh.setSingleStep(0.1)
|
|
45
|
+
self.spin_thresh.setValue(0.5)
|
|
46
|
+
c_lay.addWidget(self.spin_thresh)
|
|
47
|
+
|
|
48
|
+
btn_cluster = QPushButton("🔍 聚类分析")
|
|
49
|
+
btn_cluster.clicked.connect(self._run_clustering)
|
|
50
|
+
c_lay.addWidget(btn_cluster)
|
|
51
|
+
|
|
52
|
+
btn_reset = QPushButton("恢复全部列表")
|
|
53
|
+
btn_reset.clicked.connect(self._populate_list)
|
|
54
|
+
c_lay.addWidget(btn_reset)
|
|
55
|
+
lay.addWidget(cluster_grp)
|
|
56
|
+
|
|
57
|
+
self.listw = QListWidget()
|
|
58
|
+
self.listw.currentRowChanged.connect(self._on_row)
|
|
59
|
+
lay.addWidget(self.listw, 1)
|
|
60
|
+
|
|
61
|
+
self.status_lbl = QLabel()
|
|
62
|
+
self.status_lbl.setStyleSheet("color: #40C4FF; font-size: 11px;")
|
|
63
|
+
lay.addWidget(self.status_lbl)
|
|
64
|
+
|
|
65
|
+
btns = QHBoxLayout()
|
|
66
|
+
self.apply_btn = QPushButton("应用此构象")
|
|
67
|
+
self.apply_btn.setProperty("role", "action")
|
|
68
|
+
self.apply_btn.clicked.connect(self._apply)
|
|
69
|
+
cancel = QPushButton("关闭")
|
|
70
|
+
cancel.clicked.connect(self.reject)
|
|
71
|
+
btns.addStretch(1)
|
|
72
|
+
btns.addWidget(cancel)
|
|
73
|
+
btns.addWidget(self.apply_btn)
|
|
74
|
+
lay.addLayout(btns)
|
|
75
|
+
|
|
76
|
+
self._populate_list()
|
|
77
|
+
|
|
78
|
+
def _populate_list(self):
|
|
79
|
+
self.listw.clear()
|
|
80
|
+
self.cluster_result = None
|
|
81
|
+
for c in self.ensemble.conformers:
|
|
82
|
+
en = f"{c.energy:.3f} {c.energy_unit}" if c.energy is not None else "未计算能量"
|
|
83
|
+
it = QListWidgetItem(f"构象 {c.index + 1} {en} " + ("已收敛" if c.minimized else "未确认收敛"))
|
|
84
|
+
it.setData(Qt.ItemDataRole.UserRole, c.index)
|
|
85
|
+
self.listw.addItem(it)
|
|
86
|
+
if self.ensemble.count > 0:
|
|
87
|
+
self.listw.setCurrentRow(0)
|
|
88
|
+
self.status_lbl.setText(f"当前显示全部 {self.ensemble.count} 个生成构象。")
|
|
89
|
+
|
|
90
|
+
def _run_clustering(self):
|
|
91
|
+
if self.ensemble.count < 2:
|
|
92
|
+
QMessageBox.information(self, "提示", "至少需要 2 个构象才能进行 RMSD 聚类。")
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
thresh = self.spin_thresh.value()
|
|
96
|
+
coords_list = [c.coords for c in self.ensemble.conformers]
|
|
97
|
+
res = cluster_conformer_ensemble(coords_list, rmsd_threshold=thresh)
|
|
98
|
+
self.cluster_result = res
|
|
99
|
+
|
|
100
|
+
self.listw.clear()
|
|
101
|
+
n_clusters = res["n_clusters"]
|
|
102
|
+
for cid, members in res["clusters"].items():
|
|
103
|
+
medoid_idx = res["medoids"][cid]
|
|
104
|
+
medoid_c = self.ensemble.conformers[medoid_idx]
|
|
105
|
+
en = f"{medoid_c.energy:.3f} {medoid_c.energy_unit}" if medoid_c.energy is not None else "未知"
|
|
106
|
+
# 簇中心代表
|
|
107
|
+
it_center = QListWidgetItem(
|
|
108
|
+
f"🏷 簇 {cid + 1} 中心 · 构象 {medoid_idx + 1} ({en}) · 共 {len(members)} 构象"
|
|
109
|
+
)
|
|
110
|
+
it_center.setForeground(Qt.GlobalColor.cyan)
|
|
111
|
+
it_center.setData(Qt.ItemDataRole.UserRole, medoid_idx)
|
|
112
|
+
self.listw.addItem(it_center)
|
|
113
|
+
|
|
114
|
+
for m in members:
|
|
115
|
+
if m == medoid_idx:
|
|
116
|
+
continue
|
|
117
|
+
c = self.ensemble.conformers[m]
|
|
118
|
+
d = res["matrix"][medoid_idx, m]
|
|
119
|
+
en_m = f"{c.energy:.3f}" if c.energy is not None else "--"
|
|
120
|
+
it_sub = QListWidgetItem(f" ├─ 构象 {m + 1} (ΔRMSD={d:.2f}Å, {en_m} kcal/mol)")
|
|
121
|
+
it_sub.setData(Qt.ItemDataRole.UserRole, m)
|
|
122
|
+
self.listw.addItem(it_sub)
|
|
123
|
+
|
|
124
|
+
if self.listw.count() > 0:
|
|
125
|
+
self.listw.setCurrentRow(0)
|
|
126
|
+
self.status_lbl.setText(f"聚类完成: 在截断半径 {thresh:.2f} Å 下聚为 {n_clusters} 个结构簇。")
|
|
127
|
+
|
|
128
|
+
def _on_row(self, row):
|
|
129
|
+
if row < 0 or row >= self.listw.count():
|
|
130
|
+
return
|
|
131
|
+
item = self.listw.item(row)
|
|
132
|
+
if not item:
|
|
133
|
+
return
|
|
134
|
+
conf_idx = item.data(Qt.ItemDataRole.UserRole)
|
|
135
|
+
if 0 <= conf_idx < self.ensemble.count:
|
|
136
|
+
c = self.ensemble.conformers[conf_idx]
|
|
137
|
+
if self.on_preview is not None:
|
|
138
|
+
QTimer.singleShot(0, lambda: self.on_preview(c.coords) if self.isVisible() else None)
|
|
139
|
+
|
|
140
|
+
def _apply(self):
|
|
141
|
+
row = self.listw.currentRow()
|
|
142
|
+
if row < 0 or row >= self.listw.count():
|
|
143
|
+
return
|
|
144
|
+
item = self.listw.item(row)
|
|
145
|
+
if not item:
|
|
146
|
+
return
|
|
147
|
+
conf_idx = item.data(Qt.ItemDataRole.UserRole)
|
|
148
|
+
if 0 <= conf_idx < self.ensemble.count:
|
|
149
|
+
if self.on_apply(self.ensemble.conformers[conf_idx].coords) is False:
|
|
150
|
+
return
|
|
151
|
+
self.accept()
|