Author: bugman Date: Tue Dec 8 16:40:42 2009 New Revision: 10073 URL: http://svn.gna.org/viewcvs/relax?rev=10073&view=rev Log: The PCS centre can now be forcefully overwritten. Modified: 1.3/generic_fns/pcs.py 1.3/prompt/pcs.py Modified: 1.3/generic_fns/pcs.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pcs.py?rev=10073&r1=10072&r2=10073&view=diff ============================================================================== --- 1.3/generic_fns/pcs.py (original) +++ 1.3/generic_fns/pcs.py Tue Dec 8 16:40:42 2009 @@ -135,7 +135,7 @@ spin.relax_sim_data.append(values) -def centre(pos=None, atom_id=None, pipe=None, ave_pos=False): +def centre(pos=None, atom_id=None, pipe=None, ave_pos=False, force=False): """Specify the atom in the loaded structure corresponding to the paramagnetic centre. @keyword pos: The atomic position. If set, the atom_id string will be ignored. @@ -144,9 +144,9 @@ @type atom_id: str @keyword pipe: An alternative data pipe to extract the paramagnetic centre from. @type pipe: None or str - @keyword ave_pos: A flag which if True causes the atomic positions from multiple models to be - averaged. + @keyword ave_pos: A flag which if True causes the atomic positions from multiple models to be averaged. @type ave_pos: bool + @keyword force: A flag which if True will cause the current PCS centre to be overwritten. """ # The data pipe. @@ -164,7 +164,7 @@ raise RelaxNoPdbError # Test the centre has already been set. - if hasattr(cdp, 'paramagnetic_centre'): + if not force and hasattr(cdp, 'paramagnetic_centre'): raise RelaxError("The paramagnetic centre has already been set to the coordinates " + repr(cdp.paramagnetic_centre) + ".") # Position is supplied. Modified: 1.3/prompt/pcs.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/pcs.py?rev=10073&r1=10072&r2=10073&view=diff ============================================================================== --- 1.3/prompt/pcs.py (original) +++ 1.3/prompt/pcs.py Tue Dec 8 16:40:42 2009 @@ -59,7 +59,7 @@ pcs.back_calc(align_id=align_id) - def centre(self, pos=None, atom_id=None, pipe=None, ave_pos=True): + def centre(self, pos=None, atom_id=None, pipe=None, ave_pos=True, force=False): """Specify which atom is the paramagnetic centre. Keyword Arguments @@ -72,6 +72,8 @@ pipe: The data pipe containing the structures to extract the centre from. ave_pos: A flag specifying if the position of the atom is to be averaged across all models. + + force: A flag which if True will cause the current PCS centre to be overwritten. Description @@ -118,7 +120,8 @@ text = text + "pos=" + repr(pos) text = text + ", atom_id=" + repr(atom_id) text = text + ", pipe=" + repr(pipe) - text = text + ", ave_pos=" + repr(ave_pos) + ")" + text = text + ", ave_pos=" + repr(ave_pos) + text = text + ", force=" + repr(force) + ")" print(text) # The argument checks. @@ -126,9 +129,10 @@ arg_check.is_str(atom_id, 'atom ID string', can_be_none=True) arg_check.is_str(pipe, 'data pipe', can_be_none=True) arg_check.is_bool(ave_pos, 'average position flag') - - # Execute the functional code. - pcs.centre(pos=pos, atom_id=atom_id, pipe=pipe, ave_pos=ave_pos) + arg_check.is_bool(force, 'force flag') + + # Execute the functional code. + pcs.centre(pos=pos, atom_id=atom_id, pipe=pipe, ave_pos=ave_pos, force=force) def copy(self, pipe_from=None, pipe_to=None, align_id=None):