moleditpy 1.8.0__tar.gz → 1.8.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moleditpy
3
- Version: 1.8.0
3
+ Version: 1.8.2
4
4
  Summary: A cross-platform, simple, and intuitive molecular structure editor built in Python. It allows 2D molecular drawing and 3D structure visualization. It supports exporting structure files for input to DFT calculation software.
5
5
  Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/HiroYokoyama/python_molecular_editor
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "moleditpy"
7
7
 
8
- version = "1.8.0"
8
+ version = "1.8.2"
9
9
 
10
10
  authors = [
11
11
  { name="HiroYokoyama", email="titech.yoko.hiro@gmail.com" },
@@ -11,7 +11,7 @@ DOI 10.5281/zenodo.17268532
11
11
  """
12
12
 
13
13
  #Version
14
- VERSION = '1.8.0'
14
+ VERSION = '1.8.2'
15
15
 
16
16
  print("-----------------------------------------------------")
17
17
  print("MoleditPy — A Python-based molecular editing software")
@@ -7131,7 +7131,6 @@ class MainWindow(QMainWindow):
7131
7131
  self.mode_actions['select'].setChecked(True)
7132
7132
 
7133
7133
  def trigger_conversion(self):
7134
- self.scene.clear_all_problem_flags()
7135
7134
  mol = self.data.to_rdkit_mol(use_2d_stereo=False)
7136
7135
  if not mol or mol.GetNumAtoms() == 0:
7137
7136
  # 3Dビューと関連データをクリア
@@ -7142,6 +7141,9 @@ class MainWindow(QMainWindow):
7142
7141
  self.view_2d.setFocus()
7143
7142
  return
7144
7143
 
7144
+ # 化学的問題のフラグをクリア(分子が存在する場合のみ)
7145
+ self.scene.clear_all_problem_flags()
7146
+
7145
7147
  # 原子プロパティを保存(ワーカープロセスで失われるため)
7146
7148
  self.original_atom_properties = {}
7147
7149
  for i in range(mol.GetNumAtoms()):
@@ -9434,6 +9436,10 @@ class MainWindow(QMainWindow):
9434
9436
 
9435
9437
  bond_counter = 0 # 結合の個別識別用
9436
9438
 
9439
+ # Ball and Stick用のシリンダーリストを準備(高速化のため)
9440
+ if self.current_3d_style == 'ball_and_stick':
9441
+ bond_cylinders = []
9442
+
9437
9443
  for bond in mol.GetBonds():
9438
9444
  begin_atom_idx = bond.GetBeginAtomIdx()
9439
9445
  end_atom_idx = bond.GetEndAtomIdx()
@@ -9455,9 +9461,9 @@ class MainWindow(QMainWindow):
9455
9461
 
9456
9462
  if bt == Chem.rdchem.BondType.SINGLE or bt == Chem.rdchem.BondType.AROMATIC:
9457
9463
  if self.current_3d_style == 'ball_and_stick':
9458
- # Ball and stickはグレー
9464
+ # Ball and stickは全結合をまとめて処理(高速化)
9459
9465
  cyl = pv.Cylinder(center=c, direction=d, radius=cyl_radius, height=h, resolution=bond_resolution)
9460
- actor = self.plotter.add_mesh(cyl, color='grey', **mesh_props)
9466
+ bond_cylinders.append(cyl)
9461
9467
  self._3d_color_map[f'bond_{bond_counter}'] = [127, 127, 127] # グレー
9462
9468
  else:
9463
9469
  # その他(stick, wireframe)は中央で色が変わる2つの円柱
@@ -9488,11 +9494,10 @@ class MainWindow(QMainWindow):
9488
9494
  c1, c2 = c + off_dir * (s_double / 2), c - off_dir * (s_double / 2)
9489
9495
 
9490
9496
  if self.current_3d_style == 'ball_and_stick':
9491
- # Ball and stickはグレー
9497
+ # Ball and stickは全結合をまとめて処理(高速化)
9492
9498
  cyl1 = pv.Cylinder(center=c1, direction=d, radius=r, height=h, resolution=bond_resolution)
9493
9499
  cyl2 = pv.Cylinder(center=c2, direction=d, radius=r, height=h, resolution=bond_resolution)
9494
- self.plotter.add_mesh(cyl1, color='grey', **mesh_props)
9495
- self.plotter.add_mesh(cyl2, color='grey', **mesh_props)
9500
+ bond_cylinders.extend([cyl1, cyl2])
9496
9501
  self._3d_color_map[f'bond_{bond_counter}_1'] = [127, 127, 127]
9497
9502
  self._3d_color_map[f'bond_{bond_counter}_2'] = [127, 127, 127]
9498
9503
  else:
@@ -9525,13 +9530,11 @@ class MainWindow(QMainWindow):
9525
9530
  s_triple = cyl_radius * triple_offset_factor
9526
9531
 
9527
9532
  if self.current_3d_style == 'ball_and_stick':
9528
- # Ball and stickはグレー
9533
+ # Ball and stickは全結合をまとめて処理(高速化)
9529
9534
  cyl1 = pv.Cylinder(center=c, direction=d, radius=r, height=h, resolution=bond_resolution)
9530
9535
  cyl2 = pv.Cylinder(center=c + off_dir * s_triple, direction=d, radius=r, height=h, resolution=bond_resolution)
9531
9536
  cyl3 = pv.Cylinder(center=c - off_dir * s_triple, direction=d, radius=r, height=h, resolution=bond_resolution)
9532
- self.plotter.add_mesh(cyl1, color='grey', **mesh_props)
9533
- self.plotter.add_mesh(cyl2, color='grey', **mesh_props)
9534
- self.plotter.add_mesh(cyl3, color='grey', **mesh_props)
9537
+ bond_cylinders.extend([cyl1, cyl2, cyl3])
9535
9538
  self._3d_color_map[f'bond_{bond_counter}_1'] = [127, 127, 127]
9536
9539
  self._3d_color_map[f'bond_{bond_counter}_2'] = [127, 127, 127]
9537
9540
  self._3d_color_map[f'bond_{bond_counter}_3'] = [127, 127, 127]
@@ -9564,6 +9567,18 @@ class MainWindow(QMainWindow):
9564
9567
  self._3d_color_map[f'bond_{bond_counter}_3_end'] = end_color_rgb
9565
9568
 
9566
9569
  bond_counter += 1
9570
+
9571
+ # Ball and Stick用:全結合をまとめて一括描画(高速化)
9572
+ if self.current_3d_style == 'ball_and_stick' and bond_cylinders:
9573
+ # 全シリンダーを結合してMultiBlockを作成
9574
+ combined_bonds = pv.MultiBlock(bond_cylinders)
9575
+ combined_mesh = combined_bonds.combine()
9576
+
9577
+ # 一括でグレーで描画
9578
+ bond_actor = self.plotter.add_mesh(combined_mesh, color='grey', **mesh_props)
9579
+
9580
+ # まとめて色情報を記録
9581
+ self._3d_color_map['bonds_combined'] = [127, 127, 127]
9567
9582
 
9568
9583
  if getattr(self, 'show_chiral_labels', False):
9569
9584
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moleditpy
3
- Version: 1.8.0
3
+ Version: 1.8.2
4
4
  Summary: A cross-platform, simple, and intuitive molecular structure editor built in Python. It allows 2D molecular drawing and 3D structure visualization. It supports exporting structure files for input to DFT calculation software.
5
5
  Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/HiroYokoyama/python_molecular_editor
File without changes
File without changes