TheGUmmer Lv 1
In the selection interface would it possible to have a hot key to cycle through a segments sidechain snap positions. Sometimes I have a hard time trying to move the longer sidechains into the position I would like.
In the selection interface would it possible to have a hot key to cycle through a segments sidechain snap positions. Sometimes I have a hard time trying to move the longer sidechains into the position I would like.
Never mind. It has benn point out to me that it is already there. Ctrl key and the left and right movement (arrow) keys.
Is this in the help screen? I didn't see it and tried to write a script to do it (but it turns out that's impossible).
@photoelectric:
If you want to do it by script, use the
do_sidechain_snap(segment index, snap index)
function. with
get_sidechain_snap_count(segment index)
you get the number of snaps (rotamers) for the selected segment index.
Mouse over the segment you want to change and press TAB, and you will see the segment index number.
For example,
l=get_sidechain_snap_count(1)
if l>0 then
for k=1,l do
do_sidechain_snap(1,k)
end – k
end – l
will cycle through all possible rotamers of the very first segment.
A couple of notes, though:
1) The hot keys to cycle only works in the new interface
2) There is no need for the 'if' in the code above. You can just write it like this:
local segment = 1
for i=1, get_sidechain_snap_count(segment)
do_sidechain_snap(segment, i)
end
A 'for' loop will be skipped if the number returned from get_sidechain_snap_count() is zero. Lua only executes the get_sidechain_snap_count() once, too.
3) Be warned, though, if you do anything that manipulates the backbone inside the loop (wiggle all, for example), it can change the number of possible snap positions. If this reduces the number of snap positions, your code will break. For example, this code will periodically cause runtime errors, in a non-deterministic way:
local segment = 1
for i=1, get_sidechain_snap_count(segment)
do_sidechain_snap(segment, i)
do_global_wiggle_all(1)
end
Glycine has 1 snap position, not 0, right?
To prevent this error, I would do it this way:
local segment = 1
for i=1, get_sidechain_snap_count(segment)
if i<=get_sidechain_snap_count(segment) then
do_sidechain_snap(segment, i)
do_global_wiggle_all(1)
end
end
Okay, it's a little bit clumsy to get the number of snap positions twice, but it prevents this error.