Learn how to use the computational crystallography toolbox, the open source library for crystallography and cryo-EM.
Go to the Download page to get the most recent cctbx source code as binary installer for Linux, MacOS and Windows.
Installation is very simple and fast. After uncompressing the bundle, run the
install --prefix= command to install on macOS and Linux. On Windows, uncompressing the zip file will provide a working copy of cctbx.
Type this into a terminal window to start python from cctbx so that it knows about all the cctbx modules:
The libtbx.python command runs a version of python that already knows about the cctbx so you can easily import cctbx functions. For example:
from iotbx.data_manager import DataManager # Load in the DataManager
Sometimes you want to save the commands in a script. This avoids typing the same text over and over again if you want to perform some actions on many files. For example, save the following lines in a file, you can call it
hello_cctbx.py (this page explains in more detail what the script does).
from iotbx.map_model_manager import map_model_manager # load in the map_model_manager mmm=map_model_manager() # get an initialized instance of the map_model_manager mmm.generate_map() # get a model from a small library model and calculate a map for it mmm.write_map("map.mrc") # write out a map in ccp4/mrc format mmm.write_model("model.pdb") # write out a model in PDB format
Then run the script by typing the following command in a terminal:
You just ran your first cctbx script which produced example map and model files.
If you want to use the cctbx, you most likely want to do some actions on models, crystallographic data files or cryo-EM maps. The following pages give an introduction to higher level objects and methods for this purpose.
Most scripts will act on files, so this section should be of interest to everyone. Use the DataManager to conveniently read and write data and model files.
The model manager lets you do operations on models. Learn how to to set up the model manager, apply coordinate shifts, do atom selections and calculate model-based map coefficients.
The map manager lets you do operations on maps. Learn how to read and save maps, change a map, convert a real-space map to a Fourier representation and back and manipulate maps that represent only a part of a full map. The tutorial also explains how to find and represent map reconstruction symmetry.
The map-model manager is useful to keep track of both maps and models. This tutorial shows how to set up the manager, how to cut out a piece of a map around a part of a model and how to create masks.
Want to contribute to the cctbx? Here is the GitHub page.