IMP  2.0.0
The Integrative Modeling Platform
restrainer/saxs_restraint.py

This example shows how to use IMP::saxs::Restraint.

1 ## \example restrainer/saxs_restraint.py
2 ## This example shows how to use IMP::saxs::Restraint.
3 ##
4 ## \include saxs_representation.xml
5 ## \include saxs_restraint.xml
6 ##
7 
8 #-- File: saxs_restraint.py --#
9 
10 import IMP
11 import IMP.restrainer
12 
13 # Create restrainer object
14 restrainer = IMP.restrainer.Main()
15 
16 # Add representation and restraint to restrainer
17 rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/saxs_representation.xml'))
18 rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/saxs_restraint.xml'))
19 
20 ###=======================================================================###
21 # At this point all data from XML files have been placed into the model.
22 # Now it is possible to perform various operations on the IMP model.
23 ###=======================================================================###
24 
25 # Get the IMP model object used by restrainer
26 model = restrainer.get_model()
27 
28 # Get restraint by name
29 r = rsr.get_restraint_by_name('saxs_restraint')
30 
31 # Get IMP::RestraintSet by name
32 rs = rsr.get_restraint_set_by_name('saxs_restraint_set')
33 
34 # Get IMP::saxs::Restraint
35 saxs_restraint = r.imp_restraint
36 saxs_restraint.evaluate(False)