[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] Interaction graph routine




And now I have another one: When creating a PairScore, the help recommends to return all the particles that could be read if the particle in the argument is scored. The argument is only one particle, and obviously in a pair score 2 particles are read when scoring. The examples of creating a PairScore return only the particle too. Why?
The short answer is that it is easier and faster to figure out what are all the possible particles that can be passed as part of pairs to a pair score than all the pairs that can be passed. Take when the pairs are generated from close pairs. The n input particles are known, a priori. To get inputs over all pairs, one would have to generate and pass all n^2 pairs to the pair score. That would be slow and you would then have a list of length n^2 with only n unique items, which would have to be further processed. I could not think of a case where it was that bad to just inspect particles on at a time for getting inputs. That said, you can certainly construct cases where more input particles will be returned when you pass the particles one at a time than if you were to pass all the pairs. And passing a full list of particles, rather than calling the function repeatedly may be noticeably more efficient.