Author: bugman Date: Thu Jan 15 17:12:46 2009 New Revision: 8478 URL: http://svn.gna.org/viewcvs/relax?rev=8478&view=rev Log: Created the validate() method. Modified: branches/multi_structure/generic_fns/structure/api_base.py Modified: branches/multi_structure/generic_fns/structure/api_base.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/api_base.py?rev=8478&r1=8477&r2=8478&view=diff ============================================================================== --- branches/multi_structure/generic_fns/structure/api_base.py (original) +++ branches/multi_structure/generic_fns/structure/api_base.py Thu Jan 15 17:12:46 2009 @@ -682,6 +682,21 @@ raise RelaxImplementError + def validate(self): + """Check the integrity of the structural data. + + The number of molecules must be the same in all models. + """ + + # Reference number of molecules. + num_mols = len(self.structural_data[0].mol) + + # Loop over all other models. + for i in range(1, len(self.structural_data)+1): + if num_mols != len(self.structural_data[i].mol): + raise RelaxError, "The structural object is not valid - the number of molecules is not the same for all models." + + class ModelList(list): """List type data container for the different structural models.