Have a look at my last message ;)

Regards,

Edward


On 23 June 2011 15:26, Han Sun <[email protected]> wrote:
> Hi Edward,
>
> I added the residue check as you suggested. A new problem was coming out.
> Firstly, a single atom 2 can be loaded properly. But if all atoms are
> loaded, then it complains that the second atom exists and a new spin with
> the same name can not be generated again. I guess the code can not check
> properly that the atom 2 has been loaded, but I could not find the problem
> in the code. Could you help me with that?
>
> Best,
> Han
>
>
> On Jun 23, 2011, at 3:19 PM, [email protected] 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
>> [email protected]
>>
>> 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
>
>

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

This is the relax-devel mailing list
[email protected]

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-devel

Reply via email to