mailr13924 - /branches/xyz/generic_fns/structure/main.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by hasu on July 27, 2011 - 11:17:
Author: han87
Date: Wed Jul 27 11:17:48 2011
New Revision: 13924

URL: http://svn.gna.org/viewcvs/relax?rev=13924&view=rev
Log:
Deleting the function 'vector_xyz' in the generic_fns/structure/main.py

The code of the function 'vector_xyz' was removed since it will be not used.

Modified:
    branches/xyz/generic_fns/structure/main.py

Modified: branches/xyz/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/xyz/generic_fns/structure/main.py?rev=13924&r1=13923&r2=13924&view=diff
==============================================================================
--- branches/xyz/generic_fns/structure/main.py (original)
+++ branches/xyz/generic_fns/structure/main.py Wed Jul 27 11:17:48 2011
@@ -612,140 +612,6 @@
         raise RelaxError("No vectors could be extracted.")
 
 
-def vectors_xyz(spin_id1=None, spin_id2=None, model=None, verbosity=1, 
ave=True, unit=True):
-    """Extract the bond vectors from the loaded structures and store them in 
the spin container.
-
-    @keyword attached:      The spin identifier string of the atom 1. 
-    @type attached:         str
-    @keyword spin_id:       The spin identifier string of the atom 2.
-    @type spin_id:          str
-    @keyword model:         The model to extract the vector from.  If None, 
all vectors will be
-                            extracted.
-    @type model:            str
-    @keyword verbosity:     The higher the value, the more information is 
printed to screen.
-    @type verbosity:        int
-    @keyword ave:           A flag which if True will cause the average of 
all vectors to be
-                            extracted.
-    @type ave:              bool
-    @keyword unit:          A flag which if True will cause the function to 
calculate the unit
-                            vectors.
-    @type unit:             bool
-    """
-
-    # Test if the PDB file has been loaded.
-    if not hasattr(cdp, 'structure'):
-        raise RelaxPdbError
-
-    # Test if sequence data is loaded.
-    if not exists_mol_res_spin_data():
-        raise RelaxNoSequenceError
-
-    # Print out.
-    if verbosity:
-        # Number of models.
-        num_models = cdp.structure.num_models()
-
-        # Multiple models loaded.
-        if num_models > 1:
-            if model:
-                print(("Extracting vectors for model '%s'." % model))
-            else:
-                print(("Extracting vectors for all %s models." % num_models))
-                if ave:
-                    print("Averaging all vectors.")
-
-        # Single model loaded.
-        else:
-            print("Extracting vectors from the single model.")
-
-        # Unit vectors.
-        if unit:
-            print("Calculating the unit vectors.")
-
-    # Loop over the spins.
-    no_vectors = True
-    for spin1, mol_name1, res_num1, res_name1 in 
spin_loop(selection=spin_id1, full_info=True):
-        # Skip deselected spins.
-        if not spin.select:
-            continue
-
-        # The spin identification string.  The residue name and spin num is 
not included to allow molecules with point mutations to be used as different 
models.
-        id1 = generate_spin_id(res_num1=res_num1, res_name1=None, 
spin_num1=res_num1)
-
-        # Test that the spin number or name are set (one or both are 
essential for the identification of the atom).
-        if spin.num == None and spin.name == None:
-            warn(RelaxWarning("Either the spin number or name must be set 
for the spin " + repr(id) + " to identify the corresponding atom in the 
molecule."))
-            continue
-
-        # The bond vector already exists.
-        if hasattr(spin, object_name):
-            obj = getattr(spin, object_name)
-            if obj:
-                warn(RelaxWarning("The bond vector for the spin " + repr(id) 
+ " already exists."))
-                continue
-
-        # Get the bond info.
-        bond_vectors, attached_name, warnings = 
cdp.structure.bond_vectors(attached_atom=attached, model_num=model, 
res_num=res_num, spin_name=spin.name, return_name=True, return_warnings=True)
-
-        # No attached atom.
-        if not bond_vectors:
-            # Warning messages.
-            if warnings:
-                warn(RelaxWarning(warnings + " (atom ID " + repr(id) + ")."))
-
-            # Skip the spin.
-            continue
-
-        # Set the attached atom name.
-        if not hasattr(spin, 'attached_atom'):
-            spin.attached_atom = attached_name
-        elif spin.attached_atom != attached_name:
-            raise RelaxError("The " + repr(spin.attached_atom) + " atom 
already attached to the spin does not match the attached atom " + 
repr(attached_name) + ".")
-
-        # Initialise the average vector.
-        if ave:
-            ave_vector = zeros(3, float64)
-
-        # Loop over the individual vectors.
-        for i in xrange(len(bond_vectors)):
-            # Unit vector.
-            if unit:
-                # Normalisation factor.
-                norm_factor = norm(bond_vectors[i])
-
-                # Test for zero length.
-                if norm_factor == 0.0:
-                    warn(RelaxZeroVectorWarning(id))
-
-                # Calculate the normalised vector.
-                else:
-                    bond_vectors[i] = bond_vectors[i] / norm_factor
-
-            # Sum the vectors.
-            if ave:
-                ave_vector = ave_vector + bond_vectors[i]
-
-        # Average.
-        if ave:
-            vector = ave_vector / float(len(bond_vectors))
-        else:
-            vector = bond_vectors
-
-        # Set the vector.
-        setattr(spin, object_name, vector)
-
-        # We have a vector!
-        no_vectors = False
-
-        # Print out of modified spins.
-        if verbosity:
-            print(("Extracted " + spin.name + "-" + attached_name + " 
vectors for " + repr(id) + '.'))
-
-    # Right, catch the problem of missing vectors to prevent massive user 
confusion!
-    if no_vectors:
-        raise RelaxError("No vectors could be extracted.")
-
-
 def write_pdb(file=None, dir=None, model_num=None, force=False):
     """The PDB writing function.
 




Related Messages


Powered by MHonArc, Updated Wed Jul 27 11:20:03 2011