Icon representing a recipe

Recipe: Sheet Polar Bonding Bander v1

created by phallicies

Profile


Name
Sheet Polar Bonding Bander v1
ID
45198
Shared with
Public
Parent
None
Children
Created on
January 16, 2013 at 18:16 PM UTC
Updated on
January 16, 2013 at 18:16 PM UTC
Description

Bonds the polar Atoms of sheets together to form a better connection as well as find sheets that can be bonded and tries to band them.

Best for


Code


rtob = {} btor = {} bonds = {} sheets = {} count=1 count2=1 count3=1 cbonds=0 options = dialog.CreateDialog("Options") options.ci = dialog.AddSlider("CI:",1,.01,1,1) options.distance = dialog.AddSlider("Search Distance",5.5,4,7,1) options.nosearch = dialog.AddCheckbox("No Searching Enabled",true) options.bndstr = dialog.AddSlider("Band Strength",1.5,.1,10,1) options.okay = dialog.AddButton("Okay",1) dialog.Show(options) ci=options.ci.value distance=options.distance.value nosearch=options.nosearch.value bndstr=options.bndstr.value behavior.SetClashImportance(ci) band.DeleteAll() segs=structure.GetCount() print("Enumerating Array with Sheet Segments.") for i=1,segs do --12 if structure.GetSecondaryStructure(i)=="E" then sheets[count] = {i} count=count+1 end btor[i]={0,0,0} rtob[i]={0,0,0} end print("") print("Finding Bondable Polar Atoms...") for i=1, count do for j=i+1,count-1 do --23 if sheets[j][1]-sheets[i][1]>2 then band.AddBetweenSegments(sheets[i][1],sheets[j][1],1,4) bandlen = band.GetLength(1) if bandlen>2.5 and bandlen<4 then cbonds=cbonds+1 bonds[cbonds]={sheets[i][1],sheets[j][1],1,4} end if nosearch==false then if bandlen>2.5 and bandlen<distance then if rtob[i][1] == 0 then rtob[i] = {bandlen,sheets[i][1],sheets[j][1]} count2=count2+1 else if rtob[i][1] > bandlen then rtob[i] = {bandlen,sheets[i][1],sheets[j][1]} end end end end --33 band.Delete(1) end end for k=i+1,count-1 do if sheets[k][1]-sheets[i][1]>2 then band.AddBetweenSegments(sheets[i][1],sheets[k][1],4,1) bandlen = band.GetLength(1) if bandlen>2.5 and bandlen<4 then cbonds=cbonds+1 bonds[cbonds]={sheets[i][1],sheets[k][1],4,1} end if nosearch==false then if bandlen>2.5 and bandlen<distance then if btor[i][1] == 0 then btor[i] = {bandlen,sheets[i][1],sheets[k][1]} count3=count3+1 else if btor[i][1] > bandlen then btor[i] = {bandlen,sheets[i][1],sheets[k][1]} end end end end band.Delete(1) end end end --del1=0 --for i=1,count2-1 do -- print(rtob[i][1],rtob[i][2],rtob[i][3],rtob[i][4]) --53 --end --del2=0 --for i=1,count3-1 do -- print(btor[i][1],btor[i][2],btor[i][3],btor[i][4]) --end print("Banding Currently Bonded Atoms.") for i=1,cbonds do band.AddBetweenSegments(bonds[i][1],bonds[i][2],bonds[i][3],bonds[i][4]) band.SetStrength(i,bndstr) band.SetGoalLength(i,3) end print("Banding Polar Atoms Close to Bonding") if nosearch==false then for i=1,structure.GetCount() do if rtob[i][1]==0 then else band.AddBetweenSegments(rtob[i][2],rtob[i][3],1,4) band.SetGoalLength(band.GetCount(),3) end if btor[i][1]==0 then else band.AddBetweenSegments(btor[i][2],btor[i][3],4,1) band.SetGoalLength(band.GetCount(),3) end end end print("") print("All banding done. Take time to eliminate all excess bands") print("or the ones you dont want. Hit okay when done.") pause=dialog.CreateDialog("Hit Okay when Ready") pause.okay=dialog.AddButton("Okay",1) dialog.Show(pause) structure.WiggleAll(5) behavior.SetClashImportance(.5*ci) structure.ShakeSidechainsAll(2) behavior.SetClashImportance(ci) structure.WiggleAll(10)

Comments