Author: bugman Date: Sun Nov 5 10:29:59 2006 New Revision: 2751 URL: http://svn.gna.org/viewcvs/relax?rev=2751&view=rev Log: The function 'self.create_tensor_pdb()' has been modified for the new 'self.atomic_data' structure. The centre of mass, vector distribution, and axes have been turned into individual residues. Modified: branches/tensor_pdb/generic_fns/pdb.py Modified: branches/tensor_pdb/generic_fns/pdb.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/pdb.py?rev=2751&r1=2750&r2=2751&view=diff ============================================================================== --- branches/tensor_pdb/generic_fns/pdb.py (original) +++ branches/tensor_pdb/generic_fns/pdb.py Sun Nov 5 10:29:59 2006 @@ -276,7 +276,67 @@ R = self.centre_of_mass() # Add the central atom. - self.atom_add(atom_id='R', element='C', pos=R) + self.atom_add(atom_id='R', atom_name='R', res_name='COM', chain_id=chain_id, res_num=res_num, pos=R, element='C') + + # Increment the residue number. + res_num = res_num + 1 + + + # Vector distribution. + ###################### + + # Print out. + print "\nGenerating the geometric object." + + # Increment value. + inc = 20 + + # Get the uniform vector distribution. + print " Creating the uniform vector distribution." + vectors = self.uniform_vect_dist_spherical_angles(inc=20) + + # Loop over the radial array of vectors (change in longitude). + for i in range(inc): + # Loop over the vectors of the radial array (change in latitude). + for j in range(inc/2+2): + # Index. + index = i + j*inc + + # Atom id. + atom_id = 'T' + `i` + 'P' + `j` + + # Rotate the vector into the diffusion frame. + vector = dot(self.relax.data.diff[self.run].rotation, vectors[index]) + + # Set the length of the vector to its diffusion rate within the diffusion tensor geometric object. + vector = dot(self.relax.data.diff[self.run].tensor, vector) + + # Scale the vector. + vector = vector * scale + + # Position relative to the centre of mass. + pos = R + vector + + # Add the vector as a H atom of the TNS residue. + self.atom_add(atom_id=atom_id, atom_name=atom_id, res_name='TNS', chain_id=chain_id, res_num=res_num, pos=pos, element='H') + + # Connect to the previous atom (to generate the longitudinal lines). + if j != 0: + prev_id = 'T' + `i` + 'P' + `j-1` + self.atom_connect(atom_id=atom_id, bonded_id=prev_id) + + # Connect across the radial arrays (to generate the latitudinal lines). + if i != 0: + neighbour_id = 'T' + `i-1` + 'P' + `j` + self.atom_connect(atom_id=atom_id, bonded_id=neighbour_id) + + # Connect the last radial array to the first (to zip up the geometric object and close the latitudinal lines). + if i == inc-1: + neighbour_id = 'T' + `0` + 'P' + `j` + self.atom_connect(atom_id=atom_id, bonded_id=neighbour_id) + + # Increment the residue number. + res_num = res_num + 1 # Axes of the tensor. @@ -297,11 +357,12 @@ Dpar_vect = R + Dpar_vect Dpar_vect_neg = R + Dpar_vect_neg - # Add the atom and connect it to the centre of mass. - self.atom_add(atom_id='Dpar', element='C', pos=Dpar_vect) - self.atom_add(atom_id='Dpar_neg', element='C', pos=Dpar_vect_neg) - self.atom_connect(atom_id='Dpar', bonded_id='R') - self.atom_connect(atom_id='Dpar_neg', bonded_id='R') + # Create the 'AXS' residue. + self.atom_add(atom_id='R_axes', atom_name='R', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=R, element='C') + self.atom_add(atom_id='Dpar', atom_name='Dpar', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dpar_vect, element='C') + self.atom_add(atom_id='Dpar_neg', atom_name='Dpar', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dpar_vect_neg, element='C') + self.atom_connect(atom_id='Dpar', bonded_id='R_axes') + self.atom_connect(atom_id='Dpar_neg', bonded_id='R_axes') # Print out. print " Scaling factor: " + `scale` @@ -330,80 +391,26 @@ Dy_vect_neg = R + Dy_vect_neg Dz_vect_neg = R + Dz_vect_neg - # Add the atoms and connect them to the centre of mass. - self.atom_add(atom_id='Dx', element='C', pos=Dx_vect) - self.atom_add(atom_id='Dy', element='C', pos=Dy_vect) - self.atom_add(atom_id='Dz', element='C', pos=Dz_vect) - self.atom_add(atom_id='Dx_neg', element='C', pos=Dx_vect_neg) - self.atom_add(atom_id='Dy_neg', element='C', pos=Dy_vect_neg) - self.atom_add(atom_id='Dz_neg', element='C', pos=Dz_vect_neg) - self.atom_connect(atom_id='Dx', bonded_id='R') - self.atom_connect(atom_id='Dy', bonded_id='R') - self.atom_connect(atom_id='Dz', bonded_id='R') - self.atom_connect(atom_id='Dx_neg', bonded_id='R') - self.atom_connect(atom_id='Dy_neg', bonded_id='R') - self.atom_connect(atom_id='Dz_neg', bonded_id='R') + # Create the 'AXS' residue. + self.atom_add(atom_id='R_axes', atom_name='R', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=R, element='C') + self.atom_add(atom_id='Dx', atom_name='Dx', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dx_vect, element='C') + self.atom_add(atom_id='Dy', atom_name='Dy', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dy_vect, element='C') + self.atom_add(atom_id='Dz', atom_name='Dz', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dz_vect, element='C') + self.atom_add(atom_id='Dx_neg', atom_name='Dx', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dx_vect_neg, element='C') + self.atom_add(atom_id='Dy_neg', atom_name='Dy', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dy_vect_neg, element='C') + self.atom_add(atom_id='Dz_neg', atom_name='Dz', res_name='AXS', chain_id=chain_id, res_num=res_num, pos=Dz_vect_neg, element='C') + self.atom_connect(atom_id='Dx', bonded_id='R_axes') + self.atom_connect(atom_id='Dy', bonded_id='R_axes') + self.atom_connect(atom_id='Dz', bonded_id='R_axes') + self.atom_connect(atom_id='Dx_neg', bonded_id='R_axes') + self.atom_connect(atom_id='Dy_neg', bonded_id='R_axes') + self.atom_connect(atom_id='Dz_neg', bonded_id='R_axes') # Print out. print " Scaling factor: " + `scale` print " Dx vector (scaled + shifted to R): " + `Dx_vect` print " Dy vector (scaled + shifted to R): " + `Dy_vect` print " Dz vector (scaled + shifted to R): " + `Dz_vect` - - - # Vector distribution. - ###################### - - # Print out. - print "\nGenerating the geometric object." - - # Increment value. - inc = 20 - - # Get the uniform vector distribution. - print " Creating the uniform vector distribution." - vectors = self.uniform_vect_dist_spherical_angles(inc=20) - - # Loop over the radial array of vectors (change in longitude). - for i in range(inc): - # Loop over the vectors of the radial array (change in latitude). - for j in range(inc/2+2): - # Index. - index = i + j*inc - - # Atom id. - atom_id = 'T' + `i` + 'P' + `j` - - # Rotate the vector into the diffusion frame. - vector = dot(self.relax.data.diff[self.run].rotation, vectors[index]) - - # Set the length of the vector to its diffusion rate within the diffusion tensor geometric object. - vector = dot(self.relax.data.diff[self.run].tensor, vector) - - # Scale the vector. - vector = vector * scale - - # Position relative to the centre of mass. - pos = R + vector - - # Add the vector as a H atom. - self.atom_add(atom_id=atom_id, element='H', pos=pos) - - # Connect to the previous atom (to generate the longitudinal lines). - if j != 0: - prev_id = 'T' + `i` + 'P' + `j-1` - self.atom_connect(atom_id=atom_id, bonded_id=prev_id) - - # Connect across the radial arrays (to generate the latitudinal lines). - if i != 0: - neighbour_id = 'T' + `i-1` + 'P' + `j` - self.atom_connect(atom_id=atom_id, bonded_id=neighbour_id) - - # Connect the last radial array to the first (to zip up the geometric object and close the latitudinal lines). - if i == inc-1: - neighbour_id = 'T' + `0` + 'P' + `j` - self.atom_connect(atom_id=atom_id, bonded_id=neighbour_id) - # Create the PDB file.