mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Accept non-kekulisable molecules. (#9167)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
This commit is contained in:
@@ -73,7 +73,15 @@ None'''
|
||||
else:
|
||||
# py3Dmol does not currently support v3k mol files, so
|
||||
# we can only provide those with "smaller" molecules
|
||||
mb = Chem.MolToMolBlock(mol, confId=confId)
|
||||
try:
|
||||
mb = Chem.MolToMolBlock(mol, confId=confId)
|
||||
except Chem.AtomKekulizeException:
|
||||
# The bonding is likely to be wrong, but it would be good
|
||||
# to see something.
|
||||
p = Chem.rdmolfiles.MolWriterParams()
|
||||
p.kekulize = False
|
||||
mb = Chem.MolToMolBlock(mol, confId=confId, params=p)
|
||||
|
||||
view.addModel(mb, 'sdf')
|
||||
if drawAs is None:
|
||||
drawAs = drawing_type_3d
|
||||
@@ -545,3 +553,4 @@ def UninstallIPythonRenderer():
|
||||
|
||||
|
||||
InstallIPythonRenderer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user