Ah ok.  Maybe I would suggest using a name such as xyz_model_increment
to make this clearer.

Cheers,

Edward



On 24 June 2011 12:08, Han Sun <[email protected]> wrote:
> Hi Edward,
>
> They are not doing the same thing. The model_index will be incremented only
> if one model is loaded. And the model_increment counts for every model. For
> example if I have four models and only two will be loaded. Then model_index
> will count twice and model_increment will count four times.
>
> Best,
> Han
>
> On Jun 24, 2011, at 12:00 PM, Edward d'Auvergne wrote:
>
>> Hi Han,
>>
>> I was just wondering, are the model_index and model_increment counters
>> doing the same or different things in this function?  Maybe
>> modex_index could be used instead?
>>
>> Regards,
>>
>> Edward
>>
>>
>>
>> On 24 June 2011 11:50,  <[email protected]> wrote:
>>>
>>> Author: han87
>>> Date: Fri Jun 24 11:50:33 2011
>>> New Revision: 13214
>>>
>>> URL: http://svn.gna.org/viewcvs/relax?rev=13214&view=rev
>>> Log:
>>> Debugging the user function load_xyz() and changing the system
>>> test_read_xyz_internal2().
>>>
>>> Debugging the user function load_xyz() in
>>> generic_fns/structure/internal.py and changing the system test
>>> test_read_xyz_internal2() so that loading a desired model can be achieved.
>>>
>>> Modified:
>>>   branches/xyz/generic_fns/structure/internal.py
>>>   branches/xyz/test_suite/system_tests/structure.py
>>>
>>> Modified: branches/xyz/generic_fns/structure/internal.py
>>> URL:
>>> http://svn.gna.org/viewcvs/relax/branches/xyz/generic_fns/structure/internal.py?rev=13214&r1=13213&r2=13214&view=diff
>>>
>>> ==============================================================================
>>> --- branches/xyz/generic_fns/structure/internal.py (original)
>>> +++ branches/xyz/generic_fns/structure/internal.py Fri Jun 24 11:50:33
>>> 2011
>>> @@ -833,13 +833,17 @@
>>>        # Loop over all models in the XYZ file.
>>>        mol_index=0
>>>        model_index = 0
>>> +        model_increment = 0
>>>        orig_model_num = []
>>>        mol_conts = []
>>>        orig_mol_num = []
>>>        new_mol_name = []
>>>        for model_records in self.__parse_models_xyz(file_path):
>>> +            # Increment the model_increment
>>> +            model_increment = model_increment +1
>>> +
>>>            # Only load the desired model.
>>> -            if read_model and model_index not in read_model:
>>> +            if read_model and model_increment not in read_model:
>>>                continue
>>>
>>>            # Store the original model number.
>>> @@ -875,7 +879,7 @@
>>>
>>>            # Increment the model index.
>>>            model_index = model_index + 1
>>> -
>>> +
>>>        orig_mol_num=[0]
>>>        # Create the structural data data structures.
>>>        self.pack_structs(mol_conts, orig_model_num=orig_model_num,
>>> set_model_num=set_model_num, orig_mol_num=orig_mol_num,
>>> set_mol_name=new_mol_name, file_name=file, file_path=path)
>>>
>>> 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=13214&r1=13213&r2=13214&view=diff
>>>
>>> ==============================================================================
>>> --- branches/xyz/test_suite/system_tests/structure.py (original)
>>> +++ branches/xyz/test_suite/system_tests/structure.py Fri Jun 24 11:50:33
>>> 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)
>>> +
>>>  self.interpreter.structure.read_xyz(file='SSS-cluster4-new-test.xyz',
>>> dir=path, read_model=[1,3])
>>>
>>>        # Test the molecule name.
>>>        self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name,
>>> 'SSS-cluster4-new-test_mol1')
>>>
>>>
>>> _______________________________________________
>>> 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
>
>

_______________________________________________
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