1 """Restraints for handling distances between accessible volumes.
32 IMP.Restraint.__init__(self, m,
"BiStableDistanceRestraint %1%")
41 forster_radius = dist.forster_radius
42 distance_range = (1, 2.5 * forster_radius)
43 self.dc = IMP.bff.tools.FRETDistanceConverter(
44 forster_radius=forster_radius,
46 distance_range=distance_range
48 self.particle_list = [av1.get_particle(), av2.get_particle()]
50 def unprotected_evaluate(self, da):
54 r: IMP.algebra.Vector3D = \
57 d_mp = r.get_magnitude()
58 d_mod = self.dc(d_mp, d_exp.distance_type)
59 score = d_exp.score_model(d_mod)
62 def do_get_inputs(self):
63 return self.particle_list
66 class AVNetworkRestraintWrapper(IMP.pmi.restraints.RestraintBase):
69 def add_used_dyes_to_rb(used_avs: typing.List[
IMP.bff.AV]):
72 p_dye = dye.get_particle()
83 p_att = dye.get_source()
89 def add_xyz_mass_to_avs(self):
91 IMP_NEW(Particle,p2,(m,"p2"));
92 IMP::core::XYZR d2=IMP::core::XYZR::setup_particle(
93 m,p2->get_index(),IMP::algebra::Sphere3D(
94 IMP::algebra::Vector3D(1.0,4.0,6.0),1.0));
95 atom::Mass mm2 = atom::Mass::setup_particle(p2, 30.0);
98 for ak
in self.used_avs:
100 r_mean = max(av.get_radii())
103 av_d.set_radius(r_mean * 1.0)
106 av_m.set_mass(r_mean * 2.0)
108 """Restraint for Accessible Volume (AV) decorated particles
110 The AVs of the decorated particles are recomputed when the
111 score is evaluated. Computing an AV (searching for the points
112 that are accessible is computationally costly (expensive
121 mean_position_restraint: bool =
False,
122 sigma_DA: float = 6.0,
123 label: str =
"AVNetworkRestraint",
124 occupy_volume: bool =
True
132 :param mean_position_restraint:
135 :param occupy_volume:
141 super(AVNetworkRestraintWrapper, self).__init__(m, label=label, weight=weight)
147 self.mean_position_restraint = mean_position_restraint
148 if pathlib.Path(fps_json_fn).is_file():
156 raise FileNotFoundError(
"{}".format(fps_json_fn))
158 self.used_avs = dict([(v.get_name(), v)
for v
in self.av_network_restraint.get_used_avs()])
159 if not self.mean_position_restraint:
160 self.rs.add_restraint(self.av_network_restraint)
162 self.used_distances = self.av_network_restraint.get_used_distances()
163 self.add_used_dyes_to_rb(self.used_avs)
164 for dk
in self.used_distances:
165 d_exp = self.used_distances[dk]
166 av1 = self.used_avs[d_exp.position_1]
167 av2 = self.used_avs[d_exp.position_2]
168 r = AVMeanDistanceRestraint(m, av1, av2, d_exp, sigma=sigma_DA)
169 self.rs.add_restraint(r)
171 self.add_xyz_mass_to_avs()
172 self.set_weight(weight)
175 """Evaluate the score of the restraint."""
176 return self.rs.unprotected_evaluate(
None) * self.weight
178 def add_to_model(self, add_to_rmf=True):
180 add_to_rmf=add_to_rmf)
A decorator for a particle with accessible volume (AV).
Restraints for handling electron microscopy maps.
A member of a rigid body, it has internal (local) coordinates.
static bool get_is_setup(const IMP::ParticleAdaptor &p)
Various classes to hold sets of particles.
static XYZR setup_particle(Model *m, ParticleIndex pi)
Container for experimental distance measurement.
A restraint that uses an annotated volumetric network to score particle distances.
Object used to hold a set of restraints.
Class for storing model, its restraints, constraints, and particles.
Classes to handle different kinds of restraints.
The standard decorator for manipulating molecular structures.
static Mass setup_particle(Model *m, ParticleIndex pi, Float mass)
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...
A decorator for a rigid body.
Functionality for loading, creating, manipulating and scoring atomic structures.
Hierarchies get_leaves(const Selection &h)
Bayesian Fluorescence Framework.
Inferential scoring building on methods developed as part of the Inferential Structure Determination ...
A restraint is a term in an IMP ScoringFunction.