Author: bugman Date: Mon Jul 2 19:59:32 2012 New Revision: 17135 URL: http://svn.gna.org/viewcvs/relax?rev=17135&view=rev Log: More BMRB fixes for the interatomic data design. Modified: branches/interatomic/generic_fns/bmrb.py branches/interatomic/generic_fns/relax_data.py branches/interatomic/specific_fns/model_free/bmrb.py Modified: branches/interatomic/generic_fns/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/bmrb.py?rev=17135&r1=17134&r2=17135&view=diff ============================================================================== --- branches/interatomic/generic_fns/bmrb.py (original) +++ branches/interatomic/generic_fns/bmrb.py Mon Jul 2 19:59:32 2012 @@ -32,7 +32,7 @@ from data.exp_info import ExpInfo import dep_check from generic_fns import exp_info -from generic_fns.mol_res_spin import create_spin, generate_spin_id, return_residue, return_spin +from generic_fns.mol_res_spin import create_spin, generate_spin_id, return_residue, return_spin, set_spin_element, set_spin_isotope from generic_fns.pipes import cdp_name from info import Info_box from relax_errors import RelaxError, RelaxFileError, RelaxFileOverwriteError, RelaxNoModuleInstallError, RelaxNoPipeError @@ -53,7 +53,7 @@ write(file=sys.stdout, version=version) -def generate_sequence(N=0, spin_ids=None, spin_nums=None, spin_names=None, res_nums=None, res_names=None, mol_names=None): +def generate_sequence(N=0, spin_ids=None, spin_nums=None, spin_names=None, res_nums=None, res_names=None, mol_names=None, isotopes=None, elements=None): """Generate the sequence data from the BRMB information. @keyword N: The number of spins. @@ -70,6 +70,10 @@ @type res_names: list of str or None @keyword mol_names: The list of molecule names. @type mol_names: list of str or None + @keyword isotopes: The optional list of isotope types. + @type isotopes: list of str or None + @keyword elements: The optional list of element types. + @type elements: list of str or None """ # The blank data. @@ -97,7 +101,15 @@ continue # Create the spin. - create_spin(spin_num=spin_nums[i], spin_name=spin_names[i], res_num=res_nums[i], res_name=res_names[i], mol_name=mol_names[i]) + spin = create_spin(spin_num=spin_nums[i], spin_name=spin_names[i], res_num=res_nums[i], res_name=res_names[i], mol_name=mol_names[i]) + + # Set the spin isotope and element. + spin_id = spin._spin_ids[0] + if elements: + set_spin_element(spin_id=spin_id, element=elements[i], force=True) + if isotopes and elements: + isotope = "%s%s" % (isotopes[i], elements[i]) + set_spin_isotope(spin_id=spin_id, isotope=isotope, force=True) def list_sample_conditions(star): Modified: branches/interatomic/generic_fns/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/relax_data.py?rev=17135&r1=17134&r2=17135&view=diff ============================================================================== --- branches/interatomic/generic_fns/relax_data.py (original) +++ branches/interatomic/generic_fns/relax_data.py Mon Jul 2 19:59:32 2012 @@ -34,7 +34,7 @@ # relax module imports. from data import Relax_data_store; ds = Relax_data_store() from data.exp_info import ExpInfo -from generic_fns import bmrb +from generic_fns import bmrb, dipole_pair from generic_fns.interatomic import create_interatom, return_interatom, return_interatom_list from generic_fns.mol_res_spin import Selection, create_spin, exists_mol_res_spin_data, find_index, generate_spin_id, get_molecule_names, return_spin, return_spin_from_selection, spin_index_loop, spin_loop from generic_fns import pipes @@ -175,7 +175,25 @@ mol_names = bmrb.molecule_names(data, N) # Generate the sequence if needed. - bmrb.generate_sequence(N, spin_names=data['atom_names'], res_nums=data['res_nums'], res_names=data['res_names'], mol_names=mol_names) + bmrb.generate_sequence(N, spin_names=data['atom_names'], res_nums=data['res_nums'], res_names=data['res_names'], mol_names=mol_names, isotopes=data['isotope'], elements=data['atom_types']) + + # The attached protons. + if data.has_key('atom_names_2'): + # Generate the proton spins. + bmrb.generate_sequence(N, spin_names=data['atom_names_2'], res_nums=data['res_nums'], res_names=data['res_names'], mol_names=mol_names, isotopes=data['isotope_2'], elements=data['atom_types_2']) + + # Define the dipolar interaction. + for i in range(len(data['atom_names'])): + # The spin IDs. + spin_id1 = generate_spin_id(spin_name=data['atom_names'][i], res_num=data['res_nums'][i], res_name=data['res_names'][i], mol_name=mol_names[i]) + spin_id2 = generate_spin_id(spin_name=data['atom_names_2'][i], res_num=data['res_nums'][i], res_name=data['res_names'][i], mol_name=mol_names[i]) + + # Check if the container exists. + if return_interatom(spin_id1=spin_id1, spin_id2=spin_id2): + continue + + # Define. + dipole_pair.define(spin_id1=spin_id1, spin_id2=spin_id2, verbose=False) # The data and error. vals = data['data'] @@ -212,7 +230,7 @@ errors[i] = errors[i] * vals[i]**2 # Pack the data. - pack_data(ri_id, ri_type, frq, vals, errors, mol_names=mol_names, res_nums=data['res_nums'], res_names=data['res_names'], spin_nums=None, spin_names=data['atom_names'], gen_seq=True) + pack_data(ri_id, ri_type, frq, vals, errors, mol_names=mol_names, res_nums=data['res_nums'], res_names=data['res_names'], spin_nums=None, spin_names=data['atom_names'], gen_seq=True, verbose=False) # Store the temperature calibration and control. if data['temp_calibration']: Modified: branches/interatomic/specific_fns/model_free/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/specific_fns/model_free/bmrb.py?rev=17135&r1=17134&r2=17135&view=diff ============================================================================== --- branches/interatomic/specific_fns/model_free/bmrb.py (original) +++ branches/interatomic/specific_fns/model_free/bmrb.py Mon Jul 2 19:59:32 2012 @@ -440,7 +440,7 @@ # Store the spin specific data in lists for later use. for spin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True): # Skip the protons. - if spin.name == 'H': + if spin.name == 'H' or (hasattr(spin, 'element') and spin.element == 'H'): warn(RelaxWarning("Skipping the proton spin '%s'." % spin_id)) continue @@ -451,7 +451,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.isotope == 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) if not hasattr(spin, 'element') or spin.element == None: raise RelaxError("For the BMRB, the spin element type of '%s' must be specified. Please use the spin user function for setting the element type." % spin_id)