mailRe: XYZ file support.


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on June 10, 2011 - 12:21:
Hi,

So the next is to keep following where the system test fails:

======================================================================
ERROR: Load the 'Indol_test.xyz' XYZ file (using the internal
structural object XYZ reader).
----------------------------------------------------------------------

relax> pipe.create(pipe_name='mf', pipe_type='mf')

relax> structure.read_xyz(file='Indol_test.xyz',
dir='/data/relax/branches/xyz/test_suite/shared_data/structures',
read_mol=None, set_mol_name=None, read_model=None, set_model_num=None)
Traceback (most recent call last):
  File "test_suite/system_tests/structure.py", line 636, in
test_read_xyz_internal1
    self.interpreter.structure.read_xyz(file='Indol_test.xyz', dir=path)
  File "prompt/structure.py", line 571, in read_xyz
    generic_fns.structure.main.read_xyz(file=file, dir=dir,
read_mol=read_mol, set_mol_name=set_mol_name, read_model=read_model,
set_model_num=set_model_num)
AttributeError: 'module' object has no attribute 'read_xyz'

----------------------------------------------------------------------

As you can see, the function generic_fns.structure.main.read_xyz() is
missing, so this can be duplicated from
generic_fns.structure.main.read_pdb().  This is more complicated, so
if you have any questions, don't hesitate to ask.

Regards,

Edward


On 10 June 2011 10:41, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
Hi,

For the next step in making the system test

$ relax -s Structure.test_read_xyz_internal1

operational would be to make the front end of the user function.  That
will require modifying code in the 'prompt' directory, again
duplicating the load_pdb() code by modifying it for the XYZ format.

Regards,

Edward


On 9 June 2011 17:34, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
Hi,

Could you attach the file to the task instead?  Cheers.  Email systems
destroys the file format, so copying and pasting the text does not
work and causes the "patch" program to fail :(  Could you also add a
quick commit message as a comment to the attached file?

Cheers,

Edward


On 9 June 2011 17:32, Han Sun <hasu@xxxxxxxxxxxxxxxxx> wrote:
The function of the test_read_xyz_internal1() is generated.

Following is the patch after running svn diff > patch.

Index: structure.py
===================================================================
--- structure.py    (revision 12899)
+++ structure.py    (working copy)
@@ -633,3 +633,31 @@
                self.assertEqual(mol.file_path, paths[i][j])
                self.assertEqual(mol.file_model, models[i][j])
                self.assertEqual(mol.file_mol_num, 1)
+
+
+    def test_read_xyz_internal1(self):
+        """Load the 'Indol_test.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 PDB.
+        self.interpreter.structure.read_pdb(file='Indol_test.xyz',
dir=path, parser='internal')
+
+        # Test the molecule name.
+        
self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name,
'1F35_N_H_molmol_mol1')
+
+        # Load a single atom and test it.
+        
self.interpreter.structure.load_spins('#1F35_N_H_molmol_mol1:3@N')
+        self.assertEqual(count_spins(), 1)
+
+        # Try loading a few protons.
+        self.interpreter.structure.load_spins('@*H*')
+
+        # And now all the rest of the atoms.
+        self.interpreter.structure.load_spins()
+
+        # Extract a N-Ca vector.
+        self.interpreter.structure.vectors('CA',
spin_id='#1F35_N_H_molmol_mol1:3@N')
+        print((cdp.mol[0].res[0].spin[0]))
+        self.assert_(hasattr(cdp.mol[0].res[0].spin[0], 'bond_vect'))
~
~
~

Best,
Han


On Jun 9, 2011, at 5:25 PM, Edward d'Auvergne wrote:

Cheers.  I have added the file to the repository.  And I have performed
an:

$ svnmerge.py merge

on your branch, so it should be up to date.

Regards,

Edward


On 9 June 2011 17:15, Han Sun <hasu@xxxxxxxxxxxxxxxxx> wrote:

Hi,
the test xyz-file 'Indol_test.xyz' will be in the directory:
xyz/test_suite/shared_data/structures.
Han







Related Messages


Powered by MHonArc, Updated Fri Jun 10 12:40:11 2011