On Tue, Mar 31, 2009 at 9:45 PM, Sean Law <magic...@hotmail.com> wrote: > the performance is lightning fast. Can anybody help me improve the overall > performance or suggest an alternative? Thanks in advance!
A kind of alternative would be to use a custom dihedral command, that avoids evaluating selections: def torsion(a, b, c, d): l = (b - a).cross(c - b) r = (d - c).cross(b - c) a = degrees(l.angle(r)) if (l.cross(r) * (c - b)) < 0.0: return -a else: return a where a, b, c, and d are vector classes and 'cross' is defined as usual like: def cross(self, other): return Vector(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x) pymol has a vector class in the chempy package called 'cpv'. gilleain