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

Source Code for Module prompt.palmer

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003, 2004 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 dir/mfin 79 dir/mfdata 80 dir/mfpar 81 dir/mfmodel 82 dir/run.sh 83 84 The file 'run/run.sh' contains the single command: 85 modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out 86 This can be used to execute modelfree4. 87 """ 88 89 # Function intro text. 90 if self.__relax__.interpreter.intro: 91 text = sys.ps3 + "palmer.create(" 92 text = text + "run=" + `run` 93 text = text + ", dir=" + `dir` 94 text = text + ", force=" + `force` 95 text = text + ", diff_search=" + `diff_search` 96 text = text + ", sims=" + `sims` 97 text = text + ", sim_type=" + `sim_type` 98 text = text + ", trim=" + `trim` 99 text = text + ", steps=" + `steps` 100 text = text + ", constraints=" + `constraints` 101 text = text + ", nucleus=" + `nucleus` 102 text = text + ", atom1=" + `atom1` 103 text = text + ", atom2=" + `atom2` + ")" 104 print text 105 106 # The run argument. 107 if type(run) != str: 108 raise RelaxStrError, ('run', run) 109 110 # Directory. 111 if dir != None: 112 if type(dir) != str: 113 raise RelaxNoneStrError, ('directory name', dir) 114 115 # The force flag. 116 if type(force) != int or (force != 0 and force != 1): 117 raise RelaxBinError, ('force flag', force) 118 119 # The diff_search argument. 120 if type(diff_search) != str: 121 raise RelaxStrError, ('diff_search', diff_search) 122 123 # The number of Monte Carlo simulations. 124 if type(sims) != int: 125 raise RelaxIntError, ('sims', sims) 126 127 # The sim_type argument. 128 if type(sim_type) != str: 129 raise RelaxStrError, ('sim_type', sim_type) 130 131 # The trim argument. 132 if type(trim) != float and type(trim) != int: 133 raise RelaxFloatError, ('trim', trim) 134 135 # The steps argument. 136 if type(steps) != int: 137 raise RelaxIntError, ('steps', steps) 138 139 # Constraint flag. 140 if type(constraints) != int or (constraints != 0 and constraints != 1): 141 raise RelaxBinError, ('constraint flag', constraints) 142 143 # The nucleus argument. 144 if type(nucleus) != str: 145 raise RelaxStrError, ('nucleus', nucleus) 146 147 # The atom1 argument. 148 if type(atom1) != str: 149 raise RelaxStrError, ('atom1', atom1) 150 151 # The atom2 argument. 152 if type(atom2) != str: 153 raise RelaxStrError, ('atom2', atom2) 154 155 # Execute the functional code. 156 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)
157 158
159 - def execute(self, run=None, dir=None, force=0):
160 """Function for executing Modelfree4. 161 162 Keyword Arguments 163 ~~~~~~~~~~~~~~~~~ 164 165 run: The name of the run. 166 167 dir: The directory to place the files. The default is the value of 'run'. 168 169 force: A flag which if set to 1 will cause the results file to be overwritten if it already 170 exists. 171 172 173 Description 174 ~~~~~~~~~~~ 175 176 Modelfree 4 will be executed as: 177 modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out 178 179 If a PDB file is loaded and non-isotropic diffusion is selected, then the file name will be 180 placed on the command line as '-s pdb_file_name'. 181 """ 182 183 # Function intro text. 184 if self.__relax__.interpreter.intro: 185 text = sys.ps3 + "palmer.execute(" 186 text = text + "run=" + `run` 187 text = text + ", dir=" + `dir` 188 text = text + ", force=" + `force` + ")" 189 print text 190 191 # The run argument. 192 if type(run) != str: 193 raise RelaxStrError, ('run', run) 194 195 # Directory. 196 if dir != None: 197 if type(dir) != str: 198 raise RelaxNoneStrError, ('directory name', dir) 199 200 # The force flag. 201 if type(force) != int or (force != 0 and force != 1): 202 raise RelaxBinError, ('force flag', force) 203 204 # Execute the functional code. 205 self.__relax__.generic.palmer.execute(run=run, dir=dir, force=force)
206 207
208 - def extract(self, run=None, dir=None):
209 """Function for extracting data from the Modelfree4 'mfout' star formatted file. 210 211 Keyword Arguments 212 ~~~~~~~~~~~~~~~~~ 213 214 run: The name of the run. 215 216 dir: The directory where the file 'mfout' is found. The default is the value of 'run'. 217 """ 218 219 # Function intro text. 220 if self.__relax__.interpreter.intro: 221 text = sys.ps3 + "palmer.extract(" 222 text = text + "run=" + `run` 223 text = text + ", dir=" + `dir` + ")" 224 print text 225 226 # The run argument. 227 if type(run) != str: 228 raise RelaxStrError, ('run', run) 229 230 # Directory. 231 if dir != None: 232 if type(dir) != str: 233 raise RelaxNoneStrError, ('directory name', dir) 234 235 # Execute the functional code. 236 self.__relax__.generic.palmer.extract(run=run, dir=dir)
237