Author: bugman Date: Fri Feb 15 11:06:25 2008 New Revision: 5005 URL: http://svn.gna.org/viewcvs/relax?rev=5005&view=rev Log: Modified the centre_of_mass() function to use obey the selections in the mol-res-spin structure. Modified: 1.3/generic_fns/structure.py Modified: 1.3/generic_fns/structure.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure.py?rev=5005&r1=5004&r2=5005&view=diff ============================================================================== --- 1.3/generic_fns/structure.py (original) +++ 1.3/generic_fns/structure.py Fri Feb 15 11:06:25 2008 @@ -206,6 +206,16 @@ # Loop over the structures. for struct in cdp.structure.structures: + # Get the corresponding molecule container. + if cdp.mol[0].name == None: + mol_cont = cdp.mol[0] + else: + mol_cont = return_molecule(struct.name) + + # Deselected molecule. + if not mol_cont.select: + continue + # Protein. if struct.peptide_chains: chains = struct.peptide_chains @@ -216,23 +226,28 @@ # Loop over the residues of the protein in the PDB file. for res in chains[0].residues: - # Find the corresponding residue in 'relax_data_store'. - found = 0 - for res_data in relax_data_store.res[run]: - if res.number == res_data.num: - found = 1 - break - - # Doesn't exist. - if not found: - continue - - # Skip unselected residues. - if not res_data.select: + # Get the corresponding residue container. + if mol_cont.res[0].name == None and mol_cont.res[0].num == None: + res_cont = mol_cont.res[0] + else: + res_cont = return_residue(res.number) + + # Deselected residue. + if not res_cont.select: continue # Loop over the atoms of the residue. for atom in res: + # Get the corresponding spin container. + if res_cont.spin[0].name == None and res_cont.spin[0].num == None: + spin_cont = res_cont.spin[0] + else: + spin_cont = return_spin(atom.properties['number']) + + # Deselected spin. + if not spin_cont.select: + continue + # Atomic mass. mass = atomic_mass(atom.properties['element'])