def setup_domains(self): # scale the temperature (necessary at high pulling speeds) if self.temperature: atoms = self.soup.atoms() anderson_velocity_scale(atoms, self.temperature, 3 * len(atoms)) # select the atoms from the domains definition selection = data.backbone_atoms if self.is_backbone_only else None self.atoms1 = get_atoms_of_residues(self.soup, self.domain1, selection) self.atoms2 = get_atoms_of_residues(self.soup, self.domain2, selection) # get direction vectors based on domains self.disp2to1 = pdbatoms.get_center(self.atoms1) \ - pdbatoms.get_center(self.atoms2) self.axis2to1 = v3.norm(self.disp2to1) # calculate relative velocities between domains self.vel2to1 = average_vel(self.atoms1) - average_vel(self.atoms2) self.axis_vel2to1 = v3.parallel(self.vel2to1, self.axis2to1) self.vel = v3.dot(self.axis_vel2to1, self.axis2to1) if self.is_first_domain_only: self.move_atoms = self.atoms1 else: self.move_atoms = self.atoms1 + self.atoms2
def setup_domains(self): # scale the temperature (necessary at high pulling speeds) if self.temperature: atoms = self.soup.atoms() anderson_velocity_scale(atoms, self.temperature, 3*len(atoms)) # select the atoms from the domains definition selection = ['CA'] if self.is_backbone_only else None self.atoms1 = get_atoms_of_residues(self.soup, self.domain1, selection) self.atoms2 = get_atoms_of_residues(self.soup, self.domain2, selection) # get direction vectors based on domains self.disp2to1 = pdbatoms.get_center(self.atoms1) \ - pdbatoms.get_center(self.atoms2) self.axis2to1 = v3.norm(self.disp2to1) # calculate relative velocities between domains self.vel2to1 = average_vel(self.atoms1) - average_vel(self.atoms2) self.axis_vel2to1 = v3.parallel(self.vel2to1, self.axis2to1) self.vel = v3.dot(self.axis_vel2to1, self.axis2to1) if self.is_first_domain_only: self.move_atoms = self.atoms1 else: self.move_atoms = self.atoms1 + self.atoms2
def get_pdb_transform(pdb, center_res, top_res): """ Returns a transformation matrix that centers pdb to center_res on the z-axis and moves top_res above center_res on the y-axis """ soup = pdbatoms.Soup(pdb) atoms = soup.atoms() soup_center = pdbatoms.get_center(atoms) translation = v3.translation(-soup_center) soup.transform(translation) result = translation center_atom = find_ca_of_resname(soup.atoms(), center_res) view = v3.vector(0, 0, 1) axis = v3.cross(view, center_atom.pos) angle = v3.vec_dihedral(view, axis, center_atom.pos) rotation = v3.rotation(axis, angle) soup.transform(rotation) result = v3.combine(rotation, result) top_atom = find_ca_of_resname(soup.atoms(), top_res) top_dir = v3.vector(0, 1, 0) axis = view.copy() angle = v3.vec_dihedral(top_dir, axis, top_atom.pos) rotation2 = v3.rotation(axis, angle) result = v3.combine(rotation2, result) del soup return result
def volume(atoms, grid_spacing, pdb="", verbose=True): """ Returns the volume of a list of atoms, and writes a PDB file of fictious atoms to fill the volume. """ center = pdbatoms.get_center(atoms) width = pdbatoms.get_width(atoms, center) + 4.0 grid = Grid(grid_spacing, width, center) if verbose: print "%d atoms, grid %d x %d x %d points, width %.2f angstroms" % \ (len(atoms), grid.n, grid.n, grid.n, grid.actual_width) for atom in atoms: grid.exclude_sphere(atom.pos, atom.radius) d_volume = float(grid_spacing)**3 volume = grid.n_excluded() * d_volume if verbose: print "Volume %.1f angstroms^3 (%d x %.3f angstroms^3)" \ % (volume, grid.n_excluded(), d_volume) if pdb: if verbose: print "Warning: there will probably be more residues/atoms " \ "than PDB can uniquely number" print pdb grid.write_pdb(pdb) return volume
def volume(atoms, grid_spacing, pdb="",verbose=True): """ Returns the volume of a list of atoms, and writes a PDB file of fictious atoms to fill the volume. """ center = pdbatoms.get_center(atoms) width = pdbatoms.get_width(atoms, center) + 4.0 grid = Grid(grid_spacing, width, center) if verbose: print "%d atoms, grid %d x %d x %d points, width %.2f angstroms" % \ (len(atoms), grid.n, grid.n, grid.n, grid.actual_width) for atom in atoms: grid.exclude_sphere(atom.pos, atom.radius) d_volume = float(grid_spacing)**3 volume = grid.n_excluded()*d_volume if verbose: print "Volume %.1f angstroms^3 (%d x %.3f angstroms^3)" \ % (volume, grid.n_excluded(), d_volume) if pdb: if verbose: print "Warning: there will probably be more residues/atoms " \ "than PDB can uniquely number" print pdb grid.write_pdb(pdb) return volume