Author: bugman Date: Wed Jul 2 11:55:35 2014 New Revision: 24401 URL: http://svn.gna.org/viewcvs/relax?rev=24401&view=rev Log: Merged revisions 24396,24399 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r24396 | bugman | 2014-07-02 09:50:36 +0200 (Wed, 02 Jul 2014) | 6 lines Python 3 fixes for the entire codebase using the 2to3 script. The command used was: 2to3 -j 4 -w -f xrange . ........ r24399 | bugman | 2014-07-02 11:46:40 +0200 (Wed, 02 Jul 2014) | 5 lines The internal structural object add_molecule() and has_molecule() methods are now model specific. This allows for finer control of structural object. ........ Modified: branches/disp_spin_speed/ (props changed) branches/disp_spin_speed/lib/structure/internal/object.py branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py branches/disp_spin_speed/test_suite/system_tests/relax_disp.py Propchange: branches/disp_spin_speed/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Jul 2 11:55:35 2014 @@ -1 +1 @@ -/trunk:1-24393 +/trunk:1-24399 Modified: branches/disp_spin_speed/lib/structure/internal/object.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/structure/internal/object.py?rev=24401&r1=24400&r2=24401&view=diff ============================================================================== --- branches/disp_spin_speed/lib/structure/internal/object.py (original) +++ branches/disp_spin_speed/lib/structure/internal/object.py Wed Jul 2 11:55:35 2014 @@ -1140,21 +1140,22 @@ return self.structural_data[-1] - def add_molecule(self, name=None): + def add_molecule(self, model_num=None, name=None): """Add a new molecule to the store. - @keyword name: The molecule identifier string. - @type name: str + @keyword model_num: The optional model to add the molecule to. If not supplied, the molecule will be added to all models. + @type model_num: None or int + @keyword name: The molecule identifier string. + @type name: str """ # Add a model if necessary. if len(self.structural_data) == 0: self.add_model() - # Loop over the models. - for i in range(len(self.structural_data)): - # Add the molecule. - self.structural_data[i].mol.add_item(mol_name=name, mol_cont=MolContainer()) + # Add the molecule to each model. + for model in self.model_loop(model=model_num): + model.mol.add_item(mol_name=name, mol_cont=MolContainer()) def are_bonded(self, atom_id1=None, atom_id2=None): @@ -1736,13 +1737,15 @@ return mol - def has_molecule(self, name=None): + def has_molecule(self, model_num=None, name=None): """Check if the molecule name exists. - @param name: The molecule name. - @type name: str - @return: True if the molecule exists, False otherwise. - @rtype: bool + @keyword model_num: The optional model to check. If not supplied, the molecule will be searched for across all models. + @type model_num: None or int + @param name: The molecule name. + @type name: str + @return: True if the molecule exists, False otherwise. + @rtype: bool """ # No models. @@ -1750,7 +1753,7 @@ return False # Loop over the models. - for model_cont in self.model_loop(): + for model_cont in self.model_loop(model=model_num): # Loop over the molecules. for mol in model_cont.mol: # Matching molecule. Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py?rev=24401&r1=24400&r2=24401&view=diff ============================================================================== --- branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py (original) +++ branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py Wed Jul 2 11:55:35 2014 @@ -421,7 +421,7 @@ # Loop 100 times for each spin in the clustered analysis (to make the timing numbers equivalent). for spin_index in xrange(100): # Repeat the function call, to simulate minimisation. - for i in xrange(iter): + for i in range(iter): chi2 = C1.calc(C1.params) print("chi2 single:", chi2) @@ -443,7 +443,7 @@ C1 = Profile(num_spins=num_spins, model=model, r2=5.0, dw=3.0, pA=0.9, kex=1000.0, spins_params=['r2', 'dw', 'pA', 'kex']) # Repeat the function call, to simulate minimisation. - for i in xrange(iter): + for i in range(iter): chi2 = C1.calc(C1.params) print("chi2 cluster:", chi2) Modified: branches/disp_spin_speed/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/system_tests/relax_disp.py?rev=24401&r1=24400&r2=24401&view=diff ============================================================================== --- branches/disp_spin_speed/test_suite/system_tests/relax_disp.py (original) +++ branches/disp_spin_speed/test_suite/system_tests/relax_disp.py Wed Jul 2 11:55:35 2014 @@ -5342,7 +5342,7 @@ pipe_name = 'base pipe' pipe_type = 'relax_disp' pipe_name_r2eff = "%s_R2eff"%(pipe_name) - select_spin_index = range(0, 1) + select_spin_index = list(range(0, 1)) self.setup_sod1wt_t25(pipe_name=pipe_name, pipe_type=pipe_type, pipe_name_r2eff=pipe_name_r2eff, select_spin_index=select_spin_index) # Generate r20 key. @@ -5491,7 +5491,7 @@ pipe_name = 'base pipe' pipe_type = 'relax_disp' pipe_name_r2eff = "%s_R2eff"%(pipe_name) - select_spin_index = range(0, 1) + select_spin_index = list(range(0, 1)) self.setup_sod1wt_t25(pipe_name=pipe_name, pipe_type=pipe_type, pipe_name_r2eff=pipe_name_r2eff, select_spin_index=select_spin_index) # Define replicated @@ -5574,7 +5574,7 @@ pipe_name = 'base pipe' pipe_type = 'relax_disp' pipe_name_r2eff = "%s_R2eff"%(pipe_name) - select_spin_index = range(0, 2) + select_spin_index = list(range(0, 2)) self.setup_sod1wt_t25(pipe_name=pipe_name, pipe_type=pipe_type, pipe_name_r2eff=pipe_name_r2eff, select_spin_index=select_spin_index) # Generate r20 key. @@ -5742,7 +5742,7 @@ pipe_name = 'base pipe' pipe_type = 'relax_disp' pipe_name_r2eff = "%s_R2eff"%(pipe_name) - select_spin_index = range(0, 2) + select_spin_index = list(range(0, 2)) self.setup_sod1wt_t25(pipe_name=pipe_name, pipe_type=pipe_type, pipe_name_r2eff=pipe_name_r2eff, select_spin_index=select_spin_index) # Generate r20 key.