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


Python Framework.reconstruct_cif方法代码示例

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


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

示例1: Assembly

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

#.........这里部分代码省略.........
        to_fractional = np.linalg.inv(to_cartesian)
        

        # get the current oriented and translated ligands

        oriented = self.orient_molecule_and_translate(self.opt_vec)
        #print(oriented)


        # produce optimized orientation
        for i in range(len(oriented)):
            oriented[i] = np.dot(to_fractional, oriented[i][0:3,:])
            oriented[i] = self.frame.modGroupUC(oriented[i][0:3,:])
        
        # produced optimized rod shift
        # for i in range(len(rods)):
        #     for j in range(len(rods[i])):
        #         self.rod_coords_abc[i][self.oned_direct,j] += self.opt_vec[1+i]
        #     self.rod_coords_abc[i] = self.frame.modGroupUC(self.rod_coords_abc[i])


        final_rods_abc = []
        for i in range(len(self.rods)):
            this_new_abc = np.copy(self.rod_ref_abc[i])

            # start of this cxn info in the optimization vec
            conn_start_ind = 1 + len(self.rods) + i*6 + i*len(self.cxns[i])

            for j in range(len(self.rods[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] += self.opt_vec[1 + i]

                # shift ref pt as well based on the periodic image indicated in the opt_Vec
                periodic_image = round(self.opt_vec[conn_start_ind + 6 + j], 0)
                this_new_abc[self.oned_direct,j] += periodic_image

            # get the new xyz
            this_new_xyz = np.dot(to_cartesian, this_new_abc)
            # apply shift (this is the fixed relative positions in rod constraint)
            # non-trivial if we have non perpendicular oned_direct, but we took care of this
            # in self.get_rod_coords()
            this_shifted_xyz = this_new_xyz + self.rod_disp_xyz[i]

            
            # use modified UC matrix to get back abc coords
            this_shifted_abc = np.dot(to_fractional, this_shifted_xyz)
            # mod rods back into the UC if they left
            this_modded_abc = self.frame.modGroupUC(this_shifted_abc)
            #final_rods_abc.append(this_modded_abc)
            self.rod_coords_abc[i] = this_modded_abc




        # modify UC parameters
        final_a = self.frame.a
        final_b = self.frame.b
        final_c = self.frame.c
        for direct in self.twod_direct:
             if(direct == 0):
                 final_a = self.frame.a * self.opt_vec[0]
             elif(direct == 1):
                 final_b = self.frame.b * self.opt_vec[0]
             elif(direct == 2):
                 final_c = self.frame.c * self.opt_vec[0]

        # create lists for final atomic coords/labels
        final_ra = [] 
        final_rb = [] 
        final_rc = []
        final_atmtype = []
        final_label = []
        overall_ind = 0

        # add oriented molecules
        for i in range(len(oriented)):
            for j in range(np.shape(oriented[i])[1]):
                final_atmtype.append(self.mol.labels[j])
                final_label.append(self.mol.labels[j]+str(overall_ind))
                overall_ind += 1

                final_ra.append(oriented[i][0,j])
                final_rb.append(oriented[i][1,j])
                final_rc.append(oriented[i][2,j])

        # add shifted rods
        for i in range(len(rods)):
            for j in range(len(rods[i])):
                final_atmtype.append(self.rod_atmtype[i][j])
                final_label.append(self.rod_atmtype[i][j] + str(overall_ind))
                overall_ind += 1

                final_ra.append(self.rod_coords_abc[i][0,j])
                final_rb.append(self.rod_coords_abc[i][1,j])
                final_rc.append(self.rod_coords_abc[i][2,j])

        self.frame.reconstruct_cif(final_a, final_b, final_c, final_ra, final_rb, final_rc, 
                                   final_label, final_atmtype, self.mol.molname)
开发者ID:mwitman1,项目名称:onedMOF,代码行数:104,代码来源:mainv2.py


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