Author: bugman Date: Wed Mar 6 17:33:01 2013 New Revision: 18659 URL: http://svn.gna.org/viewcvs/relax?rev=18659&view=rev Log: 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. Added: trunk/test_suite/shared_data/structures/strychnine.xyz Modified: trunk/test_suite/system_tests/structure.py Added: trunk/test_suite/shared_data/structures/strychnine.xyz URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/structures/strychnine.xyz?rev=18659&view=auto ============================================================================== --- trunk/test_suite/shared_data/structures/strychnine.xyz (added) +++ trunk/test_suite/shared_data/structures/strychnine.xyz Wed Mar 6 17:33:01 2013 @@ -1,0 +1,49 @@ +47 +strychnine molecule + O -2.547545 2.139059 0.472310 + O 2.015408 3.324289 0.213156 + N 1.207610 1.203922 0.478894 + N -1.350394 -2.624460 0.301178 + C -0.258837 -2.073956 -0.558021 + C -0.824223 -1.406962 -1.808433 + C -1.741283 -0.250780 -1.378644 + C -0.819735 0.828965 -0.783392 + C 0.003153 0.334416 0.415455 + C 2.358372 0.448322 0.162421 + C 3.667689 0.888405 -0.010558 + C 4.632616 -0.056196 -0.360560 + C 4.303015 -1.398582 -0.525823 + C 2.988069 -1.825141 -0.331972 + C 2.015427 -0.899636 0.012625 + C 0.561728 -1.122705 0.360284 + C 0.390886 -1.834862 1.723978 + C -1.067936 -2.282629 1.709808 + C -2.708975 -2.252045 -0.131301 + C -2.815469 -0.775379 -0.431910 + C -3.718174 0.023460 0.134879 + C -3.726395 1.516213 -0.058936 + C -1.423939 2.193179 -0.407936 + C -0.372897 3.059448 0.332496 + C 1.064718 2.558120 0.325331 + H 0.399932 -2.896344 -0.855386 + H -1.364146 -2.140645 -2.409934 + H -0.007016 -1.035292 -2.430851 + H -2.229948 0.177326 -2.261725 + H -0.101863 1.055799 -1.581061 + H -0.582210 0.470722 1.326014 + H 3.918694 1.929549 0.116264 + H 5.656588 0.267474 -0.505165 + H 5.068478 -2.115052 -0.797816 + H 2.736463 -2.873299 -0.445917 + H 1.059165 -2.698455 1.760657 + H 0.631843 -1.189746 2.570301 + H -1.243126 -3.142405 2.361743 + H -1.719677 -1.470258 2.058429 + H -3.410692 -2.541912 0.651788 + H -2.971493 -2.840572 -1.016009 + H -4.455619 -0.395106 0.813636 + H -3.834304 1.785629 -1.118252 + H -4.559845 1.966160 0.480526 + H -1.736135 2.699031 -1.329897 + H -0.354638 4.078330 -0.048526 + H -0.690723 3.116119 1.378208 Modified: trunk/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=18659&r1=18658&r2=18659&view=diff ============================================================================== --- trunk/test_suite/system_tests/structure.py (original) +++ trunk/test_suite/system_tests/structure.py Wed Mar 6 17:33:01 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):