entities.StreamingTrajectory

entities.StreamingTrajectory(
    universe,
    name='StreamingTrajectory',
    create_object=True,
)

Trajectory subclass for IMD streaming connections.

Handles real-time molecular dynamics trajectories streamed via the IMD protocol. Unlike regular trajectories with random frame access, streaming trajectories read frames sequentially as they become available.

Parameters

Name Type Description Default
universe MDAnalysis.Universe MDAnalysis Universe with IMD reader required
name str Name for the trajectory object, by default “StreamingTrajectory” 'StreamingTrajectory'
create_object Create the mesh object to be linked to this trajectory True

Attributes

Name Description
atoms All atoms as MDAnalysis AtomGroup.
n_frames Return None for streaming trajectories (unknown frame count).
styles Get the styles in the tree.
uframe Current frame number in MDAnalysis Universe.

Methods

Name Description
add_style Add a visual style to the trajectory.
create_object Create and initialize Blender object for trajectory.
get_view Get the 3D bounding box of a selection within the trajectory
reset_playback Set the playback settings to their default values
set_frame Update trajectory state for scene frame.

add_style

entities.StreamingTrajectory.add_style(
    style='spheres',
    color='common',
    selection=None,
    material=None,
    name=None,
)

Add a visual style to the trajectory.

Parameters

Name Type Description Default
style bpy.types.GeometryNodeTree | str The style to apply to the trajectory. Can be a GeometryNodeTree or a string identifying a predefined style (e.g., “spheres”, “sticks”, “ball_stick”). Default is “spheres”. 'spheres'
color str | None The coloring scheme to apply. Can be “common” (element-based coloring), “chain”, “residue”, or other supported schemes. If None, no coloring is applied. Default is “common”. 'common'
selection str | AtomGroup | None Apply the style only to atoms matching this selection. Can be: - A string referring to an existing boolean attribute on the trajectory - A AtomGroup object defining a selection criteria - None to apply to all atoms (default) None
material bpy.types.Material | str | None The material to apply to the styled atoms. Can be a Blender Material object, a string with a material name, or None to use default materials. Default is None. None
name str | None The label for this style None

Returns

Name Type Description
Trajectory Returns self for method chaining.

Raises

Name Type Description
ValueError If an unsupported style string is passed

Notes

If a selection is provided, it will be evaluated and stored as a new named attribute on the trajectory with an automatically generated name (sel_N).

create_object

entities.StreamingTrajectory.create_object(name='NewUniverseObject')

Create and initialize Blender object for trajectory.

Creates mesh, computes attributes, sets up modifiers, registers with MolecularNodes.

Parameters

Name Type Description Default
name str Name for the Blender object "NewUniverseObject"

Returns

Name Type Description
bpy.types.Object Created Blender object

get_view

entities.StreamingTrajectory.get_view(selection=None, frame=None)

Get the 3D bounding box of a selection within the trajectory

Parameters

Name Type Description Default
selection str | AtomGroup A selection phrase or AtomGroup When not specified, the whole entity is considered None
frame int | None Frame number of trajectory to use for calculating bounds. When not specified, current trajectory frame is used None

reset_playback

entities.StreamingTrajectory.reset_playback()

Set the playback settings to their default values

set_frame

entities.StreamingTrajectory.set_frame(frame)

Update trajectory state for scene frame.

Main entry point called by Blender’s animation system. Updates positions, selections, and calculations with recursion prevention.

Parameters

Name Type Description Default
frame int Scene frame number (mapping applied to get Universe frame) required

Notes

Typically called automatically by frame change handlers, not user code.