IMP  2.1.1
The Integrative Modeling Platform
restrainer/saxs_restraint.py

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

<!-- File: saxs_representation.xml -->
<Representation>
<Protein id="6lyz">
<Chain filename="data/6lyz.pdb" selector="NonWaterNonHydrogen"/>
</Protein>
</Representation>
<!-- File: saxs_restraint.xml -->
<SAXS name="saxs_restraint_set">
<Restraint name="saxs_restraint" profile_filename="data/lyzexp.dat">
<Particle id="6lyz"></Particle>
</SAXS>
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(
18  IMP.restrainer.get_example_path('input/saxs_representation.xml'))
19 rsr = restrainer.add_restraint(
20  IMP.restrainer.get_example_path('input/saxs_restraint.xml'))
21 
22 # =======================================================================###
23 # At this point all data from XML files have been placed into the model.
24 # Now it is possible to perform various operations on the IMP model.
25 # =======================================================================###
26 
27 # Get the IMP model object used by restrainer
28 model = restrainer.get_model()
29 
30 # Get restraint by name
31 r = rsr.get_restraint_by_name('saxs_restraint')
32 
33 # Get IMP::RestraintSet by name
34 rs = rsr.get_restraint_set_by_name('saxs_restraint_set')
35 
36 # Get IMP::saxs::Restraint
37 saxs_restraint = r.imp_restraint
38 saxs_restraint.evaluate(False)