IMP  2.0.0
The Integrative Modeling Platform
fit_restraint.py
1 ## \example em/fit_restraint.py
2 ## A simple example showing how to set up a fit restraint. The number of spheres and resolution are randomly chosen and so should not be considered significant.
3 
4 import IMP.em
5 import IMP.core
6 import IMP.atom
7 IMP.base.set_log_level(IMP.base.SILENT)
8 m= IMP.Model()
9 #1. setup the input protein
10 ##1.1 select a selector.
12 ##1.2 read the protein
13 mh=IMP.atom.read_pdb(IMP.em.get_example_path("input.pdb"),m,sel)
16 #2. read the density map
17 resolution=8.
18 voxel_size=1.5
20 dmap.get_header_writable().set_resolution(resolution)
21 #3. calculate the cross correlation between the density and the map
22 print "The cross-correlation score is:",1.-IMP.em.compute_fitting_score(ps,dmap)
23 #4. add a fitting restraint
24 r= IMP.em.FitRestraint(ps, dmap)
25 m.add_restraint(r)
26 print "The fit of the particles in the density is:",r.evaluate(False)