Install and use Runsnake

It is a good idea to profile code to speed up runtime.

Install RunSnakeRun

libtbx.python -m pip install SquareMap RunSnakeRun

To profile something:

libtbx.python -m cProfile -o prof.out my_model.pdb is the code that is being profiled. This script may or may not have inputs. In this example the script has the input my_model.pdb.

It is a good idea to use an alias:

alias runsnake='libtbx.python /base/Python.framework/Versions/2.7/lib/python2.7/site-packages/runsnakerun/'

The alias runs the script that is installed in phenix/base.

After profiling you can view the file with:

runsnake prof.out

In the output of the above command, you will see many squares of different size. The size is proportional to runtime. In the square you can find what it is exactly (function name). When you hovering with mouse over a square, the same functions are highlighted as well, so it is easy to see if something is run from different places.

You can also use a flag, so every command outputs a runsnake profile: