mailr2922 - in /1.3: generic_fns/structure.py prompt/structure.py


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

Header


Content

Posted by edward on December 07, 2006 - 05:35:
Author: bugman
Date: Thu Dec  7 05:34:34 2006
New Revision: 2922

URL: http://svn.gna.org/viewcvs/relax?rev=2922&view=rev
Log:
Created a symmetric chain 'B' in the PDB representation of the XH vector 
distribution.


Modified:
    1.3/generic_fns/structure.py
    1.3/prompt/structure.py

Modified: 1.3/generic_fns/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure.py?rev=2922&r1=2921&r2=2922&view=diff
==============================================================================
--- 1.3/generic_fns/structure.py (original)
+++ 1.3/generic_fns/structure.py Thu Dec  7 05:34:34 2006
@@ -436,7 +436,7 @@
             atomic_arrays.sort()
             last_res = atomic_arrays[-1][3]
 
-            # Add the TER 'atom''.
+            # Add the TER 'atom'.
             self.atom_add(atom_id='TER' + atom_id_ext, record_name='TER', 
res_name=last_res, res_num=res_num)
 
 
@@ -456,26 +456,26 @@
         tensor_pdb_file.close()
 
 
-    def create_vector_dist(self, run=None, length=1.8e-6, file=None, 
dir=None, force=0):
+    def create_vector_dist(self, run=None, length=None, symmetry=1, 
file=None, dir=None, force=0):
         """Create a PDB representation of the XH vector distribution.
 
-        @param run:     The run.
-        @type run:      str
-        @param length:  The length to set the vectors to in the PDB file.
-        @type length:   float
-        @param file:    The name of the PDB file to create.
-        @type file:     str
-        @param dir:     The name of the directory to place the PDB file into.
-        @type dir:      str
-        @param force:   Flag which if set to 1 will overwrite any 
pre-existing file.
-        @type force:    int
+        @param run:         The run.
+        @type run:          str
+        @param length:      The length to set the vectors to in the PDB file.
+        @type length:       float
+        @param symmetry:    The symmetry flag which if set will create a 
second PDB chain 'B' which
+            is the same as chain 'A' but with the XH vectors reversed.
+        @type symmetry:     int
+        @param file:        The name of the PDB file to create.
+        @type file:         str
+        @param dir:         The name of the directory to place the PDB file 
into.
+        @type dir:          str
+        @param force:       Flag which if set will overwrite any 
pre-existing file.
+        @type force:        int
         """
 
         # Arguments.
-        self.length = length
-        self.file = file
-        self.dir = dir
-        self.force = force
+        self.run = run
 
         # Test if the run exists.
         if not run in self.relax.data.run_names:
@@ -547,11 +547,58 @@
             self.atom_add(atom_id=X_id, record_name='ATOM', 
atom_name=data.heteronuc, res_name=data.name, chain_id='A', res_num=data.num, 
pos=R, element=data.heteronuc)
 
             # Add the H atom.
-            self.atom_add(atom_id=H_id, record_name='ATOM', 
atom_name=data.proton, res_name=data.name, chain_id='A', res_num=data.num, 
pos=vector, element=data.proton)
+            self.atom_add(atom_id=H_id, record_name='ATOM', 
atom_name=data.proton, res_name=data.name, chain_id='A', res_num=data.num, 
pos=R+vector, element=data.proton)
 
             # Connect the two atoms.
             self.atom_connect(atom_id=X_id, bonded_id=H_id)
 
+            # Store the terminate residue number for the TER record.
+            last_res = data.num
+            last_name = data.name
+
+        # The TER record.
+        self.atom_add(atom_id='TER' + '_A', record_name='TER', 
res_name=last_name, chain_id='A', res_num=last_res)
+
+        # Symmetry chain.
+        if symmetry:
+            # Loop over the spin systems.
+            for i in xrange(len(self.relax.data.res[self.run])):
+                # Alias the spin system data.
+                data = self.relax.data.res[self.run][i]
+
+                # Skip unselected spin systems.
+                if not data.select:
+                    continue
+
+                # Skip spin systems missing the xh_vect structure.
+                if not hasattr(data, 'xh_vect'):
+                    continue
+
+                # Scale the vector.
+                vector = data.xh_vect * length * 1e10
+
+                # The atom ids.
+                end = '_' + `data.num` + '_' + data.name
+                X_id = data.heteronuc + end
+                H_id = data.proton + end
+
+                # Add the central X atom.
+                self.atom_add(atom_id=X_id + '_B', record_name='ATOM', 
atom_name=data.heteronuc, res_name=data.name, chain_id='B', res_num=data.num, 
pos=R, element=data.heteronuc)
+
+                # Add the H atom.
+                self.atom_add(atom_id=H_id + '_B', record_name='ATOM', 
atom_name=data.proton, res_name=data.name, chain_id='B', res_num=data.num, 
pos=R-vector, element=data.proton)
+
+                # Connect the two atoms.
+                self.atom_connect(atom_id=X_id + '_B', bonded_id=H_id + '_B')
+
+                # Store the terminate residue number for the TER record.
+                last_res = data.num
+                last_name = data.name
+
+            # The TER record.
+            self.atom_add(atom_id='TER' + '_B', record_name='TER', 
res_name=last_name, chain_id='B', res_num=last_res)
+
+
 
         # Create the PDB file.
         ######################
@@ -560,7 +607,7 @@
         print "\nGenerating the PDB file."
 
         # Open the PDB file for writing.
-        tensor_pdb_file = self.relax.IO.open_write_file(self.file, self.dir, 
force=self.force)
+        tensor_pdb_file = self.relax.IO.open_write_file(file, dir, 
force=force)
 
         # Write the data.
         self.write_pdb_file(tensor_pdb_file)

Modified: 1.3/prompt/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/structure.py?rev=2922&r1=2921&r2=2922&view=diff
==============================================================================
--- 1.3/prompt/structure.py (original)
+++ 1.3/prompt/structure.py Thu Dec  7 05:34:34 2006
@@ -169,7 +169,7 @@
         self.__relax__.generic.structure.create_diff_tensor_pdb(run=run, 
scale=scale, file=file, dir=dir, force=force)
 
 
-    def create_vector_dist(self, run=None, length=1e-8, file='XH_dist.pdb', 
dir=None, force=0):
+    def create_vector_dist(self, run=None, length=2e-9, symmetry=1, 
file='XH_dist.pdb', dir=None, force=0):
         """Create a PDB file representation of the distribution of XH bond 
vectors.
 
         Keyword Arguments
@@ -178,6 +178,9 @@
         run:  The run to assign the structure to.
 
         length:  The length of the vectors in the PDB representation 
(meters).
+
+        symmetry:  A flag which, if set to 1, will create a second chain 
with reversed XH bond
+            orientations.
 
         file:  The name of the PDB file.
 
@@ -194,6 +197,10 @@
         into relax.  The origin of the vector distribution is located at the 
centre of mass (of the
         selected residues).  This vector distribution PDB file can 
subsequently be read into any
         molecular viewer.
+
+        Because of the symmetry of the diffusion tensor, reversing the 
orientation of the XH bond
+        vector has no effect.  Therefore by setting the symmetry flag, two 
chains 'A' and 'B' will
+        be added to the PDB file whereby chain 'B' is chain 'A' with the XH 
bonds reversed.
         """
 
         # Function intro text.
@@ -201,6 +208,7 @@
             text = sys.ps3 + "structure.create_vector_dist("
             text = text + "run=" + `run`
             text = text + ", length=" + `length`
+            text = text + ", symmetry=" + `symmetry`
             text = text + ", file=" + `file`
             text = text + ", dir=" + `dir`
             text = text + ", force=" + `force` + ")"
@@ -214,6 +222,10 @@
         if type(length) != float:
             raise RelaxFloatError, ('vector length', length)
 
+        # The symmetry flag.
+        if type(symmetry) != int or (symmetry != 0 and symmetry != 1):
+            raise RelaxBinError, ('symmetry flag', symmetry)
+
         # File name.
         if type(file) != str:
             raise RelaxStrError, ('file name', file)
@@ -227,7 +239,7 @@
             raise RelaxBinError, ('force flag', force)
 
         # Execute the functional code.
-        self.__relax__.generic.structure.create_vector_dist(run=run, 
length=length, file=file, dir=dir, force=force)
+        self.__relax__.generic.structure.create_vector_dist(run=run, 
length=length, symmetry=symmetry, file=file, dir=dir, force=force)
 
 
     def read_pdb(self, run=None, file=None, dir=None, model=None, 
load_seq=1):




Related Messages


Powered by MHonArc, Updated Thu Dec 07 07:00:08 2006