integer band.AddBetweenSegments(integer segmentIndex1, integer segmentIndex2, [integer atomIndex1], [integer atomIndex2])
Add a band between the two segments. By default bands to the backbone. Specify an atom number from 1 to structure.GetAtomCount() to band to a different atom. Returns band number.
V1 Function Name

band.AddBetweenSegments adds a band between the specified segments.

By default, the band is added to the alpha carbon atom of each segment. The parameters atomIndex1 and atomIndex2 can be used to specify different atoms for each segment. Atom numbers must be in the range 1 to structure.GetAtomCount for each segment.

The added band has a default goal length of 3.5 Angstroms. Goal length can be changed by band.SetGoalLength, and queried by band.GetGoalLength.

The added band has a default strength of 1.0. Strength can be changed by band.SetStrength, and queried by band.GetStrength.

The added band always has an actual length, which is the distance in Angstroms between the two atoms. The actual length changes as parts of the protein move, but it can't be set directly. The actual length can be queried by band.GetLength.

A band created using the default atom numbers has an actual length that's normally the same as the length reported by structure.GetDistance.

Caution: the returned band index may be zero. A zero band index causes an error in other functions, such as band.SetStrength.

One case which returns a zero band index is banding a segment to itself, for example:

bIdx = band.AddBetweenSegments ( 21, 21 )

This is a rare case of a Foldit Lua function setting a return code. Most other Foldit functions "throw" an error in the case of bad parameters. In most cases, this terminates the recipe, but the thrown error can be "caught" by calling the function in question via the pcall function.