IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
pmi/restraints/__init__.py
1 """@namespace IMP.pmi.restraints
2  Classes to handle different kinds of restraints.
3 """
4 
5 import IMP
6 import IMP.pmi
7 import IMP.pmi.tools
8 
9 class _NuisancesBase(object):
10  ''' This base class is used to provide nuisance setup and interface
11  for the ISD cross-link restraints '''
12  sigma_dictionary={}
13  psi_dictionary={}
14 
15  def create_length(self):
16  ''' a nuisance on the length of the cross-link '''
17  lengthinit = 10.0
18  self.lengthissampled = True
19  lengthminnuis = 0.0000001
20  lengthmaxnuis = 1000.0
21  lengthmin = 6.0
22  lengthmax = 30.0
23  lengthtrans = 0.2
24  length = IMP.pmi.tools.SetupNuisance(self.m, lengthinit,
25  lengthminnuis,
26  lengthmaxnuis,
27  lengthissampled).get_particle()
28  self.rslen.add_restraint(
30  self.m,
31  length,
32  1000000000.0,
33  lengthmax,
34  lengthmin))
35 
36  def create_sigma(self, resolution):
37  ''' a nuisance on the structural uncertainty '''
38  if isinstance(resolution,str):
39  sigmainit = 2.0
40  else:
41  sigmainit = resolution + 2.0
42  self.sigmaissampled = True
43  sigmaminnuis = 0.0000001
44  sigmamaxnuis = 1000.0
45  sigmamin = 0.01
46  sigmamax = 100.0
47  sigmatrans = 0.5
48  sigma = IMP.pmi.tools.SetupNuisance(self.m, sigmainit,
49  sigmaminnuis, sigmamaxnuis, self.sigmaissampled).get_particle()
50  self.sigma_dictionary[resolution] = (
51  sigma,
52  sigmatrans,
53  self.sigmaissampled)
54  self.rssig.add_restraint(
56  self.m,
57  sigma,
58  1000000000.0,
59  sigmamax,
60  sigmamin))
61  # self.rssig.add_restraint(IMP.isd.JeffreysRestraint(self.sigma))
62 
63  def get_sigma(self, resolution):
64  if not resolution in self.sigma_dictionary:
65  self.create_sigma(resolution)
66  return self.sigma_dictionary[resolution]
67 
68  def create_psi(self, value):
69  ''' a nuisance on the inconsistency '''
70  if isinstance(value,str):
71  psiinit = 0.5
72  else:
73  psiinit = value
74  self.psiissampled = True
75  psiminnuis = 0.0000001
76  psimaxnuis = 0.4999999
77  psimin = 0.01
78  psimax = 0.49
79  psitrans = 0.1
80  psi = IMP.pmi.tools.SetupNuisance(self.m, psiinit,
81  psiminnuis, psimaxnuis,
82  self.psiissampled).get_particle()
83  self.psi_dictionary[value] = (
84  psi,
85  psitrans,
86  self.psiissampled)
87  self.rspsi.add_restraint(
89  self.m,
90  psi,
91  1000000000.0,
92  psimax,
93  psimin))
94  self.rspsi.add_restraint(IMP.isd.JeffreysRestraint(self.m, psi))
95 
96  def get_psi(self, value):
97  if not value in self.psi_dictionary:
98  self.create_psi(value)
99  return self.psi_dictionary[value]
Miscellaneous utilities.
Definition: tools.py:1
Uniform distribution with harmonic boundaries.
Definition: UniformPrior.h:20
Python classes to represent, score, sample and analyze models.