Thanks :) it isn't slow - I just wondered if I'd missed something in the docs that would do it for me!
-----Original Message----- From: Modeller Caretaker [mailto:modeller-care@salilab.org] Sent: 30 October 2014 19:32 To: Wood, Chris (STFC,RAL,SC); modeller_usage@salilab.org Subject: Re: [modeller_usage] Physical.values
On 10/30/14, 11:55 AM, chris.wood@stfc.ac.uk wrote: > In the modeller.physical module, is there a way to select to select > the physical types given the index?
No. They are treated as a dict at the Python level. Why do you want to?
> I see that each modeller.physical.<restraint type> has a _num method > which returns the index
Actually that's a private member variable, so you shouldn't rely on it. Use the get_type() method instead.
> I'd like to avoid looping through all the object types if possible!
Just loop the first time you need to do a lookup, and cache the list for future calls. I can't imagine it would be slow!
Ben Webb, Modeller Caretaker