Author: bugman Date: Thu Feb 21 16:18:33 2008 New Revision: 5111 URL: http://svn.gna.org/viewcvs/relax?rev=5111&view=rev Log: Wrote the stitch_cap_to_cone() to join the cap of a cone to the cone edge. This is being called from the specific_fns.n_state_model.cone_pdb() function. Modified: 1.3/generic_fns/structure.py 1.3/specific_fns/n_state_model.py Modified: 1.3/generic_fns/structure.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure.py?rev=5111&r1=5110&r2=5111&view=diff ============================================================================== --- 1.3/generic_fns/structure.py (original) +++ 1.3/generic_fns/structure.py Thu Feb 21 16:18:33 2008 @@ -1110,6 +1110,52 @@ relax_data_store.res[run][res].xh_vect = xh_vect +def stitch_cap_to_cone(atomic_data=None, atom_id_ext='', max_angle=None, inc=None): + """Function for stitching the cap of a cone to the cone edge, in the PDB representations. + + @param atomic_data: The dictionary containing the atomic data. + @type atomic_data: dict + @param atom_id_ext: The atom identifier extension. + @type atom_id_ext: str + @param max_angle: The maximal polar angle, in rad, after which all vectors are skipped. + @type max_angle: float + @param inc: The number of increments or number of vectors used to generate the outer + edge of the cone. + @type inc: int + """ + + # Generate the increment values of v. + v = zeros(inc/2+2, float64) + val = 1.0 / float(inc/2) + for i in xrange(1, inc/2+1): + v[i] = float(i-1) * val + val/2.0 + v[-1] = 1.0 + + # Generate the distribution of spherical angles phi. + phi = arccos(2.0 * v - 1.0) + + # Loop over the angles and find the minimum latitudinal index. + for j_min in xrange(len(phi)): + if phi[j_min] < max_angle: + break + + print j_min + + # Loop over the radial array of vectors (change in longitude). + for i in range(inc): + # Cap atom id. + cap_atom_id = 'T' + `i` + 'P' + `j_min` + atom_id_ext + + # Cone edge atom id. + edge_atom_id = 'T' + `i` + atom_id_ext + + # Connect the two atoms (to stitch up the 2 objects). + print "Connecting: " + `cap_atom_id` + " to " + `edge_atom_id` + atom_connect(atomic_data=atomic_data, atom_id=edge_atom_id, bonded_id=cap_atom_id) + + + + def terminate(atomic_data=None, atom_id_ext='', res_num=None): """Function for terminating the chain by adding a TER record to the atomic_data object. Modified: 1.3/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/n_state_model.py?rev=5111&r1=5110&r2=5111&view=diff ============================================================================== --- 1.3/specific_fns/n_state_model.py (original) +++ 1.3/specific_fns/n_state_model.py Thu Feb 21 16:18:33 2008 @@ -237,10 +237,11 @@ angle = cdp.theta_diff_on_cone generic_fns.structure.cone_edge(atomic_data=atomic_data, res_num=3, apex=cdp.pivot_point, R=R, angle=angle, length=norm(cdp.pivot_CoM), inc=inc) - # Generate the cone cap. + # Generate the cone cap, and stitch it to the cone edge. if cone_type == 'diff in cone': print "\nGenerating the cone cap." generic_fns.structure.generate_vector_dist(atomic_data=atomic_data, res_name='CON', res_num=4, centre=cdp.pivot_point, R=R, max_angle=angle, scale=norm(cdp.pivot_CoM), inc=inc) + generic_fns.structure.stitch_cap_to_cone(atomic_data=atomic_data, max_angle=angle, inc=inc) # Terminate the chain. generic_fns.structure.terminate(atomic_data=atomic_data, res_num=res_num)