Author: bugman Date: Fri Sep 26 12:12:47 2008 New Revision: 7329 URL: http://svn.gna.org/viewcvs/relax?rev=7329&view=rev Log: Added code to duplicate the structural object if it doesn't exist in the new pipe. This has been added to the model-free duplicate_data() method. Modified: 1.3/specific_fns/model_free/main.py Modified: 1.3/specific_fns/model_free/main.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/main.py?rev=7329&r1=7328&r2=7329&view=diff ============================================================================== --- 1.3/specific_fns/model_free/main.py (original) +++ 1.3/specific_fns/model_free/main.py Fri Sep 26 12:12:47 2008 @@ -981,7 +981,7 @@ # Duplicate all non-sequence specific data. for data_name in dir(ds[pipe_from]): # Skip the container objects. - if data_name in ['align_tensors', 'diff_tensor', 'mol', 'structure']: + if data_name in ['diff_tensor', 'mol', 'structure']: continue # Skip special objects. @@ -1026,6 +1026,33 @@ raise RelaxError, "The diffusion tensor object " + `data_name` + " of the " + `pipe_from` + " data pipe is not located in the " + `pipe_to` + " data pipe." elif data_from: data_to = getattr(ds[pipe_to].diff_tensor, data_name) + else: + continue + + # The data must match! + if data_from != data_to: + raise RelaxError, "The object " + `data_name` + "." + `data_name` + " is not consistent between the pipes " + `pipe_from` + " and " + `pipe_to` + "." + + # Structure comparison. + if hasattr(ds[pipe_from], 'structure'): + # Duplicate the tensor if it doesn't exist. + if not hasattr(ds[pipe_to], 'structure'): + setattr(ds[pipe_to], 'structure', deepcopy(ds[pipe_from].structure)) + + # Otherwise compare the objects inside the container. + else: + # Loop over the modifiable objects. + for data_name in ds[pipe_from].structure.__mod_attr__: + # Get the original object. + data_from = None + if hasattr(ds[pipe_from].structure, data_name): + data_from = getattr(ds[pipe_from].structure, data_name) + + # Get the target object. + if data_from and not hasattr(ds[pipe_to].structure, data_name): + raise RelaxError, "The structural object " + `data_name` + " of the " + `pipe_from` + " data pipe is not located in the " + `pipe_to` + " data pipe." + elif data_from: + data_to = getattr(ds[pipe_to].structure, data_name) else: continue