# Rotate selected atoms using a given center, axis, and angle.

from chimera import Point, Vector, Xform, selection

center = Vector(10,15,20)
axis = Vector(0.8,0.5,0.1)
angle = 35
xf = Xform()
xf.premultiply(Xform.translation(-center))
xf.premultiply(Xform.rotation(axis, angle))
xf.premultiply(Xform.translation(center))

atoms = selection.currentAtoms()
for a in atoms:
    a.setCoord(xf.apply(a.coord()))
