News

Python extension enabling Jupyter Notebook integration in Flare released

In a recent post I wrote about Integrating Jupyter Notebook into Flare as a new Python extension dedicated to Python developers and enthusiasts. The Python extension that makes this possible is now released (Figure 1).


Figure 1. The button which enables the Python Notebook extension.

While using it to carry out my daily Python coding tasks, I have identified a number of features that the protoype extension was missing and were worth implementing. So, there are a few more highlights that I’d like to share with you.

As discussed in my previous post, the feature that personally I enjoy most is the fact that the Flare Python Notebook has direct access to the Flare main_window() object, and hence allows you to work on the project currently loaded in the main viewport, i.e., interact with ligands and proteins, visualize molecular and field surfaces, etc. As this involves running the Python code in the main GUI thread, only a single Python Notebook may have access to the GUI at any given time.

However, I thought it would be useful to be able to run other concurrent, separate pyflare processes within the same Python Notebook while the main GUI process is busy doing a computation, e.g., preparing a protein (Figure 2):


Figure 2. Download a PDB complex in the GUI, then run Protein Preparation.

The Python Notebook remains responsive while the Protein Preparation task is run by a FieldEngine process in the background. This means I can open a second Python Notebook tab and, for example, visualize the 2D ligand structure. Since the new notebook tab runs as a separate pyflare process, it does not have access to the Flare main_window() object, as shown by the absence of the Flare icon and by the tooltip (Figure 3):


Figure 3. Open another tab and carry out some other task in a separate process.

Once the calculation has finished, you can switch back to the main tab and keep on working there.

To provide better integration with the Flare GUI, I have moved the familiar ‘Kernel’ notebook menu controls to the bottom of the window (Figure 4):


Figure 4. Restart/Stop commands can be accessed from bottom left buttons.

Also, the Load/Save commands were moved from the File menu to buttons, in order to provide more control on the location the notebooks can be saved to or retrieved from (Figure 5):


Figure 5. Load/Save notebooks through a standard file dialog.

The Python Notebook extension is now ready for download from Developers extension on our GitLab page. I’d be really keen on hearing thoughts and ideas from other Python enthusiasts out there, so please do not hesitate to get in touch if you would like more information, have feedback or have suggestions for new features in the next version of the Python Notebook.

Try Cresset solutions on your project

Request a free software evaluation