Utilities

Small helper node groups used throughout Molecular Nodes

Accumulate Axis Rotation

Accumulate transforms that are rotations around an axis in local space. The axis is defined by the current Position to the position of the last True point for the Pivot input.

Inputs

Name Type Description
Position Vector Position vector to transform
Selection Bool
Pivot Bool The points at which points where Accumulate is true will look to for their axis of transformation.
Angle Float Amount to rotate around the axis
Group ID Int Transform field is accumulated individually for each Group ID
Transform Index Int Index at which to evaluate the final transform for the positon. For most cases this will be Index, but it might be that some points need to use the accumulated transform from another point instead

Outputs

Name Type Description
Position Vector Transformed vector
Trasnform Matrix The accumlated transform, not yet applied to the Position vector

API Reference: nodes.geometry.AccumulateAxisRotation

Angstrom to World

Inputs

Name Type Description
Angstrom Float

Outputs

Name Type Description
World Float

API Reference: nodes.geometry.AngstromToWorld

Between Float

Test if a float is between the upper and lower bounds

Inputs

Name Type Description
Value Float The value to test if it is between the lower and upper bounds
Lower Float Test if the Value is greater than or equal to this
Upper Float Test if the Value is less than or equal to this

Outputs

Name Type Description
Boolean Bool Whether the input Value is between (and including) the lower and upper bounds

API Reference: nodes.geometry.BetweenFloat

Between Integer

Test if an integer is between (and including) the upper and lower bounds

Inputs

Name Type Description
Value Int The value to test if it exists within the bounds
Lower Int The lower bounds for the test
Upper Int The upper bounds for the test

Outputs

Name Type Description
Boolean Bool Whether the input Value is between (and including) the lower and upper bounds

API Reference: nodes.geometry.BetweenInteger

Between Vector

Test if a vector is element-wise between the upper and lower bounds.

Inputs

Name Type Description
Value Vector The value to test element-wise
Lower Vector The lower bounds (including) for the comparison
Upper Vector The upper bounds (including) for the comparison

Outputs

Name Type Description
Boolean Bool If the value is between (and including) the lower the upper bounds

API Reference: nodes.geometry.BetweenVector

Centroid

Video

Calculate the centroid point for the selection for each group in the Group ID. The centroid is the average position of all points in each Group ID. If a selection is given, then only the selected points contribute towards the overall centroid calculation, but the result is still available on the other points in the Group ID

Inputs

Name Type Description
Position Vector The Position vector to use for the centroid calculation
Selection Bool Selected points contribute to the computation of the centroid, unselected points do not contribute but still return the centroid for their Group ID
Group ID Int Compute the centroid on for each unique Group ID

Outputs

Name Type Description
Centroid Vector The computed average vector for each Group ID

API Reference: nodes.geometry.Centroid

Dihedral Angle

Computes the angle between two vectors, AB & CD around around the axis of BC. The first vector AB is treated as the “12 O’clock” up position, looking down the axis towards C, with angles being return in the range of (-Pi, Pi). Clockwise angles are positive and anti-clockwise angles are negative.

Inputs

Name Type Description
A Vector First vector for the calculation, which draws a line to B
B Vector Second vector for the calculation, which receives a line from A and draws a line to C
C Vector Third vector for the calculation, which receives a line from B and draws a line to D
D Vector Last vector for the calculation, which is the end point of the line from D

Outputs

Name Type Description
Angle Float The angle between the vectors AB and CD, when made perpendicular to BC.
BA⟂(BC) Vector The vector BA when made perpendicular to the axis BC
CD⟂(BC) Vector The Vector CD when makde perpendicular to the axis BC
BC Vector The axis vector BC

API Reference: nodes.geometry.DihedralAngle

Evaluate on Atoms

Inputs

Name Type Description
Geometry Geometry Geometry to get the bundle of
Selection Bool The parts of the geometry that go into the first output
Closure Closure
Result Menu Where to store the result of the closure. Bundle overwrite the existing MN/Atoms bundle. Geometry passes along the bundle and joins the resulting geometry into the output.

Outputs

Name Type Description
Geometry Geometry

API Reference: nodes.geometry.EvaluateOnAtoms

Evaluate Per Group

Inputs

Name Type Description
Geometry Geometry Geometry to split into two parts
Closure Closure
Group Menu
Group ID Int

Outputs

Name Type Description
Geometry Geometry
Instances Geometry

API Reference: nodes.geometry.EvaluatePerGroup

Fallback Boolean

Computes the boolean field if the given attribute doesn’t exist. If it doesn’t exist it just uses the attribute instead

Use the Boolean attribute specified by name. If the attribute doesn’t exist, use the Fallback value instead

Inputs

Name Type Description
Name String Name of the attribute to attempt to read from the geometry
Fallback Bool Value to use instead if the named attribute doesn’t exist on the geometry

Outputs

Name Type Description
Boolean Bool The named attribute read from the geometry if it exists, or the fallback value if it doesn’t

API Reference: nodes.geometry.FallbackBoolean

Fallback Float

Use the Float attribute specified by name. If the attribute doesn’t exist, use the Fallback value instead

Inputs

Name Type Description
Name String Name of the attribute to attempt to read from the geometry
Fallback Float Value to use instead if the named attribute doesn’t exist on the geometry

Outputs

Name Type Description
Value Float The named attribute read from the geometry if it exists, or the fallback value if it doesn’t

API Reference: nodes.geometry.FallbackFloat

Fallback Integer

Use the Integer attribute specified by name. If the attribute doesn’t exist, use the Fallback value instead

Inputs

Name Type Description
Name String Name of the attribute to attempt to read from the geometry
Fallback Int Value to use instead if the named attribute doesn’t exist on the geometry

Outputs

Name Type Description
Integer Int The named attribute read from the geometry if it exists, or the fallback value if it doesn’t

API Reference: nodes.geometry.FallbackInteger

Fallback Matrix

Use the Matrix attribute specified by name. If the attribute doesn’t exist, use the Fallback value instead

Inputs

Name Type Description
Name String Name of the attribute to attempt to read from the geometry
Fallback Matrix Value to use instead if the named attribute doesn’t exist on the geometry

Outputs

Name Type Description
Matrix Matrix The named attribute read from the geometry if it exists, or the fallback value if it doesn’t

API Reference: nodes.geometry.FallbackMatrix

Fallback Rotation

Use the Rotation attribute specified by name. If the attribute doesn’t exist, use the Fallback value instead

Inputs

Name Type Description
Name String Name of the attribute to attempt to read from the geometry
Fallback Rotation Value to use instead if the named attribute doesn’t exist on the geometry

Outputs

Name Type Description
Rotation Rotation The named attribute read from the geometry if it exists, or the fallback value if it doesn’t

API Reference: nodes.geometry.FallbackRotation

Fallback Vector

Use the Vector attribute specified by name. If the attribute doesn’t exist, use the Fallback value instead

Inputs

Name Type Description
Name String Name of the attribute to attempt to read from the geometry
Fallback Vector Value to use instead if the named attribute doesn’t exist on the geometry

Outputs

Name Type Description
Output Vector The named attribute read from the geometry if it exists, or the fallback value if it doesn’t

API Reference: nodes.geometry.FallbackVector

Fractionate Float

Split a float into the floor, ceiling and fraction of Value

Inputs

Name Type Description
Menu Menu
Value Float The value to fractionate

Outputs

Name Type Description
Fraction Float Fractional component of the value, between 0 and 1
Floor Int The floor of the value; the integer rounded down
Ceiling Int The ceiling of the value, the integer rounded up

API Reference: nodes.geometry.FractionateFloat

Get Geometry Atoms

Inputs

Name Type Description
Geometry Geometry Geometry to get the bundle of

Outputs

Name Type Description
Geometry Geometry
Bundle Bundle
Atoms Geometry

API Reference: nodes.geometry.GetGeometryAtoms

Index Distance

Inputs

Name Type Description
Index Int
Target Index Int Index for the selected point to measure to
Position Vector

Outputs

Name Type Description
Vector Vector Vector from the current point to the indexed point
Direction Vector Normalized vector from the current point to the indexed point
Distance Float Distance from the current point to the indexed point
Rotation Rotation

API Reference: nodes.geometry.IndexDistance

Index Mix Float

Sample and interpolate the Float value between the floor and ceiling of the given Index, by the fractional amount

Inputs

Name Type Description
Value Float The field to interpolate based on the input Index
Index Float The floor and ceiling of this Index value is taken and used for sampling, the fraction of this value is then used to mix between the sampled values

Outputs

Name Type Description
Value Float The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index
From Int The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index
To Int The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index

API Reference: nodes.geometry.IndexMixFloat

Index Mix Rotation

Sample and interpolate the Rotation value between the floor and ceiling of the given Index, by the fractional amount

Inputs

Name Type Description
Rotation Rotation The field to interpolate based on the input Index
Index Float The floor and ceiling of this Index value is taken and used for sampling, the fraction of this value is then used to mix between the sampled values

Outputs

Name Type Description
Rotation Rotation The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index
From Int The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index
To Int The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index

API Reference: nodes.geometry.IndexMixRotation

Index Mix Vector

Sample and interpolate the Vector value between the floor and ceiling of the given Index, by the fractional amount

Inputs

Name Type Description
Value Vector The field to interpolate based on the input Index
Index Float The floor and ceiling of this Index value is taken and used for sampling, the fraction of this value is then used to mix between the sampled values

Outputs

Name Type Description
Value Vector The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index
From Int The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index
To Int The mixed value of the field, first evaluating the field at the From and To Indices then mixing between them based on the fraction of the input Index

API Reference: nodes.geometry.IndexMixVector

Integer Distance

Inputs

Name Type Description
A Int
B Int
Distance Int

Outputs

Name Type Description
Cutoff Bool
Distance Int

API Reference: nodes.geometry.IntegerDistance

Is Even

Inputs

Name Type Description
Value Int

Outputs

Name Type Description
Even Bool
Odd Bool

API Reference: nodes.geometry.IsEven

MN Typed Bundles

Inputs

Name Type Description
Type Menu
Closure Closure
step Int
Path String

Outputs

Name Type Description
Bundle Bundle

API Reference: nodes.geometry.MNTypedBundles

Rotation from ZYZ

Combine a rotation defined as ZYZ common in electron tomography

Combine a rotation defined as ZYZ,common in electron tomography

Inputs

Name Type Description
Phi Float First rotation around the Z axis
Theta Float Second rotation around the Y axis
Psi Float Third rotation around the Z axis

Outputs

Name Type Description
Rotation Rotation The combined Rotation

API Reference: nodes.geometry.RotationFromZYZ

Transform Accumulate

Accumulate transforms on the domain if selected

Inputs

Name Type Description
Domain Menu Domain on which to accumulate transforms
Accumulate Bool Selected transforms are included in the accumulation, non-selected transforms become identity matrices
Transform Matrix Transform field to accumulate
Group ID Int Transform field is accumulated individually for each Group ID

Outputs

Name Type Description
Transform Matrix The accumulating Transform field

API Reference: nodes.geometry.TransformAccumulate

Transform Accumulate Point

Accumulate transforms on the point domain

Accumulate transforms on a domain, applying these transforms to the Position

Inputs

Name Type Description
Domain Menu Domain on which to accumulate the transforms
Accumulate Bool Include the transform in the final accumlation
Position Vector Point to transform, defaults to Position
Transform Matrix Transform field to accumulate
Group ID Int Transform field is accumulated individually for each Group ID

Outputs

Name Type Description
Vector Vector Transformed vector

API Reference: nodes.geometry.TransformAccumulatePoint

Transform Local

Apply the transform after first moving to world origin, then returning to original position

Inputs

Name Type Description
Origin Vector Vector that defines the local space origin, defaults to Position
Transform Matrix Transform to apply in local space

Outputs

Name Type Description
Transform Matrix The final transform

API Reference: nodes.geometry.TransformLocal

Transform Local Axis

Create a transform around an axis in local space defined by the Origin point

Create a transform that is rotation around an axis in local space, with local space defined by the origin point which defaults to Position

Inputs

Name Type Description
Origin Vector The vector defining the local space. Defaults to Position
Axis Vector The axis to rotate around
Angle Float Amount to rotate around the axis

Outputs

Name Type Description
Transform Matrix The Transform around the axis

API Reference: nodes.geometry.TransformLocalAxis

Transform Mix

Mix between two transformations

Mix between two transforms, controlling the translation, rotation and scale independently

Inputs

Name Type Description
A Matrix Transform A to mix from at 0.0
B Matrix Transform B which will be mixed to at 1.0
Menu Menu
Translation Float Amount to mix the Translation between A and B
Rotation Float Amount to mix the Rotation between A and B
Scale Float Amount to mix the Scale between A and B
Factor Float

Outputs

Name Type Description
Transform Matrix The final mixed Transform

API Reference: nodes.geometry.TransformMix

Transform Relative

The transform to get from B to A, relative to the CB axis

Inputs

Name Type Description
A Vector The final position
B Vector The position moving from
C Vector The position defining the axis of CB

Outputs

Name Type Description
Transform Matrix The Transform to move from B to A, relative to the axis of C to B

API Reference: nodes.geometry.TransformRelative

Vector Angle

The angle between two vectors, in radians

Compute the angle in radians between two vectors.

Inputs

Name Type Description
A Vector The first vector for angle calculation
B Vector The second vector for the angle calculation

Outputs

Name Type Description
Angle Float The angle between the two vectors in radians
A×B Vector Axis around which the angle rotates (cross product of A and B)

API Reference: nodes.geometry.VectorAngle

Vector Direction

Direction from one point to another, optionally normalized

Inputs

Name Type Description
Normalize Bool
To Vector
From Vector

Outputs

Name Type Description
Direction Vector Vector between the points, potentially normalized
Distance Float Distance between the points before normalization

API Reference: nodes.geometry.VectorDirection

Vector from Point

Calculate the vector from the current point’s position to the input vector

Inputs

Name Type Description
Target Vector Vector that is the target
Position Vector Position of the current point

Outputs

Name Type Description
Vector Vector Vector from the current point’s position to the given vector
Direction Vector Normalized output vector
Length Float Length of the output vector
Rotation Rotation

API Reference: nodes.geometry.VectorFromPoint

Velocity

Outputs

Name Type Description
velocity Vector

API Reference: nodes.geometry.Velocity

World to Angstrom

Inputs

Name Type Description
World Float

Outputs

Name Type Description
Angstrom Float

API Reference: nodes.geometry.WorldToAngstrom

2 Index Angle

Inputs

Name Type Description
Position Vector The Position vectors to use for the angle calculation
Index A Int First end point for the angle calculation around the current point
Index B Int The Index for the middle point in the angle calculation, defaulting to the current point
Index C Int Last end point for the angle calculation around the current point

Outputs

Name Type Description
Angle Float Angle of the line A -> Self -> C in radians

API Reference: nodes.geometry._2IndexAngle

3 Index Angle

Inputs

Name Type Description
Index A Int First of the points for the angle calculation
Index B Int The middle point for the angle calculation
Index C Int Last of the points for the angle calculation

Outputs

Name Type Description
Angle Float Angle between the points around Index B in radians

API Reference: nodes.geometry._3IndexAngle