Ben Webb wrote: > Friedrich Foerster wrote: > >> for the 26s project i would like to use a maximum diameter restraint >> on the shape of proteins. so it'd be a restraint similar to the >> connectivity restraint: all distances in a protein are evaluated and >> if the largest distance is above a specified threshold, a harmonic >> restraint would be applied on the respective pair. >> > > The solution already proposed by Daniel looks perfect to me as a literal > solution to your problem, but is that really what you want to do: > constrain every particle pair in the protein to less than the diameter? > If you have a lot of particles, that's going to become expensive rather > quickly (O(N^2), obviously). Another option to consider would be to > constrain every particle to be less than the radius from the protein > center. That would give you far fewer restraints and scale as O(N). You > could do this with a bunch of DistanceToSingletonScores if the protein > center is at a fixed point, or use a GravityCenterScoreState to stick a > particle at the center of gravity of your protein, and then use regular > distance restraints between each particle and that center. > Good point. I hadn't suggested it since it is a looser bound than the diameter in general (not that the looseness is likely to matter :-). Also, since we already have code to compute an enclosing ball of a set of balls we can easily write a gravitycenter-analog which puts the point at the sphere center if you want something tighter than the gravity-center based bounds. Actually, I've been meaning to write such a class for a while.