Author: bugman Date: Wed Feb 4 15:55:49 2009 New Revision: 8728 URL: http://svn.gna.org/viewcvs/relax?rev=8728&view=rev Log: Fixes for the load_pdb() method. Previously loaded structures were not being taken into account. Modified: 1.3/generic_fns/structure/scientific.py Modified: 1.3/generic_fns/structure/scientific.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/scientific.py?rev=8728&r1=8727&r2=8728&view=diff ============================================================================== --- 1.3/generic_fns/structure/scientific.py (original) +++ 1.3/generic_fns/structure/scientific.py Wed Feb 4 15:55:49 2009 @@ -41,6 +41,7 @@ from generic_fns import pipes, relax_re from generic_fns.mol_res_spin import Selection, parse_token, tokenise from relax_errors import RelaxError, RelaxPdbLoadError +from relax_io import file_root from relax_warnings import RelaxWarning, RelaxNoAtomWarning, RelaxNoPDBFileWarning, RelaxZeroVectorWarning @@ -557,6 +558,17 @@ mol_index = 0 new_mol_name = [] + # Set the target molecule number offset. + if set_mol_name: + mol_offset = [set_mol_name[mol_index]] + else: + # Number of structures already present for the model. + mol_offset = 0 + for i in range(len(self.structural_data)): + model_index = model_num - 1 + if not set_model_num or (model_index <= len(set_model_num) and set_model_num[model_index] == self.structural_data[i].num): + mol_offset = len(self.structural_data[i].mol) + # Store the original model number. orig_model_num.append(model_num) @@ -571,7 +583,7 @@ mol_conts[-1].append(MolContainer()) mol_conts[-1][-1].data = mol mol_conts[-1][-1].mol_type = 'protein' - self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1, file=file) + self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1+mol_offset, file=file) mol_index = mol_index + 1 # Then the nucleotide chains (generating the molecule names and incrementing the molecule index). @@ -580,7 +592,7 @@ mol_conts[-1].append(MolContainer()) mol_conts[-1][-1].data = mol mol_conts[-1][-1].mol_type = 'nucleic acid' - self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1, file=file) + self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1+mol_offset, file=file) mol_index = mol_index + 1 # Finally all other molecules (generating the molecule names and incrementing the molecule index). @@ -596,7 +608,7 @@ mol_conts[-1][-1].data.append(mol) # Update structures. - self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1, file=file) + self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1+mol_offset, file=file) mol_index = mol_index + 1 # Increment the model counter.