Package prompt :: Module palmer
[hide private]
[frames] | no frames]

Source Code for Module prompt.palmer

  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  import sys 
 24   
 25  import help 
 26   
 27   
28 -class Palmer:
29 - def __init__(self, relax):
30 # Help. 31 self.__relax_help__ = \ 32 """Class for interfacing with Art Palmer's Modelfree 4.""" 33 34 # Add the generic help string. 35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help 36 37 # Place relax in the class namespace. 38 self.__relax__ = relax
39 40
41 - def create(self, run=None, dir=None, force=0, diff_search='none', sims=0, sim_type='pred', trim=0, steps=20, constraints=1, nucleus='15N', atom1='N', atom2='H'):
42 """Function for creating the Modelfree4 input files. 43 44 Keyword Arguments 45 ~~~~~~~~~~~~~~~~~ 46 47 run: The name of the run. 48 49 dir: The directory to place the files. The default is the value of 'run'. 50 51 force: A flag which if set to 1 will cause the results file to be overwritten if it already 52 exists. 53 54 diff_search: See the Modelfree4 manual for 'diffusion_search'. 55 56 sims: The number of Monte Carlo simulations. 57 58 sim_type: See the Modelfree4 manual. 59 60 trim: See the Modelfree4 manual. 61 62 steps: See the Modelfree4 manual. 63 64 constraints: A flag specifying whether the parameters should be constrained. The default 65 is to turn constraints on (constraints=1). 66 67 nucleus: A three letter string describing the nucleus type, ie 15N, 13C, etc. 68 69 atom1: The symbol of the X nucleus in the pdb file. 70 71 atom2: The symbol of the H nucleus in the pdb file. 72 73 74 Description 75 ~~~~~~~~~~~ 76 77 The following files are created 78 79 'dir/mfin', 80 'dir/mfdata', 81 'dir/mfpar', 82 'dir/mfmodel', 83 'dir/run.sh'. 84 85 The file 'run/run.sh' contains the single command, 86 87 'modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out', 88 89 which can be used to execute modelfree4. 90 """ 91 92 # Function intro text. 93 if self.__relax__.interpreter.intro: 94 text = sys.ps3 + "palmer.create(" 95 text = text + "run=" + `run` 96 text = text + ", dir=" + `dir` 97 text = text + ", force=" + `force` 98 text = text + ", diff_search=" + `diff_search` 99 text = text + ", sims=" + `sims` 100 text = text + ", sim_type=" + `sim_type` 101 text = text + ", trim=" + `trim` 102 text = text + ", steps=" + `steps` 103 text = text + ", constraints=" + `constraints` 104 text = text + ", nucleus=" + `nucleus` 105 text = text + ", atom1=" + `atom1` 106 text = text + ", atom2=" + `atom2` + ")" 107 print text 108 109 # The run argument. 110 if type(run) != str: 111 raise RelaxStrError, ('run', run) 112 113 # Directory. 114 if dir != None: 115 if type(dir) != str: 116 raise RelaxNoneStrError, ('directory name', dir) 117 118 # The force flag. 119 if type(force) != int or (force != 0 and force != 1): 120 raise RelaxBinError, ('force flag', force) 121 122 # The diff_search argument. 123 if type(diff_search) != str: 124 raise RelaxStrError, ('diff_search', diff_search) 125 126 # The number of Monte Carlo simulations. 127 if type(sims) != int: 128 raise RelaxIntError, ('sims', sims) 129 130 # The sim_type argument. 131 if type(sim_type) != str: 132 raise RelaxStrError, ('sim_type', sim_type) 133 134 # The trim argument. 135 if type(trim) != float and type(trim) != int: 136 raise RelaxFloatError, ('trim', trim) 137 138 # The steps argument. 139 if type(steps) != int: 140 raise RelaxIntError, ('steps', steps) 141 142 # Constraint flag. 143 if type(constraints) != int or (constraints != 0 and constraints != 1): 144 raise RelaxBinError, ('constraint flag', constraints) 145 146 # The nucleus argument. 147 if type(nucleus) != str: 148 raise RelaxStrError, ('nucleus', nucleus) 149 150 # The atom1 argument. 151 if type(atom1) != str: 152 raise RelaxStrError, ('atom1', atom1) 153 154 # The atom2 argument. 155 if type(atom2) != str: 156 raise RelaxStrError, ('atom2', atom2) 157 158 # Execute the functional code. 159 self.__relax__.generic.palmer.create(run=run, dir=dir, force=force, diff_search=diff_search, sims=sims, sim_type=sim_type, trim=trim, steps=steps, constraints=constraints, nucleus=nucleus, atom1=atom1, atom2=atom2)
160 161
162 - def execute(self, run=None, dir=None, force=0):
163 """Function for executing Modelfree4. 164 165 Keyword Arguments 166 ~~~~~~~~~~~~~~~~~ 167 168 run: The name of the run. 169 170 dir: The directory to place the files. The default is the value of 'run'. 171 172 force: A flag which if set to 1 will cause the results file to be overwritten if it already 173 exists. 174 175 176 Description 177 ~~~~~~~~~~~ 178 179 Modelfree 4 will be executed as 180 181 $ modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out 182 183 If a PDB file is loaded and non-isotropic diffusion is selected, then the file name will be 184 placed on the command line as '-s pdb_file_name'. 185 """ 186 187 # Function intro text. 188 if self.__relax__.interpreter.intro: 189 text = sys.ps3 + "palmer.execute(" 190 text = text + "run=" + `run` 191 text = text + ", dir=" + `dir` 192 text = text + ", force=" + `force` + ")" 193 print text 194 195 # The run argument. 196 if type(run) != str: 197 raise RelaxStrError, ('run', run) 198 199 # Directory. 200 if dir != None: 201 if type(dir) != str: 202 raise RelaxNoneStrError, ('directory name', dir) 203 204 # The force flag. 205 if type(force) != int or (force != 0 and force != 1): 206 raise RelaxBinError, ('force flag', force) 207 208 # Execute the functional code. 209 self.__relax__.generic.palmer.execute(run=run, dir=dir, force=force)
210 211
212 - def extract(self, run=None, dir=None):
213 """Function for extracting data from the Modelfree4 'mfout' star formatted file. 214 215 Keyword Arguments 216 ~~~~~~~~~~~~~~~~~ 217 218 run: The name of the run. 219 220 dir: The directory where the file 'mfout' is found. The default is the value of 'run'. 221 """ 222 223 # Function intro text. 224 if self.__relax__.interpreter.intro: 225 text = sys.ps3 + "palmer.extract(" 226 text = text + "run=" + `run` 227 text = text + ", dir=" + `dir` + ")" 228 print text 229 230 # The run argument. 231 if type(run) != str: 232 raise RelaxStrError, ('run', run) 233 234 # Directory. 235 if dir != None: 236 if type(dir) != str: 237 raise RelaxNoneStrError, ('directory name', dir) 238 239 # Execute the functional code. 240 self.__relax__.generic.palmer.extract(run=run, dir=dir)
241