Author: bugman Date: Mon Jul 2 18:08:29 2012 New Revision: 17133 URL: http://svn.gna.org/viewcvs/relax?rev=17133&view=rev Log: More BMRB function conversions for the interatomic data design. Modified: branches/interatomic/generic_fns/diffusion_tensor.py branches/interatomic/test_suite/system_tests/scripts/bmrb_rw.py Modified: branches/interatomic/generic_fns/diffusion_tensor.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/diffusion_tensor.py?rev=17133&r1=17132&r2=17133&view=diff ============================================================================== --- branches/interatomic/generic_fns/diffusion_tensor.py (original) +++ branches/interatomic/generic_fns/diffusion_tensor.py Mon Jul 2 18:08:29 2012 @@ -37,7 +37,8 @@ from data.diff_tensor import DiffTensorData from generic_fns import pipes from generic_fns.angles import fold_spherical_angles -from generic_fns.mol_res_spin import get_molecule_names, spin_loop +from generic_fns.interatomic import return_interatom_list +from generic_fns.mol_res_spin import get_molecule_names, return_spin, spin_loop from maths_fns.coord_transform import cartesian_to_spherical from maths_fns.rotation_matrix import R_to_euler_zyz from physical_constants import element_from_isotope, number_from_isotope @@ -175,7 +176,7 @@ raise RelaxError("For the BMRB, the residue of spin '%s' must be named." % spin_id) if spin.name == None: raise RelaxError("For the BMRB, the spin '%s' must be named." % spin_id) - if spin.heteronuc_type == None: + if not hasattr(spin, 'isotope') or spin.isotope == None: raise RelaxError("For the BMRB, the spin isotope type of '%s' must be specified." % spin_id) # The molecule/residue/spin info. @@ -184,23 +185,32 @@ res_name_list.append(str(res_name)) atom_name_list.append(str(spin.name)) + # Interatomic info. + interatoms = return_interatom_list(spin_id) + if len(interatoms) == 0: + raise RelaxError("No interatomic interactions are defined for the spin '%s'." % spin_id) + if len(interatoms) > 1: + raise RelaxError("The BMRB only handles a signal interatomic interaction for the spin '%s'." % spin_id) + + # Get the attached spin. + spin_attached = return_spin(interatoms[0].spin_id1) + if id(spin_attached) == id(spin): + spin_attached = return_spin(interatoms[0].spin_id2) + # The attached atom info. - if hasattr(spin, 'attached_atom'): - attached_atom_name_list.append(str(spin.attached_atom)) - elif hasattr(spin, 'attached_proton'): - attached_atom_name_list.append(str(spin.attached_proton)) + if hasattr(spin_attached, 'name'): + attached_atom_name_list.append(str(spin_attached.name)) else: attached_atom_name_list.append(None) - - if hasattr(spin, 'proton_type'): - attached_element_list.append(element_from_isotope(spin.proton_type)) - attached_isotope_list.append(str(number_from_isotope(spin.proton_type))) + if hasattr(spin_attached, 'isotope'): + attached_element_list.append(element_from_isotope(spin_attached.isotope)) + attached_isotope_list.append(str(number_from_isotope(spin_attached.isotope))) else: attached_element_list.append(None) attached_isotope_list.append(None) # Other info. - isotope_list.append(int(string.strip(spin.heteronuc_type, string.ascii_letters))) + isotope_list.append(int(string.strip(spin.isotope, string.ascii_letters))) element_list.append(spin.element) # Convert the molecule names into the entity IDs. Modified: branches/interatomic/test_suite/system_tests/scripts/bmrb_rw.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/scripts/bmrb_rw.py?rev=17133&r1=17132&r2=17133&view=diff ============================================================================== --- branches/interatomic/test_suite/system_tests/scripts/bmrb_rw.py (original) +++ branches/interatomic/test_suite/system_tests/scripts/bmrb_rw.py Mon Jul 2 18:08:29 2012 @@ -24,15 +24,21 @@ # Play with the data. self._execute_uf(uf_name='deselect.all') -self._execute_uf(uf_name='spin.copy', spin_from=':9', spin_to=':9@NE') -self._execute_uf(uf_name='select.spin', spin_id=':9') -self._execute_uf(uf_name='select.spin', spin_id=':10') -self._execute_uf(uf_name='select.spin', spin_id=':11') -self._execute_uf(uf_name='spin.name', name='N', force=False) -self._execute_uf(uf_name='spin.element', element='N', force=False) +self._execute_uf(uf_name='select.spin', spin_id=':9@N') +self._execute_uf(uf_name='select.spin', spin_id=':10@N') +self._execute_uf(uf_name='select.spin', spin_id=':11@N') +self._execute_uf(uf_name='spin.name', name='N', spin_id='@N', force=False) +self._execute_uf(uf_name='spin.element', element='N', spin_id='@N*', force=False) self._execute_uf(uf_name='molecule.name', name='OMP') self._execute_uf(uf_name='molecule.type', type='protein') self._execute_uf(uf_name='bmrb.thiol_state', state='reduced') + +# Set up a second spin type. +self._execute_uf(uf_name='spin.copy', spin_from=':9@N', spin_to=':9@NE1') +self._execute_uf(uf_name='spin.create', res_num=9, spin_name='HE1') +self._execute_uf(uf_name='spin.element', element='H', spin_id=':9@HE1') +self._execute_uf(uf_name='spin.isotope', isotope='1H', spin_id=':9@HE1') +self._execute_uf(uf_name='dipole_pair.define', spin_id1=':9@NE1', spin_id2=':9@HE1') # Display the data (as a test). self._execute_uf(uf_name='relax_data.display', ri_id='R1_800')