How do I…
A quick reference document on how to do common operations inside of Molecular Nodes.
Gotchas
I can’t see the atoms
In rendered view the atoms don’t show up!
The default starting style is MOL_style_atoms_cycles
. This is chosen because it is the safest option when importing larger structures to not crash your computer. It is not however only visible in the Cycles render engine and not Eevee. You can change the style you are applying to the molecule, or change the render engine to fix it.
Changing the colors but it’s still grey
If you are changing the colour of the molecule but it still appears gray, you are likely still in 3D view instead of rendered view.
Import
Import from the PDB
End the PDB ID and download. Options for removing the solvent from the structure on import (any potential water atoms), aligning the structure to the world origin, importing bond information and setting a starting default style.
Styles
Combine 2 different Styles
Apply the separate styles in a separate branch of the node tree. Combine the resulting styles with Join Geometry
node and use the result of this.
A different selection can be used on each style, with the style only being applied to the given selection for each branch of the node tree.
Change Style based on Distance
The same distance measurements from the Geometry Proximity
node can used in a Compare
node to apply a distance cutoff. In this example the distance cutoff is 0.8
and the output is a boolean selection. This boolean selection can then be used for the surface style, and the inverse through the Not Boolean Math
node is used for the ribbon style.
Color By
Manually Colour Chains
Cartoons and ribbons take their colours from the alpha carbon atoms. To colour secondary structure you can just set the colour of the carbon atoms using MOL_color_set_common
which is in the starting node tree.
To manually set the colours, there is a node that is generated uniquely for each structure based on the chain information. You can access via Add Node using Shift + A, Molecular Nodes
-> Color
-> Color by Chains
If you wish to set the colour for every atom in the structure based on the chain number, then you instead of the MOL_color_set_common
you can use the MOL_color_set
node which is accessible via Molecular Nodes -> Color -> Set Color
.
Color Based on B-factor
You can access any of the atomic attributes with the Named Attribute
node and using the name of the attribute. In this example we set the colour of the structure by first mapping the b_factor
attribute from 0..100
to 0..1
, then using this value from 0..1
to select a colour using a ColorRamp
node. The output of this colour goes into the MOL_color_set
node.
Color Based on Distance to an Object
You can measure the distance from each atom to a particular object using the Object Info
node to get the information from an object (ensure you select Relative instead of Original) and this is used by the Geometry Proximity
node. You can then use the Map Range
node to convert the min and maximum distance over which to change the colour. The output of the ColorRamp
node then sets the colors of the atoms.
The closer atoms to Suzanne are colored green, and the ones that are further away are colored red. As you move around Suzanne, the colors of the atoms are updated.