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):
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits