[prev in list] [next in list] [prev in thread] [next in thread] 

List:       relax-commits
Subject:    r2700 - in /branches/tensor_pdb: generic_fns/molmol.py prompt/molmol.py
From:       edward.dauvergne () domain ! hid
Date:       2006-10-29 7:42:33
Message-ID: E1Ge5JR-0006KT-Im () domain ! hid
[Download RAW message or body]

Author: bugman
Date: Sun Oct 29 08:42:32 2006
New Revision: 2700

URL: http://svn.gna.org/viewcvs/relax?rev=2700&view=rev
Log:
Created the user function 'molmol.tensor_pdb()' for displaying the diffusion tensor \
in Molmol.

The function takes the pre-generated diffusion tensor PDB file, created with the user \
function 'pdb.create_tensor_pdb()', and displays it in Molmol over the loaded \
structure.


Modified:
    branches/tensor_pdb/generic_fns/molmol.py
    branches/tensor_pdb/prompt/molmol.py

Modified: branches/tensor_pdb/generic_fns/molmol.py
URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/molmol.py?rev=2700&r1=2699&r2=2700&view=diff
 ==============================================================================
--- branches/tensor_pdb/generic_fns/molmol.py (original)
+++ branches/tensor_pdb/generic_fns/molmol.py Sun Oct 29 08:42:32 2006
@@ -21,6 +21,7 @@
 ###############################################################################
 
 from os import popen
+from string import split
 
 
 class Molmol:
@@ -190,6 +191,44 @@
         self.pipe_write("XMacStand ribbon.mac")
 
 
+    def tensor_pdb(self, run=None, file=None):
+        """Display the diffusion tensor geometric structure."""
+
+        # Arguments.
+        self.run = run
+
+        # Test if the run exists.
+        if not self.run in self.relax.data.run_names:
+            raise RelaxNoRunError, self.run
+
+        # To overlay the structure with the diffusion tensor, select all and \
reorient to the PDB frame. +        self.pipe_write("SelectAtom ''")
+        self.pipe_write("SelectBond ''")
+        self.pipe_write("SelectAngle ''")
+        self.pipe_write("SelectDist ''")
+        self.pipe_write("SelectPrim ''")
+        self.pipe_write("RotateInit")
+        self.pipe_write("MoveInit")
+
+        # Read in the tensor PDB file and force Molmol to recognise the CONECT \
records (not that it will show the bonds)! +        self.pipe_write("ReadPdb " + \
file) +        file_parts = split(file, '.')
+        self.pipe_write("SelectMol '@" + file_parts[0] + "'")
+        self.pipe_write("CalcBond 1 1 1")
+
+        # Apply the 'ball/stick' style to the tensor.
+        self.pipe_write("SelectAtom '0'")
+        self.pipe_write("SelectBond '0'")
+        self.pipe_write("SelectAtom ':TNS'")
+        self.pipe_write("SelectBond ':TNS'")
+        self.pipe_write("XMacStand ball_stick.mac")
+
+        # Touch up.
+        self.pipe_write("RadiusAtom 1")
+        self.pipe_write("SelectAtom ':TNS@C*'")
+        self.pipe_write("RadiusAtom 1.5")
+
+
     def view(self, run=None):
         """Function for running Molmol."""
 

Modified: branches/tensor_pdb/prompt/molmol.py
URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/molmol.py?rev=2700&r1=2699&r2=2700&view=diff
 ==============================================================================
--- branches/tensor_pdb/prompt/molmol.py (original)
+++ branches/tensor_pdb/prompt/molmol.py Sun Oct 29 08:42:32 2006
@@ -241,6 +241,80 @@
 
         # Execute the functional code.
         self.__relax__.generic.molmol.ribbon(run=run)
+
+
+    def tensor_pdb(self, run=None, file=None):
+        """Function displaying the diffusion tensor PDB geometric object over the \
loaded PDB. +
+        Keyword Arguments
+        ~~~~~~~~~~~~~~~~~
+
+        run:  The name of the run.
+
+        file:  The name of the PDB file containing the tensor geometric object.
+
+
+        Description
+        ~~~~~~~~~~~
+
+        In executing this user function, a PDB file must have previously been loaded \
into this run, +        a geometric object or polygon representing the Brownian \
rotational diffusion tensor will be +        overlain with the loaded PDB file and \
displayed within Molmol.  The PDB file containing the +        geometric object must \
be created using the complementary 'pdb.create_tensor_pdb()' user +        function.
+
+        To display the diffusion tensor, the multiple commands will be executed.  To \
overlay the +        structure with the diffusion tensor, everything will be selected \
and reoriented and moved to +        their original PDB frame positions:
+
+            SelectAtom ''
+            SelectBond ''
+            SelectAngle ''
+            SelectDist ''
+            SelectPrim ''
+            RotateInit
+            MoveInit
+
+        Next the tensor PDB file is read in, selected, and the covalent bonds of the \
PDB CONECT +        records calculated:
+
+            ReadPdb file
+            SelectMol '@file'
+            CalcBond 1 1 1
+
+        Then only the atoms and bonds of the geometric object are selected and the \
'ball/stick' +        style applied:
+
+            SelectAtom '0'
+            SelectBond '0'
+            SelectAtom ':TNS'
+            SelectBond ':TNS'
+            XMacStand ball_stick.mac
+
+        The appearance is finally touched up:
+
+            RadiusAtom 1
+            SelectAtom ':TNS@C*'
+            RadiusAtom 1.5
+        """
+
+        # Function intro text.
+        if self.__relax__.interpreter.intro:
+            text = sys.ps3 + "molmol.tensor_pdb("
+            text = text + "run=" + `run`
+            text = text + ", file=" + `file` + ")"
+            print text
+
+        # The run name.
+        if type(run) != str:
+            raise RelaxStrError, ('run', run)
+
+        # The file name.
+        if type(file) != str:
+            raise RelaxStrError, ('file name', file)
+
+        # Execute the functional code.
+        self.__relax__.generic.molmol.tensor_pdb(run=run, file=file)
 
 
     def view(self, run=None):


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic