pyphyschemtools 0.2.1__py3-none-any.whl → 0.3.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.
- pyphyschemtools/.ipynb_checkpoints/Chem3D-checkpoint.py +32 -8
- pyphyschemtools/.visualID_Eng.py.swp +0 -0
- pyphyschemtools/Chem3D.py +32 -8
- pyphyschemtools/__init__.py +2 -2
- pyphyschemtools/resources/svg/pyPC_LPCNO_Banner.png +0 -0
- pyphyschemtools/resources/svg/{pyPCBanner.svg → pyPC_LPCNO_Banner.svg} +4 -4
- pyphyschemtools/resources/svg/tools4pyPC_banner.png +0 -0
- pyphyschemtools/resources/svg/tools4pyPC_banner.svg +193 -0
- pyphyschemtools/visualID_Eng.py +7 -2
- {pyphyschemtools-0.2.1.dist-info → pyphyschemtools-0.3.3.dist-info}/METADATA +9 -7
- {pyphyschemtools-0.2.1.dist-info → pyphyschemtools-0.3.3.dist-info}/RECORD +14 -10
- {pyphyschemtools-0.2.1.dist-info → pyphyschemtools-0.3.3.dist-info}/WHEEL +0 -0
- {pyphyschemtools-0.2.1.dist-info → pyphyschemtools-0.3.3.dist-info}/licenses/LICENSE +0 -0
- {pyphyschemtools-0.2.1.dist-info → pyphyschemtools-0.3.3.dist-info}/top_level.txt +0 -0
|
@@ -283,10 +283,15 @@ class molView:
|
|
|
283
283
|
and bond orders (detects double/triple bonds).
|
|
284
284
|
Requires the `rdkit` library. If False, fallback to standard 3Dmol
|
|
285
285
|
distance-based single bonds.
|
|
286
|
+
display_now : bool, optional
|
|
287
|
+
If True (default), renders the molecule immediately.
|
|
288
|
+
Set to False to prevent immediate display when you plan to call
|
|
289
|
+
further visualization methods provided by the molView class
|
|
286
290
|
viewer : bool, optional
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
291
|
+
If True (default), initializes the py3Dmol engine and prepares the 3D model.
|
|
292
|
+
If False, operates in 'headless' mode: only geometric data is processed
|
|
293
|
+
for analysis (volume, CM, etc.), saving significant memory for
|
|
294
|
+
high-throughput processing.
|
|
290
295
|
zoom : None, optional
|
|
291
296
|
scaling factor
|
|
292
297
|
|
|
@@ -311,10 +316,12 @@ class molView:
|
|
|
311
316
|
>>> vol = mv.data.get_cage_volume()
|
|
312
317
|
"""
|
|
313
318
|
|
|
314
|
-
def __init__(self, mol, source=
|
|
319
|
+
def __init__(self, mol, source=None, style='bs', displayHbonds=True, cpk_scale=0.6, w=600, h=400,\
|
|
315
320
|
supercell=(1, 1, 1), display_now=True, detect_BondOrders=True, viewer=True, zoom=None):
|
|
321
|
+
# For the automatic detection or source validation
|
|
322
|
+
valid_sources = ['file', 'mol', 'cif', 'cid', 'rscb', 'cod', 'ase']
|
|
323
|
+
|
|
316
324
|
self.mol = mol
|
|
317
|
-
self.source = source
|
|
318
325
|
self.style = style
|
|
319
326
|
self.cpk_scale = cpk_scale
|
|
320
327
|
self.displayHbonds = displayHbonds
|
|
@@ -324,6 +331,19 @@ class molView:
|
|
|
324
331
|
self.supercell = supercell
|
|
325
332
|
self.viewer = viewer
|
|
326
333
|
self.zoom = zoom
|
|
334
|
+
if source is None and os.path.exists(str(mol)):
|
|
335
|
+
self.source = 'file'
|
|
336
|
+
elif source in valid_sources:
|
|
337
|
+
self.source = source
|
|
338
|
+
else:
|
|
339
|
+
# Clear error message and early exit if the source is unrecognized
|
|
340
|
+
error_msg = f"❌ Invalid source: '{source}'. \nAllowed sources are: {', '.join(valid_sources)}"
|
|
341
|
+
print(error_msg)
|
|
342
|
+
self.data = None
|
|
343
|
+
self.v = None
|
|
344
|
+
return
|
|
345
|
+
# Viewer initialization and data loading
|
|
346
|
+
# We only proceed if the source is valid
|
|
327
347
|
self.v = py3Dmol.view(width=self.w, height=self.h) # Création du viewer une seule fois
|
|
328
348
|
self._load_and_display(show=display_now)
|
|
329
349
|
|
|
@@ -670,13 +690,17 @@ class molView:
|
|
|
670
690
|
try:
|
|
671
691
|
# On utilise l'alias long d'ASE pour PDB, sinon le format détecté
|
|
672
692
|
atoms = read(io.StringIO(content), format=fmt)
|
|
673
|
-
except Exception
|
|
693
|
+
except (Exception, StopIteration):
|
|
674
694
|
# Si l'extraction échoue, on tente une dernière fois sans format forcé
|
|
675
695
|
try:
|
|
676
696
|
atoms = read(io.StringIO(content))
|
|
677
697
|
except:
|
|
678
|
-
print(f"Extraction of coordinates is impossible
|
|
679
|
-
|
|
698
|
+
print(f"❌ Extraction of coordinates is impossible for source {self.source}")
|
|
699
|
+
self.data = None
|
|
700
|
+
# --- CRUCIAL : On arrête tout ici si on n'a pas d'atomes ---
|
|
701
|
+
if self.viewer:
|
|
702
|
+
self.v.show() # On montre au moins le viewer vide ou l'erreur
|
|
703
|
+
return
|
|
680
704
|
|
|
681
705
|
self.data = XYZData(
|
|
682
706
|
symbols=atoms.get_chemical_symbols(),
|
|
Binary file
|
pyphyschemtools/Chem3D.py
CHANGED
|
@@ -283,10 +283,15 @@ class molView:
|
|
|
283
283
|
and bond orders (detects double/triple bonds).
|
|
284
284
|
Requires the `rdkit` library. If False, fallback to standard 3Dmol
|
|
285
285
|
distance-based single bonds.
|
|
286
|
+
display_now : bool, optional
|
|
287
|
+
If True (default), renders the molecule immediately.
|
|
288
|
+
Set to False to prevent immediate display when you plan to call
|
|
289
|
+
further visualization methods provided by the molView class
|
|
286
290
|
viewer : bool, optional
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
291
|
+
If True (default), initializes the py3Dmol engine and prepares the 3D model.
|
|
292
|
+
If False, operates in 'headless' mode: only geometric data is processed
|
|
293
|
+
for analysis (volume, CM, etc.), saving significant memory for
|
|
294
|
+
high-throughput processing.
|
|
290
295
|
zoom : None, optional
|
|
291
296
|
scaling factor
|
|
292
297
|
|
|
@@ -311,10 +316,12 @@ class molView:
|
|
|
311
316
|
>>> vol = mv.data.get_cage_volume()
|
|
312
317
|
"""
|
|
313
318
|
|
|
314
|
-
def __init__(self, mol, source=
|
|
319
|
+
def __init__(self, mol, source=None, style='bs', displayHbonds=True, cpk_scale=0.6, w=600, h=400,\
|
|
315
320
|
supercell=(1, 1, 1), display_now=True, detect_BondOrders=True, viewer=True, zoom=None):
|
|
321
|
+
# For the automatic detection or source validation
|
|
322
|
+
valid_sources = ['file', 'mol', 'cif', 'cid', 'rscb', 'cod', 'ase']
|
|
323
|
+
|
|
316
324
|
self.mol = mol
|
|
317
|
-
self.source = source
|
|
318
325
|
self.style = style
|
|
319
326
|
self.cpk_scale = cpk_scale
|
|
320
327
|
self.displayHbonds = displayHbonds
|
|
@@ -324,6 +331,19 @@ class molView:
|
|
|
324
331
|
self.supercell = supercell
|
|
325
332
|
self.viewer = viewer
|
|
326
333
|
self.zoom = zoom
|
|
334
|
+
if source is None and os.path.exists(str(mol)):
|
|
335
|
+
self.source = 'file'
|
|
336
|
+
elif source in valid_sources:
|
|
337
|
+
self.source = source
|
|
338
|
+
else:
|
|
339
|
+
# Clear error message and early exit if the source is unrecognized
|
|
340
|
+
error_msg = f"❌ Invalid source: '{source}'. \nAllowed sources are: {', '.join(valid_sources)}"
|
|
341
|
+
print(error_msg)
|
|
342
|
+
self.data = None
|
|
343
|
+
self.v = None
|
|
344
|
+
return
|
|
345
|
+
# Viewer initialization and data loading
|
|
346
|
+
# We only proceed if the source is valid
|
|
327
347
|
self.v = py3Dmol.view(width=self.w, height=self.h) # Création du viewer une seule fois
|
|
328
348
|
self._load_and_display(show=display_now)
|
|
329
349
|
|
|
@@ -670,13 +690,17 @@ class molView:
|
|
|
670
690
|
try:
|
|
671
691
|
# On utilise l'alias long d'ASE pour PDB, sinon le format détecté
|
|
672
692
|
atoms = read(io.StringIO(content), format=fmt)
|
|
673
|
-
except Exception
|
|
693
|
+
except (Exception, StopIteration):
|
|
674
694
|
# Si l'extraction échoue, on tente une dernière fois sans format forcé
|
|
675
695
|
try:
|
|
676
696
|
atoms = read(io.StringIO(content))
|
|
677
697
|
except:
|
|
678
|
-
print(f"Extraction of coordinates is impossible
|
|
679
|
-
|
|
698
|
+
print(f"❌ Extraction of coordinates is impossible for source {self.source}")
|
|
699
|
+
self.data = None
|
|
700
|
+
# --- CRUCIAL : On arrête tout ici si on n'a pas d'atomes ---
|
|
701
|
+
if self.viewer:
|
|
702
|
+
self.v.show() # On montre au moins le viewer vide ou l'erreur
|
|
703
|
+
return
|
|
680
704
|
|
|
681
705
|
self.data = XYZData(
|
|
682
706
|
symbols=atoms.get_chemical_symbols(),
|
pyphyschemtools/__init__.py
CHANGED
|
Binary file
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
viewBox="0 0 178.01071 29.131533"
|
|
8
8
|
version="1.1"
|
|
9
9
|
id="svg5"
|
|
10
|
-
inkscape:version="1.4.
|
|
11
|
-
sodipodi:docname="
|
|
12
|
-
inkscape:export-filename="
|
|
10
|
+
inkscape:version="1.4.3 (unknown)"
|
|
11
|
+
sodipodi:docname="pyPC_LPCNO_Banner.svg"
|
|
12
|
+
inkscape:export-filename="pyPC_LPCNO_Banner.png"
|
|
13
13
|
inkscape:export-xdpi="300.008"
|
|
14
14
|
inkscape:export-ydpi="300.008"
|
|
15
15
|
xml:space="preserve"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
inkscape:document-units="mm"
|
|
31
31
|
showgrid="false"
|
|
32
32
|
inkscape:zoom="2.1549693"
|
|
33
|
-
inkscape:cx="154.
|
|
33
|
+
inkscape:cx="154.75859"
|
|
34
34
|
inkscape:cy="88.168309"
|
|
35
35
|
inkscape:window-width="2544"
|
|
36
36
|
inkscape:window-height="1344"
|
|
Binary file
|