File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ import os
2+ os .system ('pip install py3Dmol' )
3+ import kora .install .rdkit
4+
5+ from rdkit import Chem
6+ from rdkit .Chem import AllChem
7+ import py3Dmol
8+
9+
10+ def plot (smiles , size = (200 ,200 ), style = 'stick' ):
11+ """
12+ Visualize a molecule from its formula (smiles)
13+ Adapted from https://birdlet.github.io/2019/10/02/py3dmol_example
14+ """
15+ mol = Chem .MolFromSmiles (smiles )
16+ mol = Chem .AddHs (mol )
17+ AllChem .EmbedMolecule (mol )
18+ AllChem .MMFFOptimizeMolecule (mol )
19+ block = Chem .MolToMolBlock (mol )
20+
21+ viewer = py3Dmol .view (width = size [0 ], height = size [1 ])
22+ viewer .addModel (block , 'mol' )
23+ viewer .setStyle ({style :{}})
24+ viewer .zoomTo ()
25+ viewer .show ()
Original file line number Diff line number Diff line change 55
66setuptools .setup (
77 name = "kora" ,
8- version = "0.6.9 " ,
8+ version = "0.6.10 " ,
99 author = "Korakot Chaovavanich" ,
1010 author_email = "korakot@gmail.com" ,
1111 description = "Convenient tools for Colab" ,
You can’t perform that action at this time.
0 commit comments