1 """@namespace IMP.pmi.restraints.basic
2 Some miscellaneous simple restraints.
5 from __future__
import print_function
13 class ExternalBarrier(object):
21 self.m = representation.prot.get_model()
34 resolution=resolution,
35 hierarchies=hierarchies)
38 self.rs.add_restraint(r3)
40 def set_label(self, label):
43 def add_to_model(self):
46 def get_restraint(self):
52 score = self.rs.unprotected_evaluate(
None)
53 output[
"_TotalScore"] = str(score)
54 output[
"ExternalBarrier_" + self.label] = str(score)
58 class DistanceRestraint(object):
69 self.m = representation.prot.get_model()
81 resolution=resolution,
82 name=tuple_selection1[2],
83 residue=tuple_selection1[0])
86 resolution=resolution,
87 name=tuple_selection2[2],
88 residue=tuple_selection2[0])
96 if len(particles1) > 1
or len(particles2) > 1:
97 raise ValueError(
"more than one particle selected")
99 self.rs.add_restraint(
103 self.rs.add_restraint(
108 def set_weight(self,weight):
110 self.rs.set_weight(weight)
112 def set_label(self, label):
115 def add_to_model(self):
118 def get_restraint(self):
121 def get_output(self):
124 score = self.weight * self.rs.unprotected_evaluate(
None)
125 output[
"_TotalScore"] = str(score)
126 output[
"DistanceRestraint_" + self.label] = str(score)
130 return self.weight * self.rs.unprotected_evaluate(
None)
137 a python restraint with bistable potential
138 Authors: G. Bouvier, R. Pellarin. Pasteur Institute.
143 def __init__(self,m,p1,p2,dist1,dist2,sigma1,sigma2,weight1,weight2):
145 input twp particles, the two equilibrium distances, their amplitudes, and their weights (populations)
147 IMP.Restraint.__init__(self, m,
"BiStableDistanceRestraint %1%")
157 if self.weight1+self.weight2 != 1:
158 raise ValueError(
"The sum of the weights must be one")
162 self.particle_list=[p1,p2]
164 def gaussian(self,x, mu, sig, w):
165 return w*self.np.exp(-self.np.power(x - mu, 2.) / (2 * self.np.power(sig, 2.)))
167 def unprotected_evaluate(self,da):
169 prob=self.gaussian(dist,self.dist1,self.sigma1,self.weight1)+\
170 self.gaussian(dist,self.dist2,self.sigma2,self.weight2)
171 return -self.math.log(prob)
174 return self.particle_list
Applies a SingletonScore to each Singleton in a list.
Lower bound harmonic function (non-zero when feature < mean)
Various classes to hold sets of particles.
Upper bound harmonic function (non-zero when feature > mean)
Distance restraint between two particles.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Object used to hold a set of restraints.
def __init__
input twp particles, the two equilibrium distances, their amplitudes, and their weights (populations)...
Store a list of ParticleIndexes.
Apply a function to the distance to a fixed point.
A decorator for a particle with x,y,z coordinates.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
Functionality for loading, creating, manipulating and scoring atomic structures.
a python restraint with bistable potential Authors: G.
virtual ModelObjectsTemp do_get_inputs() const =0
A restraint is a term in an IMP ScoringFunction.