mailr5839 - in /1.3/generic_fns/structure: api_base.py scientific.py


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

Header


Content

Posted by edward on April 20, 2008 - 13:27:
Author: bugman
Date: Sun Apr 20 13:27:34 2008
New Revision: 5839

URL: http://svn.gna.org/viewcvs/relax?rev=5839&view=rev
Log:
Deleted the xh_vector() method from the API base class and Scientific Python 
PDB data object.


Modified:
    1.3/generic_fns/structure/api_base.py
    1.3/generic_fns/structure/scientific.py

Modified: 1.3/generic_fns/structure/api_base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/api_base.py?rev=5839&r1=5838&r2=5839&view=diff
==============================================================================
--- 1.3/generic_fns/structure/api_base.py (original)
+++ 1.3/generic_fns/structure/api_base.py Sun Apr 20 13:27:34 2008
@@ -402,23 +402,3 @@
 
         # Raise the error.
         raise RelaxImplementError
-
-
-    def xh_vector(self, spin, structure=None, unit=True):
-        """Prototype method stub for calculating/extracting the XH vector 
from the loaded structure.
-
-        @param spin:        The spin system data container.
-        @type spin:         SpinContainer instance
-        @keyword structure: The structure number to get the XH vector from.  
If set to None and
-                            multiple structures exist, then the XH vector 
will be averaged across
-                            all structures.
-        @type structure:    int
-        @keyword unit:      A flag which if set will cause the method to 
return the unit XH vector
-                            rather than the full vector.
-        @type unit:         bool
-        @return:            The XH vector (or unit vector if the unit flag 
is set).
-        @rtype:             list or None
-        """
-
-        # Raise the error.
-        raise RelaxImplementError

Modified: 1.3/generic_fns/structure/scientific.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/scientific.py?rev=5839&r1=5838&r2=5839&view=diff
==============================================================================
--- 1.3/generic_fns/structure/scientific.py (original)
+++ 1.3/generic_fns/structure/scientific.py Sun Apr 20 13:27:34 2008
@@ -320,102 +320,3 @@
 
                 # Increment i.
                 i = i + 1
-
-
-    def xh_vector(self, spin, structure=None, unit=True):
-        """Function for calculating/extracting the XH vector from the loaded 
structure.
-
-        @param spin:        The spin system data container.
-        @type spin:         SpinContainer instance
-        @keyword structure: The structure number to get the XH vector from.  
If set to None and
-                            multiple structures exist, then the XH vector 
will be averaged across
-                            all structures.
-        @type structure:    int
-        @keyword unit:      A flag which if set will cause the function to 
return the unit XH vector
-                            rather than the full vector.
-        @type unit:         bool
-        @return:            The XH vector (or unit vector if the unit flag 
is set).
-        @rtype:             list or None
-        """
-
-        # Initialise.
-        vector_array = []
-        ave_vector = zeros(3, float64)
-
-        # Loop over the structures.
-        for i in xrange(self.num_str()):
-            # The vectors from a specific structure.
-            if structure != None and structure != i:
-                continue
-
-            # Reassign the first peptide or nucleotide chain of the first 
structure.
-            if self.structural_data[i].peptide_chains:
-                pdb_residues = 
self.structural_data[i].peptide_chains[0].residues
-            elif self.structural_data[i].nucleotide_chains:
-                pdb_residues = 
self.structural_data[i].nucleotide_chains[0].residues
-            else:
-                raise RelaxNoPdbChainError
-
-            # Find the corresponding residue in the PDB.
-            pdb_res = None
-            for k in xrange(len(pdb_residues)):
-                if spin.num == pdb_residues[k].number:
-                    pdb_res = pdb_residues[k]
-                    break
-            if pdb_res == None:
-                raise RelaxNoResError, spin.num
-
-            # Test if the proton atom exists for residue i.
-            if not pdb_res.atoms.has_key(spin.proton):
-                warn(RelaxNoAtomWarning(spin.proton, spin.num))
-
-            # Test if the heteronucleus atom exists for residue i.
-            elif not pdb_res.atoms.has_key(spin.heteronuc):
-                warn(RelaxNoAtomWarning(spin.heteronuc, spin.num))
-
-            # Calculate the vector.
-            else:
-                # Get the proton position.
-                posH = pdb_res.atoms[spin.proton].position.array
-
-                # Get the heteronucleus position.
-                posX = pdb_res.atoms[spin.heteronuc].position.array
-
-                # Calculate the XH bond vector.
-                vector = posH - posX
-
-                # Unit vector.
-                if unit:
-                    # Normalisation factor.
-                    norm_factor = sqrt(dot(vector, vector))
-
-                    # Test for zero length.
-                    if norm_factor == 0.0:
-                        warn(RelaxZeroVectorWarning(spin.num))
-
-                    # Calculate the normalised vector.
-                    else:
-                        vector_array.append(vector / norm_factor)
-
-                # Normal XH vector.
-                else:
-                    vector_array.append(vector)
-
-        # Return None if there are no vectors.
-        if not len(vector_array):
-            return
-
-        # Sum the vectors.
-        for vector in vector_array:
-            # Sum.
-            ave_vector = ave_vector + vector
-
-        # Average the vector.
-        ave_vector = ave_vector / len(vector_array)
-
-        # Unit vector.
-        if unit:
-            ave_vector = ave_vector / sqrt(dot(ave_vector, ave_vector))
-
-        # Return the vector.
-        return ave_vector




Related Messages


Powered by MHonArc, Updated Sun Apr 20 13:40:26 2008