mailRe: r13180 - 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 Edward d'Auvergne on June 23, 2011 - 15:25:
Hi Han,

This change should really have been in two commits, for the two
different changes.  This is important if there is something wrong with
a change and it needs to be reverted.  If there are two changes in the
commit, then the second good change is lost when reverting the first
bad change.  It is better to have many small commits than one large
on, for that exact reason.

Anyway, for the first change, you'll probably need this design
migrated to the residue as well:

        # Get the molecule container corresponding to the molecule name.
        mol_cont = None
        if mol_name:
            # Update the ID string.
            id = id + '#' + mol_name

            # The container.
            mol_cont = return_molecule(id)


Regards,

Edward




On 23 June 2011 15:19,  <hasu@xxxxxxxxxxxxxxxxx> wrote:
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()
+


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits




Related Messages


Powered by MHonArc, Updated Thu Jun 23 17:00:14 2011