def transforms(self, molecule): import PDBmatrices sm = [] h = pdb_headers(molecule) if self.use_smtry_records.get(): sm = PDBmatrices.pdb_smtry_matrices(h) if len(sm) == 0 and self.use_cryst1_smtry.get(): sm = PDBmatrices.pdb_space_group_matrices(h) from Matrix import identity_matrix, matrix_products mm = [identity_matrix()] if self.use_mtrix_records.get(): mm = PDBmatrices.pdb_mtrix_matrices(h) if sm: tflist = matrix_products(sm, mm) else: tflist = mm # Adjust transforms so centers of models are in unit cell box from Molecule import unit_cell_parameters, molecule_center uc = unit_cell_parameters(molecule) if uc: mc = molecule_center(molecule) tflist = PDBmatrices.pack_unit_cell(uc, self.grid_origin(), mc, tflist) # Make multiple unit cells nc = self.number_of_cells() if nc != (1,1,1): tflist = PDBmatrices.unit_cell_translations(uc, nc, tflist) return tflist
def transforms(self, molecule): import PDBmatrices sm = [] h = pdb_headers(molecule) if self.use_smtry_records.get(): sm = PDBmatrices.pdb_smtry_matrices(h) if len(sm) == 0 and self.use_cryst1_smtry.get(): sm = PDBmatrices.pdb_space_group_matrices(h) from Matrix import identity_matrix, matrix_products mm = [identity_matrix()] if self.use_mtrix_records.get(): mm = PDBmatrices.pdb_mtrix_matrices(h) if sm: tflist = matrix_products(sm, mm) else: tflist = mm # Adjust transforms so centers of models are in unit cell box from Molecule import unit_cell_parameters, molecule_center uc = unit_cell_parameters(molecule) if uc: mc = molecule_center(molecule) tflist = PDBmatrices.pack_unit_cell(uc, self.grid_origin(), mc, tflist) # Make multiple unit cells nc = self.number_of_cells() if nc != (1, 1, 1): tflist = PDBmatrices.unit_cell_translations(uc, nc, tflist) return tflist
def dihedral_symmetries(n): clist = cyclic_symmetries(n) reflect = ((-1,0,0,0),(0,1,0,0),(0,0,-1,0)) from Matrix import matrix_products, identity_matrix tflist = matrix_products([identity_matrix(), reflect], clist) return tflist
def dihedral_symmetries(n): clist = cyclic_symmetries(n) reflect = ((-1, 0, 0, 0), (0, 1, 0, 0), (0, 0, -1, 0)) from Matrix import matrix_products, identity_matrix tflist = matrix_products([identity_matrix(), reflect], clist) return tflist
def unit_cell_translations(uc, nc, tflist): ranges = [(0,n-1) for n in nc] cell_axes = unit_cell_axes(*uc) mlist = translation_matrices(cell_axes, ranges) from Matrix import matrix_products tlist = matrix_products(mlist, tflist) return tlist
def unit_cell_translations(uc, nc, tflist): ranges = [(0, n - 1) for n in nc] cell_axes = unit_cell_axes(*uc) mlist = translation_matrices(cell_axes, ranges) from Matrix import matrix_products tlist = matrix_products(mlist, tflist) return tlist
def pdb_3x3x3_unit_cell_matrices(pdb_headers): cell_axes = pdb_unit_cell_axes(pdb_headers) mlist = translation_matrices(cell_axes, ((-1,1), (-1,1), (-1,1))) clist = pdb_unit_cell_matrices(pdb_headers) from Matrix import matrix_products plist = matrix_products(mlist, clist) return plist
def pdb_3x3x3_unit_cell_matrices(pdb_headers): cell_axes = pdb_unit_cell_axes(pdb_headers) mlist = translation_matrices(cell_axes, ((-1, 1), (-1, 1), (-1, 1))) clist = pdb_unit_cell_matrices(pdb_headers) from Matrix import matrix_products plist = matrix_products(mlist, clist) return plist
def pdb_unit_cell_matrices(pdb_headers): slist = crystal_symmetry_matrices(pdb_headers) import parsepdb mlist = parsepdb.pdb_mtrix_matrices(pdb_headers) if slist and mlist: from Matrix import matrix_products smlist = matrix_products(slist, mlist) return smlist elif slist: return slist elif mlist: return mlist from Matrix import identity_matrix return [identity_matrix()]