From: Jan Saam (jan.saam_at_charite.de)
Date: Wed Jun 04 2003 - 16:54:02 CDT

Hi,

regarding the rotation of molecule parts around a bond axis, I have another
script for you that does work with any type of bond. Well it even works with
any pair of atoms regardless wether they are bonded or not.
You must specify a selection that will be moved, usually the part of molecule
that is at one side of the bond. Furthermore you specify the atom indices of
the two toms that constitute the rotation axis and finally the relative
rotation angle.

If you merge the two scripts I sent you can get something that allows to
specify an absolute dihedral angle.

Have fun,
                Jan

# Rotate selection $sel $angle degrees around the bond through
# atoms $ind1 and $ind2
proc rotate_bond { sel ind1 ind2 angle {molid top}} {
    set a1 [atomselect $molid "index $ind1"]
    set a2 [atomselect $molid "index $ind2"]
    set c1 [lindex [$a1 get {x y z}] 0]
    set c2 [lindex [$a2 get {x y z}] 0]
    # compute rotation matrix
    set rot_mat [trans bond $c1 $c2 $angle deg]

    # rotate selection
    $sel move $rot_mat
}

> In addition, is it possible to rotate some parts of a molecule by
> specifying a new dihedral, as it is possible to use the move command
> to move atomselections by some given distance x, y, z????
>
> Thank you
>
> Stud. Polyt.
> Thomas Hedegaard Pedersen
> Department of Chemistry
> Technical University of Denmark