Ejemplo n.º 1
0
    def write_data_file(self):
        """Generate the data file and return the filename.
        """
        nrows = len(self.cpartition.chain)
        ncols = 1 + 3 * self.cpartition.num_tls_segments()
        tbl = table.StringTable(nrows, ncols, "?")

        mpred = lambda f: f.fragment_id
        frag_id_iter = itertools.imap(mpred, self.cpartition.chain.iter_fragments())
        tbl.set_column(0, 0, frag_id_iter)

        for itls, tls in enumerate(self.cpartition.iter_tls_segments()):
            tls_group = tls.tls_group
            tls_info = tls.model_tls_info
            O = tls_info["COR"]

            for frag in tls.iter_fragments():
                ## FIXME: This should be able to handle either one
                atm = frag.get_atom("CA")  ## for amino acids
                # atm = frag.get_atom("P") ## for nucleic acids
                if atm is None:
                    continue

                # if frag.get_atom("CA") is not None:
                #    atm = frag.get_atom("CA")
                #    console.stdoutln("CA_ATOM: %s" % str(atm))

                # elif frag.get_atom("P") is not None:
                #    atm = frag.get_atom("P")

                i = frag.ifrag

                for n, Lx_val, Lx_vec, Lx_rho, Lx_pitch in [
                    (0, "L1_eigen_val", "L1_eigen_vec", "L1_rho", "L1_pitch"),
                    (1, "L2_eigen_val", "L2_eigen_vec", "L2_rho", "L2_pitch"),
                    (2, "L3_eigen_val", "L3_eigen_vec", "L3_rho", "L3_pitch"),
                ]:

                    Lval = tls_info[Lx_val]
                    Lvec = tls_info[Lx_vec]
                    Lrho = tls_info[Lx_rho]
                    Lpitch = tls_info[Lx_pitch]

                    if numpy.allclose(Lval, 0.0):
                        continue

                    dvec = TLS.calc_LS_displacement(O, Lval, Lvec, Lrho, Lpitch, atm.position, conf.ADP_PROB)
                    tbl[i, 1 + 3 * itls + n] = AtomMath.length(dvec)

        flatfile_write(
            "LibrationAnalysis: data", "LIAN", "DATA", str(tbl), self.chain.chain_id, self.cpartition.num_tls_segments()
        )

        open(self.txt_path, "w").write(str(tbl))
Ejemplo n.º 2
0
    def write_data_file(self):
        """Generate the data file and return the filename.
        """
        nrows = len(self.cpartition.chain)
        ncols = 1 + 3 * self.cpartition.num_tls_segments()
        tbl = table.StringTable(nrows, ncols, "?")

        mpred = lambda f: f.fragment_id
        frag_id_iter = itertools.imap(mpred, self.cpartition.chain.iter_fragments())
        tbl.set_column(0, 0, frag_id_iter)

        for itls, tls in enumerate(self.cpartition.iter_tls_segments()):
            tls_group = tls.tls_group
            tls_info = tls.model_tls_info
            O = tls_info["COR"]

            for frag in tls.iter_fragments():
                atm = frag.get_atom("CA")
                if atm is None:
                    continue

                i = frag.ifrag

                for n, Lx_val, Lx_vec, Lx_rho, Lx_pitch in [
                    (0, "L1_eigen_val", "L1_eigen_vec", "L1_rho", "L1_pitch"),
                    (1, "L2_eigen_val", "L2_eigen_vec", "L2_rho", "L2_pitch"),
                    (2, "L3_eigen_val", "L3_eigen_vec", "L3_rho", "L3_pitch") ]:

                    Lval   = tls_info[Lx_val]
                    Lvec   = tls_info[Lx_vec]
                    Lrho   = tls_info[Lx_rho]
                    Lpitch = tls_info[Lx_pitch]

                    if numpy.allclose(Lval, 0.0):
                        continue

                    dvec = TLS.calc_LS_displacement(O, Lval, Lvec, Lrho, Lpitch, atm.position, settings.ADP_PROB)
                    tbl[i, 1 + 3*itls + n] = AtomMath.length(dvec)

        open(self.txt_path, "w").write(str(tbl))
Ejemplo n.º 3
0
def calc_directional_overlap(a, b):
    cos_ab = numpy.dot(a, b) / (AtomMath.length(a) * AtomMath.length(b))
    if cos_ab < 0.0:
        return 0.0
    return abs(cos_ab)
Ejemplo n.º 4
0
def calc_angle(a, b):
    cos_ab = numpy.dot(a, b)/ (AtomMath.length(a) * AtomMath.length(b))
    return Constants.RAD2DEG * abs(math.acos(cos_ab))