mailr18091 - /trunk/generic_fns/interatomic.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 10, 2012 - 17:30:
Author: bugman
Date: Mon Dec 10 17:30:10 2012
New Revision: 18091

URL: http://svn.gna.org/viewcvs/relax?rev=18091&view=rev
Log:
Fixes for the checks in the interatomic.copy user function backend.


Modified:
    trunk/generic_fns/interatomic.py

Modified: trunk/generic_fns/interatomic.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/interatomic.py?rev=18091&r1=18090&r2=18091&view=diff
==============================================================================
--- trunk/generic_fns/interatomic.py (original)
+++ trunk/generic_fns/interatomic.py Mon Dec 10 17:30:10 2012
@@ -29,10 +29,9 @@
 
 # relax module imports.
 from generic_fns import pipes
-from generic_fns.mol_res_spin import Selection, return_spin
-from relax_errors import RelaxError, RelaxInteratomError, 
RelaxNoInteratomError
+from generic_fns.mol_res_spin import Selection, count_spins, return_spin
+from relax_errors import RelaxError, RelaxInteratomError, 
RelaxNoInteratomError, RelaxNoSpinError
 from relax_io import write_data
-from relax_warnings import RelaxNoSpinWarning
 
 
 def copy(pipe_from=None, pipe_to=None, spin_id1=None, spin_id2=None, 
verbose=True):
@@ -62,13 +61,21 @@
     pipes.test(pipe_from)
     pipes.test(pipe_to)
 
+    # Check that the spin IDs exist.
+    if spin_id1:
+        if count_spins(selection=spin_id1, pipe=pipe_from, skip_desel=False) 
== 0:
+            raise RelaxNoSpinError(spin_id1, pipe_from)
+        if count_spins(selection=spin_id1, pipe=pipe_to, skip_desel=False) 
== 0:
+            raise RelaxNoSpinError(spin_id1, pipe_to)
+    if spin_id2:
+        if count_spins(selection=spin_id2, pipe=pipe_from, skip_desel=False) 
== 0:
+            raise RelaxNoSpinError(spin_id2, pipe_from)
+        if count_spins(selection=spin_id2, pipe=pipe_to, skip_desel=False) 
== 0:
+            raise RelaxNoSpinError(spin_id2, pipe_to)
+
     # Test if pipe_from contains interatomic data (skipping the rest of the 
function if it is missing).
     if not exists_data(pipe_from):
         return
-
-    # Test if pipe_to contains interatomic data.
-    if exists_data(pipe_to):
-        raise RelaxInteratomError
 
     # Loop over the interatomic data of the pipe_from data pipe.
     ids = []




Related Messages


Powered by MHonArc, Updated Mon Dec 10 17:40:02 2012