1 """@namespace IMP.pmi.restraints.stereochemistry
2 Restraints for keeping correct stereochemistry.
5 from __future__
import print_function
14 from operator
import itemgetter
15 from math
import pi,log,sqrt
21 """ This class creates a restraint between consecutive TempResidue objects OR an entire
22 PMI MOlecule object. """
27 disorderedlength=
False,
32 @param objects - a list of hierarchies, PMI TempResidues OR a single Molecule
33 @param scale Scale the maximal distance between the beads by this factor when disorderedlength is False.
34 The maximal distance is calculated as ((float(residuegap) + 1.0) * 3.6) * scale.
35 @param disorderedlength - This flag uses either disordered length
36 calculated for random coil peptides (True) or zero
37 surface-to-surface distance between beads (False)
38 as optimal distance for the sequence connectivity
40 @param upperharmonic - This flag uses either harmonic (False)
41 or upperharmonic (True) in the intra-pair
42 connectivity restraint.
43 @param resolution - The resolution to connect things at - only used if you pass PMI objects
44 @param label - A string to identify this restraint in the output/stat file
51 raise Exception(
"ConnectivityRestraint: only pass stuff from one Molecule, please")
55 self.m = list(hiers)[0].get_model()
71 SortedSegments.append((start, end, startres))
72 SortedSegments = sorted(SortedSegments, key=itemgetter(2))
75 self.particle_pairs=[]
76 for x
in range(len(SortedSegments) - 1):
78 last = SortedSegments[x][1]
79 first = SortedSegments[x + 1][0]
81 apply_restraint =
True
95 apply_restraint =
False
104 residuegap = firstresn - lastresn - 1
105 if disorderedlength
and (nreslast / 2 + nresfirst / 2 + residuegap) > 20.0:
108 optdist = sqrt(5 / 3) * 1.93 * \
109 (nreslast / 2 + nresfirst / 2 + residuegap) ** 0.6
117 optdist = (0.0 + (float(residuegap) + 1.0) * 3.6) * scale
124 pt0 = last.get_particle()
125 pt1 = first.get_particle()
126 self.particle_pairs.append((pt0,pt1))
129 print(
"Adding sequence connectivity restraint between", pt0.get_name(),
" and ", pt1.get_name(),
'of distance', optdist)
130 self.rs.add_restraint(r)
132 def set_label(self, label):
135 def get_weight(self):
138 def add_to_model(self):
141 def get_restraint(self):
144 def set_weight(self, weight):
146 self.rs.set_weight(weight)
148 def get_output(self):
150 score = self.weight * self.rs.unprotected_evaluate(
None)
151 output[
"_TotalScore"] = str(score)
152 output[
"ConnectivityRestraint_" + self.label] = str(score)
156 """ Returns number of connectivity restraints """
157 return len(self.rs.get_restraints())
160 """ Returns the list of connected particles pairs """
161 return self.particle_pairs
164 return self.weight * self.rs.unprotected_evaluate(
None)
167 """A class to create an excluded volume restraint for a set of particles at a given resolution.
168 Can be initialized as a bipartite restraint between two sets of particles.
169 # Potential additional function: Variable resolution for each PMI object. Perhaps passing selection_tuples
170 with (PMI_object, resolution)
179 @param included_objects Can be one of the following inputs:
180 IMP Hierarchy, PMI System/State/Molecule/TempResidue, or a list/set of them
181 @param other_objects Initializes a bipartite restraint between included_objects and other_objects
182 Same format as included_objects
183 @param resolution The resolution particles at which to impose the restraint.
184 By default, the coarsest particles will be chosen.
185 If a number is chosen, for each particle, the closest
186 resolution will be used (see IMP.atom.Selection).
187 @param kappa Restraint strength
201 if other_objects
is not None:
209 if hierarchies
is None:
210 raise Exception(
"Must at least pass included objects")
211 self.mdl = hierarchies[0].get_model()
212 included_ps = [h.get_particle()
for h
in hierarchies]
214 other_ps = [h.get_particle()
for h
in other_hierarchies]
237 self.rs.add_restraint(evr)
239 def add_excluded_particle_pairs(self, excluded_particle_pairs):
241 inverted=[(p1,p0)
for p0,p1
in excluded_particle_pairs]
246 self.cpc.add_pair_filter(icpf)
248 def set_label(self, label):
251 def add_to_model(self):
254 def get_restraint(self):
257 def set_weight(self, weight):
259 self.rs.set_weight(weight)
261 def get_output(self):
263 score = self.weight * self.rs.unprotected_evaluate(
None)
264 output[
"_TotalScore"] = str(score)
265 output[
"ExcludedVolumeSphere_" + self.label] = str(score)
269 return self.weight * self.rs.unprotected_evaluate(
None)
272 """Enforce ideal Helix dihedrals and bonds for a selection at resolution 0"""
279 @param hierarchy the root node
280 @param selection_tuple (start, stop, molname, copynum=0)
283 self.mdl = hierarchy.get_model()
287 start = selection_tuple[0]
288 stop = selection_tuple[1]
289 mol = selection_tuple[2]
291 if len(selection_tuple)>3:
292 copy_index = selection_tuple[3]
295 residue_indexes=range(start,stop+1))
296 ps = sel.get_selected_particles(with_representation=
False)
300 self.rs.add_restraint(self.r)
301 print(
'Created helix %s.%i.%i-%i with %i dihedrals and %i bonds'%(
302 mol,copy_index,start,stop,
303 self.get_number_of_bonds(),self.get_number_of_dihedrals()))
304 def set_label(self, label):
307 def get_weight(self):
310 def add_to_model(self):
313 def get_restraint(self):
316 def set_weight(self, weight):
318 self.rs.set_weight(weight)
320 def get_number_of_bonds(self):
321 return self.r.get_number_of_bonds()
323 def get_number_of_dihedrals(self):
324 return self.r.get_number_of_dihedrals()
327 return self.weight * self.rs.unprotected_evaluate(
None)
329 def get_output(self):
331 score = self.evaluate()
332 output[
"_TotalScore"] = str(score)
333 output[
"HelixRestraint_" + self.label] = str(score)
337 """ Add bond restraint between pair of consecutive
338 residues/beads to enforce the stereochemistry.
340 def __init__(self, objects, distance=3.78, strength=10.0, jitter=None):
342 @param objects Objects to restrain
343 @param distance Resting distance for restraint
344 @param strength Bond constant
345 @param jitter Defines the +- added to the optimal distance in the harmonic well restraint
346 used to increase the tolerance
350 self.m = particles[0].get_model()
363 (distance - jitter, distance + jitter), strength)
368 raise ValueError(
"wrong length of pair")
371 raise TypeError(
"%s is not a residue" % p)
374 print(
"ResidueBondRestraint: adding a restraint between %s %s" % (pair[0].get_name(), pair[1].get_name()))
375 self.rs.add_restraint(
380 def set_label(self, label):
382 self.rs.set_name(label)
383 for r
in self.rs.get_restraints():
386 def add_to_model(self):
389 def get_restraint(self):
392 def set_weight(self, weight):
394 self.rs.set_weight(weight)
396 def get_excluded_pairs(self):
397 return self.pairslist
399 def get_output(self):
401 score = self.weight * self.rs.unprotected_evaluate(
None)
402 output[
"_TotalScore"] = str(score)
403 output[
"ResidueBondRestraint_" + self.label] = str(score)
408 """Add angular restraint between triplets of consecutive
409 residues/beads to enforce the stereochemistry.
411 def __init__(self, objects, anglemin=100.0, anglemax=140.0, strength=10.0):
414 self.m = particles[0].get_model()
422 (pi * anglemin / 180.0,
423 pi * anglemax / 180.0),
429 raise ValueError(
"wrong length of triplet")
432 raise TypeError(
"%s is not a residue" % p)
435 print(
"ResidueAngleRestraint: adding a restraint between %s %s %s" % (triplet[0].get_name(), triplet[1].get_name(), triplet[2].get_name()))
436 self.rs.add_restraint(
444 def set_label(self, label):
446 self.rs.set_name(label)
447 for r
in self.rs.get_restraints():
450 def add_to_model(self):
453 def get_restraint(self):
456 def set_weight(self, weight):
458 self.rs.set_weight(weight)
460 def get_excluded_pairs(self):
461 return self.pairslist
463 def get_output(self):
465 score = self.weight * self.rs.unprotected_evaluate(
None)
466 output[
"_TotalScore"] = str(score)
467 output[
"ResidueAngleRestraint_" + self.label] = str(score)
472 """Add dihedral restraints between quadruplet of consecutive
473 residues/beads to enforce the stereochemistry.
474 Give as input a string of "C" and "T", meaning cys (0+-40) or trans (180+-40)
475 dihedral. The length of the string must be \#residue-3.
476 Without the string, the dihedral will be assumed trans.
478 def __init__(self, objects, stringsequence=None, strength=10.0):
481 self.m = particles[0].get_model()
488 if stringsequence
is None:
489 stringsequence =
"T" * (len(particles) - 3)
494 raise ValueError(
"wrong length of quadruplet")
497 raise TypeError(
"%s is not a residue" % p)
500 dihedraltype = stringsequence[n]
501 if dihedraltype ==
"C":
505 (pi * anglemin / 180.0,
506 pi * anglemax / 180.0),
508 print(
"ResidueDihedralRestraint: adding a CYS restraint between %s %s %s %s" % (quadruplet[0].get_name(), quadruplet[1].get_name(),
509 quadruplet[2].get_name(), quadruplet[3].get_name()))
510 if dihedraltype ==
"T":
511 anglemin = 180 - 70.0
512 anglemax = 180 + 70.0
514 (pi * anglemin / 180.0,
515 pi * anglemax / 180.0),
517 print(
"ResidueDihedralRestraint: adding a TRANS restraint between %s %s %s %s" % (quadruplet[0].get_name(), quadruplet[1].get_name(),
518 quadruplet[2].get_name(), quadruplet[3].get_name()))
519 self.rs.add_restraint(
525 self.pairslist.append(
527 self.pairslist.append(
530 def set_label(self, label):
532 self.rs.set_name(label)
533 for r
in self.rs.get_restraints():
536 def add_to_model(self):
539 def get_restraint(self):
542 def set_weight(self, weight):
544 self.rs.set_weight(weight)
546 def get_excluded_pairs(self):
547 return self.pairslist
549 def get_output(self):
551 score = self.weight * self.rs.unprotected_evaluate(
None)
552 output[
"_TotalScore"] = str(score)
553 output[
"ResidueDihedralRestraint_" + self.label] = str(score)
557 """Experimental, requires isd_emxl for now"""
567 raise ValueError(
"IMP.isd_emxl is needed")
572 self.particles = IMP.pmi.tools.select_by_tuple(
576 self.m = representation.prot.get_model()
580 self.anglfilename = IMP.isd_emxl.get_data_path(
"CAAngleRestraint.dat")
581 self.dihefilename = IMP.isd_emxl.get_data_path(
582 "CADihedralRestraint.dat")
583 self.nativeness = nativeness
584 self.kt_caff = kt_caff
590 if len(self.particles) != len(ssstring):
591 print(len(self.particles), len(ssstring))
592 print(
"SecondaryStructure: residue range and SS string incompatible")
593 self.ssstring = ssstring
595 (bondrslist, anglrslist, diherslist,
596 pairslist) = self.get_CA_force_field()
597 self.pairslist = pairslist
600 self.anglrs.add_restraints(anglrslist)
601 self.dihers.add_restraints(diherslist)
602 self.bondrs.add_restraints(bondrslist)
604 def set_label(self, label):
607 def add_to_model(self):
612 def get_CA_force_field(self):
618 for res
in range(0, len(self.particles) - 1):
620 ps = self.particles[res:res + 2]
623 br = self.get_distance_restraint(ps[0], ps[1], 3.78, 416.0)
624 br.set_name(
'Bond_restraint')
625 bondrslist.append(br)
627 for res
in range(0, len(self.particles) - 4):
632 ps = self.particles[res:res + 5]
635 score_dih] = self.read_potential_dihedral(
636 self.ssstring[res:res + 4],
642 dr = IMP.isd_emxl.CADihedralRestraint(
651 dr.set_name(
'Dihedral restraint')
652 diherslist.append(dr)
654 for res
in range(0, len(self.particles) - 2):
655 ps = self.particles[res:res + 3]
656 [psi, score_ang] = self.read_potential_angle(
657 self.ssstring[res:res + 2],
True)
660 dr = IMP.isd_emxl.CAAngleRestraint(
666 dr.set_name(
'Angle restraint')
667 anglrslist.append(dr)
668 return (bondrslist, anglrslist, diherslist, pairslist)
670 def read_potential_dihedral(self, string, mix=False):
675 for i
in range(0, 36):
676 phi0.append(i * 10.0 / 180.0 * pi)
677 phi1.append(i * 10.0 / 180.0 * pi)
678 for j
in range(0, 36):
679 score_dih.append(0.0)
682 f = open(self.dihefilename,
'r')
683 for line
in f.readlines():
684 riga = (line.strip()).split()
685 if (len(riga) == 4
and riga[0] == string):
686 ii = int(float(riga[1]) / 10.0)
687 jj = int(float(riga[2]) / 10.0)
688 score_dih[ii * len(phi0) + jj] = - \
689 self.kt_caff * self.log(float(riga[3]))
694 for i
in range(0, 36):
695 for j
in range(0, 36):
697 f = open(self.dihefilename,
'r')
698 for line
in f.readlines():
699 riga = (line.strip()).split()
700 if (len(riga) == 4
and riga[0] == string):
701 ii = int(float(riga[1]) / 10.0)
702 jj = int(float(riga[2]) / 10.0)
703 counts[ii * len(phi0) + jj] += self.nativeness * \
705 if (len(riga) == 4
and riga[0] ==
"-----"):
706 ii = int(float(riga[1]) / 10.0)
707 jj = int(float(riga[2]) / 10.0)
708 counts[ii * len(phi0) + jj] += (1.0 - self.nativeness) * \
711 for i
in range(len(counts)):
712 score_dih[i] = -self.kt_caff * self.log(counts[i])
713 return [phi0, phi1, score_dih]
715 def read_potential_angle(self, string, mix=False):
719 for i
in range(0, 180):
720 psi.append(i / 180.0 * pi)
721 score_ang.append(0.0)
724 f = open(self.anglfilename,
'r')
725 for line
in f.readlines():
726 riga = (line.strip()).split()
727 if (len(riga) == 3
and riga[0] == string):
729 score_ang[ii] = -self.kt_caff * self.log(float(riga[2]))
734 for i
in range(0, 180):
737 f = open(self.anglfilename,
'r')
738 for line
in f.readlines():
739 riga = (line.strip()).split()
740 if (len(riga) == 3
and riga[0] == string):
742 counts[ii] += self.nativeness * float(riga[2])
743 if (len(riga) == 3
and riga[0] ==
"---"):
745 counts[ii] += (1.0 - self.nativeness) * float(riga[2])
747 for i
in range(0, 180):
748 score_ang[i] = -self.kt_caff * self.log(counts[i])
749 return [psi, score_ang]
751 def get_excluded_pairs(self):
752 return self.pairslist
754 def get_restraint(self):
756 tmprs.add_restraint(self.anglrs)
757 tmprs.add_restraint(self.dihers)
758 tmprs.add_restraint(self.bondrs)
761 def get_distance_restraint(self, p0, p1, d0, kappa):
767 def get_output(self):
769 score_angle = self.anglrs.unprotected_evaluate(
None)
770 score_dihers = self.dihers.unprotected_evaluate(
None)
771 score_bondrs = self.bondrs.unprotected_evaluate(
None)
772 output[
"_TotalScore"] = str(score_angle + score_dihers + score_bondrs)
774 output[
"SecondaryStructure_Angles_" + self.label] = str(score_angle)
775 output[
"SecondaryStructure_Dihedrals_" +
776 self.label] = str(score_dihers)
777 output[
"SecondaryStructure_Bonds_" + self.label] = str(score_bondrs)
782 """Add harmonic restraints between all pairs
784 def __init__(self, hierarchy, selection_tuples=None, resolution=1,
785 strength=0.01, dist_cutoff=10.0, ca_only=
True):
787 @param hierarchy Root hierarchy to select from
788 @param selection_tuples Selecting regions for the restraint [[start,stop,molname,copy_index=0],...]
789 @param resolution Resolution for applying restraint
790 @param strength Bond strength
791 @param dist_cutoff Cutoff for making restraints
792 @param ca_only Selects only CAlphas. Only matters if resolution=0.
796 self.m = hierarchy.get_model()
797 for st
in selection_tuples:
803 hierarchy, molecule=st[2],
804 residue_indexes=range(st[0],st[1]+1),
805 copy_index=copy_index)
808 hierarchy, molecule=st[2],
809 residue_indexes=range(st[0],st[1]+1),
810 copy_index=copy_index,
812 particles+=sel.get_selected_particles()
820 for r
in self.rs.get_restraints():
821 a1,a2 = r.get_inputs()
824 print(
'ElasticNetwork: created',self.rs.get_number_of_restraints(),
'restraints')
826 def set_label(self, label):
828 self.rs.set_name(label)
829 for r
in self.rs.get_restraints():
832 def add_to_model(self):
835 def get_restraint(self):
838 def set_weight(self, weight):
840 self.rs.set_weight(weight)
842 def get_excluded_pairs(self):
843 return self.pairslist
845 def get_output(self):
847 score = self.weight * self.rs.unprotected_evaluate(
None)
848 output[
"_TotalScore"] = str(score)
849 output[
"ElasticNetworkRestraint_" + self.label] = str(score)
854 """ Enable CHARMM force field """
860 enable_nonbonded=
True,
862 zone_nonbonded=
False):
863 """Setup the CHARMM restraint on a selection. Expecting atoms.
864 @param root The node at which to apply the restraint
865 @param ff_temp The temperature of the force field
866 @param zone_ps Create a zone around this set of particles
867 Automatically includes the entire residue (incl. backbone)
868 @param zone_size The size for looking for neighbor residues
869 @param enable_nonbonded Allow the repulsive restraint
870 @param enable_bonded Allow the bonded restraint
871 @param zone_nonbonded EXPERIMENTAL: exclude from nonbonded all sidechains that aren't in zone!
874 kB = (1.381 * 6.02214) / 4184.0
876 self.mdl = root.get_model()
878 self.nonbonded_rs =
IMP.RestraintSet(self.mdl, 1.0 / (kB * ff_temp),
'NONBONDED')
885 topology = ff.create_topology(root)
886 topology.apply_default_patches()
887 topology.setup_hierarchy(root)
888 if zone_ps
is not None:
889 limit_to_ps=IMP.pmi.topology.get_particles_within_zone(
893 entire_residues=
True,
894 exclude_backbone=
False)
898 self.ps = limit_to_ps
902 print(
'init bonds score',r.unprotected_evaluate(
None))
903 self.bonds_rs.add_restraint(r)
905 ff.add_well_depths(root)
907 atoms = IMP.atom.get_by_type(root,IMP.atom.ATOM_TYPE)
910 if (zone_ps
is not None)
and zone_nonbonded:
911 print(
'stereochemistry: zone_nonbonded is True')
913 backbone_types=[
'C',
'N',
'CB',
'O']
915 for n
in backbone_types])
916 backbone_atoms = sel.get_selected_particles()
918 sel_ps=IMP.pmi.topology.get_particles_within_zone(
922 entire_residues=
True,
923 exclude_backbone=
True)
933 self.nbl.add_pair_filter(r.get_full_pair_filter())
936 self.nonbonded_rs.add_restraint(pr)
937 print(
'CHARMM is set up')
939 def set_label(self, label):
941 self.rs.set_name(label)
942 for r
in self.rs.get_restraints():
945 def add_to_model(self):
949 def get_restraint(self):
952 def get_close_pair_container(self):
955 def set_weight(self, weight):
957 self.rs.set_weight(weight)
959 def get_output(self):
961 bonds_score = self.weight * self.bonds_rs.unprotected_evaluate(
None)
962 nonbonded_score = self.weight * self.nonbonded_rs.unprotected_evaluate(
None)
963 score=bonds_score+nonbonded_score
964 output[
"_TotalScore"] = str(score)
965 output[
"CHARMM_BONDS"] = str(bonds_score)
966 output[
"CHARMM_NONBONDED"] = str(nonbonded_score)
971 """Add bonds and improper dihedral restraints for the CBs
974 self, rnums, representation, selection_tuple, strength=10.0, kappa=1.0,
975 jitter_angle=0.0, jitter_improper=0.0):
979 ca-cb is a constraint, no restraint needed
984 self.m = representation.prot.get_model()
994 ca, cb = self.get_ca_cb(
995 IMP.pmi.tools.select_by_tuple(representation,
996 (rnum, rnum,
'chainA'), resolution=0))
1000 ca_prev, cb_prev = self.get_ca_cb(
1001 IMP.pmi.tools.select_by_tuple(representation,
1002 (rnum - 1, rnum - 1,
'chainA'), resolution=0))
1003 ca_next, cb_next = self.get_ca_cb(
1004 IMP.pmi.tools.select_by_tuple(representation,
1005 (rnum + 1, rnum + 1,
'chainA'), resolution=0))
1039 self.rset_angles.add_restraint(ar13u)
1040 self.rset_angles.add_restraint(ar13l)
1046 self.rset_angles.add_restraint(ar23u)
1047 self.rset_angles.add_restraint(ar23l)
1048 if not nter
and not cter:
1072 self.rset_angles.add_restraint(idru)
1073 self.rset_angles.add_restraint(idrl)
1074 self.rs.add_restraint(self.rset_bonds)
1075 self.rs.add_restraint(self.rset_angles)
1077 def get_ca_cb(self, atoms):
1082 ca = a.get_particle()
1084 cb = a.get_particle()
1087 def set_label(self, label):
1089 self.rs.set_name(label)
1090 for r
in self.rs.get_restraints():
1093 def add_to_model(self):
1096 def get_restraint(self):
1099 def set_weight(self, weight):
1100 self.weight = weight
1101 self.rs.set_weight(weight)
1103 def get_excluded_pairs(self):
1104 return self.pairslist
1106 def get_output(self):
1108 score = self.weight * self.rs.unprotected_evaluate(
None)
1109 output[
"_TotalScore"] = str(score)
1110 output[
"PseudoAtomicRestraint_" + self.label] = str(score)
1114 """Create harmonic restraints between the reference and (transformed) clones.
1115 @note Wraps IMP::core::TransformedDistancePairScore with an IMP::core::Harmonic
1125 @param references Can be one of the following inputs:
1126 IMP Hierarchy, PMI System/State/Molecule/TempResidue, or a list/set of them
1127 @param clones_list List of lists of the above
1128 @param transforms Transforms moving each selection to the first selection
1129 @param label Label for output
1130 @param strength The elastic bond strength
1131 @param ca_only Optionally select so only CAlpha particles are used
1135 self.mdl = refs[0].get_model()
1139 if len(clones_list)!=len(transforms):
1140 raise Exception(
'Error: There should be as many clones as transforms')
1143 for tmp_clones,trans
in zip(clones_list,transforms):
1145 if len(clones)!=len(refs):
1146 raise Exception(
"Error: len(references)!=len(clones)")
1148 for p0,p1
in zip(refs,clones):
1152 p1.get_particle_index()])
1153 self.rs.add_restraint(r)
1154 print(
'created symmetry network with',self.rs.get_number_of_restraints(),
'restraints')
1156 def set_label(self, label):
1158 self.rs.set_name(label)
1159 for r
in self.rs.get_restraints():
1162 def add_to_model(self):
1165 def get_restraint(self):
1168 def set_weight(self, weight):
1169 self.weight = weight
1170 self.rs.set_weight(weight)
1172 def get_excluded_pairs(self):
1173 return self.pairslist
1175 def get_output(self):
1177 score = self.weight * self.rs.unprotected_evaluate(
None)
1178 output[
"SymmetryRestraint_" + self.label] = str(score)
1179 output[
"_TotalScore"] = str(score)
1184 """ This class creates a restraint between the termini two polypeptides, to simulate the sequence connectivity. """
1189 disorderedlength=
False,
1194 @param nterminal - single PMI2 Hierarchy/molecule at the nterminal
1195 @param cterminal - single PMI2 Hierarchy/molecule at the cterminal
1196 @param scale Scale the maximal distance between the beads by this factor when disorderedlength is False.
1197 The maximal distance is calculated as ((float(residuegap) + 1.0) * 3.6) * scale.
1198 @param disorderedlength - This flag uses either disordered length
1199 calculated for random coil peptides (True) or zero
1200 surface-to-surface distance between beads (False)
1201 as optimal distance for the sequence connectivity
1203 @param upperharmonic - This flag uses either harmonic (False)
1204 or upperharmonic (True) in the intra-pair
1205 connectivity restraint.
1206 @param resolution - The resolution to connect things at - only used if you pass PMI objects
1207 @param label - A string to identify this restraint in the output/stat file
1213 nter_lastres=ssn[-1][1]
1214 cter_firstres=ssc[0][0]
1215 self.m = nter_lastres.get_model()
1219 optdist = (3.6) * scale
1226 pt0 = nter_lastres.get_particle()
1227 pt1 = cter_firstres.get_particle()
1230 print(
"Adding fusion connectivity restraint between", pt0.get_name(),
" and ", pt1.get_name(),
'of distance', optdist)
1231 self.rs.add_restraint(r)
1233 def set_label(self, label):
1236 def get_weight(self):
1239 def add_to_model(self):
1242 def get_restraint(self):
1245 def set_weight(self, weight):
1246 self.weight = weight
1247 self.rs.set_weight(weight)
1249 def get_output(self):
1251 score = self.weight * self.rs.unprotected_evaluate(
None)
1252 output[
"_TotalScore"] = str(score)
1253 output[
"FusionRestraint_" + self.label] = str(score)
1257 return self.weight * self.rs.unprotected_evaluate(
None)
1264 """Restrain the dihedral between planes defined by three particles.
1266 This restraint is useful for restraining the twist of a string of
1267 more or less identical rigid bodies, so long as the curvature is mild.
1270 def __init__(self, particle_triplets, angle=0., k=1., label=None,
1273 @param particle_triplets List of lists of 3 particles. Each triplet
1274 defines a plane. Dihedrals of adjacent planes
1276 @param angle Angle of plane dihedral in degrees
1277 @param k Strength of restraint
1278 @param label Label for output
1279 @param weight Weight of restraint
1280 @note Particles defining planes should be rigid and more or less
1281 parallel for proper behavior
1283 model = particle_triplets[0][0].get_model()
1284 super(PlaneDihedralRestraint, self).
__init__(model, label=label,
1287 angle = pi * angle / 180.
1289 for i, t1
in enumerate(particle_triplets[:-1]):
1290 t2 = particle_triplets[i + 1]
1291 q1 = [t1[1], t1[0], t2[0], t2[1]]
1292 q2 = [t1[2], t1[0], t2[0], t2[2]]
1293 self.rs.add_restraint(
1295 self.rs.add_restraint(
A filter which returns true if a container containers the Pair.
Add dihedral restraints between quadruplet of consecutive residues/beads to enforce the stereochemist...
CHARMMParameters * get_heavy_atom_CHARMM_parameters()
Lower bound harmonic function (non-zero when feature < mean)
static bool get_is_setup(const IMP::ParticleAdaptor &p)
Enforce CHARMM stereochemistry on the given Hierarchy.
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.
Upper bound harmonic function (non-zero when feature > mean)
Enable CHARMM force field.
A class to store an fixed array of same-typed values.
Enforce ideal Helix dihedrals and bonds for a selection at resolution 0.
This class creates a restraint between the termini two polypeptides, to simulate the sequence connect...
Add harmonic restraints between all pairs.
Restrain the dihedral between planes defined by three particles.
Dihedral restraint between four particles.
A score on the distance between the surfaces of two spheres.
Return all close unordered pairs of particles taken from the SingletonContainer.
static bool get_is_setup(const IMP::ParticleAdaptor &p)
Return all spatially-proximals pairs of particles (a,b) from the two SingletonContainers A and B...
GenericHierarchies get_leaves(Hierarchy mhd)
Get all the leaves of the bit of hierarchy.
Distance restraint between two particles.
Object used to hold a set of restraints.
Store a list of ParticleIndexPairs.
A well with harmonic barriers.
Angle restraint between three particles.
ParticleIndexPairs get_indexes(const ParticlePairsTemp &ps)
Add bond restraint between pair of consecutive residues/beads to enforce the stereochemistry.
The standard decorator for manipulating molecular structures.
RestraintSet * create_elastic_network(const Particles &ps, Float dist_cutoff, Float strength)
Create an elastic network restraint set.
Add bonds and improper dihedral restraints for the CBs.
Store a list of ParticleIndexes.
A decorator for a particle representing an atom.
def get_particle_pairs
Returns the list of connected particles pairs.
def __init__
Setup the CHARMM restraint on a selection.
Create harmonic restraints between the reference and (transformed) clones.
Add angular restraint between triplets of consecutive residues/beads to enforce the stereochemistry...
def get_num_restraints
Returns number of connectivity restraints.
A decorator for a residue.
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...
This class creates a restraint between consecutive TempResidue objects OR an entire PMI MOlecule obje...
A class to create an excluded volume restraint for a set of particles at a given resolution.
The general base class for IMP exceptions.
def __init__
need to add: ca-ca bond ca-cb is a constraint, no restraint needed ca-ca-ca cb-ca-ca-cb ...
Applies a PairScore to a Pair.
Experimental, requires isd_emxl for now.
Functionality for loading, creating, manipulating and scoring atomic structures.
Select hierarchy particles identified by the biological name.
Applies a PairScore to each Pair in a list.
A repulsive potential on the distance between two atoms.
Perform more efficient close pair finding when rigid bodies are involved.
Inferential scoring building on methods developed as part of the Inferential Structure Determination ...
Harmonic function (symmetric about the mean)
Restraint a set of residues to use ideal helix dihedrals and bonds.