Author: bugman Date: Thu Aug 21 18:11:32 2008 New Revision: 7222 URL: http://svn.gna.org/viewcvs/relax?rev=7222&view=rev Log: Fixed the call to and the execution of the stitch_cap_to_cone() function. Modified: 1.3/generic_fns/structure/geometric.py 1.3/specific_fns/n_state_model.py Modified: 1.3/generic_fns/structure/geometric.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/geometric.py?rev=7222&r1=7221&r2=7222&view=diff ============================================================================== --- 1.3/generic_fns/structure/geometric.py (original) +++ 1.3/generic_fns/structure/geometric.py Thu Aug 21 18:11:32 2008 @@ -644,19 +644,63 @@ return res_num -def stitch_cap_to_cone(structure=None, atom_id_ext='', max_angle=None, inc=None): +def stitch_cap_to_cone(structure=None, cone_start=None, cap_start=None, max_angle=None, inc=None): """Function for stitching the cap of a cone to the cone edge, in the PDB representations. - @param structure: The structural data object. + @keyword structure: The structural data object. @type structure: instance of class derived from Base_struct_API - @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. + @keyword cone_start: The starting atom number of the cone residue. + @type cone_start: int + @keyword cap_start: The starting atom number of the cap residue. + @type cap_start: int + @keyword 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 + @keyword inc: The number of increments or number of vectors used to generate the outer edge of the cone. @type inc: int """ + + # Loop over the radial array of vectors (change in longitude). + for i in range(inc): + # Connect the two atoms (to stitch up the 2 objects). + structure.atom_connect(index1=cone_start-1+i, index2=cap_start-1+i) + + +def uniform_vect_dist_spherical_angles(inc=20): + """Uniform distribution of vectors on a sphere using uniform spherical angles. + + This function returns an array of unit vectors uniformly distributed within 3D space. To + create the distribution, uniform spherical angles are used. The two spherical angles are + defined as + + theta = 2.pi.u, + phi = cos^-1(2v - 1), + + where + + u in [0, 1), + v in [0, 1]. + + Because theta is defined between [0, pi] and phi is defined between [0, 2pi], for a uniform + distribution u is only incremented half of 'inc'. The unit vectors are generated using the + equation + + | cos(theta) * sin(phi) | + vector = | sin(theta) * sin(phi) |. + | cos(phi) | + + The vectors of this distribution generate both longitudinal and latitudinal lines. + """ + + # The inc argument must be an even number. + if inc%2: + raise RelaxError, "The increment value of " + `inc` + " must be an even number." + + # Generate the increment values of u. + u = zeros(inc, float64) + val = 1.0 / float(inc) + for i in xrange(inc): + u[i] = float(i) * val # Generate the increment values of v. v = zeros(inc/2+2, float64) @@ -665,69 +709,6 @@ 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 - - # 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). - structure.atom_connect(index1=edge_atom_id, index2=cap_atom_id) - - -def uniform_vect_dist_spherical_angles(inc=20): - """Uniform distribution of vectors on a sphere using uniform spherical angles. - - This function returns an array of unit vectors uniformly distributed within 3D space. To - create the distribution, uniform spherical angles are used. The two spherical angles are - defined as - - theta = 2.pi.u, - phi = cos^-1(2v - 1), - - where - - u in [0, 1), - v in [0, 1]. - - Because theta is defined between [0, pi] and phi is defined between [0, 2pi], for a uniform - distribution u is only incremented half of 'inc'. The unit vectors are generated using the - equation - - | cos(theta) * sin(phi) | - vector = | sin(theta) * sin(phi) |. - | cos(phi) | - - The vectors of this distribution generate both longitudinal and latitudinal lines. - """ - - # The inc argument must be an even number. - if inc%2: - raise RelaxError, "The increment value of " + `inc` + " must be an even number." - - # Generate the increment values of u. - u = zeros(inc, float64) - val = 1.0 / float(inc) - for i in xrange(inc): - u[i] = float(i) * val - - # 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 theta. theta = 2.0 * pi * u 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=7222&r1=7221&r2=7222&view=diff ============================================================================== --- 1.3/specific_fns/n_state_model.py (original) +++ 1.3/specific_fns/n_state_model.py Thu Aug 21 18:11:32 2008 @@ -241,13 +241,15 @@ angle = cdp.theta_diff_in_cone elif cone_type == 'diff on cone': angle = cdp.theta_diff_on_cone + cap_start_atom = structure.structural_data[0].atom_num[-1]+1 generic_fns.structure.geometric.cone_edge(structure=structure, res_name='CON', res_num=3, apex=cdp.pivot_point, R=R, angle=angle, length=norm(cdp.pivot_CoM), inc=inc) # Generate the cone cap, and stitch it to the cone edge. if cone_type == 'diff in cone': print "\nGenerating the cone cap." + cone_start_atom = structure.structural_data[0].atom_num[-1]+1 generic_fns.structure.geometric.generate_vector_dist(structure=structure, res_name='CON', res_num=3, centre=cdp.pivot_point, R=R, max_angle=angle, scale=norm(cdp.pivot_CoM), inc=inc) - generic_fns.structure.geometric.stitch_cap_to_cone(structure=structure, max_angle=angle, inc=inc) + generic_fns.structure.geometric.stitch_cap_to_cone(structure=structure, cone_start=cone_start_atom, cap_start=cap_start_atom, max_angle=angle, inc=inc) # Create the PDB file. print "\nGenerating the PDB file."