reaction.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:crnpy 作者: etonello 项目源码 文件源码
def latex(self, rate = False):
        """Return the latex code for the reaction.
        By default the kinetic parameter of the reaction is included.
        To use the rate instead, use rate = True.

        :Example:

        >>> from crnpy.reaction import Reaction
        >>> from crnpy.crncomplex import Complex
        >>> r = Reaction("r1", Complex(A = 1, B = 2), Complex(C = 1), "k1*A*B**2")
        >>> print(r.latex())
        r_{1}: A + 2 B \\xrightarrow{k_{1}} C
        >>> print(r.latex(True))
        r_{1}: A + 2 B \\xrightarrow{A B^{2} k_{1}} C

        :rtype: string.
        """
        return "{}: {} {} {}".format(sp.latex(self.reactionid),
                                     sp.latex(self.reactant.symp()),
                                     str("\\xrightarrow{" + sp.latex(self.rate if rate else self.kinetic_param) + "}") if self.rate else str("\\rightarrow"),
                                     sp.latex(self.product.symp()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号