reaction.py 文件源码

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

项目:crnpy 作者: etonello 项目源码 文件源码
def format_kinetics(self, rate = False, precision = 3):
        """Convert the kinetic parameter or rate to string.
        If rate = True, return a string representing the rate,
        otherwise one representing the kinetic parameter.
        If the kinetic parameter is a float, use exponent notation,
        with a number of digits equal to precision (3 is the default).
        If the reaction has no defined rate, return None."""
        k = None
        if self.rate:
            if isinstance(self.kinetic_param, sp.Float):
                k = "{:.{}e}".format(self.kinetic_param, precision)
                if rate:
                    k = k + "*" + str(self.reactant.ma())
            else:
                if rate:
                    k = str(self.rate)
                else:
                    k = str(self.kinetic_param)
        return k
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号