Rendering tool of cube file on jupyter-notebook #psikit #psi4 #memo

Visualize molecular orbital is one of the good way for understating molecular reactivity. Opensource quantum chemistry package ‘Psi4’ can generate cube file for MO rendering and psikit has function for rendering MO with pymol. Here is an example notebook.

And recently I found new tool for cube file rendering named fortecubeview package. The license of the package is MIT ;).

So I tried to use it with psikit. Because it is easy to generate cubefiles with psikit. And fortecubeview can render cubefiles only calling plot function.

Ok, let’s install the package at first.

$ mamba install -c conda-forge pythreejs
$ pip install fortecubeview

# install the extension for jupyter notebooks
$ jupyter nbextension install --py --symlink --sys-prefix pythreejs
$ jupyter nbextension enable --py --sys-prefix pythreejs

# Next launch jupyter-notebook
$ jupyter-notebook

I changed tempdir from default setting to other place. All cube files will be stored in my defined path. First molecule is nitro benzene. (scf/6-31** level)

from psikit import Psikit
import fortecubeview
import os
pk = Psikit()
pk.tempdir ='/home/iwatobipen/dev/sandbox/rdk/psi4test/tmp1'
fortecubeview.plot(path=pk.tempdir, width=600, height=300, colorscheme='national', sumlevel=0.7)

Fortecubeveiw provides select box for cubefiles and user can interactively change drawing target.

Next, draw metoxy benzene.

pk = Psikit()
pk.tempdir ='/home/iwatobipen/dev/sandbox/rdk/psi4test/tmp2'
fortecubeview.plot(path=pk.tempdir, width=600, height=300, colorscheme='national', sumlevel=0.7)

There is a difference the shape of HOMO orbital between nitro-benzene and methoxy-benzene. HOMO lobe of nitro-benzene can see on metha and ortho positions. Nitoro benzene has an ortho orientation for electrophilic substitution reaction. On the other hand, HOMO lobe of methoxy benzene can see on ortho and para positions. It means that methoxy-benzene has ortho- para- orientations for electrophilic substitution reaction.

In summary, fortecubeveiw is a convenient tool for cube file visualization. If we run psi4 against more large biological system such as X-ray crystal structure, can we visualize protein-ligand interaction? It seems interesting.

I uploaded today’s notebook on my gist.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.


Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: