Icon representing a recipe

Recipe: iwdn ufreeze SC 1.0

created by ichwilldiesennamen

Profile


Name
iwdn ufreeze SC 1.0
ID
104256
Shared with
Public
Parent
sel_freeze_SC
Children
None
Created on
December 29, 2020 at 20:16 PM UTC
Updated on
December 29, 2020 at 20:16 PM UTC
Description

Freeze/unfreeze selected sidechains

Best for


Code


--iwdn ufreeze SC --Version 1.0 201229 --Recipe to freeze/unfreeze selected sidechains. The selection is freeze-inverted afterwards. toWorkOn = {} toWorkOnIdx = 1 function findToWorkOn() residues = structure.GetCount() for m=1,residues do if (selection.IsSelected(m) == true) then toWorkOn[toWorkOnIdx] = m toWorkOnIdx = toWorkOnIdx+1 end end --If user has not selected anything beforehand then choose all non-locked residues. if (toWorkOnIdx == 1) then for m=1,residues do if (structure.IsLocked(m) == false) then toWorkOn[toWorkOnIdx] = m toWorkOnIdx = toWorkOnIdx+1 end end end --If still toWorkOn is empty then this is an error. if (toWorkOnIdx == 1) then print("Error. No residues to work on could be found!") return end end --freeze all selected residues function process() for m=1,#toWorkOn do local frzback, frzside = freeze.IsFrozen(toWorkOn[m]) if (frzside == true) then freeze.Unfreeze(toWorkOn[m], false, true) --backbone, sidechain else freeze.Freeze(toWorkOn[m], false, true) --backbone, sidechain end end end function main() findToWorkOn() process() end --xpcall(main, cleanup) main()

Comments


ichwilldiesennamen Lv 1

This recipe is part of my typical design-toolbox.
This tool freezes selected or all sidechains. If there are selected segments before this recipe is run then only these will be frozen/unfrozen. If there is no selection before it is run then all freezable sidechains are frozen. This recipe is invertive so that already frozen segments in the selection become unfrozen after running this recipe.
I hope this is helpful. It sure was for me.

Happy folding to all!