Author: bugman Date: Mon Jan 19 11:00:55 2009 New Revision: 8503 URL: http://svn.gna.org/viewcvs/relax?rev=8503&view=rev Log: Redesigned add_molecule(). The method now is one line long!!! Modified: branches/multi_structure/generic_fns/structure/api_base.py branches/multi_structure/generic_fns/structure/internal.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=8503&r1=8502&r2=8503&view=diff ============================================================================== --- branches/multi_structure/generic_fns/structure/api_base.py (original) +++ branches/multi_structure/generic_fns/structure/api_base.py Mon Jan 19 11:00:55 2009 @@ -62,19 +62,13 @@ self.structural_data = ModelList() - def add_molecule(self, name=None, model=None, file=None, path=None, str=None): + def add_molecule(self, name=None, model=None): """Prototype method stub for adding the given molecule to the store. @keyword name: The molecule identification string. @type name: str @keyword model: The number of the model to add the molecule to. @type model: int or None - @keyword file: The name of the file containing the molecule. - @type file: str - @keyword path: The optional path where the file is located. - @type path: str - @keyword str: The molecule object, containing the structural data. - @type str: class instance """ # Raise the error. Modified: branches/multi_structure/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/internal.py?rev=8503&r1=8502&r2=8503&view=diff ============================================================================== --- branches/multi_structure/generic_fns/structure/internal.py (original) +++ branches/multi_structure/generic_fns/structure/internal.py Mon Jan 19 11:00:55 2009 @@ -53,64 +53,17 @@ id = 'internal' - def add_molecule(self, name=None, model=None, file=None, path=None, str=None): - """Add the given structure to the store. - - @keyword name: The structural identifier. + def add_molecule(self, name=None, model=None): + """Add a new molecule to the store. + + @keyword name: The molecule identifier string. @type name: str @keyword model: The number of the model to add the molecule to. @type model: int or None - @keyword file: The name of the file containing the structure. - @type file: str - @keyword path: The optional path where the file is located. - @type path: str - @keyword str: The object containing the structural data. - @type str: Structure_container instance - """ - - # Get the model. - model_cont = self.get_model(model) - - # Check that the name does not already exist. - - # Some checks. - if model != None: - # Index check. - if struct_index >= self.num: - raise RelaxError, "The structure index of " + `struct_index` + " cannot be more than the total number of structures of " + `self.num` + "." - - # ID check. - if name != self.name[struct_index]: - raise RelaxError, "The ID names " + `name` + " and " + `self.name[struct_index]` + " do not match." - - # Model. - if model != self.model[struct_index]: - raise RelaxError, "The models " + `model` + " and " + `self.model[struct_index]` + " do not match." - - # File name. - if file != self.file[struct_index]: - raise RelaxError, "The file names of " + `file` + " and " + `self.file[struct_index]` + " do not match." - - # Initialise. - else: - self.num = self.num + 1 - self.name.append(name) - self.model.append(model) - self.file.append(file) - self.path.append(path) - - # Initialise the structural object if not provided. - if str == None: - str = Structure_container() - - # Add the structural data. - if struct_index != None: - if struct_index >= len(self.structural_data): - self.structural_data.append(str) - else: - self.structural_data[struct_index] = str - else: - self.structural_data.append(str) + """ + + # Create the structural data data structures. + self.pack_structs([[MolContainer()]], orig_model_num=[model], set_mol_name=[name]) def __bonded_atom(self, attached_atom, index, struct_index):