当前位置: 首页>>代码示例>>Python>>正文


Python Framework.update_UC_matrix方法代码示例

本文整理汇总了Python中framework.Framework.update_UC_matrix方法的典型用法代码示例。如果您正苦于以下问题:Python Framework.update_UC_matrix方法的具体用法?Python Framework.update_UC_matrix怎么用?Python Framework.update_UC_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在framework.Framework的用法示例。


在下文中一共展示了Framework.update_UC_matrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Assembly

# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import update_UC_matrix [as 别名]

#.........这里部分代码省略.........
            b = self.cxn_xyz[i]

            M = trans.affine_matrix_from_points(a, b, shear = False, scale = False, usesvd = True)

            alpha, beta, gamma = trans.euler_from_matrix(M)
            translations = M[0:3,3]
            conn_start_ind = 1 + len(self.rods) + i*6
            self.opt_vec[conn_start_ind+0] = alpha  
            self.opt_vec[conn_start_ind+1] = beta 
            self.opt_vec[conn_start_ind+2] = gamma 
            self.opt_vec[conn_start_ind+3] = translations[0] 
            self.opt_vec[conn_start_ind+4] = translations[1]
            self.opt_vec[conn_start_ind+5] = translations[2]
            print(M)
            


    def construct_curr_UC(self, xuse):
        """
        Creates the current representation of the unit cell so that we can
        evaluate how well the components are embedded in 3 space

        NOTE: we may have to break this optimization into several pieces:
            (1) determine embedding by fitting one molecule
            (2) only optimize the remaining molecule orientations/translations with the fixed
                embedding variables (F, {dCs})
        """

        # Steps to reconstruct unit cell
        # 1: stasrt with opt_vec[0] (F) and opt_vec[1:n_rods] (set of dCs)
        # 2: recompute cxn points based on F and dCs

        # recompute UC matrix transformation based on current scale factor
        to_cartesian = self.frame.update_UC_matrix(xuse[0], self.twod_direct)
        to_fractional = np.linalg.inv(to_cartesian)

        # get the current oriented and translated ligands
        oriented = self.orient_cxn_and_translate(xuse)


        # get final connection pt coords on molecule
        for i in range(len(oriented)):
            oriented[i][0:3,:] = np.dot(to_fractional, oriented[i][0:3,:])
            oriented[i][0:3,:] = self.frame.modGroupUC(oriented[i][0:3,:])
            oriented[i][0:3,:] = np.dot(to_cartesian, oriented[i][0:3,:])


        final_xyz = []
        #new_abc = np.copy(self.cxn_ref_abc)
        #print(new_abc)
        #print(np.shape(new_abc))
        #print(self.cxn_ref_abc)
        #print(np.shape(self.cxn_ref_abc))

        # get final connection pt coords on rod
        for i in range(len(self.cxns)):
            this_new_abc = np.copy(self.cxn_ref_abc[i])

            conn_start_ind = 1 + len(self.rods) + i*6 + i*len(self.cxns[i])

            for j in range(len(self.cxns[i])):

                # shift ref pt based on curr val of rod shift
                # print(xuse[1 + self.connect_to_rod[i][j]])
                this_new_abc[self.oned_direct,j] += xuse[1 + self.connect_to_rod[i][j]]
开发者ID:mwitman1,项目名称:onedMOF,代码行数:69,代码来源:mainv2.py


注:本文中的framework.Framework.update_UC_matrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。