Author: bugman Date: Fri Aug 26 12:23:00 2011 New Revision: 14481 URL: http://svn.gna.org/viewcvs/relax?rev=14481&view=rev Log: Renamed the PyMOL and Molmol macro user function back ends. Modified: 1.3/generic_fns/molmol.py 1.3/generic_fns/pymol_control.py Modified: 1.3/generic_fns/molmol.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/molmol.py?rev=14481&r1=14480&r2=14481&view=diff ============================================================================== --- 1.3/generic_fns/molmol.py (original) +++ 1.3/generic_fns/molmol.py Fri Aug 26 12:23:00 2011 @@ -204,7 +204,7 @@ return commands -def macro_exec(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): +def macro_apply(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): """Execute a Molmol macro. @keyword data_type: The data type to map to the structure. @@ -234,69 +234,7 @@ molmol_obj.exec_cmd(command) -def ribbon(): - """Apply the Molmol ribbon style.""" - - # Calculate the protons. - molmol_obj.exec_cmd("CalcAtom 'H'") - molmol_obj.exec_cmd("CalcAtom 'HN'") - - # Calculate the secondary structure. - molmol_obj.exec_cmd("CalcSecondary") - - # Execute the ribbon macro. - molmol_obj.exec_cmd("XMacStand ribbon.mac") - - -def tensor_pdb(file=None): - """Display the diffusion tensor geometric structure. - - @keyword file: The name of the PDB file containing the tensor geometric object. - @type file: str - """ - - # Test if the current data pipe exists. - pipes.test() - - # To overlay the structure with the diffusion tensor, select all and reorient to the PDB frame. - molmol_obj.exec_cmd("SelectAtom ''") - molmol_obj.exec_cmd("SelectBond ''") - molmol_obj.exec_cmd("SelectAngle ''") - molmol_obj.exec_cmd("SelectDist ''") - molmol_obj.exec_cmd("SelectPrim ''") - molmol_obj.exec_cmd("RotateInit") - molmol_obj.exec_cmd("MoveInit") - - # Read in the tensor PDB file and force Molmol to recognise the CONECT records (not that it will show the bonds)! - molmol_obj.exec_cmd("ReadPdb " + file) - file_parts = split(file, '.') - molmol_obj.exec_cmd("SelectMol '@" + file_parts[0] + "'") - molmol_obj.exec_cmd("CalcBond 1 1 1") - - # Apply the 'ball/stick' style to the tensor. - molmol_obj.exec_cmd("SelectAtom '0'") - molmol_obj.exec_cmd("SelectBond '0'") - molmol_obj.exec_cmd("SelectAtom ':TNS'") - molmol_obj.exec_cmd("SelectBond ':TNS'") - molmol_obj.exec_cmd("XMacStand ball_stick.mac") - - # Touch up. - molmol_obj.exec_cmd("RadiusAtom 1") - molmol_obj.exec_cmd("SelectAtom ':TNS@C*'") - molmol_obj.exec_cmd("RadiusAtom 1.5") - - -def view(): - """Start Molmol.""" - - # Open a Molmol pipe. - if molmol_obj.running(): - raise RelaxError("The Molmol pipe already exists.") - else: - molmol_obj.open_gui() - - -def write(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir=None, force=False): +def macro_write(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir=None, force=False): """Create a Molmol macro. @keyword data_type: The data type to map to the structure. @@ -347,3 +285,65 @@ cdp.result_files = [] cdp.result_files.append(['grace', 'Grace', file_path]) status.observers.result_file.notify() + + +def ribbon(): + """Apply the Molmol ribbon style.""" + + # Calculate the protons. + molmol_obj.exec_cmd("CalcAtom 'H'") + molmol_obj.exec_cmd("CalcAtom 'HN'") + + # Calculate the secondary structure. + molmol_obj.exec_cmd("CalcSecondary") + + # Execute the ribbon macro. + molmol_obj.exec_cmd("XMacStand ribbon.mac") + + +def tensor_pdb(file=None): + """Display the diffusion tensor geometric structure. + + @keyword file: The name of the PDB file containing the tensor geometric object. + @type file: str + """ + + # Test if the current data pipe exists. + pipes.test() + + # To overlay the structure with the diffusion tensor, select all and reorient to the PDB frame. + molmol_obj.exec_cmd("SelectAtom ''") + molmol_obj.exec_cmd("SelectBond ''") + molmol_obj.exec_cmd("SelectAngle ''") + molmol_obj.exec_cmd("SelectDist ''") + molmol_obj.exec_cmd("SelectPrim ''") + molmol_obj.exec_cmd("RotateInit") + molmol_obj.exec_cmd("MoveInit") + + # Read in the tensor PDB file and force Molmol to recognise the CONECT records (not that it will show the bonds)! + molmol_obj.exec_cmd("ReadPdb " + file) + file_parts = split(file, '.') + molmol_obj.exec_cmd("SelectMol '@" + file_parts[0] + "'") + molmol_obj.exec_cmd("CalcBond 1 1 1") + + # Apply the 'ball/stick' style to the tensor. + molmol_obj.exec_cmd("SelectAtom '0'") + molmol_obj.exec_cmd("SelectBond '0'") + molmol_obj.exec_cmd("SelectAtom ':TNS'") + molmol_obj.exec_cmd("SelectBond ':TNS'") + molmol_obj.exec_cmd("XMacStand ball_stick.mac") + + # Touch up. + molmol_obj.exec_cmd("RadiusAtom 1") + molmol_obj.exec_cmd("SelectAtom ':TNS@C*'") + molmol_obj.exec_cmd("RadiusAtom 1.5") + + +def view(): + """Start Molmol.""" + + # Open a Molmol pipe. + if molmol_obj.running(): + raise RelaxError("The Molmol pipe already exists.") + else: + molmol_obj.open_gui() Modified: 1.3/generic_fns/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pymol_control.py?rev=14481&r1=14480&r2=14481&view=diff ============================================================================== --- 1.3/generic_fns/pymol_control.py (original) +++ 1.3/generic_fns/pymol_control.py Fri Aug 26 12:23:00 2011 @@ -348,7 +348,7 @@ return commands -def macro_exec(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): +def macro_apply(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): """Execute a PyMOL macro. @keyword data_type: The data type to map to the structure. @@ -378,121 +378,7 @@ pymol_obj.exec_cmd(command) -def tensor_pdb(file=None): - """Display the diffusion tensor geometric structure. - - @keyword file: The name of the file containing the diffusion tensor geometric object. - @type file: str - """ - - # Test if the current data pipe exists. - pipes.test() - - # Read in the tensor PDB file. - pymol_obj.exec_cmd("load " + file) - - - # The tensor object. - #################### - - # Select the TNS residue. - pymol_obj.exec_cmd("select resn TNS") - - # Hide everything. - pymol_obj.exec_cmd("hide ('sele')") - - # Show as 'sticks'. - pymol_obj.exec_cmd("show sticks, 'sele'") - - - # Centre of mass. - ################# - - # Select the COM residue. - pymol_obj.exec_cmd("select resn COM") - - # Show the centre of mass as the dots representation. - pymol_obj.exec_cmd("show dots, 'sele'") - - # Colour it blue. - pymol_obj.exec_cmd("color blue, 'sele'") - - - # The diffusion tensor axes. - ############################ - - # Select the AXS residue. - pymol_obj.exec_cmd("select resn AXS") - - # Hide everything. - pymol_obj.exec_cmd("hide ('sele')") - - # Show as 'sticks'. - pymol_obj.exec_cmd("show sticks, 'sele'") - - # Colour it cyan. - pymol_obj.exec_cmd("color cyan, 'sele'") - - # Select the N atoms of the AXS residue (used to display the axis labels). - pymol_obj.exec_cmd("select (resn AXS and elem N)") - - # Label the atoms. - pymol_obj.exec_cmd("label 'sele', name") - - - - # Monte Carlo simulations. - ########################## - - # Select the SIM residue. - pymol_obj.exec_cmd("select resn SIM") - - # Colour it. - pymol_obj.exec_cmd("colour cyan, 'sele'") - - - # Clean up. - ########### - - # Remove the selection. - pymol_obj.exec_cmd("cmd.delete('sele')") - - -def vector_dist(file=None): - """Display the XH bond vector distribution. - - @keyword file: The vector distribution PDB file. - @type file: str - """ - - # Test if the current data pipe exists. - pipes.test() - - # The file root. - id = file_root(file) - - # Read in the vector distribution PDB file. - pymol_obj.exec_cmd("load " + file) - - - # Create a surface. - ################### - - # Select the vector distribution. - pymol_obj.exec_cmd("cmd.show('surface', " + repr(id) + ")") - - -def view(): - """Start PyMOL.""" - - # Open PyMOL. - if pymol_obj.running(): - raise RelaxError("PyMOL is already running.") - else: - pymol_obj.open_gui() - - -def write(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir=None, force=False): +def macro_write(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir=None, force=False): """Create a PyMOL macro file. @keyword data_type: The data type to map to the structure. @@ -543,3 +429,117 @@ cdp.result_files = [] cdp.result_files.append(['pymol', 'PyMOL', file_path]) status.observers.result_file.notify() + + +def tensor_pdb(file=None): + """Display the diffusion tensor geometric structure. + + @keyword file: The name of the file containing the diffusion tensor geometric object. + @type file: str + """ + + # Test if the current data pipe exists. + pipes.test() + + # Read in the tensor PDB file. + pymol_obj.exec_cmd("load " + file) + + + # The tensor object. + #################### + + # Select the TNS residue. + pymol_obj.exec_cmd("select resn TNS") + + # Hide everything. + pymol_obj.exec_cmd("hide ('sele')") + + # Show as 'sticks'. + pymol_obj.exec_cmd("show sticks, 'sele'") + + + # Centre of mass. + ################# + + # Select the COM residue. + pymol_obj.exec_cmd("select resn COM") + + # Show the centre of mass as the dots representation. + pymol_obj.exec_cmd("show dots, 'sele'") + + # Colour it blue. + pymol_obj.exec_cmd("color blue, 'sele'") + + + # The diffusion tensor axes. + ############################ + + # Select the AXS residue. + pymol_obj.exec_cmd("select resn AXS") + + # Hide everything. + pymol_obj.exec_cmd("hide ('sele')") + + # Show as 'sticks'. + pymol_obj.exec_cmd("show sticks, 'sele'") + + # Colour it cyan. + pymol_obj.exec_cmd("color cyan, 'sele'") + + # Select the N atoms of the AXS residue (used to display the axis labels). + pymol_obj.exec_cmd("select (resn AXS and elem N)") + + # Label the atoms. + pymol_obj.exec_cmd("label 'sele', name") + + + + # Monte Carlo simulations. + ########################## + + # Select the SIM residue. + pymol_obj.exec_cmd("select resn SIM") + + # Colour it. + pymol_obj.exec_cmd("colour cyan, 'sele'") + + + # Clean up. + ########### + + # Remove the selection. + pymol_obj.exec_cmd("cmd.delete('sele')") + + +def vector_dist(file=None): + """Display the XH bond vector distribution. + + @keyword file: The vector distribution PDB file. + @type file: str + """ + + # Test if the current data pipe exists. + pipes.test() + + # The file root. + id = file_root(file) + + # Read in the vector distribution PDB file. + pymol_obj.exec_cmd("load " + file) + + + # Create a surface. + ################### + + # Select the vector distribution. + pymol_obj.exec_cmd("cmd.show('surface', " + repr(id) + ")") + + +def view(): + """Start PyMOL.""" + + # Open PyMOL. + if pymol_obj.running(): + raise RelaxError("PyMOL is already running.") + else: + pymol_obj.open_gui()