_cartesian_class_get_zmat.py 文件源码

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

项目:chemcoord 作者: mcocdawc 项目源码 文件源码
def _calculate_zmat_values(self, construction_table):
        c_table = construction_table
        if not isinstance(c_table, pd.DataFrame):
            if isinstance(c_table, pd.Series):
                c_table = pd.DataFrame(c_table).T
            else:
                c_table = np.array(c_table)
                if len(c_table.shape) == 1:
                    c_table = c_table[None, :]
                c_table = pd.DataFrame(
                    data=c_table[:, 1:], index=c_table[:, 0],
                    columns=['b', 'a', 'd'])
        c_table = c_table.replace(constants.int_label).astype('i8')
        c_table.index = c_table.index.astype('i8')

        new_index = c_table.index.append(self.index.difference(c_table.index))
        X = self.loc[new_index, ['x', 'y', 'z']].values.astype('f8').T
        c_table = c_table.replace(dict(zip(new_index, range(len(self)))))
        c_table = c_table.values.T

        err, C = transformation.get_C(X, c_table)
        if err == ERR_CODE_OK:
            C[[1, 2], :] = np.rad2deg(C[[1, 2], :])
            return C.T
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号