Trajectory
Trajectory(
universe,
name='NewUniverseObject',
world_scale=0.01,
create_object=True,
)Attributes
| Name | Description |
|---|---|
| uframe | Get the current frame number of the linked Universe.trajectory. |
Methods
| Name | Description |
|---|---|
| add_selection | Adds a new selection with the given name, selection string and selection parameters. |
| add_selection_from_atomgroup | Create a Selection object from an AtomGroup |
| add_style | Add a visual style to the trajectory. |
| adjust_periodic_positions | Returns the input pos2 with a periodic correction potentially applied |
| get_view | Get the 3D bounding box of a selection within the trajectory |
| position_cache_mean | Return the mean position from the currently cached positions |
| remove_selection | Removes the selection with the given name |
| reset_playback | Set the playback settings to their default values |
| set_frame | Update the positions, selections and calculations for this trajectory, based on |
| update_position_cache | Update the currently cached positions, based on the new frame |
add_selection
Trajectory.add_selection(name, selection_str, updating=True, periodic=True)Adds a new selection with the given name, selection string and selection parameters.
add_selection_from_atomgroup
Trajectory.add_selection_from_atomgroup(atomgroup, name='NewSelection')Create a Selection object from an AtomGroup
add_style
Trajectory.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).
adjust_periodic_positions
Trajectory.adjust_periodic_positions(pos1, pos2)Returns the input pos2 with a periodic correction potentially applied
get_view
Trajectory.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 | Frame number of trajectory to use for calculating bounds. When not specified, current trajectory frame is used | None |
position_cache_mean
Trajectory.position_cache_mean(frame)Return the mean position from the currently cached positions
remove_selection
Trajectory.remove_selection(name)Removes the selection with the given name
reset_playback
Trajectory.reset_playback()Set the playback settings to their default values
set_frame
Trajectory.set_frame(frame)Update the positions, selections and calculations for this trajectory, based on frame number of the current scene, not the frame number of the Universe
update_position_cache
Trajectory.update_position_cache(frame, cache_ahead=True)Update the currently cached positions, based on the new frame