Package dx :: Module opendx
[hide private]
[frames] | no frames]

Source Code for Module dx.opendx

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003-2005 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  from os import system 
24  from re import search 
25   
26  from isosurface_3D import Iso3D 
27   
28   
29 -class OpenDX:
30 - def __init__(self, relax):
31 """Class containting the function for OpenDX.""" 32 33 # Place the program class structure under self.relax 34 self.relax = relax 35 36 # Set up all the classes. 37 self.iso3d = Iso3D(relax)
38 39
40 - def map(self, run=None, params=None, map_type='Iso3D', res_num=None, inc=20, lower=None, upper=None, axis_incs=10, file="map", dir="dx", point=None, point_file="point", remap=None):
41 """Function for mapping the given space and creating OpenDX files.""" 42 43 # Residue index. 44 index = None 45 if res_num: 46 for i in xrange(len(self.relax.data.res[run])): 47 if self.relax.data.res[run][i].num == res_num: 48 index = i 49 break 50 if index == None: 51 raise RelaxNoResError, res_num 52 53 # Space type. 54 if search("^[Ii]so3[Dd]", map_type): 55 if len(params) != 3: 56 raise RelaxError, "The 3D isosurface map requires a 3 parameter model." 57 58 # Create the map. 59 self.iso3d.map_space(run, params, res_num, index, inc, lower, upper, axis_incs, file, dir, point, point_file, remap) 60 else: 61 raise RelaxError, "The map type '" + map_type + "' is not supported."
62 63
64 - def run(self, file="map", dir="dx", dx_exe="dx", vp_exec=1):
65 """Function for running OpenDX.""" 66 67 # Text for changing to the directory dir. 68 dir_text = "" 69 if dir != None: 70 dir_text = " -directory " + dir 71 72 # Text for executing OpenDX. 73 execute_text = "" 74 if vp_exec: 75 execute_text = " -execute" 76 77 # Run OpenDX. 78 system(dx_exe + dir_text + " -program " + file + ".net" + execute_text + " &")
79