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

Source Code for Module prompt.fix

 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   
26 -class Fix:
27 - def __init__(self, relax):
28 """Class containing the function for fixing or allowing parameter values to change.""" 29 30 self.relax = relax
31 32
33 - def fix(self, run=None, element=None, fixed=1):
34 """Function for either fixing or allowing parameter values to change. 35 36 Keyword Arguments 37 ~~~~~~~~~~~~~~~~~ 38 39 run: The name of the run. 40 41 element: Which element to fix. 42 43 fixed: A flag specifying if the parameters should be fixed or allowed to change. 44 45 46 Description 47 ~~~~~~~~~~~ 48 49 The keyword argument 'element' can be any of the following: 50 51 'diff' - the diffusion tensor parameters. This will allow all diffusion tensor parameters 52 to be toggled. 53 54 an integer - if an integer number is given, then all parameters for the residue 55 corresponding to that number will be toggled. 56 57 'all_res' - using this keyword, all parameters from all residues will be toggled. 58 59 'all' - all parameter will be toggled. This is equivalent to combining both 'diff' and 60 'all_res'. 61 62 63 The flag 'fixed', if set to 1, will fix parameters, while a value of 0 will allow parameters 64 to vary. 65 66 67 Only parameters corresponding to the given run will be affected. 68 """ 69 70 # Function intro text. 71 if self.relax.interpreter.intro: 72 text = sys.ps3 + "fix(" 73 text = text + "run=" + `run` 74 text = text + ", element=" + `element` 75 text = text + ", fixed=" + `fixed` + ")" 76 print text 77 78 # The run argument. 79 if type(run) != str: 80 raise RelaxStrError, ('run', run) 81 82 # The element argument. 83 if type(element) != str and type(element) != int: 84 raise RelaxIntStrError, ('element', element) 85 86 # The fixed argument. 87 if type(fixed) != int or (fixed != 0 and fixed != 1): 88 raise RelaxBinError, ('fixed', fixed) 89 90 # Execute the functional code. 91 self.relax.generic.fix.fix(run=run, element=element, fixed=fixed)
92