mailr26099 - /trunk/pipe_control/structure/main.py


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

Header


Content

Posted by edward on September 30, 2014 - 17:26:
Author: bugman
Date: Tue Sep 30 17:26:24 2014
New Revision: 26099

URL: http://svn.gna.org/viewcvs/relax?rev=26099&view=rev
Log:
Created the pipe_control.structure.main.check_structure() checking object.

This will be used for providing much more detailed feedback for when 
structural information is
missing.


Modified:
    trunk/pipe_control/structure/main.py

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=26099&r1=26098&r2=26099&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Tue Sep 30 17:26:24 2014
@@ -100,6 +100,29 @@
     # Add a model.
     cdp.structure.structural_data.add_item(model_num=model_num)
     print("Created the empty model number %s." % model_num)
+
+
+def check_structure_func():
+    """Test if structural data is present.
+
+    @return:        The initialised RelaxError object or nothing.
+    @rtype:         None or RelaxError instance
+    """
+
+    # Test if the structure exists.
+    if not hasattr(cdp, 'structure'):
+        return RelaxError("No structural data is present in the current data 
pipe.")
+
+    # Check for models:
+    if not cdp.structure.num_models():
+        return RelaxError("The structural object in the current data pipe 
contains no models.")
+
+    # Check for molecules.
+    if not cdp.structure.num_molecules():
+        return RelaxError("The structural object in the current data pipe 
contains no molecules.")
+
+# Create the checking object.
+check_structure = Check(check_structure_func)
 
 
 def connect_atom(index1=None, index2=None):




Related Messages


Powered by MHonArc, Updated Tue Sep 30 17:40:02 2014