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

Source Code for Module generic_fns.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  from re import match 
24   
25 -class Fix:
26 - def __init__(self, relax):
27 """Class containing the function for fixing or allowing parameter values to change.""" 28 29 self.relax = relax
30 31
32 - def fix(self, run, element, fixed):
33 """Function for fixing or allowing parameter values to change.""" 34 35 # Test if the run exists. 36 if not run in self.relax.data.run_names: 37 raise RelaxNoRunError, run 38 39 # Diffusion tensor. 40 if element == 'diff': 41 # Test if the diffusion tensor data is loaded. 42 if not self.relax.data.diff.has_key(run): 43 raise RelaxNoTensorError, run 44 45 # Set the fixed flag. 46 self.relax.data.diff[run].fixed = fixed 47 48 49 # All residues. 50 elif element == 'all_res': 51 # Test if sequence data is loaded. 52 if not self.relax.data.res.has_key(run): 53 raise RelaxNoSequenceError, run 54 55 # Loop over the sequence and set the fixed flag. 56 for i in xrange(len(self.relax.data.res[run])): 57 self.relax.data.res[run][i].fixed = fixed 58 59 60 # All parameters. 61 elif element == 'all': 62 # Test if sequence data is loaded. 63 if not self.relax.data.res.has_key(run): 64 raise RelaxNoSequenceError, run 65 66 # Test if the diffusion tensor data is loaded. 67 if not self.relax.data.diff.has_key(run): 68 raise RelaxNoTensorError, run 69 70 # Set the fixed flag for the diffusion tensor. 71 self.relax.data.diff[run].fixed = fixed 72 73 # Loop over the sequence and set the fixed flag. 74 for i in xrange(len(self.relax.data.res[run])): 75 self.relax.data.res[run][i].fixed = fixed 76 77 78 # Unknown. 79 else: 80 raise RelaxError, "The 'element' argument " + `element` + " is unknown."
81