Author: bugman Date: Tue Feb 10 13:22:15 2015 New Revision: 27619 URL: http://svn.gna.org/viewcvs/relax?rev=27619&view=rev Log: Merged revisions 27616-27618 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r27616 | bugman | 2015-02-10 13:08:00 +0100 (Tue, 10 Feb 2015) | 6 lines Created the Structure.test_atomic_fluctuations_no_match system test. This demonstrates a failure in the operation of the structure.atomic_fluctuations user function when the supplied atom ID matches no atoms. ........ r27617 | bugman | 2015-02-10 13:15:55 +0100 (Tue, 10 Feb 2015) | 6 lines Fixes for the lib.structure.internal.coordinates.assemble_coord_array() function. The problem was uncovered by the Structure.test_atomic_fluctuations_no_match system test. The function can now handle no data being passed in. ........ r27618 | bugman | 2015-02-10 13:19:26 +0100 (Tue, 10 Feb 2015) | 8 lines Fixes for the pipe_control.structure.main.assemble_structural_coordinates() function. The function will now raise a RelaxError if no structural data matching the atom ID can be found. The problem was uncovered by the Structure.test_atomic_fluctuations_no_match system test. The fix affects the structure.atomic_fluctuations, structure.displacement, structure.find_pivot, structure.rmsd, structure.superimpose, and structure.web_of_motion user functions. ........ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/lib/structure/internal/coordinates.py branches/frame_order_cleanup/pipe_control/structure/main.py branches/frame_order_cleanup/test_suite/system_tests/structure.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Tue Feb 10 13:22:15 2015 @@ -1 +1 @@ -/trunk:1-27614 +/trunk:1-27618 Modified: branches/frame_order_cleanup/lib/structure/internal/coordinates.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/structure/internal/coordinates.py?rev=27619&r1=27618&r2=27619&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/internal/coordinates.py (original) +++ branches/frame_order_cleanup/lib/structure/internal/coordinates.py Tue Feb 10 13:22:15 2015 @@ -161,6 +161,10 @@ @return: The array of atomic coordinates (first dimension is the model and/or molecule, the second are the atoms, and the third are the coordinates); the common list of molecule names; the common list of residue names; the common list of residue numbers; the common list of atom names; the common list of element names. @rtype: numpy rank-3 float64 array, list of str, list of str, list of int, list of str, list of str """ + + # No data to assemble. + if mol_names == []: + return [], [], [], [], [], [] # Set up the structures for common coordinates. num_mols = len(skip) Modified: branches/frame_order_cleanup/pipe_control/structure/main.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/structure/main.py?rev=27619&r1=27618&r2=27619&view=diff ============================================================================== --- branches/frame_order_cleanup/pipe_control/structure/main.py (original) +++ branches/frame_order_cleanup/pipe_control/structure/main.py Tue Feb 10 13:22:15 2015 @@ -131,6 +131,10 @@ # Assemble the atomic coordinates of all molecules. ids, object_id_list, model_list, molecule_list, atom_pos, mol_names, res_names, res_nums, atom_names, elements, one_letter_codes, num_mols = assemble_atomic_coordinates(objects=objects, object_names=object_names, molecules=molecules, models=models, atom_id=atom_id) + + # No data. + if mol_names == []: + raise RelaxError("No structural data matching the atom ID string '%s' can be found." % atom_id) # Are all molecules the same? same_mol = True Modified: branches/frame_order_cleanup/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/structure.py?rev=27619&r1=27618&r2=27619&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/system_tests/structure.py (original) +++ branches/frame_order_cleanup/test_suite/system_tests/structure.py Tue Feb 10 13:22:15 2015 @@ -559,6 +559,25 @@ self.assertEqual(len(script), len(lines)) for i in range(len(lines)): self.assertEqual(script[i], lines[i]) + + + def test_atomic_fluctuations_no_match(self): + """Check the operation of the structure.atomic_fluctuations user function when no data matches the atom ID. + + This checks the interatomic distance fluctuations calculated by the U{structure.atomic_fluctuations user function<http://www.nmr-relax.com/manual/structure_atomic_fluctuations.html>}. + """ + + # Load the file. + path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' + self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) + + # Run the structure.atomic_fluctuations user function and collect the results in a dummy file object. + file = DummyFileObject() + self.interpreter.structure.atomic_fluctuations(atom_id='@X', file=file, format='text') + + # Check the file. + lines = file.readlines() + self.assertEqual(len(lines), 0) def test_atomic_fluctuations_parallax(self):