Author: bugman Date: Wed Feb 13 16:42:50 2013 New Revision: 18465 URL: http://svn.gna.org/viewcvs/relax?rev=18465&view=rev Log: Added the mol_name_target argument to the structure.load_spins user function. This allows spins from different molecules to be placed together in the same molecule container in the relax data store. Modified: trunk/generic_fns/structure/main.py trunk/user_functions/structure.py Modified: trunk/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/main.py?rev=18465&r1=18464&r2=18465&view=diff ============================================================================== --- trunk/generic_fns/structure/main.py (original) +++ trunk/generic_fns/structure/main.py Wed Feb 13 16:42:50 2013 @@ -334,13 +334,15 @@ write_data(out=sys.stdout, headings=["Spin_ID", "Position"], data=data) -def load_spins(spin_id=None, str_id=None, ave_pos=False): +def load_spins(spin_id=None, str_id=None, mol_name_target=None, ave_pos=False): """Load the spins from the structural object into the relax data store. @keyword spin_id: The molecule, residue, and spin identifier string. @type spin_id: str @keyword str_id: The structure identifier. This can be the file name, model number, or structure number. @type str_id: int or str + @keyword mol_name: The name of target molecule container, overriding the name of the loaded structures + @type mol_name: str or None @keyword ave_pos: A flag specifying if the average atom position or the atom position from all loaded structures is loaded into the SpinContainer. @type ave_pos: bool """ @@ -368,6 +370,10 @@ # Loop over all atoms of the spin_id selection. for model_num, mol_name, res_num, res_name, atom_num, atom_name, element, pos in cdp.structure.atom_loop(atom_id=spin_id, str_id=str_id, model_num_flag=True, mol_name_flag=True, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, element_flag=True, pos_flag=True, ave=ave_pos): + # Override the molecule name. + if mol_name_target: + mol_name = mol_name_target + # Update the model info. if last_model != model_num: model_index = model_index + 1 @@ -398,7 +404,10 @@ # Append all the spin ID info for the first model for printing later. if model_index == 0: - mol_names.append(mol_name) + if mol_name_target: + mol_names.append(mol_name_target) + else: + mol_names.append(mol_name) res_nums.append(res_num) res_names.append(res_name) spin_nums.append(atom_num) Modified: trunk/user_functions/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/structure.py?rev=18465&r1=18464&r2=18465&view=diff ============================================================================== --- trunk/user_functions/structure.py (original) +++ trunk/user_functions/structure.py Wed Feb 13 16:42:50 2013 @@ -428,6 +428,12 @@ desc = "The spin identification string for the selective loading of certain spins into the relax data store.", wiz_combo_choices = ["@N", "@C", "@H", "@O", "@P", "@NE1", "@HE1", ":A@C2", ":A@C8", ":G@N1", ":G@C8", ":C@C5", ":C@C5", ":U@N3", ":U@C5", ":U@C6"], can_be_none = True +) +uf.add_keyarg( + name = "mol_name_target", + py_type = "str", + desc_short = "target molecule name", + desc = "The name of target molecule container, overriding the name of the loaded structures." ) uf.add_keyarg( name = "ave_pos",