Author: bugman Date: Tue Jan 22 11:28:44 2013 New Revision: 18259 URL: http://svn.gna.org/viewcvs/relax?rev=18259&view=rev Log: Merged revisions 18249-18258 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18249 | bugman | 2013-01-21 21:30:10 +0100 (Mon, 21 Jan 2013) | 5 lines Modified the N_state_model.test_mc_sim_failure to demonstrate a failure in paramagnetic centre code. The failure is for the combination of paramagnetic centre optimisation and Monte Carlo simulations. ........ r18250 | bugman | 2013-01-21 21:33:40 +0100 (Mon, 21 Jan 2013) | 5 lines Fix for the N-state model _minimise_setup_atomic_pos() method for the paramagnetic centre. The cdp.paramagnetic_centre_sim may not exist prior to Monte Carlo simulations. ........ r18251 | bugman | 2013-01-21 21:36:42 +0100 (Mon, 21 Jan 2013) | 3 lines Modified the paramag.centre user function printouts for the 'fix' flag. ........ r18252 | bugman | 2013-01-21 21:37:08 +0100 (Mon, 21 Jan 2013) | 3 lines Fix for the recent changes to the N_state_model.test_mc_sim_failure system test. ........ r18253 | bugman | 2013-01-21 21:41:29 +0100 (Mon, 21 Jan 2013) | 6 lines The alignment tensor objects in the relax data store now support sequential Monte Carlo analyses. The AlignTensorData.set_sim_num() method was preventing a second Monte Carlo error analysis from being performed by throwing a RelaxError. The check for previous simulations has been killed. ........ r18254 | bugman | 2013-01-21 22:37:54 +0100 (Mon, 21 Jan 2013) | 5 lines Fix for the Monte Carlo initialisation of the paramagnetic centre position in the N-state model. The simulation positions are now initialised to the optimised position. ........ r18255 | bugman | 2013-01-21 23:37:09 +0100 (Mon, 21 Jan 2013) | 3 lines Fix for the N-state model Monte Carlo simulations for when the paramagnetic centre is fixed. ........ r18256 | bugman | 2013-01-22 09:56:39 +0100 (Tue, 22 Jan 2013) | 6 lines Added checks to the N-state model for the paramagnetic centre optimisation. Only simplex optimisation without constraints is allowed for the paramagnetic centre position as the PCS gradients and Hessians are not yet implemented for the coordinate parameters. ........ r18257 | bugman | 2013-01-22 10:32:14 +0100 (Tue, 22 Jan 2013) | 6 lines Improved the RDC and PCS Q factor calculation warnings to be more informative. These warnings sometimes appear at the end of the N-state model optimisation, but it is not clear where they come from. ........ r18258 | bugman | 2013-01-22 11:11:01 +0100 (Tue, 22 Jan 2013) | 5 lines Fix for a recently introduced breakage of the N_state_model.test_mc_sim_failure system test. Newton optimisation is now not allowed for optimising the paramagnetic centre position. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/data/align_tensor.py branches/frame_order_testing/generic_fns/paramag.py branches/frame_order_testing/generic_fns/pcs.py branches/frame_order_testing/generic_fns/rdc.py branches/frame_order_testing/specific_fns/n_state_model.py branches/frame_order_testing/test_suite/system_tests/n_state_model.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Tue Jan 22 11:28:44 2013 @@ -1,1 +1,1 @@ -/trunk:1-18247 +/trunk:1-18258 Modified: branches/frame_order_testing/data/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/data/align_tensor.py?rev=18259&r1=18258&r2=18259&view=diff ============================================================================== --- branches/frame_order_testing/data/align_tensor.py (original) +++ branches/frame_order_testing/data/align_tensor.py Tue Jan 22 11:28:44 2013 @@ -1328,10 +1328,6 @@ @type sim_number: int """ - # Check if not already set. - if self._sim_num != None: - raise RelaxError("The number of simulations has already been set.") - # Store the value. self.__dict__['_sim_num'] = sim_number Modified: branches/frame_order_testing/generic_fns/paramag.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/paramag.py?rev=18259&r1=18258&r2=18259&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/paramag.py (original) +++ branches/frame_order_testing/generic_fns/paramag.py Tue Jan 22 11:28:44 2013 @@ -70,9 +70,9 @@ # The fixed flag. if fix: - print("The paramagnetic centre will be fixed during optimisation.") + print("The paramagnetic centre position will be fixed during optimisation.") else: - print("The paramagnetic centre will be optimised.") + print("The paramagnetic centre position will be optimised.") cdp.paramag_centre_fixed = fix # Position is supplied. Modified: branches/frame_order_testing/generic_fns/pcs.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/pcs.py?rev=18259&r1=18258&r2=18259&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/pcs.py (original) +++ branches/frame_order_testing/generic_fns/pcs.py Tue Jan 22 11:28:44 2013 @@ -522,13 +522,13 @@ # Warnings (and then exit). if not spin_count: - warn(RelaxWarning("No spins have been used in the calculation.")) + warn(RelaxWarning("No spins have been used in the calculation, skipping the PCS Q factor calculation.")) return if not pcs_data: - warn(RelaxWarning("No PCS data can be found for the alignment ID '%s'." % align_id)) + warn(RelaxWarning("No PCS data can be found for the alignment ID '%s', skipping the PCS Q factor calculation for this alignment." % align_id)) continue if not pcs_bc_data: - warn(RelaxWarning("No back-calculated PCS data can be found for the alignment ID '%s'." % align_id)) + warn(RelaxWarning("No back-calculated PCS data can be found for the alignment ID '%s', skipping the PCS Q factor calculation for this alignment." % align_id)) continue # The total Q-factor. Modified: branches/frame_order_testing/generic_fns/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/rdc.py?rev=18259&r1=18258&r2=18259&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/rdc.py (original) +++ branches/frame_order_testing/generic_fns/rdc.py Tue Jan 22 11:28:44 2013 @@ -465,13 +465,13 @@ # Warnings (and then exit). if not interatom_count: - warn(RelaxWarning("No interatomic data containers have been used in the calculation.")) + warn(RelaxWarning("No interatomic data containers have been used in the calculation, skipping the RDC Q factor calculation.")) return if not rdc_data: - warn(RelaxWarning("No RDC data can be found for the alignment ID '%s'." % align_id)) + warn(RelaxWarning("No RDC data can be found for the alignment ID '%s', skipping the RDC Q factor calculation for this alignment." % align_id)) continue if not rdc_bc_data: - warn(RelaxWarning("No back-calculated RDC data can be found for the alignment ID '%s'." % align_id)) + warn(RelaxWarning("No back-calculated RDC data can be found for the alignment ID '%s', skipping the RDC Q factor calculation for this alignment." % align_id)) continue # Normalisation factor of 2Da^2(4 + 3R)/5. Modified: branches/frame_order_testing/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/n_state_model.py?rev=18259&r1=18258&r2=18259&view=diff ============================================================================== --- branches/frame_order_testing/specific_fns/n_state_model.py (original) +++ branches/frame_order_testing/specific_fns/n_state_model.py Tue Jan 22 11:28:44 2013 @@ -898,8 +898,8 @@ # The paramagnetic centre. if not hasattr(cdp, 'paramagnetic_centre'): paramag_centre = zeros(3, float64) - elif sim_index != None: - if cdp.paramagnetic_centre_sim[sim_index] == None: + elif sim_index != None and not cdp.paramag_centre_fixed: + if not hasattr(cdp, 'paramagnetic_centre_sim') or cdp.paramagnetic_centre_sim[sim_index] == None: paramag_centre = zeros(3, float64) else: paramag_centre = array(cdp.paramagnetic_centre_sim[sim_index]) @@ -2083,6 +2083,13 @@ min_options = (min_algor,) + min_options min_algor = 'Method of Multipliers' + # Only allow simplex optimisation for the paramagnetic centre position optimisation (the PCS gradients and Hessians are not yet implemented). + if hasattr(cdp, 'paramag_centre_fixed') and not cdp.paramag_centre_fixed: + if min_algor != 'simplex': + raise RelaxError("For the paramagnetic centre position, only simplex optimisation is allowed as the PCS gradients and Hessians are not yet implemented.") + if constraints: + raise RelaxError("For the paramagnetic centre position, constrains are not allowed as the PCS gradients and Hessians are not yet implemented.") + # Linear constraints. if constraints: A, b = self._linear_constraints(data_types=data_types, scaling_matrix=scaling_matrix) @@ -2507,6 +2514,11 @@ # Append None to fill the structure. sim_object.append(None) + # Set the simulation paramagnetic centre positions to the optimised values. + if hasattr(cdp, 'paramag_centre_fixed') and not cdp.paramag_centre_fixed: + for j in range(cdp.sim_number): + cdp.paramagnetic_centre_sim[j] = deepcopy(cdp.paramagnetic_centre) + def sim_pack_data(self, data_id, sim_data): """Pack the Monte Carlo simulation data. Modified: branches/frame_order_testing/test_suite/system_tests/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/n_state_model.py?rev=18259&r1=18258&r2=18259&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/n_state_model.py (original) +++ branches/frame_order_testing/test_suite/system_tests/n_state_model.py Tue Jan 22 11:28:44 2013 @@ -521,6 +521,14 @@ self.interpreter.minimise('newton', constraints=False) self.interpreter.monte_carlo.error_analysis() + # Activate the optimisation of the paramagnetic centre position and try again. + self.interpreter.paramag.centre(fix=False) + self.interpreter.monte_carlo.setup(number=3) + self.interpreter.monte_carlo.create_data() + self.interpreter.monte_carlo.initial_values() + self.interpreter.minimise('simplex', constraints=False, max_iter=100) + self.interpreter.monte_carlo.error_analysis() + def test_metal_pos_opt(self): """Test a certain algorithm for the optimisation of the lanthanide position using RDCs and PCSs (with missing data)."""