Channels & tubes#

Planned content:

  • Sweep ordered alpha-sphere centers into a channel tube with spline smoothing.

  • Color by segment or solvent distance.

Channel tube#

Goal

  • Sweep ordered alpha-sphere centers/radii into a tube.

  • Color by segment or solvent distance; apply spline smoothing.

import molsysviewer as mv

centers = [(0,0,0), (2,0.5,0.2), (4,1,0.5), (6,1.5,1.0)]
radii   = [1.2, 1.0, 0.9, 1.1]

v = mv.MolSysView()
v.shapes.add_channel_tube(
    centers=centers,
    radii=radii,
    color_mode="segment",  # or "distance"
    smoothing=0.5,
    tag="channel-demo",
)
v.show()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 8
      6 v = mv.MolSysView()
      7 v.show()
----> 8 v.shapes.add_channel_tube(
      9     centers=centers,
     10     radii=radii,
     11     color_mode="segment",  # or "distance"
     12     smoothing=0.5,
     13     tag="channel-demo",
     14 )

File ~/repos@uibcdf/molsysviewer/molsysviewer/shapes/__init__.py:106, in ShapesManager.add_channel_tube(self, *args, **kwargs)
    101 def add_channel_tube(
    102     self,
    103     *args,
    104     **kwargs,
    105 ):
--> 106     return self.tubes.add_channel_tube(*args, **kwargs)

TypeError: ChannelTubes.add_channel_tube() got an unexpected keyword argument 'smoothing'

What to tweak

  • color_mode: "segment" uses per-segment colors; "distance" uses solvent distances if provided.

  • solvent_distances or colors/color_map to drive coloring.

  • smoothing_subdivisions: increase to smooth the spline sweep.

  • radial_segments: increase for a rounder tube.

  • alpha: overall transparency.

  • tag: group channels for selective clear.