CCTBX is the Computational Crystallography Toolbox. Its development is based at Lawrence-Berkeley National Laboratory. It provides code for computations with diffraction data and atomic coordinates of proteins and small molecules. It has C++ and Python ports. It is available in Anaconda in the conda-forge channel as cctbx-base for python3.8 through 3.11 for Windows, macOS, and Linux.
I assume that Anaconda has already been installed. We also create the Jupyter Notebook kernel while we are at it. Execute one line at a time: Wait for the execution to finish before executing the next line.
conda create --name cctbx39 python=3.9
conda activate cctbx39
conda install -c conda-forge cctbx-base -y
conda install ipykernel -y
python -m ipykernel install --user --name cctbx39 --display-name "cctbx python3.9"
The second to last command triggers the installation of Jupyter in the cctbx39 env.
The last command creates and installs the Jupyter kernel in ~/Library/Jupyter/kernels/cctbx39
on the Mac.
Select cctbx python3.9 from the list of kernels when opening a new notebook in Jupyter.
Replace the 3.9 or 39 above with whatever version of Python you want to use (between 3.8 and 3.11).
Neosnippets is a popular snippet manager for Vim. It also works with Neovim. Its development has plateaued.
There are other snippets managers for Vim and NeoVim, such as ultisnip
s and snipmate
.
To complicate matters more, there several alternate systems for managing plugins.
-
Facilitate code reuse. The use of code snippets can save time by reusing existing code. The presence of tab stops in code snippets can help ensure that all parameters that need to be customized for a new problem are considered. Thus, tab stops can reduce subsequent debugging.
-
Use of Emacs to edit Jupyter and Colab code and markdown cells The existing snippet formats for Jupyter and Colab notebooks do not support tab triggers and tab stops: These are standard features of code snippet systems in most text editors. We can overcome these limitations by sending the active code cell to Vim or NeoVim via the GhostText extension for the browser and the ghosttext.vim plugin.
- Install the snippets for Vim.
I assume that the neosnippets
plugin has already been properly installed.
The snippets are stored in a single file called cctbx.snips
.
I store this file in a folder called ~/.vim/my-snippets/neosnippets
.
You may have to concatenate the cctbx.snips
with an existing python.snippets
file.
cd ~/.vim/my-snippets/neosnippets
git clone https://github.com/MooersLab/cctbxsnips-neosnippets.git
cd cctbxsnips-neosnippets/
mv cctbx.snips ../.
cd ..
rm -rf cctbxsnips-neosnippets
- Optional If you want to use these snippets from Vim or NeoVim to edit live cells in Jupyter or Colab notebooks, install GhostText in your browser and the Vim Ghostplugin for Vim.
- Install the [nvim-ghost](https://github.com/subnut/nvim-ghost.nvim] plugin for NeoVim).
- cctbxsnips-Emacs CCTBX snippets for the yasnippet snippet system in for Emacs.
- cctbxsnips-SublimeText3 CCTBX snippets for Sublime Text 3 (ST3).
- cctbxsnips-VSC CCTBX snippets for Visual Studio Code (VSC).
- cctbxsnips-UltiSnips CCTBX snippets for Vim or NeoVim via UltiSnips plugin.
- cctbxsnips-Snipmate CCTBX snippets for Vim or NeoVim via snipmate plugin.
- cctbxsnips-Atom CCTBX snippets for Atom.
- Jupyterlab cctbx snippets CCTBX snippets for JupyterLab with the
jupyterlab-snippets
extension or the jupyterlab-snippets-mutlimenus extension. - Jupyterlab cctbx plus snippets The variant of the
jupyterlabcctbxsnips
library with comments to guide editing of the snippets. - Colab cctbx snippets Colab snippets.
Version | Changes | Date |
---|---|---|
Version 0.2 | Added badges and update table to README.md | 2024 April 13 |
- NIH: R01 CA242845
- NIH: R01 AI088011
- NIH: P30 CA225520 (PI: R. Mannel)
- NIH P20GM103640 and P30GM145423 (PI: A. West)