Author: bugman Date: Sun Nov 18 21:01:13 2007 New Revision: 3561 URL: http://svn.gna.org/viewcvs/relax?rev=3561&view=rev Log: Implemented the spin.create() user function. Modified: 1.3/prompt/spin.py Modified: 1.3/prompt/spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/spin.py?rev=3561&r1=3560&r2=3561&view=diff ============================================================================== --- 1.3/prompt/spin.py (original) +++ 1.3/prompt/spin.py Sun Nov 18 21:01:13 2007 @@ -115,55 +115,58 @@ spin.copy(pipe_from=pipe_from, spin_from=spin_from, pipe_to=pipe_to, spin_to=spin_to) - def create(self, res_num=None, res_name=None): - """Function for creating a new residue. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - res_num: The residue number. - - res_name: The name of the residue. - - - Description - ~~~~~~~~~~~ - - Using this function a new sequence can be generated without using the sequence user - functions. However if the sequence already exists, the new residue will be added to the end - of the residue list (the residue numbers of this list need not be sequential). The same - residue number cannot be used more than once. A corresponding single spin system will be - created for this residue. The spin system number and name or additional spin systems can be - added later if desired. + def create(self, spin_num=None, spin_name=None, res_id=None): + """Function for creating a new spin. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + spin_num: The spin number. + + spin_name: The name of the spin. + + res_id: The residue ID string identifying the residue to add the spin to. + + + Description + ~~~~~~~~~~~ + + This function will add a new spin data container to the relax data storage object. The same + spin number cannot be used more than once. Examples ~~~~~~~~ - The following sequence of commands will generate the sequence 1 ALA, 2 GLY, 3 LYS: - - relax> residue.create(1, 'ALA') - relax> residue.create(2, 'GLY') - relax> residue.create(3, 'LYS') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "residue.create(" - text = text + ", res_num=" + `res_num` - text = text + ", res_name=" + `res_name` + ")" - print text - - # Residue number. - if type(res_num) != int: - raise RelaxIntError, ('residue number', res_num) - - # Residue name. - if type(res_name) != str: - raise RelaxStrError, ('residue name', res_name) - - # Execute the functional code. - residue.create(res_num=res_num, res_name=res_name) + The following sequence of commands will generate the sequence 1 C4, 2 C9, 3 C15: + + relax> spin.create(1, 'C4') + relax> spin.create(2, 'C9') + relax> spin.create(3, 'C15') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "spin.create(" + text = text + ", spin_num=" + `spin_num` + text = text + ", spin_name=" + `spin_name` + text = text + ", res_id=" + `res_id` + ")" + print text + + # Spin number. + if type(spin_num) != int: + raise RelaxIntError, ('spin number', spin_num) + + # Spin name. + if type(spin_name) != str: + raise RelaxStrError, ('spin name', spin_name) + + # The residue ID. + if type(res_id) != str: + raise RelaxStrError, ('residue identification string', res_id) + + # Execute the functional code. + spin.create(spin_num=spin_num, spin_name=spin_name, res_id=res_id) def delete(self, res_id=None):