Giter VIP home page Giter VIP logo

molecularnodes's Introduction

Molecular Nodes

Buy Me A Coffee

Molecular Nodes provides a convenient method for importing structural biology files into Blender, and several nodes for working with atomic data inside of Blender's Geometry Nodes.

Blender's Geometry Nodes provides a powerful interface for procedural modelling and animation. Currently it is limited in its ability to read any kind of structured data file as input, that isn't a 3D mesh. Molecular Nodes bridges this gap by providing an interface for converting .pdb and other file types into meshes that are usable by Geometry Nodes.

Acknowledgements

This addon is built crucially around the python library atomium, which provides a great lightweight and pure-python way to to parse a variety of structural biology files, that interface nicely with the built-in python interpreter that is bundled with Blender.

This addon is built using the excellent plugin for creating addons Serpens, which made the process of compiling a clear and concise addon, significantly reducing development time an creating a better addon overall.

Importantly none of this would be possible without the Blender and the Blender Foundation and the fantastic work of all the developers, from the community and the foundation itself.

This documentation is currently not complete for all of the nodes, but there should be enough to get you started. More complete documentation is in the works.

Installation

This addon is built with Blender v. 3.1.2, some of the nodes may break in earlier versions.

To install Molecular Nodes, download the latest release and install the addon through the preferences panel inside of Blender, and select the MolecularNodes_0.3.4.zip file

Edit -> Preferences -> Addons -> Install Screenshot highlighting the install addon button.

If the addon isn't highlighted, search for it and click the tick box to enable the addon. Screenshot highlighting the enable Molecular Nodes Addon

Installing Atomium

Windows: You must run Blender as Administrator to be able to install Atomium successfully.

Screenshot highlighting the Install Atomium Button

While still in the preferences panel, click the Install Atomium button to download and install the Atomium python library. This should only need to be done the first time you install Molecular Nodes. You will need to complete this step again if you reinstall Blender or upgrade the version.

The addon should now be enabled and available for use.

Loading Structures

You can load structures using the Molecular Nodes panel, which should be available at the top-right of the 3D viewport. You can press N to show & hide the side panels. Click on the Molecular Nodes tab to reveal the panel.

Screenshot highlighting the Molecular Nodes Penal

Molecular Noes provides two ways to open files. You can fetch directly from the PDB by inputting the 4-character code into the top box and pressing the download button. This will download the file and open it inside of Blender.

Screenshot showing the interface of the Molecular Nodes Panel

You can also open a file saved on your local computer. Click the folder icon to navigate to your .pdb file, select it and press OK. Then press Open on the Molecular Nodes panel to read the file and load the model into Blender.

Using the Nodes

Atomic Properties

With Molecular Nodes enabled, create a geometry nodes node tree, and inside the add menu (Shift + A) there will be an additional category for Molecular Nodes. image

To access the atomic properties that are associated with the model, add the "Atomic Properties" node from Properties -> Atomic Properties and in the node, select the *_properties collection. This will scale the points according to their Atomic Radii, and make all of the atomic properties associated with the atoms (atomic number, is_backbone / is_sidechain) available for use inside of the node tree.

Styling

image

To quickly colour the structure, add the "Style Colour" node from Styling -> Style Colour, select a material for the atoms, and connect the atomic_number from the Properties node to the atomic_number of the style node. The outputted colour becomes an output for the node tree.

image

Name the output for the node tree in the modifier tab: image

And add an attribute node to the shader, inputting the name for the colour output fromt the GN node tree, in this case colour. image

Voila!

By default, the atoms are 'point clouds' and only visible inside of Cycles.

The atoms should now be visible, inside of the Cycles render engine: image

To make the atoms visible inside of EEVEE, use the Styling -> Atoms EEVEE node. You will need to create and assign a material for each element individually.

image

Animating Frames

To animate between frames of a .pdb file, add the Animate Frames node from Animation -> Animate Frames and choose the *_frames collection to give the model the infomation of the different structures. You can now animate between the frames by using the Animate 0...1 slider which will animate between the first frame (0) and the last frame (1). Attach the Animate Node from Animation -> Animate to automatically play through the frames.

image

You can now play back the animation!

In the example below, I create the .pdb frames from this tweet and imported them with the steps above, and added a Random Vector based on the chain number, to colour the carbons of the different chains different colours.

Want to support the development of this addon? Buy me a coffee! (it took a lot of them to make it)

Buy Me A Coffee

molecularnodes's People

Contributors

bradyajohnston avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.