Author: bugman Date: Thu Jan 10 11:18:57 2013 New Revision: 18183 URL: http://svn.gna.org/viewcvs/relax?rev=18183&view=rev Log: Merged revisions 18182 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18182 | bugman | 2013-01-10 11:18:44 +0100 (Thu, 10 Jan 2013) | 7 lines Fix for bug #20417 (https://gna.org/bugs/?20417). The backwards compatibility hook for the loading of old relax state and results files can now handle the presence of proton spins. The data structures are now correctly converted to the current data pipe design. This is only the case for old files containing PCS data. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/data/__init__.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Jan 10 11:18:57 2013 @@ -1,1 +1,1 @@ -/trunk:1-18180 +/trunk:1-18182 Modified: branches/frame_order_testing/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/data/__init__.py?rev=18183&r1=18182&r2=18183&view=diff ============================================================================== --- branches/frame_order_testing/data/__init__.py (original) +++ branches/frame_order_testing/data/__init__.py Thu Jan 10 11:18:57 2013 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2012 Edward d'Auvergne # +# Copyright (C) 2003-2013 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -212,8 +212,13 @@ # The current spin ID. spin_id = generic_fns.mol_res_spin.generate_spin_id(mol_name=mol.name, res_num=res.num, res_name=res.name, spin_name=spin.name, spin_num=spin.num) - # The interatomic data container design. - if hasattr(spin, 'heteronuc_type'): + # Convert proton spins (the 'heteronuc_type' variable indicates a pre-interatomic container design state). + if hasattr(spin, 'heteronuc_type') and hasattr(spin, 'element') and spin.element == 'H': + # Rename the nuclear isotope. + spin.isotope = spin.proton_type + + # Convert heteronuclear spins (the 'heteronuc_type' variable indicates a pre-interatomic container design state). + elif hasattr(spin, 'heteronuc_type'): # Rename the nuclear isotope. spin.isotope = spin.heteronuc_type @@ -236,13 +241,21 @@ spin_id1 = generic_fns.mol_res_spin.generate_spin_id(mol_name=mol.name, res_num=res.num, res_name=res.name, spin_name=spin.name, spin_num=spin.num) spin_id2 = generic_fns.mol_res_spin.generate_spin_id(mol_name=mol.name, res_num=res.num, res_name=res.name, spin_name=proton_name) - # Create a new spin container for the proton. - h_spin = generic_fns.mol_res_spin.create_spin(mol_name=mol.name, res_num=res.num, res_name=res.name, spin_name=proton_name, pipe=pipe_name) - h_spin.select = False - - # Set up a dipole interaction between the two spins. - generic_fns.mol_res_spin.set_spin_element(spin_id=spin_id2, element='H', pipe=pipe_name) - generic_fns.mol_res_spin.set_spin_isotope(spin_id=spin_id2, isotope='1H', pipe=pipe_name) + # Fetch the proton spin if it exists. + h_spin = generic_fns.mol_res_spin.return_spin(spin_id2, pipe=pipe_name) + if h_spin: + spin_id2 = generic_fns.mol_res_spin.generate_spin_id(mol_name=mol.name, res_num=res.num, res_name=res.name, spin_name=proton_name, spin_num=h_spin.num) + + # Create a new spin container for the proton if needed. + if not h_spin: + h_spin = generic_fns.mol_res_spin.create_spin(mol_name=mol.name, res_num=res.num, res_name=res.name, spin_name=proton_name, pipe=pipe_name) + h_spin.select = False + + # Set up a dipole interaction between the two spins if needed. + if not hasattr(h_spin, 'element'): + generic_fns.mol_res_spin.set_spin_element(spin_id=spin_id2, element='H', pipe=pipe_name) + if not hasattr(h_spin, 'isotope'): + generic_fns.mol_res_spin.set_spin_isotope(spin_id=spin_id2, isotope='1H', pipe=pipe_name) generic_fns.dipole_pair.define(spin_id1, spin_id2, verbose=False, pipe=pipe_name) # Get the interatomic data container.