[cctbxbb] Use of cctbx with C++

Luc Bourhis luc_j_bourhis at mac.com
Wed Mar 16 02:49:58 PDT 2011

Hi Flavio,

> I would like to use cctbx with C++. To start with I would like to do something basic, like:
> > from cctbx import xray
> > 
> > xs = xray.structure.from_cif(file_path="my.cif")
> I looked into the cctbx functions/class list, but I could not find something similar for C++. 
> Can someone help me?

I am afraid that this is Python-only and that it will stay so. Indeed the philosophy of the cctbx is to write as little C++ as possible. Only the most numerically intensive code is written in that language. Conversely very little of the I/O is usable from C++ if any at all.

If you absolutely need to write your program in C++, your only choice is to embed a Python interpreter inside that program and call into the cctbx Python layer. The Olex 2 program uses that idea intensively and with great success.

The alternative, and the one I would recommend if you have just started your project, would be to write your program in Python, with perhaps the seldom offloading of cpu- or memory-intensive task to some C++ code of yours. This is the way of the Phenix macromolecular suites and it works great too.

Luc Bourhis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20110316/758d3b46/attachment.htm>

More information about the cctbxbb mailing list