def fit_to_chain(self, chain): """Re-sets all derived information in the TLSSegment. """ ## cut segment from chain using segment ranges segments = [] for frag_id1, frag_id2 in self.segment_ranges: segments.append(chain[frag_id1:frag_id2]) self.segments = segments ## put all atoms in the segment into a new TLSGroup instance tls_group = TLS.TLSGroup() for segment in self.segments: for atm in segment.iter_all_atoms(): if atm.include is True: tls_group.append(atm) self.tls_group = tls_group if len(self.tls_group) != self.num_atoms(): console.stderrln( "fit_to_chain: EEK! (%s) len(self.tls_group)=%d != self.num_atoms()=%d" % ( self, len(self.tls_group), self.num_atoms())) raise SystemExit ## fit the TLS group parameters try: self.fit_tls_parameters(chain) except: print console.formatExceptionInfo() ## helpful additions tls_info = self.tls_group.calc_tls_info() itls_info = TLS.calc_itls_center_of_reaction( self.tls_group.itls_T, self.tls_group.itls_L, self.tls_group.itls_S, self.tls_group.origin) self.tls_info = tls_info self.itls_info = itls_info if conf.globalconf.tls_model in ["ISOT", "NLISOT"]: self.tls_group.model = "ISOT" self.model_tls_info = itls_info elif conf.globalconf.tls_model in ["ANISO", "NLANISO"]: self.tls_group.model = "ANISO" self.model_tls_info = tls_info try: self.rmsd_b = tls_calcs.calc_rmsd_tls_biso(self.tls_group) except: print console.formatExceptionInfo()
def fit_to_chain(self, chain): """Re-sets all derived information in the TLSSegment. """ ## cut segment from chain using segment ranges segments = [] for frag_id1, frag_id2 in self.segment_ranges: segments.append(chain[frag_id1:frag_id2]) self.segments = segments ## put all atoms in the segment into a new TLSGroup instance tls_group = TLS.TLSGroup() for segment in self.segments: for atm in segment.iter_all_atoms(): if atm.include is True: tls_group.append(atm) self.tls_group = tls_group if len(self.tls_group) != self.num_atoms(): console.stderrln( "fit_to_chain: EEK! (%s) len(self.tls_group)=%d != self.num_atoms()=%d" % (self, len(self.tls_group), self.num_atoms())) raise SystemExit ## fit the TLS group parameters try: self.fit_tls_parameters(chain) except: print console.formatExceptionInfo() ## helpful additions tls_info = self.tls_group.calc_tls_info() itls_info = TLS.calc_itls_center_of_reaction(self.tls_group.itls_T, self.tls_group.itls_L, self.tls_group.itls_S, self.tls_group.origin) self.tls_info = tls_info self.itls_info = itls_info if conf.globalconf.tls_model in ["ISOT", "NLISOT"]: self.tls_group.model = "ISOT" self.model_tls_info = itls_info elif conf.globalconf.tls_model in ["ANISO", "NLANISO"]: self.tls_group.model = "ANISO" self.model_tls_info = tls_info try: self.rmsd_b = tls_calcs.calc_rmsd_tls_biso(self.tls_group) except: print console.formatExceptionInfo()