Pockets & blobs#
Planned content:
Build Gaussian pocket surfaces from alpha-spheres with multi-iso and color maps.
Pocket blobs with iso thresholds and smoothing.
Export a static view:
MolSysView.write_html("_static/views/pockets.html").
Pocket surface from alpha-spheres#
Goal
Build a Gaussian pocket surface from alpha-sphere centers/radii.
Show multiple iso levels with distinct colors/alphas.
Export a static view for the docs.
import molsysviewer as viewer
centers = [(0,0,0), (3,0,0), (1.5,2,0)]
radii = [2.0, 1.8, 1.2]
view = viewer.MolSysView()
view.shapes.add_pocket_surface(
atom_indices=[0],
iso_levels=[0.08, 0.15],
iso_colors=[0x44CCFF, 0x003366],
grid={"resolution": 1.0, "smoothness": 1.0},
tag="pocket-surface",
)
view.show()
What to tweak
atom_indices: real atom ids defining the pocket region; used for positioning/clipping.grid:resolution,smoothness,radius_offsetcontrol the Gaussian field.iso_levels/iso_colors/iso_alphas: multiple surfaces from one field.clip_planeormouth_atom_indicesif you need clipping at openings.tag: group related shapes for selective clear.
Pocket blob (Gaussian field)#
Goal
Generate a volumetric blob from alpha-spheres with custom iso thresholds and smoothing.
Support multiple iso levels/colors/alphas.
v = mv.MolSysView()
v.shapes.add_pocket_blob(
centers=[(0,0,0), (3,0,0), (1.5,2,0)],
radii=[2.0, 1.8, 1.2],
iso_levels=[0.08, 0.15],
iso_colors=[0x44CCFF, 0x003366],
iso_alphas=[0.35, 0.5],
smoothing=1.0,
tag="pocket-blob",
)
v.show()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[6], line 2
1 v = mv.MolSysView()
----> 2 v.shapes.add_pocket_blob(
3 centers=[(0,0,0), (3,0,0), (1.5,2,0)],
4 radii=[2.0, 1.8, 1.2],
5 iso_levels=[0.08, 0.15],
6 iso_colors=[0x44CCFF, 0x003366],
7 iso_alphas=[0.35, 0.5],
8 smoothing=1.0,
9 tag="pocket-blob",
10 )
11 v.show()
File ~/repos@uibcdf/molsysviewer/molsysviewer/shapes/__init__.py:99, in ShapesManager.add_pocket_blob(self, *args, **kwargs)
94 def add_pocket_blob(
95 self,
96 *args,
97 **kwargs,
98 ):
---> 99 return self.blobs.add_pocket_blob(*args, **kwargs)
TypeError: PocketBlobs.add_pocket_blob() got an unexpected keyword argument 'iso_levels'
What to tweak
smoothing: higher → smoother field, lower → sharper.iso_levels/iso_colors/iso_alphas: multiple surfaces from one field.radius_scale: scale radii before computing the field.color_mapandvalues: color per center via a numeric property.tag: group blobs for selective clear.