mailr13180 - in /branches/xyz: generic_fns/structure/main.py test_suite/system_tests/structure.py


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

Header


Content

Posted by hasu on June 23, 2011 - 15:19:
Author: han87
Date: Thu Jun 23 15:19:45 2011
New Revision: 13180

URL: http://svn.gna.org/viewcvs/relax?rev=13180&view=rev
Log:
Debugging the user function load_spins() and changing the system test 
test_read_xyz_internal2().

In the user function load_spins() in generic_fns/structure/main.py a check 
whether the residue name exists or not has been included. The code is 
similiar to the molecule check. Also see email: 
https://mail.gna.org/public/relax-devel/2011-06/msg00226.html. And in the 
system test 'test_read_xyz_internal2()' all models were loaded instead of 2 
and the line for loading proton was removed.

Modified:
    branches/xyz/generic_fns/structure/main.py
    branches/xyz/test_suite/system_tests/structure.py

Modified: branches/xyz/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/xyz/generic_fns/structure/main.py?rev=13180&r1=13179&r2=13180&view=diff
==============================================================================
--- branches/xyz/generic_fns/structure/main.py (original)
+++ branches/xyz/generic_fns/structure/main.py Thu Jun 23 15:19:45 2011
@@ -236,11 +236,26 @@
 
         # Add the residue if it doesn't exist.
         if res_cont == None:
-            # Add the residue.
-            mol_cont.res.add_item(res_name=res_name, res_num=res_num)
-
-            # Get the container.
-            res_cont = mol_cont.res[-1]
+            # Get the unnamed residue, assuming there is only one:
+            res_cont = return_residue()
+
+            # Got something!
+            if res_cont != None:
+                # Rename the residue name if the res name is given and the 
sole container is unnamed.
+                if res_cont.name == None and res_name:
+                    # Print out.
+                    print(("Renaming the unnamed sole residue container to 
'%s'." % res_name))
+
+                    # Get the name.
+                    res_cont.name = res_name
+            
+            # Nothing exists yet.
+            else:
+                # Add the residue.
+                mol_cont.res.add_item(res_name=res_name, res_num=res_num)
+
+                # Get the container.
+                res_cont = mol_cont.res[-1]
 
         # Add the atom number to the ID string (atom name is ignored because 
only the number is unique).
         id = id + '@' + repr(atom_num)

Modified: branches/xyz/test_suite/system_tests/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/xyz/test_suite/system_tests/structure.py?rev=13180&r1=13179&r2=13180&view=diff
==============================================================================
--- branches/xyz/test_suite/system_tests/structure.py (original)
+++ branches/xyz/test_suite/system_tests/structure.py Thu Jun 23 15:19:45 2011
@@ -656,7 +656,7 @@
         path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'structures'
 
         # Read the xyz.
-        
self.interpreter.structure.read_xyz(file='SSS-cluster4-new-test.xyz', 
dir=path, read_model=[1,3])
+        
self.interpreter.structure.read_xyz(file='SSS-cluster4-new-test.xyz', 
dir=path)
 
         # Test the molecule name.
         self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, 
'SSS-cluster4-new-test_mol1')
@@ -666,8 +666,8 @@
         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()
-
+        #self.interpreter.structure.load_spins('@H')
+
+        # And now all the rest of the atoms.
+        self.interpreter.structure.load_spins()
+




Related Messages


Powered by MHonArc, Updated Thu Jun 23 16:20:02 2011