This tutorial covers creating a new IMP module and writing a new restraint in C++. See the IMP website for the tutorial text.