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.
Ben