Author: bugman Date: Wed Mar 6 17:40:18 2013 New Revision: 18661 URL: http://svn.gna.org/viewcvs/relax?rev=18661&view=rev Log: Merged revisions 18657,18659-18660 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18657 | bugman | 2013-03-06 11:11:05 +0100 (Wed, 06 Mar 2013) | 8 lines Removed the prune parameter from the backend of the monte_carlo.error_analysis user function. This was a dangerous parameter used to mimic the 'Trim' parameter from the Modelfree4 program. The result is bad statistics. The probable reason for the 'Trim' parameter was the failure of model-free models in the simulations, but this issue was solved using model elimination (see http://www.nmr-relax.com/refs.html#dAuvergneGooley06). ........ r18659 | bugman | 2013-03-06 17:33:01 +0100 (Wed, 06 Mar 2013) | 5 lines Created the Structure.test_read_xyz_strychnine system test to demonstrate a bug in the XYZ parser. This is for the reading of XYZ structure files. ........ r18660 | bugman | 2013-03-06 17:37:24 +0100 (Wed, 06 Mar 2013) | 6 lines Bug fix for the XYZ 3D structure file reader. The atom name is now correctly set up for each atom in the file. The element type setting has also been simplified. ........ Added: branches/frame_order_testing/test_suite/shared_data/structures/strychnine.xyz - copied unchanged from r18660, trunk/test_suite/shared_data/structures/strychnine.xyz Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/generic_fns/monte_carlo.py branches/frame_order_testing/generic_fns/structure/internal.py branches/frame_order_testing/test_suite/system_tests/structure.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Mar 6 17:40:18 2013 @@ -1,1 +1,1 @@ -/trunk:1-18646 +/trunk:1-18660 Modified: branches/frame_order_testing/generic_fns/monte_carlo.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/monte_carlo.py?rev=18661&r1=18660&r2=18661&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/monte_carlo.py (original) +++ branches/frame_order_testing/generic_fns/monte_carlo.py Wed Mar 6 17:40:18 2013 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004-2005, 2007-2009 Edward d'Auvergne # +# Copyright (C) 2004-2013 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -111,7 +111,7 @@ pack_sim_data(data_index, random) -def error_analysis(prune=0.0): +def error_analysis(): """Function for calculating errors from the Monte Carlo simulations. The standard deviation formula used to calculate the errors is the square root of the @@ -126,12 +126,6 @@ - n is the total number of simulations. - Xi is the parameter value for simulation i. - Xav is the mean parameter value for all simulations. - - - @keyword prune: The amount to prune the upper and lower tails the distribution. If set to - 0.0, no simulations will be pruned. If set to 1.0, all simulations will be - pruned. This argument should be set 0.0 to avoid meaningless statistics. - @type prune: float """ # Test if the current data pipe exists. @@ -143,8 +137,6 @@ # Model loop, return simulation chi2 array, return selected simulation array, return simulation parameter array, and set error functions. model_loop = get_specific_fn('model_loop', cdp.pipe_type) - if prune > 0.0: - return_sim_chi2 = get_specific_fn('return_sim_chi2', cdp.pipe_type) return_selected_sim = get_specific_fn('return_selected_sim', cdp.pipe_type) return_sim_param = get_specific_fn('return_sim_param', cdp.pipe_type) set_error = get_specific_fn('set_error', cdp.pipe_type) @@ -153,31 +145,6 @@ for model_info in model_loop(): # Get the selected simulation array. select_sim = return_selected_sim(model_info) - - # Initialise an array of indices to prune (an empty array means no pruning). - indices_to_skip = [] - - # Pruning. - if prune > 0.0: - # Get the array of simulation chi-squared values. - chi2_array = return_sim_chi2(model_info) - - # The total number of simulations. - n = len(chi2_array) - - # Create a sorted array of chi-squared values. - chi2_sorted = sorted(deepcopy(chi2_array)) - - # Number of indices to remove from one side of the chi2 distribution. - num = int(float(n) * 0.5 * prune) - - # Remove the lower tail. - for i in range(num): - indices_to_skip.append(chi2_array.index(chi2_sorted[i])) - - # Remove the upper tail. - for i in range(n-num, n): - indices_to_skip.append(chi2_array.index(chi2_sorted[i])) # Loop over the parameters. index = 0 @@ -198,10 +165,6 @@ if not select_sim[i]: continue - # Prune. - if i in indices_to_skip: - continue - # Increment n. n = n + 1 @@ -212,10 +175,6 @@ if not select_sim[i]: continue - # Prune. - if i in indices_to_skip: - continue - # Sum. Xsum = Xsum + param_array[i] @@ -230,10 +189,6 @@ for i in range(len(param_array)): # Skip deselected simulations. if not select_sim[i]: - continue - - # Prune. - if i in indices_to_skip: continue # Sum. Modified: branches/frame_order_testing/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/structure/internal.py?rev=18661&r1=18660&r2=18661&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/structure/internal.py (original) +++ branches/frame_order_testing/generic_fns/structure/internal.py Wed Mar 6 17:40:18 2013 @@ -2296,13 +2296,8 @@ # Add the atom. if len(record) == 4: - # Attempt at determining the element, if missing. - element = record[0] - if not element: - element = self._det_pdb_element(record[2]) - # Add. - self.atom_add(atom_num=atom_number, pos=[record[1], record[2], record[3]], element=element) + self.atom_add(atom_name=record[0], atom_num=atom_number, pos=[record[1], record[2], record[3]], element=record[0]) # Increment of atom number atom_number = atom_number + 1 Modified: branches/frame_order_testing/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/structure.py?rev=18661&r1=18660&r2=18661&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/structure.py (original) +++ branches/frame_order_testing/test_suite/system_tests/structure.py Wed Mar 6 17:40:18 2013 @@ -917,6 +917,31 @@ self.assertAlmostEqual(cdp.interatomic[0].vector[0], -0.4102707) self.assertAlmostEqual(cdp.interatomic[0].vector[1], 0.62128879) self.assertAlmostEqual(cdp.interatomic[0].vector[2], -0.6675913) + + + def test_read_xyz_strychnine(self): + """Load the 'strychnine.xyz' XYZ file (using the internal structural object XYZ reader).""" + + # Path of the files. + path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' + + # Read the XYZ file. + self.interpreter.structure.read_xyz(file='strychnine.xyz', dir=path, set_mol_name='strychnine') + + # Test the molecule data. + self.assertEqual(len(cdp.structure.structural_data), 1) + self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) + + # Load the carbon atoms and test it. + self.interpreter.structure.load_spins('@C') + self.assertEqual(count_spins(), 21) + + # Load the protons. + self.interpreter.structure.load_spins('@H') + self.assertEqual(count_spins(), 43) + + # And now all the rest of the atoms. + self.interpreter.structure.load_spins() def test_rmsd(self):