introvoyz041
commited on
Migrated from GitHub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +11 -0
- data/CHANGELOG.md +201 -0
- data/CONTRIBUTING.md +268 -0
- data/LICENSE +674 -0
- data/LICENSE.OLD +24 -0
- data/MANIFEST.in +1 -0
- data/build.py +177 -0
- data/docs/_extensions/mcanouil/preview-colour/_extension.yml +7 -0
- data/docs/_extensions/mcanouil/preview-colour/preview-colour.lua +130 -0
- data/docs/_quarto.yml +70 -0
- data/docs/attributes.qmd +110 -0
- data/docs/cite/citations.yml +44 -0
- data/docs/cite/index.qmd +15 -0
- data/docs/data_table.qmd +130 -0
- data/docs/example_animations.qmd +110 -0
- data/docs/examples/examples.yml +46 -0
- data/docs/examples/images/6e10_spin_squishy.mp4 +3 -0
- data/docs/examples/index.qmd +21 -0
- data/docs/examples/styles.css +89 -0
- data/docs/examples/template.ejs +61 -0
- data/docs/filters.lua +30 -0
- data/docs/generate.py +69 -0
- data/docs/images/index/mn-cartoon-example.gif +3 -0
- data/docs/images/index/mn-example-em.gif +3 -0
- data/docs/images/index/mn-example-starfile.mp4 +3 -0
- data/docs/images/index/mn-md-example-spike.gif +3 -0
- data/docs/images/index/mn-md-example.gif +3 -0
- data/docs/images/installation/download-blender.png +3 -0
- data/docs/images/installation/download.mp4 +3 -0
- data/docs/images/installation/preferences.png +3 -0
- data/docs/images/installation/search_install.png +3 -0
- data/docs/images/logo.png +3 -0
- data/docs/images/nodes/linked_data_block.png +3 -0
- data/docs/index.qmd +59 -0
- data/docs/installation.qmd +67 -0
- data/docs/nodes/index.qmd +21 -0
- data/docs/style.scss +156 -0
- data/docs/tutorials/00_interface.md +128 -0
- data/docs/tutorials/01_importing.qmd +142 -0
- data/docs/tutorials/02_selections.md +78 -0
- data/docs/tutorials/03_molecular_dynamics.md +120 -0
- data/docs/tutorials/04_cryoem.qmd +61 -0
- data/docs/tutorials/images/02_selections_example.png +3 -0
- data/docs/tutorials/images/down-example-local.png +3 -0
- data/docs/tutorials/images/down-example-pdb.png +3 -0
- data/docs/tutorials/images/edit_mode_selection.png +3 -0
- data/docs/tutorials/images/gn_complex_graph.png +3 -0
- data/docs/tutorials/images/gn_flow_information.png +3 -0
- data/docs/tutorials/images/menu_add.png +3 -0
- data/docs/tutorials/images/menu_render.png +3 -0
.gitattributes
CHANGED
@@ -57,3 +57,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
57 |
# Video files - compressed
|
58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
# Video files - compressed
|
58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
60 |
+
data/molecularnodes/assets/MN_data_file_4.2.blend filter=lfs diff=lfs merge=lfs -text
|
61 |
+
data/molecularnodes/assets/template/startup.blend filter=lfs diff=lfs merge=lfs -text
|
62 |
+
data/tests/data/cellpack/petworld/petworld-sarscov2_2-no_bonds.bcif filter=lfs diff=lfs merge=lfs -text
|
63 |
+
data/tests/data/cellpack/square1.bcif filter=lfs diff=lfs merge=lfs -text
|
64 |
+
data/tests/data/cellpack/square1.cif filter=lfs diff=lfs merge=lfs -text
|
65 |
+
data/tests/data/martini/dode_membrane/topol_nowat.tpr filter=lfs diff=lfs merge=lfs -text
|
66 |
+
data/tests/data/martini/dode_membrane/traj_imaged_dt1ns_frames_1-10.xtc filter=lfs diff=lfs merge=lfs -text
|
67 |
+
data/tests/data/martini/pent/PENT2_100frames.xtc filter=lfs diff=lfs merge=lfs -text
|
68 |
+
data/tests/data/martini/pent/prot_ion.tpr filter=lfs diff=lfs merge=lfs -text
|
69 |
+
data/tests/data/md_ppr/md.tpr filter=lfs diff=lfs merge=lfs -text
|
70 |
+
data/tests/data/synvesicle_2-no_bonds.bcif filter=lfs diff=lfs merge=lfs -text
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Changelog
|
2 |
+
|
3 |
+
All notable changes to this project will be documented in this file.
|
4 |
+
|
5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6 |
+
|
7 |
+
## \[UNRELEASED\]
|
8 |
+
|
9 |
+
### Added
|
10 |
+
|
11 |
+
- Support for importing `.star` files from RELION and cisTEM files for instancing of structures from EM tomography datasets ([#196](https://github.com/BradyAJohnston/MolecularNodes/pull/196))
|
12 |
+
- Adds `starfile` and `eulerangles` as dependencies
|
13 |
+
- Creates another tab for the MolecularNodes input panel called `Starfile`
|
14 |
+
- Adds `MOL_style_cartoon` for cartoon representations of proteins ([*#199*](https://github.com/BradyAJohnston/MolecularNodes/pull/199)). Currently supports:
|
15 |
+
- Beta sheets with & without arrow heads
|
16 |
+
- Alpha-helices as cylinders or as arrows
|
17 |
+
- Adds `MOL_utils_dssp` for detection of secondary structure.
|
18 |
+
|
19 |
+
### Fixed
|
20 |
+
|
21 |
+
- Improved secondary structure import when downloading structure from the PDB as a `mmtf` file which includes assigned secondary structure.
|
22 |
+
|
23 |
+
- Improved some calculations for surface style, \~2x speedup
|
24 |
+
|
25 |
+
- Added another row of buttons for the panel to avoid the buttons being squished
|
26 |
+
|
27 |
+
## \[[2.5.4](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.5.4)\] 2023-04-10
|
28 |
+
|
29 |
+
### Fixed
|
30 |
+
|
31 |
+
- Issue with creation of biological assembly nodes. ([#191](https://github.com/BradyAJohnston/MolecularNodes/pull/191))
|
32 |
+
|
33 |
+
## \[[2.5.3](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.5.3)\] - 2023-03-30
|
34 |
+
|
35 |
+
### Added
|
36 |
+
|
37 |
+
- Import of CryoEM `.map` files as volume objects. Addition of volume-centric nodes for styling the volumes. ([#164](https://github.com/BradyAJohnston/MolecularNodes/pull/164))
|
38 |
+
- New `sec_struct` attribute as an integer for secondary structure of proteins when imported via Biotite. Atoms in a residue are given an integer value to specificy their secondary structure ([#160](https://github.com/BradyAJohnston/MolecularNodes/pull/160)):
|
39 |
+
- 0 = '' : non-protein or not assigned by biotite annotate_sse
|
40 |
+
- 1 = a : alpha helix
|
41 |
+
- 2 = b : beta sheet
|
42 |
+
- 3 = c : coil
|
43 |
+
- Refactor of python package dependency management and installation. ([#172](https://github.com/BradyAJohnston/MolecularNodes/pull/172))
|
44 |
+
|
45 |
+
### Fixed
|
46 |
+
|
47 |
+
- Fix consistency in load_trajectory function call. `custom_selections` were being taken from the GUI from inside the `md.load_trajectory()` function, rather being passed in as a function which is now the case. ([#182](https://github.com/BradyAJohnston/MolecularNodes/pull/182))
|
48 |
+
|
49 |
+
## \[[2.4.3](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.4.3)\] - 2023-03-17
|
50 |
+
|
51 |
+
### Fixed
|
52 |
+
|
53 |
+
- Bumped version of biotite to install `0.36.1`
|
54 |
+
|
55 |
+
## [2.4.2](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.4.2) - 2023-03-14
|
56 |
+
|
57 |
+
### Added
|
58 |
+
|
59 |
+
### Fixed
|
60 |
+
|
61 |
+
- Fix for custom selections panel with MDAnalysis import.
|
62 |
+
- Blender crashed when using MDAnlysis import filter, if bonds were present in the topology. ([#177](https://github.com/BradyAJohnston/MolecularNodes/pull/177))
|
63 |
+
|
64 |
+
Fixed created during refactor that disabled the custom selection list for MD import.
|
65 |
+
|
66 |
+
## [2.4.0](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.4.0) - 2023-02-23
|
67 |
+
|
68 |
+
### Added
|
69 |
+
|
70 |
+
- Custom text input for creating selections of `res_id` ranges and indivual numbers thanks to @YaoYinYing ([#149](https://github.com/BradyAJohnston/MolecularNodes/pull/149)), enabling quicker creation of complex selections inside of Molecular Nodes.
|
71 |
+
|
72 |
+
### Fixed
|
73 |
+
|
74 |
+
- Refactor of package installation via pip, to help with those who require `pip` mirrors and provide more information when installation fails on ARM macs. ([#162](https://github.com/BradyAJohnston/MolecularNodes/pull/162))
|
75 |
+
- Removed redundant python submodules and general cleanup
|
76 |
+
|
77 |
+
## [2.3.1](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.3.1) - 2023-01-26
|
78 |
+
|
79 |
+
### Added
|
80 |
+
|
81 |
+
### Fixed
|
82 |
+
|
83 |
+
- Change translations for other languages to `bpy.app.translations.pgettext_data()` from `bpy.app.translations.pgettext()` which reduces potential conflicts with other addons. ([#147](https://github.com/BradyAJohnston/MolecularNodes/pull/147))
|
84 |
+
- Fixed `chain_id_unique` not being added when importing via MDAnalysis, stopping custom nodes relying on chain information to break. ([#156](https://github.com/BradyAJohnston/MolecularNodes/pull/156))
|
85 |
+
|
86 |
+
## [\[2.3.0\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.3.0) - 2023-01-26
|
87 |
+
|
88 |
+
### Added
|
89 |
+
|
90 |
+
- Panel for adding multiple selection strings, which will become boolean attributes on the imported model when importing via MDAnalysis.
|
91 |
+
|
92 |
+
### Fixed
|
93 |
+
|
94 |
+
- Ball and stick node sphers now support field input for scaling the radius
|
95 |
+
- Error with initial node setup breaking when in non-english Blender UI ([#139](https://github.com/BradyAJohnston/MolecularNodes/pull/139)) contributed by @YaoYinYing
|
96 |
+
- Problems with biological assemblies failling on larger structures. ([#143](https://github.com/BradyAJohnston/MolecularNodes/pull/145))
|
97 |
+
- Problem with Animate Frames node defaulting to wrong from range on start
|
98 |
+
|
99 |
+
## [\[2.2.2\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.2.2) - 2023-01-06
|
100 |
+
|
101 |
+
### Added
|
102 |
+
|
103 |
+
### Fixed
|
104 |
+
|
105 |
+
- Issue on linux and with newer versions of Numpy where `np.bool` is deprecated and was erroring on import.
|
106 |
+
|
107 |
+
## [\[2.2.1\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.2.1) - 2023-01-05
|
108 |
+
|
109 |
+
### Added
|
110 |
+
|
111 |
+
- multi-model `b_factor` is added when importing from `.pdb` files via biotite [#133](https://github.com/BradyAJohnston/MolecularNodes/pull/133)
|
112 |
+
- 'Invert' field option to atom_properties and other selection nodes to optionally invert the selection
|
113 |
+
- Added better detection of ligands and modifcations (such as sugars) and a separate selection node for them. Currently ligands are stored on the `res_name` attribute, starting at 100 and incrementing one for each unique ligand.
|
114 |
+
|
115 |
+
### Fixed
|
116 |
+
|
117 |
+
- `include_bonds` option was not being utilised on MD import [#132](https://github.com/BradyAJohnston/MolecularNodes/pull/132)
|
118 |
+
- `MOL_animate_res_wiggle` was wiggling the `OXT` (`res_name == 38`) oxygen when a peptide chain ended. Added additional selection to not wiggle this atom, which should only ever appear when a peptide chain terminates.
|
119 |
+
- fixed import of `vdw_radii` for elements not supported by biotite (such as Fe) by moving vdw_radii to the data dictionary rather than relying on a function from biotite which had a limited dictionary for vdw_radii lookup
|
120 |
+
|
121 |
+
## [\[2.2.0\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.2.0) - 2023-01-03
|
122 |
+
|
123 |
+
### Added
|
124 |
+
|
125 |
+
- `atom_name` attribute, which is a numerical representation of the atom name (C, CA, C5 etc)
|
126 |
+
- Dicussed in [#118](https://github.com/BradyAJohnston/MolecularNodes/issues/118)
|
127 |
+
- Allows for more precise selections for new styling and animation nodes
|
128 |
+
- Reimplemented amino acid 'wiggle' node: using the `atom_name` attribute
|
129 |
+
- 3x faster with the improved `atom_name` attribute and refactor of the underlying nodes
|
130 |
+
- Reimplemented the amino acid to curve node
|
131 |
+
- Ribbon Style Nucleic: A ribbon representation for nucleic acids to complement the ribbon represenation of the proteins from alpha carbons. Enabled now thanks to the `atom_name` attribute.
|
132 |
+
- Capturing the `Index` field in the selection node before the selection occurs, and added an `Index` field input to the `MOL_animate_frames` node to enable selection to occur before animating between frames, if the `Pre-Sel Index` field is used in the `Index` field of the `MOL_animate_frames` node
|
133 |
+
- Added cutoff field for limiting the interpolation of atoms between frames based on a distance cutoff
|
134 |
+
- Added bonds through MDAnalysis import when a trajectory supports it [#129](https://github.com/BradyAJohnston/MolecularNodes/issues/129)
|
135 |
+
- Added `is_solvent`, `is_nucleic` and `is_peptide` boolean attributes when importing via MDAnalysis
|
136 |
+
- Added frame-specific attribute `occupancy` which is added to each frame of the trajectory when imported via MDAnalysis. [#128](https://github.com/BradyAJohnston/MolecularNodes/issues/128)
|
137 |
+
|
138 |
+
### Fixed
|
139 |
+
|
140 |
+
- Changed naming of `MOL_style_atoms` to `MOL_style_atoms_cycles` and `MOL_style_ribbon` to `MOL_style_ribbon_protein`
|
141 |
+
|
142 |
+
## [\[2.1.0\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.1.0) - 2023-01-01
|
143 |
+
|
144 |
+
### Added
|
145 |
+
|
146 |
+
- `CHANGELOG.md` for tracking changes to the project
|
147 |
+
- Issue templates for GitHub issues
|
148 |
+
- Proper support for Fields for ribbon width, enabling 'licorice' representation amoung others
|
149 |
+
- Tooltips documentation for each of the custom node groups that can be added in Geometry Nodes
|
150 |
+
- More selection nodes for distance, XYZ slice and whole residues.
|
151 |
+
- Custom selections using a string when importing via MDAnalysis [#123](https://github.com/BradyAJohnston/MolecularNodes/pull/123)
|
152 |
+
- Added option to disable interpolation of atom positions between frames
|
153 |
+
- Added node for animating any field between frames of a trajectory (no fields currently added on import, but used in the new Aniamte Frames backend)
|
154 |
+
- UVs are now available for the ribbon mesh style, idea from [ErikMarklund](https://github.com/BradyAJohnston/MolecularNodes/issues/77#issuecomment-1273598042) and implemented by [quellenform](https://github.com/quellenform/blender-CurveToMeshUV)
|
155 |
+
|
156 |
+
### Fixed
|
157 |
+
|
158 |
+
- Error when defaulting to `connect_via_distance()` when importing with 'Find Bonds' enabled
|
159 |
+
- Adding of a color node which was mis-labelled and couldn't be added
|
160 |
+
- Non-`.gro` topology files were failling to add `vdw_radii` attribute [#124](https://github.com/BradyAJohnston/MolecularNodes/issues/124)
|
161 |
+
- Remove use of `np.int` which is now deprecated and was causing errors when [linking python on M1 Mac](https://github.com/BradyAJohnston/MolecularNodes/issues/108#issuecomment-1365540371)
|
162 |
+
- Attributes now available on ribbon mesh which are [sampled from backbone](https://github.com/BradyAJohnston/MolecularNodes/issues/77)
|
163 |
+
- Changed starting material to be appended instead of created, which should avoid duplication of material.
|
164 |
+
|
165 |
+
## [\[2.0.2\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.0.2) - 2022-12-13
|
166 |
+
|
167 |
+
### Fixed
|
168 |
+
|
169 |
+
- Error on reporting the success of improting a molecule
|
170 |
+
|
171 |
+
## [\[2.0.1\]](https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.0.1) - 2022-12-13
|
172 |
+
|
173 |
+
### Changed
|
174 |
+
|
175 |
+
- Remove usage of [Atomium](https://github.com/samirelanduk/atomium) and switched to [Biotite](https://github.com/biotite-dev/biotite) for most internal structural file parsing
|
176 |
+
|
177 |
+
- Removed reliance upon [Serpens](https://blendermarket.com/products/serpens) to build the addon. Can now be developed by anybody without the requirements of additional Blender addons.
|
178 |
+
|
179 |
+
- Aspects of the addon can now have changes tracked properly by git, rather than inside a binary `.blend` Serpens file.
|
180 |
+
- Now also allows easier and clearer contributions from others who wish to contribute
|
181 |
+
- Custom node trees still remain opaque to git unfortunately
|
182 |
+
|
183 |
+
- Attributes are now created and stored on the molecular model itself, removing the need for properties models that store the data XYZ positions. Makes the import process clearer, more robust and more easily expandable.
|
184 |
+
|
185 |
+
- Bond information is available by default as edges of the mesh along with bond types
|
186 |
+
|
187 |
+
- Improve MDAnalysis installation and usage internally
|
188 |
+
|
189 |
+
- Expose operators and functions to Blender Python console to enable user scripting with the addon
|
190 |
+
|
191 |
+
``` python
|
192 |
+
import molecularnodes as mn
|
193 |
+
|
194 |
+
# to fetch structures from the protein data bank
|
195 |
+
struc_list = ['4ozs', '1xi4', '6n2y']
|
196 |
+
for pdb in struc_list:
|
197 |
+
mn.load.molecule_rcsb(pdb, starting_style = 1)
|
198 |
+
|
199 |
+
# to open a local structure file
|
200 |
+
mn.load.molecule_local('file_path_here.pdb', 'SomeMoleculeName', starting_style = 2)
|
201 |
+
```
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Contributing to Molecular Nodes
|
2 |
+
|
3 |
+
## Table of Contents
|
4 |
+
- [Contributing to Molecular Nodes](#contributing-to-molecular-nodes)
|
5 |
+
- [Table of Contents](#table-of-contents)
|
6 |
+
- [Introduction](#introduction)
|
7 |
+
- [Molecular Nodes Overview](#molecular-nodes-overview)
|
8 |
+
- [Getting Started](#getting-started)
|
9 |
+
- [Understanding Blender Add-ons](#understanding-blender-add-ons)
|
10 |
+
- [`bpy`](#bpy)
|
11 |
+
- [Creating a Basic Operator:](#creating-a-basic-operator)
|
12 |
+
- [Project Structure](#project-structure)
|
13 |
+
- [Import](#import)
|
14 |
+
- [Manipulation](#manipulation)
|
15 |
+
- [Coding Standards](#coding-standards)
|
16 |
+
- [Submitting Changes](#submitting-changes)
|
17 |
+
- [Testing](#testing)
|
18 |
+
- [Python Environments](#python-environments)
|
19 |
+
- [Running Tests](#running-tests)
|
20 |
+
- [Writing and Building Docs](#writing-and-building-docs)
|
21 |
+
- [Getting Help](#getting-help)
|
22 |
+
|
23 |
+
## Introduction
|
24 |
+
Molecular Nodes is an add-on for the 3D modelling and animation program [Blender](https://blender.org). It enables import of structural biology data formats into Blender, and provides a suite of methods for interacting, animating and visualising this data.
|
25 |
+
|
26 |
+
The structure of Molecular Nodes is likely quite different to other python projects you may be familiar with, and different to other Blender add-ons as well. Some things are done in a particularly _quirky_ qay, usually to be usable as an add-on inside of Blender.
|
27 |
+
|
28 |
+
Molecular Nodes is primarily an add-on, and intended to be interacted with through Blender's GUI. There is experimental support for installing and using as a python package from `pypi`. This is still extremely experimental, and again results in a lot of strange quirks as we are using a program intended for use through a GUI, through a script.
|
29 |
+
|
30 |
+
### Molecular Nodes Overview
|
31 |
+
There are a couple of distinct areas of Molecular Nodes to be aware of.
|
32 |
+
|
33 |
+
1. Reading, parsing and importing data formats
|
34 |
+
2. Visualising data through Geometry Nodes
|
35 |
+
|
36 |
+
Most of the 'scripting' side of things is for the first section of parsing the wide variety of structural biology data formats and importing them into Blender. The general idea is that we turn molecular structures into 3D models by turning each atom into a vertex, and each bond into an edge between vertices. Once this data is imported, Blender has a suite of tools for dealing with '3D models', which we can exploit to work on molecular models as well.
|
37 |
+
|
38 |
+
## Getting Started
|
39 |
+
Unfortunately `.blend` files are binary files to git, so the full repo size can be quite large when downloading the full history (~1GB). It's recommended to clone this repository using `git clone --depth 1` which greatly reduces the size of the download.
|
40 |
+
|
41 |
+
For writing code, I highly recommend using VSCode and the [Blender VS Code](https://github.com/JacquesLucke/blender_vscode) addon which streamlines the development process. It provides a range of commands for building and quickly refreshing the add-on during development, greatly speeding up the process.
|
42 |
+
|
43 |
+
> **Important** First Time Building
|
44 |
+
>
|
45 |
+
> Run the `build.py` to download and setup required packages for the first time.
|
46 |
+
```py
|
47 |
+
blender -b -P build.py
|
48 |
+
```
|
49 |
+
|
50 |
+
Once installed, you can use the `Blender: Build and Start` command with VS Code open in the addon directory, to start Blender with the addon built and installed. Any changes that are then made to the underlying addon code, can be quickly previewed inside of the running Blender by using the VS Code command `Blender: Reload Addons`.
|
51 |
+
|
52 |
+
|
53 |
+
## Understanding Blender Add-ons
|
54 |
+
The general idea with add-ons is that they provide new functionality to Blender, usually by adding new panels with buttons that execute custom python code. Blender ships with it's own Python kernel inside, allowing for essentially any arbitrary Python code to be executed.
|
55 |
+
|
56 |
+
Usually this is done through the creation of [`operators`](https://docs.blender.org/manual/en/latest/interface/operators.html). Think of operators as just Python code that is executed when a button is pressed inside of the GUI. All of the the buttons inside of Blender execute an operator when pressed, which then carries out the desired actions. The operators have support for taking into account the current state of the GUI, where the mouse is, what objects are available etc when executing the code.
|
57 |
+
|
58 |
+
We _can_ execute code without calling an operator, but this has to be done via the Python REPL inside of Blender. To create a useful add-on, we define the code we want to be executed, then create a related operator that can call the code when required.
|
59 |
+
|
60 |
+
Because operators take into account `context` and other aspects of the GUI when executing, they can be difficult to work with at times when trying to script without the GUI, like when trying to use Blender as a package inside of a Jupyter Notebook. To help with this problem, the general design of Molecular Nodes is to create a function which includes all of the code we want, then the associated operator only calls this function with the relevant parameters and does nothing else. That way we can get the same results as the operator while scripting, without having to deal with operators.
|
61 |
+
|
62 |
+
In the example add-on below, we can see the operator class being defined as a subclass of the `bpy.types.Operator` class. It will have a method called `execute(self, context)` which is what is called when a button is pressed in the add-on. We will have access to `context` information (where the mouse cursor is, what viewport we are in etc). You can include as much code as you wish inside of the `execute()` function, but like previously described the design with Molecular Nodes is to define the function elsewhere so it can be called more easily in another script, then have the operator just call the the function and report the success.
|
63 |
+
|
64 |
+
### `bpy`
|
65 |
+
|
66 |
+
In Blender add-on development, `import bpy` is your gateway to the Blender Python API. Anything that you can do via Blender's UI, you can usually achieve via calls to `bpy`.
|
67 |
+
|
68 |
+
```python
|
69 |
+
import bpy
|
70 |
+
|
71 |
+
bpy.data # Access all of the data blocks inside of Blender
|
72 |
+
bpy.data.objects # access all of the objects in the scene by name
|
73 |
+
|
74 |
+
cube = bpy.data.objects['Cube'] # get the data block for an object in Blender
|
75 |
+
cube.data # the data associated with the cube, such as edges, vertices, faces
|
76 |
+
cube.data.attributes
|
77 |
+
cube.data.vertices
|
78 |
+
|
79 |
+
bpy.ops # all of the pre-defined operators inside of Blender
|
80 |
+
|
81 |
+
bpy.context # all of the global context values, i.e. different properties set in the UI
|
82 |
+
bpy.types # the different pre-defined types used through bpy
|
83 |
+
```
|
84 |
+
|
85 |
+
`bpy` exposes a wide range of classes and functions, enabling you to perform tasks like creating objects, applying materials, setting animations, and much more, all programmatically.
|
86 |
+
|
87 |
+
For example, `bpy.data` grants access to the data blocks within Blender, such as meshes, materials, and textures, while `bpy.ops` allows you to call operators to perform specific actions, like rendering an image or duplicating an object.
|
88 |
+
|
89 |
+
Until earlier this year, `bpy` was only available when running scripts from inside of Blender, but it is now a `pip` installable package, which helps us with running test suites and for potential integrations with Jupyter Notebooks and other scripting environments.
|
90 |
+
|
91 |
+
### Creating a Basic Operator:
|
92 |
+
|
93 |
+
In Blender, operators are actions that can be triggered by the user or other parts of the code. They can range from simple tasks like moving an object to complex operations like rendering an animation.
|
94 |
+
|
95 |
+
Operators can execute code of any arbitrary length. They can provide additional _context_ in the form of the `context` argument, which is given by Blender depending on where the operator is invoked. If you press a button in one window of Blender, it might do something different compared to a different window of Blender. Most of the operators inside of Molecular Nodes do not change their behaviour.
|
96 |
+
|
97 |
+
The design of Molecular Nodes is mostly to expose all of the functionality inside individual function calls. To download a protein from the PDB, import it to Blender and create starting style, you can use the `mn.load.molecular_rcsb()` function. Inside of the UI for Blender, when the user clicks the <kbd>Download from PDB</kbd> button, the operator just calls this function with the inputs taken from the local context, such as starting style and PDB code to download. The operators themselves should not be doing any kind of complex operations, as that functionality won't then be available for use via scripts.
|
98 |
+
|
99 |
+
Below is the minimum required to create an add-on for Blender. We define a custom function, create an operator that executes code (calling the function), we create some UI that displays a button to execute the operator, and we create `register()` and `unregister()` functions to install and uninstall the add-on.
|
100 |
+
|
101 |
+
|
102 |
+
```py
|
103 |
+
import bpy
|
104 |
+
|
105 |
+
def my_function():
|
106 |
+
print("hello world!")
|
107 |
+
|
108 |
+
class SimpleOperator(bpy.types.Operator):
|
109 |
+
bl_idname = "wm.simple_operator"
|
110 |
+
bl_label = "Simple Operator"
|
111 |
+
|
112 |
+
def execute(self, context):
|
113 |
+
#code to be executed by the operator goes in the `execute()` function
|
114 |
+
my_function()
|
115 |
+
|
116 |
+
# operators inside of Blender return `{'FINISHED'}` to signal they have completed
|
117 |
+
# correctly and Blender can return control of the program back to the user.
|
118 |
+
# This is why they are useful for UI operations, but less useful for scripting
|
119 |
+
# other potential returns are 'CANCELLED', 'RUNNING_MODAL', 'PASS_THROUGH'
|
120 |
+
return {'FINISHED'}
|
121 |
+
|
122 |
+
# define a menu that will appear inside of the Blender's UI
|
123 |
+
# the layout function `layout.operator()` will take a string name of the operator,
|
124 |
+
# and create a button in the UI which will execute the operator when the buttons is pressed
|
125 |
+
def menu_func(self, context):
|
126 |
+
# you can input either the string for the operator name, or take that
|
127 |
+
# name from the class itself
|
128 |
+
self.layout.operator(SimpleOperator.bl_idname)
|
129 |
+
self.layout.operator("wm.simple_operator")
|
130 |
+
|
131 |
+
|
132 |
+
# The `register()` and `unregister()` functions are run whenever Blender loads the
|
133 |
+
# addon. This occurs the first time the add-on is installed and enabled, and then whenever
|
134 |
+
# Blender is started while the add-on is enabled. For Blender to be aware of the operator's
|
135 |
+
# existence, it has to be registered (and unregistered when uninstalled). The same has to
|
136 |
+
# happen for the UI components
|
137 |
+
def register():
|
138 |
+
bpy.utils.register_class(SimpleOperator)
|
139 |
+
bpy.types.VIEW3D_MT_mesh.append(menu_func)
|
140 |
+
|
141 |
+
def unregister():
|
142 |
+
bpy.utils.unregister_class(SimpleOperator)
|
143 |
+
bpy.types.VIEW3D_MT_mesh.remove(menu_func)
|
144 |
+
```
|
145 |
+
|
146 |
+
The `register()` and `unregister()` functions are two crucial components of a Blender add-on and have to be included. These functions are called when the add-on is enabled or disabled. They register all of the operators, UI elements and other necessary components with Blender when the add-on is enabled, and remove them all when it's disabled to ensure that you don't have a panel showing up for an add-on that isn't being used.
|
147 |
+
|
148 |
+
These functions are called automatically when using Blender via the GUI, but have to be manually called when scripting outside of Blender.
|
149 |
+
|
150 |
+
```py
|
151 |
+
import molecularnodes as mn
|
152 |
+
mn.register()
|
153 |
+
# other code here
|
154 |
+
```
|
155 |
+
|
156 |
+
|
157 |
+
## Project Structure
|
158 |
+
|
159 |
+
The way that data flows and is handled is unconventional, and likely different
|
160 |
+
to other python packages that you might have experience with.
|
161 |
+
|
162 |
+
There are two main components to the add-on, split into `Import` and
|
163 |
+
`Manipulation`. Depending on data format, the `import` is handled by a different python package. For downloading from the wwPDB and importing most local `.pdb` and `.cif` files, `biotite` is used. When importing a molecular dynamics trajectory.
|
164 |
+
|
165 |
+
All import methods result in a Blender object, and then the `Geometry Nodes` system inside of Blender manipulates and styles the imported 3D model.
|
166 |
+
|
167 |
+
|
168 |
+
### Import
|
169 |
+
|
170 |
+
Importing is the more traditional aspect of the add-on. With the help of several
|
171 |
+
python packages such as `biotite`, `MDAnalysis` and others, various molecular
|
172 |
+
data formats are parsed.
|
173 |
+
|
174 |
+
Once parsed, the data is turned into a 3D mesh, with a vertex for each atom and
|
175 |
+
an edge for each bond (if information available). Now inside Blender as a
|
176 |
+
'native' 3D mesh, Geometry Nodes handles all further manipulation of the data,
|
177 |
+
with additional animations, duplication, selections, and creation of new
|
178 |
+
geometry in the form of styles.
|
179 |
+
|
180 |
+
Below shows the potential flow of data, showing whether MDAnalysis (MDA),
|
181 |
+
Blender's python module (bpy) or Geometry Nodes (GN) are responsible for
|
182 |
+
handling that data. Once the data is parsed into a universe, MDA can select,
|
183 |
+
filter and do other operations on the topology and the trajectory of the
|
184 |
+
universe. While MDA can update the object inside of Blender by
|
185 |
+
|
186 |
+
```mermaid
|
187 |
+
flowchart LR
|
188 |
+
A{Data File} -->|MDA|B
|
189 |
+
B(MDA.Universe) -->|bpy|C
|
190 |
+
B -->|MDA|B
|
191 |
+
C[Blender Object] -->|GN|D
|
192 |
+
C -->|GN|C
|
193 |
+
D -->|GN|C
|
194 |
+
D[Styled Molecule] --->|GN|D
|
195 |
+
```
|
196 |
+
|
197 |
+
### Manipulation
|
198 |
+
|
199 |
+
Manipulation is handled entirely by the Geometry Nodes (GN) system that exists
|
200 |
+
inside of Blender. Inside of Geometry Nodes, users can create node trees to
|
201 |
+
modify, animate and style their macromolecular structures, through a range of
|
202 |
+
pre-made node groups which are included inside of the add-on.
|
203 |
+
|
204 |
+
The nodes take the underlying atomic data, which is stored as a 3D mesh with
|
205 |
+
each vertex representing an atom, and each edge between those vertices
|
206 |
+
representing a bond (where applicable). Both the vertices and edges can store
|
207 |
+
arbitrary attributes, which we use to store the atomic information with the
|
208 |
+
atoms and bonds. Currently only numeric, boolean and vector attributes are
|
209 |
+
supported, but in the future strings and more complex attributes will also be
|
210 |
+
supported.
|
211 |
+
|
212 |
+
Interacting with the nodes via scripting is still quite difficult, the API on
|
213 |
+
this on Blender's side still needs a lot of improvements. So far the best
|
214 |
+
approach has been to 'manually' make the node groups inside of Blender, and then
|
215 |
+
save them and append the pre-made node groups from other `.blend` files to the
|
216 |
+
current working file. This isn't a fantastic strategy as the `.blend` files are
|
217 |
+
opaque to `git`, so we just need to rely upon tests for checking if something is
|
218 |
+
broken.
|
219 |
+
|
220 |
+
## Coding Standards
|
221 |
+
This project has already gone through several iterations to improve the general code base and the ability for others to contribute. It started as my (@bradyajohnston) first python project, so there is still lots of old code that could do with a refresh. It is slowly being improve to better fit PEP8 standards, but there are no official standards for the project currently. I welcome suggestions and discussion around the topic.
|
222 |
+
|
223 |
+
## Submitting Changes
|
224 |
+
Please open an issue or PR if you would like to discuss submitting changes. Support for importing more data formats or improving on current import formats are more than welcome. Submitting changes for node groups can be a bit tricky as the node graphs inside of Blender don't work with `git`, so please open an issue or discussion with propose changes.
|
225 |
+
|
226 |
+
|
227 |
+
## Testing
|
228 |
+
|
229 |
+
### Python Environments
|
230 |
+
Blender is _VERY PARTICULAR_ about python versions. Blender 4.1 now uses Python `3.11.X`. Blender 4.0 and some earlier versions use Python `3.10.X`. I recommend using `anaconda` or something similar to manage python environments. They aren't required for building and running the add-on (this is handled by the Python that is shipped inside of Blender), but they are required for running tests.
|
231 |
+
|
232 |
+
```bash
|
233 |
+
conda create -n mn python==3.11
|
234 |
+
conda activate mn
|
235 |
+
pip install poetry
|
236 |
+
poetry install --with dev
|
237 |
+
```
|
238 |
+
|
239 |
+
### Running Tests
|
240 |
+
```bash
|
241 |
+
pytest -v # run with a more verbose output
|
242 |
+
pytest -v tests/test_load.py # run a single tests file
|
243 |
+
pytest -v -k centre # pattern match to 'centre' and only run tests with that in the name
|
244 |
+
```
|
245 |
+
|
246 |
+
Look over other tests to see how we are structuring them. Most of the tests will involve importing data, generating a 3D model and then creating a `snapshot` of the attributes for some subset of vertices from that 3D model.
|
247 |
+
We could snapshot _all_ of the vertices, but the snapshots are just `.txt` files so the diffs would become very large.
|
248 |
+
When changing something that _should_ change the output of the snapshots, we end up with _very_ large number of files changed.
|
249 |
+
Based on the current snapshot method, I can't think of of a better way to handle this.
|
250 |
+
|
251 |
+
## Writing and Building Docs
|
252 |
+
To build the documentation, [`Quarto`](https://quarto.org) is used. The docs can be built and previewed with the following line which launches a live preview of the docs.
|
253 |
+
|
254 |
+
|
255 |
+
```bash
|
256 |
+
conda activate mn
|
257 |
+
python docs/generate.py
|
258 |
+
quarto preview
|
259 |
+
```
|
260 |
+
|
261 |
+
The long-form written documentation is all inside of `docs/`. Documentation is written in markdown (`.md`) or quarto-flavored markdown (`.qmd`) which allows to execute code when building the docs.
|
262 |
+
|
263 |
+
The documentation for individual nodes which are shown [here](https://bradyajohnston.github.io/MolecularNodes/nodes/) are built by running the `docs/generate.py`, which extracts information from the relevent `.blend` data files inside of `molecularnodes/assets/`. Combining the information for the input / output types & tooltips with the summaries described in `molecularnodes/ui/node_info.py` we can then generate nice HTML documentation for each of the nodes.
|
264 |
+
|
265 |
+
This isn't currently the best implementation for this. I would prefer to just pull from those nodes which are defined in the `.blend` file, but we aren't able to include descriptions for the node groups currently inside of the `.blend`. `node_info.py` is also used for building the add menus as well as the documentation. To update the descriptions of inputs, outputs and data types the nodes themselves need to be updated inside of the `.blend` files. Relevant example videos should be updated when nodes are changed.
|
266 |
+
|
267 |
+
## Getting Help
|
268 |
+
Please open an issue on the repo to ask questions relating to development or testing.
|
data/LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<https://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
data/LICENSE.OLD
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This text is included pursuant to the obligations of an upstream licence and must be
|
2 |
+
retained in any derivatives, but it is not the licence applicable to this code
|
3 |
+
|
4 |
+
MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2022 Brady Johnston
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in all
|
16 |
+
copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24 |
+
SOFTWARE.
|
data/MANIFEST.in
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
recursive-include molecularnodes/assets *
|
data/build.py
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import glob
|
2 |
+
import os
|
3 |
+
import subprocess
|
4 |
+
import sys
|
5 |
+
from dataclasses import dataclass
|
6 |
+
from typing import List, Union
|
7 |
+
import bpy
|
8 |
+
|
9 |
+
|
10 |
+
def run_python(args: str | List[str]):
|
11 |
+
python = os.path.realpath(sys.executable)
|
12 |
+
|
13 |
+
if isinstance(args, str):
|
14 |
+
args = [python] + args.split(" ")
|
15 |
+
elif isinstance(args, list):
|
16 |
+
args = [python] + args
|
17 |
+
else:
|
18 |
+
raise ValueError(
|
19 |
+
"Arguments must be a string to split into individual arguments by space"
|
20 |
+
"or a list of individual arguments already split"
|
21 |
+
)
|
22 |
+
|
23 |
+
subprocess.run(args)
|
24 |
+
|
25 |
+
|
26 |
+
try:
|
27 |
+
import tomlkit
|
28 |
+
except ModuleNotFoundError:
|
29 |
+
run_python("-m pip install tomlkit")
|
30 |
+
import tomlkit
|
31 |
+
|
32 |
+
TOML_PATH = "molecularnodes/blender_manifest.toml"
|
33 |
+
WHL_PATH = "./molecularnodes/wheels"
|
34 |
+
PYPROJ_PATH = "./pyproject.toml"
|
35 |
+
|
36 |
+
|
37 |
+
@dataclass
|
38 |
+
class Platform:
|
39 |
+
pypi_suffix: str
|
40 |
+
metadata: str
|
41 |
+
|
42 |
+
|
43 |
+
# tags for blender metadata
|
44 |
+
# platforms = ["windows-x64", "macos-arm64", "linux-x64", "windows-arm64", "macos-x64"]
|
45 |
+
|
46 |
+
|
47 |
+
windows_x64 = Platform(pypi_suffix="win_amd64", metadata="windows-x64")
|
48 |
+
linux_x64 = Platform(pypi_suffix="manylinux2014_x86_64", metadata="linux-x64")
|
49 |
+
macos_arm = Platform(pypi_suffix="macosx_12_0_arm64", metadata="macos-arm64")
|
50 |
+
macos_intel = Platform(pypi_suffix="macosx_10_16_x86_64", metadata="macos-x64")
|
51 |
+
|
52 |
+
|
53 |
+
with open(PYPROJ_PATH, "r") as file:
|
54 |
+
pyproj = tomlkit.parse(file.read())
|
55 |
+
required_packages = pyproj["project"]["dependencies"]
|
56 |
+
|
57 |
+
|
58 |
+
build_platforms = [
|
59 |
+
windows_x64,
|
60 |
+
linux_x64,
|
61 |
+
macos_arm,
|
62 |
+
macos_intel,
|
63 |
+
]
|
64 |
+
|
65 |
+
|
66 |
+
def remove_whls():
|
67 |
+
for whl_file in glob.glob(os.path.join(WHL_PATH, "*.whl")):
|
68 |
+
os.remove(whl_file)
|
69 |
+
|
70 |
+
|
71 |
+
def download_whls(
|
72 |
+
platforms: Union[Platform, List[Platform]],
|
73 |
+
required_packages: List[str] = required_packages,
|
74 |
+
python_version="3.11",
|
75 |
+
clean: bool = True,
|
76 |
+
):
|
77 |
+
if isinstance(platforms, Platform):
|
78 |
+
platforms = [platforms]
|
79 |
+
|
80 |
+
if clean:
|
81 |
+
remove_whls()
|
82 |
+
|
83 |
+
for platform in platforms:
|
84 |
+
run_python(
|
85 |
+
f"-m pip download {' '.join(required_packages)} --dest ./molecularnodes/wheels --only-binary=:all: --python-version={python_version} --platform={platform.pypi_suffix}"
|
86 |
+
)
|
87 |
+
|
88 |
+
|
89 |
+
def update_toml_whls(platforms):
|
90 |
+
# Define the path for wheel files
|
91 |
+
wheels_dir = "molecularnodes/wheels"
|
92 |
+
wheel_files = glob.glob(f"{wheels_dir}/*.whl")
|
93 |
+
wheel_files.sort()
|
94 |
+
|
95 |
+
# Packages to remove
|
96 |
+
packages_to_remove = {
|
97 |
+
"pyarrow",
|
98 |
+
"certifi",
|
99 |
+
"charset_normalizer",
|
100 |
+
"idna",
|
101 |
+
"numpy",
|
102 |
+
"requests",
|
103 |
+
"urllib3",
|
104 |
+
}
|
105 |
+
|
106 |
+
# Filter out unwanted wheel files
|
107 |
+
to_remove = []
|
108 |
+
to_keep = []
|
109 |
+
for whl in wheel_files:
|
110 |
+
if any(pkg in whl for pkg in packages_to_remove):
|
111 |
+
to_remove.append(whl)
|
112 |
+
else:
|
113 |
+
to_keep.append(whl)
|
114 |
+
|
115 |
+
# Remove the unwanted wheel files from the filesystem
|
116 |
+
for whl in to_remove:
|
117 |
+
os.remove(whl)
|
118 |
+
|
119 |
+
# Load the TOML file
|
120 |
+
with open(TOML_PATH, "r") as file:
|
121 |
+
manifest = tomlkit.parse(file.read())
|
122 |
+
|
123 |
+
# Update the wheels list with the remaining wheel files
|
124 |
+
manifest["wheels"] = [f"./wheels/{os.path.basename(whl)}" for whl in to_keep]
|
125 |
+
|
126 |
+
# Simplify platform handling
|
127 |
+
if not isinstance(platforms, list):
|
128 |
+
platforms = [platforms]
|
129 |
+
manifest["platforms"] = [p.metadata for p in platforms]
|
130 |
+
|
131 |
+
# Write the updated TOML file
|
132 |
+
with open(TOML_PATH, "w") as file:
|
133 |
+
file.write(
|
134 |
+
tomlkit.dumps(manifest)
|
135 |
+
.replace('["', '[\n\t"')
|
136 |
+
.replace("\\\\", "/")
|
137 |
+
.replace('", "', '",\n\t"')
|
138 |
+
.replace('"]', '",\n]')
|
139 |
+
)
|
140 |
+
|
141 |
+
|
142 |
+
def clean_files(suffix: str = ".blend1") -> None:
|
143 |
+
pattern_to_remove = f"molecularnodes/**/*{suffix}"
|
144 |
+
for blend1_file in glob.glob(pattern_to_remove, recursive=True):
|
145 |
+
os.remove(blend1_file)
|
146 |
+
|
147 |
+
|
148 |
+
def build_extension(split: bool = True) -> None:
|
149 |
+
for suffix in [".blend1", ".MNSession"]:
|
150 |
+
clean_files(suffix=suffix)
|
151 |
+
|
152 |
+
if split:
|
153 |
+
subprocess.run(
|
154 |
+
f"{bpy.app.binary_path} --command extension build"
|
155 |
+
" --split-platforms --source-dir molecularnodes --output-dir .".split(" ")
|
156 |
+
)
|
157 |
+
else:
|
158 |
+
subprocess.run(
|
159 |
+
f"{bpy.app.binary_path} --command extension build "
|
160 |
+
"--source-dir molecularnodes --output-dir .".split(" ")
|
161 |
+
)
|
162 |
+
|
163 |
+
|
164 |
+
def build(platform) -> None:
|
165 |
+
download_whls(platform)
|
166 |
+
update_toml_whls(platform)
|
167 |
+
build_extension()
|
168 |
+
|
169 |
+
|
170 |
+
def main():
|
171 |
+
# for platform in build_platforms:
|
172 |
+
# build(platform)
|
173 |
+
build(build_platforms)
|
174 |
+
|
175 |
+
|
176 |
+
if __name__ == "__main__":
|
177 |
+
main()
|
data/docs/_extensions/mcanouil/preview-colour/_extension.yml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: preview-colour
|
2 |
+
author: Mickaël Canouil
|
3 |
+
version: 0.3.0
|
4 |
+
quarto-required: ">=1.3.0"
|
5 |
+
contributes:
|
6 |
+
filters:
|
7 |
+
- preview-colour.lua
|
data/docs/_extensions/mcanouil/preview-colour/preview-colour.lua
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
--[[
|
2 |
+
# MIT License
|
3 |
+
#
|
4 |
+
# Copyright (c) Mickaël Canouil
|
5 |
+
#
|
6 |
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
+
# of this software and associated documentation files (the "Software"), to deal
|
8 |
+
# in the Software without restriction, including without limitation the rights
|
9 |
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
# copies of the Software, and to permit persons to whom the Software is
|
11 |
+
# furnished to do so, subject to the following conditions:
|
12 |
+
|
13 |
+
# The above copyright notice and this permission notice shall be included in all
|
14 |
+
# copies or substantial portions of the Software.
|
15 |
+
|
16 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22 |
+
# SOFTWARE.
|
23 |
+
]]
|
24 |
+
|
25 |
+
local function is_empty(s)
|
26 |
+
return s == nil or s == ''
|
27 |
+
end
|
28 |
+
|
29 |
+
local preview_colour_meta = {
|
30 |
+
["text"] = true,
|
31 |
+
["code"] = true
|
32 |
+
}
|
33 |
+
|
34 |
+
function get_colour_preview_meta(meta)
|
35 |
+
local preview_colour_text = true
|
36 |
+
local preview_colour_code = true
|
37 |
+
if not is_empty(meta['preview-colour']) then
|
38 |
+
if not is_empty(meta['preview-colour']['text']) then
|
39 |
+
preview_colour_text = meta['preview-colour']['text']
|
40 |
+
end
|
41 |
+
if not is_empty(meta['preview-colour']['code']) then
|
42 |
+
preview_colour_code = meta['preview-colour']['code']
|
43 |
+
end
|
44 |
+
end
|
45 |
+
meta['preview-colour'] = {
|
46 |
+
["text"] = preview_colour_text,
|
47 |
+
["code"] = preview_colour_code
|
48 |
+
}
|
49 |
+
preview_colour_meta = meta['preview-colour']
|
50 |
+
return meta
|
51 |
+
end
|
52 |
+
|
53 |
+
|
54 |
+
function get_colour(element)
|
55 |
+
function get_hex_color(n)
|
56 |
+
return '#' .. string.rep('[0-9a-fA-F]', n)
|
57 |
+
end
|
58 |
+
|
59 |
+
local hex = nil
|
60 |
+
for i = 6, 3, -1 do
|
61 |
+
hex = element.text:match('(' .. get_hex_color(i) .. ')')
|
62 |
+
if (i == 5 or i == 4) and hex ~= nil then
|
63 |
+
hex = nil
|
64 |
+
break
|
65 |
+
end
|
66 |
+
if hex ~= nil and (i == 6 or i == 3) then
|
67 |
+
break
|
68 |
+
end
|
69 |
+
end
|
70 |
+
if hex == nil then
|
71 |
+
hex = element.text:match('(rgb%s*%(%s*%d+%s*,%s*%d+%s*,%s*%d+%s*%))')
|
72 |
+
end
|
73 |
+
if hex == nil then
|
74 |
+
hex = element.text:match('(hsl%s*%(%s*%d+%s*,%s*%d+%s*%%,%s*%d+%s*%%s*%))')
|
75 |
+
end
|
76 |
+
|
77 |
+
return hex
|
78 |
+
end
|
79 |
+
|
80 |
+
function process_str(element, meta)
|
81 |
+
if preview_colour_meta['text'] == false then
|
82 |
+
return element
|
83 |
+
end
|
84 |
+
if preview_colour_meta['text'] == true then
|
85 |
+
hex = get_colour(element)
|
86 |
+
if hex ~= nil then
|
87 |
+
if quarto.doc.is_format("html:js") then
|
88 |
+
colour_preview_mark = "<span style=\"display: inline-block; color: " .. hex .. ";\">◉</span>"
|
89 |
+
new_text = string.gsub(
|
90 |
+
element.text,
|
91 |
+
hex,
|
92 |
+
hex .. colour_preview_mark
|
93 |
+
)
|
94 |
+
return pandoc.RawInline('html', new_text)
|
95 |
+
elseif quarto.doc.is_format("latex") then
|
96 |
+
colour_preview_mark = "\\textcolor[HTML]{" .. string.gsub(hex, '#', '') .. "}{\\textbullet}"
|
97 |
+
new_text = string.gsub(
|
98 |
+
element.text,
|
99 |
+
hex,
|
100 |
+
"\\" .. hex .. colour_preview_mark
|
101 |
+
)
|
102 |
+
return pandoc.RawInline('latex', new_text)
|
103 |
+
end
|
104 |
+
end
|
105 |
+
end
|
106 |
+
end
|
107 |
+
|
108 |
+
function process_code(element)
|
109 |
+
if preview_colour_meta['code'] == false then
|
110 |
+
return element
|
111 |
+
end
|
112 |
+
if preview_colour_meta['code'] == true then
|
113 |
+
hex = get_colour(element)
|
114 |
+
if hex ~= nil then
|
115 |
+
if quarto.doc.is_format("html:js") then
|
116 |
+
colour_preview_mark = "<span style=\"display: inline-block; color: " .. hex .. ";\">◉</span>"
|
117 |
+
return pandoc.Span({element, pandoc.RawInline('html', colour_preview_mark)})
|
118 |
+
elseif quarto.doc.is_format("latex") then
|
119 |
+
colour_preview_mark = "\\textcolor[HTML]{" .. string.gsub(hex, '#', '') .. "}{\\textbullet}"
|
120 |
+
return pandoc.Span({element, pandoc.RawInline('latex', colour_preview_mark)})
|
121 |
+
end
|
122 |
+
end
|
123 |
+
end
|
124 |
+
end
|
125 |
+
|
126 |
+
return {
|
127 |
+
{Meta = get_colour_preview_meta},
|
128 |
+
{Str = process_str},
|
129 |
+
{Code = process_code}
|
130 |
+
}
|
data/docs/_quarto.yml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
project:
|
2 |
+
type: website
|
3 |
+
output-dir: _build
|
4 |
+
|
5 |
+
filters:
|
6 |
+
- filters.lua
|
7 |
+
- quarto
|
8 |
+
|
9 |
+
website:
|
10 |
+
title: "Molecular Nodes"
|
11 |
+
page-navigation: true
|
12 |
+
navbar:
|
13 |
+
left:
|
14 |
+
- file: installation.qmd
|
15 |
+
text: Installation
|
16 |
+
- file: tutorials/
|
17 |
+
text: Tutorials
|
18 |
+
- file: attributes.qmd
|
19 |
+
text: Documentation
|
20 |
+
- file: examples/
|
21 |
+
text: Examples
|
22 |
+
- file: cite/
|
23 |
+
text: Citations
|
24 |
+
tools:
|
25 |
+
- icon: github
|
26 |
+
href: https://github.com/BradyAJohnston/MolecularNodes
|
27 |
+
- icon: twitter
|
28 |
+
href: https://twitter.com/bradyajohnston
|
29 |
+
- icon: youtube
|
30 |
+
href: https://youtube.com/c/bradyjohnston
|
31 |
+
|
32 |
+
sidebar:
|
33 |
+
- id: documentation
|
34 |
+
title: Documentation
|
35 |
+
style: floating
|
36 |
+
align: left
|
37 |
+
# pinned: true
|
38 |
+
contents:
|
39 |
+
- installation.qmd
|
40 |
+
- attributes.qmd
|
41 |
+
- data_table.qmd
|
42 |
+
- text: Nodes
|
43 |
+
href: nodes/index.qmd
|
44 |
+
contents: nodes/*
|
45 |
+
|
46 |
+
|
47 |
+
- id: tutorials
|
48 |
+
Title: Tutorials
|
49 |
+
align: left
|
50 |
+
style: floating
|
51 |
+
contents: tutorials/
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
page-footer:
|
56 |
+
left: "This site is built with ❤️ and [Quarto](https://quarto.org/)."
|
57 |
+
# background: "#F8F9FA"
|
58 |
+
|
59 |
+
format:
|
60 |
+
html:
|
61 |
+
page-layout: full
|
62 |
+
theme:
|
63 |
+
- darkly
|
64 |
+
- style.scss
|
65 |
+
|
66 |
+
toc: true
|
67 |
+
toc-depth: 2
|
68 |
+
preview-colour:
|
69 |
+
code: true
|
70 |
+
text: true
|
data/docs/attributes.qmd
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Attributes
|
2 |
+
|
3 |
+
Below are the attributes which are potentially created when a structure is imported.
|
4 |
+
Explanations of type and domain conversions can be found in the Blender documentation [here](https://docs.blender.org/manual/en/latest/modeling/geometry_nodes/attributes_reference.html)
|
5 |
+
|
6 |
+
## World Scale
|
7 |
+
|
8 |
+
In Molecular Nodes, the world scale determines how real-world measurements are translated into the 3D environment of Blender which uses metres.
|
9 |
+
Currently, 1 angstrom (Å) is equivalent to 1 centimeter (cm).
|
10 |
+
Scaling structural coodinates by `0.01` correctly converts them and `0.01` is referred to as the world scale.
|
11 |
+
|
12 |
+
This scale will change in Blender 5.0 to be `0.1` so 1 nm will equal 1 m.
|
13 |
+
|
14 |
+
When an attribute is going to be read from the geometry, it is colored red like so: `Index::Input`, `chain_id`, while when a specific data type is refernce it will be colored accoring to the data type like so: `Int::Int`, `Float::Float`, `Vector::Vector`, etc.
|
15 |
+
|
16 |
+
## Data Types
|
17 |
+
|
18 |
+
### Attribute Types
|
19 |
+
|
20 |
+
Attributes are always associated with `Geometry::Geometry`.
|
21 |
+
They will be stored on one of the [domains](#domains) of the geometry.
|
22 |
+
The type of the attribute is determined by the type of the data it contains.
|
23 |
+
The following types are supported by Geometry Nodes.
|
24 |
+
|
25 |
+
| Type | Description |
|
26 |
+
|-----------------------|-------------------------------------------------|
|
27 |
+
| `Int::Int` | 32-bit integers |
|
28 |
+
| `Float::Float` | 32-bit floating point numbers |
|
29 |
+
| `Bool::Bool` | A simple `True::Bool` or `False::Bool` value |
|
30 |
+
| `Vector::Vector` | 3D vectors |
|
31 |
+
| `Matrix::Matrix` | 4x4 matrices, also references as `Transform::Matrix` inside of Geometry Nodes |
|
32 |
+
| `Color::Color` | RGBA colors, stored as 0..1 values |
|
33 |
+
| `Rotation::Rotation` | A rotation that internally is represented as a quaternion, but can implicitly be converted to an `Euler::Vector` vector. |
|
34 |
+
|
35 |
+
### Other Data Types
|
36 |
+
|
37 |
+
Additional data types which are not supported as Attributes but can be used in the node tree are:
|
38 |
+
|
39 |
+
| Type | Description |
|
40 |
+
|-----------------------|-------------------------------------------------|
|
41 |
+
| `String::String` | String support in Geometry Nodes is limited at the moment and you cannot store strings as attributes |
|
42 |
+
| `Object::Object` | Access to objects in the 3D scene and their associated data |
|
43 |
+
| `Collection::Collection` | Access a collection of objects from the scene. Objects are returned as instances |
|
44 |
+
|
45 |
+
## Attributes
|
46 |
+
|
47 |
+
All of the molecular attributes which are defined as strings such as `chain_id`, `res_name`, etc. are stored as integers in the geometry because Geometry Nodes does not support string attributes.
|
48 |
+
|
49 |
+
For `chain_id`, `entity_id` and other dynamic attributes, the unique values are first sorted alphabetically and then assigned an integer value based on their order.
|
50 |
+
|
51 |
+
For other attributes such as `res_name`, they are looked up from the dictionary and assigned an integer value.
|
52 |
+
|
53 |
+
### Point Attributes
|
54 |
+
|
55 |
+
| Attribute | Type | Description |
|
56 |
+
|------------------|------------------|------------------------------------|
|
57 |
+
| `Position` | `Vector::Vector` | Coordinates in 3D space of the points, read from the molecular data file. They are scaled by the world scale `0.01::Float` on import so that 1 Å == 1 cm. |
|
58 |
+
| `b_factor` | `Float::Float` | The temperature factor for the atom on import. If importing an AlphaFold structure this corresponds to the `pLDDT::Float` value. |
|
59 |
+
| `vdw_radii` | `Float::Float` | The radii of the atom, stored in world space (\~`0.015::Float`). Values sourced from [Wikipedia](https://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page)). |
|
60 |
+
| `sec_struct` | `Int::Int` | Defines secondary structure for the residue the atom is part of. `0::Int` for not a protein. `1::Int` for helices, `2::Int` for sheets, `3::Int` for coils / unstructured. |
|
61 |
+
| `mass` | `Float::Float` | Mass of the element |
|
62 |
+
| `chain_id` | `Int::Int` | The integer representation of the chain ID, for it's position in the sorted list of chain IDs in the structure. |
|
63 |
+
| `entity_id` | `Int::Int` | Multiple chains can be the same `entity`, if they are copies of the same protein that appear multiple times in the structure. Also sorted and assigned integers on import. |
|
64 |
+
| `res_id` | `Int::Int` | The 20 canonical amino acids are `0::Int` to `19::Int` sorted alphabetically. DNA bases dAdCdGdT are `30::Int` - `33::Int`, RNA bases are ACGU from `40::Int` - `43::Int`. |
|
65 |
+
| `res_name` | `Int::Int` | Residues are mapped to integer values based on the [lookup table](data_table.qmd#residue-names). |
|
66 |
+
| `atomic_number` | `Int::Int` | Stores the atomic number of the atom for it's position on the periodic table, instead of the element's name. |
|
67 |
+
| `atom_name` | `Int::Int` | Atom names are mapped to integer values based on the [lookup table](attributes.qmd#atom-names). |
|
68 |
+
| `Color` | `Color::Color` | Color of the atom, assigned on import but often changed in node trees. |
|
69 |
+
| `atom_id` | `Int::Int` | Unique ascending value for each atom in the file, starting at `1::Int` |
|
70 |
+
| `is_alpha_carbon` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
71 |
+
| `is_side_chain` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
72 |
+
| `is_backbone` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
73 |
+
| `is_solvent` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
74 |
+
| `is_nucleic` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
75 |
+
| `is_peptide` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
76 |
+
| `is_hetero` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
77 |
+
| `is_carb` | `Bool::Bool` | Computed on import or from the `atom_name` attribute. |
|
78 |
+
|
79 |
+
### Edge Attributes
|
80 |
+
|
81 |
+
Bonds between atoms are represented as edges in the geometry, and only the bond type is stored on the edge domain.
|
82 |
+
|
83 |
+
| Attribute | Type | Description |
|
84 |
+
|-------------|------------|-------------------------------------|
|
85 |
+
| `bond_type` | `Int::Int` | The type of bond between the atoms. |
|
86 |
+
|
87 |
+
Bond types are currently the values used by [`biotite`](https://www.biotite-python.org/latest/apidoc/biotite.structure.BondType.html)
|
88 |
+
|
89 |
+
| Bond Type | Integer Value | Description |
|
90 |
+
|------------------|:----------------:|------------------------------------|
|
91 |
+
| `ANY` | `0::Int` | Used if the actual type is unknown |
|
92 |
+
| `SINGLE` | `1::Int` | Single bond |
|
93 |
+
| `DOUBLE` | `2::Int` | Double bond |
|
94 |
+
| `TRIPLE` | `3::Int` | Triple bond |
|
95 |
+
| `QUADRUPLE` | `4::Int` | A quadruple bond |
|
96 |
+
| `AROMATIC_SINGLE` | `5::Int` | Aromatic bond with a single formal bond |
|
97 |
+
| `AROMATIC_DOUBLE` | `6::Int` | Aromatic bond with a double formal bond |
|
98 |
+
| `AROMATIC_TRIPLE` | `7::Int` | Aromatic bond with a triple formal bond |
|
99 |
+
|
100 |
+
## Domains {#domains}
|
101 |
+
|
102 |
+
| Domain | Description |
|
103 |
+
|---------------------|---------------------------------------------------|
|
104 |
+
| `Point::Geometry` | Individual points of geometry. These can be the vertices in a mesh, the points in a point cloud, or the control points of a curve. |
|
105 |
+
| `Edge::Geometry` | The edges of a mesh, defined as the indices between two points. |
|
106 |
+
| `Face::Geometry` | A face of a mesh, defined as a collection of edges. |
|
107 |
+
| `Corner::Geometry` | Corners of a face, where two edges meet. |
|
108 |
+
| `Curve::Geometry` | A curve object, which contains multiple control points, but can itself store attributes. |
|
109 |
+
| `Instance::Geometry` | Instances are references to other geometry. Instancing is useful for making lots of copies of some geometry for performance. |
|
110 |
+
| `Layer::Geometry` | Layers are for Grease Pencil, and contain a collection of curves. |
|
data/docs/cite/citations.yml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- title: Modeling membranes in situ
|
2 |
+
image: https://ars.els-cdn.com/content/image/1-s2.0-S0959440X24000642-gr1.jpg
|
3 |
+
path: https://www.sciencedirect.com/science/article/pii/S0959440X24000642?via%3Dihub
|
4 |
+
doi: https://doi.org/10.1016/j.sbi.2024.102837
|
5 |
+
|
6 |
+
- title: "Electrophysical cardiac remodeling at the molecular level: Insights into ryanodine receptor activationand calcium-induced calcium release from stochastic explicit-particle model"
|
7 |
+
doi: https://doi.org/10.1016/j.bpj.2024.09.029
|
8 |
+
path: https://papers.cnl.salk.edu/PDFs/Electrophysical%20cardiac%20remodeling%20at%20the%20molecular%20level_%20insights%20into%20Ryanodine%20Receptor%20activation%20and%20calcium-induced%20calcium%20release%20from%20a%20stochastic%20explicit-particle%20model%202024-4666.pdf
|
9 |
+
image: https://imgur.com/P84FZ2v.png
|
10 |
+
|
11 |
+
- title: Nonuniversal impact of cholesterol on membranes mobility, curvature sensing and elasticity
|
12 |
+
path: https://www.nature.com/articles/s41467-023-43892-x.pdf
|
13 |
+
doi: https://doi.org/10.1038/s41467-023-43892-x
|
14 |
+
image: https://imgur.com/sa4A8yr.png
|
15 |
+
|
16 |
+
- title: Archaeal GPN-loop GTPases involve a lock-switch-rock mechanism for GTP hydrolysis
|
17 |
+
path: https://journals.asm.org/doi/10.1128/mbio.00859-23
|
18 |
+
doi: https://doi.org/10.1128/mbio.00859-23
|
19 |
+
image: https://journals.asm.org/cms/10.1128/mbio.00859-23/asset/73ca5da9-6f89-43f4-a18b-790149533ac7/assets/images/large/mbio.00859-23.f005.jpg
|
20 |
+
|
21 |
+
- title: Recent advances in interpretable machine learning using structure-based protein representations
|
22 |
+
doi: https://doi.org/10.48550/arXiv.2409.17726
|
23 |
+
path: https://arxiv.org/pdf/2409.17726
|
24 |
+
image: https://arxiv.org/html/2409.17726v1/extracted/5880997/images/Fig1-pointcloud-light.png
|
25 |
+
|
26 |
+
- title: The Role of Protein-Lipid Interactions in Priming the Bacterial Translocon
|
27 |
+
doi: https://doi.org/10.3390/membranes14120249
|
28 |
+
image: https://www.mdpi.com/membranes/membranes-14-00249/article_deploy/html/images/membranes-14-00249-g003-550.jpg
|
29 |
+
path: https://www.mdpi.com/2077-0375/14/12/249
|
30 |
+
|
31 |
+
- title: Coarse-grained modeling of annexin A2-induced microdomain formation on a vesicle
|
32 |
+
doi: https://doi.org/10.1016/j.bpj.2024.06.006
|
33 |
+
path: https://www.cell.com/biophysj/fulltext/S0006-3495(24)00389-8?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0006349524003898%3Fshowall%3Dtrue
|
34 |
+
image: https://www.cell.com/cms/10.1016/j.bpj.2024.06.006/asset/7e712926-d4ed-4204-909e-ac4cc69261bf/main.assets/gr1.jpg
|
35 |
+
|
36 |
+
- title: Unravelling the Maturation Pathway of a Eukaryotic Virus through Cryo-EM
|
37 |
+
doi: https://doi.org/10.1101/2024.08.31.610394
|
38 |
+
path: https://www.biorxiv.org/content/10.1101/2024.08.31.610394v1
|
39 |
+
image: https://www.biorxiv.org/content/biorxiv/early/2024/08/31/2024.08.31.610394/F1.medium.gif
|
40 |
+
|
41 |
+
- title: Ribosomes hibernate on mitochondria during cellular stress
|
42 |
+
path: https://www.nature.com/articles/s41467-024-52911-4
|
43 |
+
image: https://media.springernature.com/lw685/springer-static/image/art%3A10.1038%2Fs41467-024-52911-4/MediaObjects/41467_2024_52911_Fig4_HTML.png
|
44 |
+
doi: https://doi.org/10.1038/s41467-024-52911-4
|
data/docs/cite/index.qmd
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Citing Molecular Nodes
|
3 |
+
listing:
|
4 |
+
id: listing-citations
|
5 |
+
contents: citations.yml
|
6 |
+
type: grid
|
7 |
+
grid-columns: 3
|
8 |
+
---
|
9 |
+
|
10 |
+
A paper for Molecular Nodes has not yet been published, but you can cite the Zenodo entry for the GitHub repo here: [![](https://zenodo.org/badge/485261976.svg)](https://zenodo.org/badge/latestdoi/485261976)
|
11 |
+
|
12 |
+
A selection of academic works that use Molecular Nodes in producing some of their figures or supplimentary movies.
|
13 |
+
|
14 |
+
::: {#listing-citations}
|
15 |
+
:::
|
data/docs/data_table.qmd
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
toc: true
|
3 |
+
toc-depth: 2
|
4 |
+
fig-align: center
|
5 |
+
---
|
6 |
+
# Data Tables
|
7 |
+
|
8 |
+
The different lookup tables that are used to conver strings to integers in Molecular Nodes.
|
9 |
+
|
10 |
+
Code for this can be found on the [GitHub Page](https://github.com/BradyAJohnston/MolecularNodes/blob/main/molecularnodes/data.py)
|
11 |
+
|
12 |
+
### Residue Names
|
13 |
+
|
14 |
+
| Name | Integer |
|
15 |
+
|----------:|:------------|
|
16 |
+
| UNK | `-1::Int` |
|
17 |
+
| ALA | `0::Int` |
|
18 |
+
| ARG | `1::Int` |
|
19 |
+
| ASN | `2::Int` |
|
20 |
+
| ASP | `3::Int` |
|
21 |
+
| CYS | `4::Int` |
|
22 |
+
| GLU | `5::Int` |
|
23 |
+
| GLN | `6::Int` |
|
24 |
+
| GLY | `7::Int` |
|
25 |
+
| HIS | `8::Int` |
|
26 |
+
| ILE | `9::Int` |
|
27 |
+
| LEU | `10::Int` |
|
28 |
+
| LYS | `11::Int` |
|
29 |
+
| MET | `12::Int` |
|
30 |
+
| PHE | `13::Int` |
|
31 |
+
| PRO | `14::Int` |
|
32 |
+
| SER | `15::Int` |
|
33 |
+
| THR | `16::Int` |
|
34 |
+
| TRP | `17::Int` |
|
35 |
+
| TYR | `18::Int` |
|
36 |
+
| VAL | `19::Int` |
|
37 |
+
| SNC | `15::Int` |
|
38 |
+
| MSE | `12::Int` |
|
39 |
+
| ASH | `3::Int` |
|
40 |
+
| CYM | `4::Int` |
|
41 |
+
| CYX | `4::Int` |
|
42 |
+
| GLH | `5::Int` |
|
43 |
+
| HID | `8::Int` |
|
44 |
+
| HIE | `8::Int` |
|
45 |
+
| HIP | `8::Int` |
|
46 |
+
| HYP | `8::Int` |
|
47 |
+
| LYN | `11::Int` |
|
48 |
+
| DA | `30::Int` |
|
49 |
+
| DC | `31::Int` |
|
50 |
+
| DG | `32::Int` |
|
51 |
+
| DT | `33::Int` |
|
52 |
+
| PST | `33::Int` |
|
53 |
+
| A | `40::Int` |
|
54 |
+
| C | `41::Int` |
|
55 |
+
| G | `42::Int` |
|
56 |
+
| U | `43::Int` |
|
57 |
+
|
58 |
+
|
59 |
+
### Atom Names
|
60 |
+
|
61 |
+
| Name | Integer |
|
62 |
+
|----------:|:------------|
|
63 |
+
| N | `1::Int` |
|
64 |
+
| CA | `2::Int` |
|
65 |
+
| C | `3::Int` |
|
66 |
+
| O | `4::Int` |
|
67 |
+
| CB | `5::Int` |
|
68 |
+
| CG | `6::Int` |
|
69 |
+
| CG1 | `7::Int` |
|
70 |
+
| CG2 | `8::Int` |
|
71 |
+
| OG | `9::Int` |
|
72 |
+
| OG1 | `10::Int` |
|
73 |
+
| SG | `11::Int` |
|
74 |
+
| CD | `12::Int` |
|
75 |
+
| CD1 | `13::Int` |
|
76 |
+
| CD2 | `14::Int` |
|
77 |
+
| ND1 | `15::Int` |
|
78 |
+
| ND2 | `16::Int` |
|
79 |
+
| OD1 | `17::Int` |
|
80 |
+
| OD2 | `18::Int` |
|
81 |
+
| SD | `19::Int` |
|
82 |
+
| CE | `20::Int` |
|
83 |
+
| CE1 | `21::Int` |
|
84 |
+
| CE2 | `23::Int` |
|
85 |
+
| CE3 | `24::Int` |
|
86 |
+
| NE | `25::Int` |
|
87 |
+
| NE1 | `26::Int` |
|
88 |
+
| NE2 | `27::Int` |
|
89 |
+
| OE1 | `28::Int` |
|
90 |
+
| OE2 | `29::Int` |
|
91 |
+
| CH2 | `30::Int` |
|
92 |
+
| NH1 | `31::Int` |
|
93 |
+
| NH2 | `32::Int` |
|
94 |
+
| OH | `33::Int` |
|
95 |
+
| CZ | `34::Int` |
|
96 |
+
| CZ2 | `35::Int` |
|
97 |
+
| CZ3 | `36::Int` |
|
98 |
+
| NZ | `37::Int` |
|
99 |
+
| OXT | `38::Int` |
|
100 |
+
| P | `50::Int` |
|
101 |
+
| O1P | `51::Int` |
|
102 |
+
| OP1 | `51::Int` |
|
103 |
+
| OP2 | `52::Int` |
|
104 |
+
| O2P | `52::Int` |
|
105 |
+
| O5' | `53::Int` |
|
106 |
+
| C5' | `54::Int` |
|
107 |
+
| C4' | `55::Int` |
|
108 |
+
| O4' | `56::Int` |
|
109 |
+
| C3' | `57::Int` |
|
110 |
+
| O3' | `58::Int` |
|
111 |
+
| C2' | `59::Int` |
|
112 |
+
| O2' | `60::Int` |
|
113 |
+
| C1' | `61::Int` |
|
114 |
+
| N1 | `62::Int` |
|
115 |
+
| N9 | `63::Int` |
|
116 |
+
| N3 | `64::Int` |
|
117 |
+
| C8 | `65::Int` |
|
118 |
+
| N7 | `66::Int` |
|
119 |
+
| C5 | `67::Int` |
|
120 |
+
| C6 | `68::Int` |
|
121 |
+
| N6 | `69::Int` |
|
122 |
+
| C2 | `70::Int` |
|
123 |
+
| C4 | `71::Int` |
|
124 |
+
| O6 | `72::Int` |
|
125 |
+
| N2 | `73::Int` |
|
126 |
+
| N4 | `74::Int` |
|
127 |
+
| O2 | `75::Int` |
|
128 |
+
| O4 | `76::Int` |
|
129 |
+
| C7 | `77::Int` |
|
130 |
+
|
data/docs/example_animations.qmd
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: "Examples"
|
3 |
+
number-sections: true
|
4 |
+
number-depth: 3
|
5 |
+
---
|
6 |
+
|
7 |
+
## Animating ATP Synthase
|
8 |
+
|
9 |
+
![](https://github.com/BradyAJohnston/MolecularNodes/raw/main/img/atp-animation-demo.gif)
|
10 |
+
|
11 |
+
To create the animation of ATP synthase you can morph between separate states of ATP synthase and export them from your favourite molecular graphics program.
|
12 |
+
In this example, we will use ChimeraX.
|
13 |
+
|
14 |
+
Use the following code in ChimeraX's console to import and create a morph between the 3 different protein conformations that will create the animation:
|
15 |
+
|
16 |
+
``` html
|
17 |
+
open 6n2y 6n2z 6n30
|
18 |
+
morph #1,2,3 wrap true
|
19 |
+
```
|
20 |
+
|
21 |
+
You can now play back the animation inside of ChimeraX.
|
22 |
+
|
23 |
+
To save the animation as a multi-pdb file, use the following code to save the `.pdb` file:
|
24 |
+
|
25 |
+
``` html
|
26 |
+
save atp-frames.pdb #4 allCoordsets true
|
27 |
+
```
|
28 |
+
|
29 |
+
You can now open the multi-frame pdb file inside of Molecular Nodes using the 'Open Local File' tab.
|
30 |
+
|
31 |
+
![](images/paste-4EFDF204.png)
|
32 |
+
|
33 |
+
This example is taken directly from the ChimeraX twitter account:
|
34 |
+
|
35 |
+
<blockquote class="twitter-tweet">
|
36 |
+
|
37 |
+
<p lang="en" dir="ltr">
|
38 |
+
|
39 |
+
To morph between 3 conformations of ATP synthase use ChimeraX commands "open 6n2y 6n2z 6n30" and "morph #1,2,3 wrap true".
|
40 |
+
<a href="https://twitter.com/hashtag/ChimeraXHowTo?src=hash&ref_src=twsrc%5Etfw">#ChimeraXHowTo</a> <a href="https://t.co/2u4Au6Tvpf">pic.twitter.com/2u4Au6Tvpf</a>
|
41 |
+
|
42 |
+
</p>
|
43 |
+
|
44 |
+
--- ChimeraX (@UCSFChimeraX) <a href="https://twitter.com/UCSFChimeraX/status/1258888093068701696?ref_src=twsrc%5Etfw">May 8, 2020</a>
|
45 |
+
|
46 |
+
</blockquote>
|
47 |
+
|
48 |
+
```{=html}
|
49 |
+
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
|
50 |
+
```
|
51 |
+
## Animating COVID Spike Protein
|
52 |
+
|
53 |
+
::: callout-caution
|
54 |
+
# Requires MDAnalysis Installed
|
55 |
+
|
56 |
+
To follow this particular tutorial, ensure you have first [installed Molecular Nodes properly](installation.qmd), including the optional MDAnalysis python package.
|
57 |
+
:::
|
58 |
+
|
59 |
+
Download the trajectory files from the the [CHARMM-GUI website](https://charmm-gui.org/?doc=archive&lib=covid19):
|
60 |
+
|
61 |
+
You will want to download the `.xtc` files for the spike protein in membrane.
|
62 |
+
|
63 |
+
::: callout-caution
|
64 |
+
The .xtc file will be large, \~2GB so the download may take a while.
|
65 |
+
:::
|
66 |
+
|
67 |
+
![](images/paste-5562A342.png)
|
68 |
+
|
69 |
+
Unzip the files (you may need to unzip the unzipped file) and then inside of Molecular Nodes, in the MD Trajectory tab, select the tpology file (`last_frame_nos.pdb`) and the trajectory file (`trj_nos.xtc`).\
|
70 |
+
\
|
71 |
+
Give the molecule a name, and your panel should look like this:
|
72 |
+
|
73 |
+
![](images/paste-E4006B81.png)
|
74 |
+
|
75 |
+
### Frames to Import
|
76 |
+
|
77 |
+
In the frame import options, we can choose which frames from the trajectory to import.
|
78 |
+
Importing every frame (`interval = 1` ) will take long time to load, and balloon-out the save-file size of the `.blend` file.
|
79 |
+
It's best to work with some subset of the trajectory frames, and interpolate between them with Molecular Nodes.\
|
80 |
+
|
81 |
+
::: callout-note
|
82 |
+
Molecular nodes is still surprisingly performant with thousands of frames loaded, but the `.blend` file takes a long time to save and load due to several GBs worth of data being save and loaded each time.
|
83 |
+
:::
|
84 |
+
|
85 |
+
For this example we are going to import every 10th frame.
|
86 |
+
|
87 |
+
### Click 'Import Frames' and Wait
|
88 |
+
|
89 |
+
Molecular Nodes is working through a lot of data, so this load step can take a few minutes - be patient.
|
90 |
+
Once it's all loaded, the structure along with the atomic properties are available for use inside of Geometry Nodes!
|
91 |
+
|
92 |
+
### Click space to play the animation.
|
93 |
+
|
94 |
+
Ensure to change over to `Cycles` & `rendered view` to view the coloured atoms, but otherwise the animation should be playing if press `space`!
|
95 |
+
|
96 |
+
*Just Points*
|
97 |
+
|
98 |
+
![](images/spike-points.webm)
|
99 |
+
|
100 |
+
*Rendered View* In this scene I additionally added a Sun light.
|
101 |
+
|
102 |
+
![](images/spike-colour.webm)
|
103 |
+
|
104 |
+
### Geometry Nodes
|
105 |
+
|
106 |
+
Now that the animation is imported into geometry nodes, you can work with the points as you would otherwise.
|
107 |
+
|
108 |
+
Try applying some noise, or in this example, scaling the points to `0` based on the proximity to an empty.
|
109 |
+
|
110 |
+
![](images/spike-dissolve.webm)
|
data/docs/examples/examples.yml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- title: Introducing RFpeptides
|
2 |
+
path: https://www.ipd.uw.edu/2024/11/introducing-rfpeptides-ai-for-cyclic-peptide-design/
|
3 |
+
image: https://www.ipd.uw.edu/wp-content/uploads/2024/11/RFpeptides-macrocycle-diffusion-web-banner-1.jpg
|
4 |
+
description: A press release for the Institute for Protein Design, introducing the new RFpeptides software
|
5 |
+
author: Institute for Protein Design
|
6 |
+
|
7 |
+
- title: Your Unstoppable Copy Machine
|
8 |
+
author: Clockwork
|
9 |
+
description: Clockwork is a YouTube channel about some of the really nitty-gritty biochemistry with great visuals and writing. They recently started posting videos again, having made the jump from 2D animations in After Effects to 3D animations inside of Blender using Molecular Nodes.
|
10 |
+
path: https://www.youtube.com/watch?v=lv89fSt5jBY
|
11 |
+
image: https://img.youtube.com/vi/lv89fSt5jBY/0.jpg
|
12 |
+
|
13 |
+
- title: Where the Light Touches Your Eyes
|
14 |
+
author: Clockwork
|
15 |
+
description: 👀 Your visual system is astounding down at the molecular level-because the photoreceptor cells in your retina maintain an incredible balance of proteins that allows for an incredible visual range. Let’s meet rhodopsin, the molecular worker at the core of your visual system. We’ll discover how light physically touches and changes you every time you perceive just about anything.
|
16 |
+
path: https://youtu.be/LexKZva0s4I?si=HeCqmEEGxEEamzNL
|
17 |
+
image: https://img.youtube.com/vi/LexKZva0s4I/0.jpg
|
18 |
+
|
19 |
+
- title: The Increible Biology Powering Autumn Colors
|
20 |
+
author: Clockwork
|
21 |
+
description: 🍂 You've probably learned why leaves change color and drop from trees in the fall. But what actually causes these color changes?
|
22 |
+
path: https://youtu.be/wOjkeyjJ364?si=WfD1PglPw3NY8UAu
|
23 |
+
image: https://img.youtube.com/vi/wOjkeyjJ364/0.jpg
|
24 |
+
|
25 |
+
- title: Biologia Molecular
|
26 |
+
description: A TikTok channel making molecular movies with \#MolecularNodes
|
27 |
+
path: https://www.tiktok.com/@biologia.molecular
|
28 |
+
image: https://imgur.com/nMBlLgk.png
|
29 |
+
|
30 |
+
- title: Knot Theory
|
31 |
+
author: Veritasium
|
32 |
+
description: A popular YouTube science channel, discussing DNA topoisomerases.
|
33 |
+
path: https://www.youtube.com/watch?v=8DBhTXM_Br4
|
34 |
+
image: https://img.youtube.com/vi/8DBhTXM_Br4/0.jpg
|
35 |
+
|
36 |
+
- title: Microtubules
|
37 |
+
author: Zhaowen Luo, St Jude Children's Hospital
|
38 |
+
description: An animation from St Jude Children's Hospital, created by Zhaowen Luo. It was shown at the Association of Medical Illustrators annual conference in 2023, and won the category for Individual Professional Motion and Interactive Media.
|
39 |
+
path: https://awards.ami.org/gallery/WOVQRGgD/LrVXNAor?search=848d592b94f65998-20
|
40 |
+
image: https://i.imgur.com/YpaJXEV.png
|
41 |
+
|
42 |
+
- title: Nano Rooms
|
43 |
+
description: Nano rooms is a YouTube channel explaining the beautilful mathematical underpinnings of biology, and many of their animations of protein structures are using Molecular Nodes and Blender.
|
44 |
+
path: https://www.youtube.com/watch?v=elRbbdJUiTU
|
45 |
+
image: https://img.youtube.com/vi/elRbbdJUiTU/0.jpg
|
46 |
+
|
data/docs/examples/images/6e10_spin_squishy.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f1238138a0693b7470813861a9d3f5884c7f8ab07a67613fbc97d2dfcfed59ea
|
3 |
+
size 12149801
|
data/docs/examples/index.qmd
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Examples
|
3 |
+
listing:
|
4 |
+
id: listing-examples
|
5 |
+
contents: examples.yml
|
6 |
+
type: grid
|
7 |
+
sort: date desc
|
8 |
+
sort-ui: false
|
9 |
+
grid-columns: 2
|
10 |
+
filter-ui: true
|
11 |
+
# template: template.ejs
|
12 |
+
|
13 |
+
# css: styles.css
|
14 |
+
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
Some examples of projects that have used Molecular Nodes in their production.
|
19 |
+
|
20 |
+
::: {#listing-examples}
|
21 |
+
:::
|
data/docs/examples/styles.css
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style>
|
2 |
+
.body {
|
3 |
+
font-family: Arial, sans-serif;
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
background-color: #f9a9f9;
|
7 |
+
color: #f9a9f9;
|
8 |
+
}
|
9 |
+
|
10 |
+
.grid-container {
|
11 |
+
max-width: 1400px;
|
12 |
+
margin: 0 auto;
|
13 |
+
padding: 20px;
|
14 |
+
}
|
15 |
+
|
16 |
+
.grid {
|
17 |
+
display: grid;
|
18 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
19 |
+
gap: 20px;
|
20 |
+
max-width: 100%;
|
21 |
+
}
|
22 |
+
|
23 |
+
@media (min-width: 992px) {
|
24 |
+
.grid {
|
25 |
+
grid-template-columns: repeat(3, 1fr);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
.grid-item {
|
30 |
+
break-inside: avoid;
|
31 |
+
margin-bottom: 20px;
|
32 |
+
border: 1px solid #ddd;
|
33 |
+
border-radius: 8px;
|
34 |
+
transition: transform 0.2s ease-in-out;
|
35 |
+
}
|
36 |
+
|
37 |
+
.grid-item:hover {
|
38 |
+
transform: translateY(-5px);
|
39 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
40 |
+
}
|
41 |
+
|
42 |
+
.media-wrapper {
|
43 |
+
margin-bottom: 15px;
|
44 |
+
}
|
45 |
+
|
46 |
+
.media-wrapper img,
|
47 |
+
.media-wrapper video {
|
48 |
+
width: 100%;
|
49 |
+
/* height: 100px; */
|
50 |
+
object-fit: cover;
|
51 |
+
border-radius: 8px 8px 0 0;
|
52 |
+
}
|
53 |
+
|
54 |
+
.card-title {
|
55 |
+
margin: 0 0 10px 0;
|
56 |
+
font-size: 1.25rem;
|
57 |
+
color: #333;
|
58 |
+
}
|
59 |
+
|
60 |
+
.quarto-grid-link {
|
61 |
+
text-decoration: none;
|
62 |
+
color: inherit;
|
63 |
+
}
|
64 |
+
|
65 |
+
.listing-description {
|
66 |
+
font-size: 0.95rem;
|
67 |
+
line-height: 1.5;
|
68 |
+
color: #666;
|
69 |
+
margin-bottom: 15px;
|
70 |
+
}
|
71 |
+
|
72 |
+
.card-attribution {
|
73 |
+
font-size: 0.85rem;
|
74 |
+
color: #777;
|
75 |
+
}
|
76 |
+
|
77 |
+
.card-footer {
|
78 |
+
border-top: 1px solid #eee;
|
79 |
+
padding-top: 10px;
|
80 |
+
margin-top: auto;
|
81 |
+
font-size: 0.85rem;
|
82 |
+
color: #888;
|
83 |
+
}
|
84 |
+
|
85 |
+
.no-external {
|
86 |
+
text-decoration: none;
|
87 |
+
color: inherit;
|
88 |
+
}
|
89 |
+
</style>
|
data/docs/examples/template.ejs
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
:::: {.grid .text-center .list}
|
2 |
+
|
3 |
+
<% for (const item of items) { %>
|
4 |
+
|
5 |
+
:::: {.quarto-grid-item .card .h-100 .w-100 .card-center .hovercard-extension}
|
6 |
+
|
7 |
+
:::: {.card-body .post-contents}
|
8 |
+
|
9 |
+
|
10 |
+
[
|
11 |
+
`<h4 class="no-anchor card-title listing-title">`{=html}
|
12 |
+
<%= item.title %>
|
13 |
+
`</h5>`{=html}
|
14 |
+
](<%- item.path %>){.quarto-grid-link}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
<% if (item.video && item.video.endsWith(".mp4")) { %>
|
19 |
+
:::: {.media-wrapper}
|
20 |
+
<video controls muted loop autoplay>
|
21 |
+
<source src="<%= item.video %>" type="video/mp4">
|
22 |
+
Your browser does not support the video tag.
|
23 |
+
</video>
|
24 |
+
:::
|
25 |
+
<% } else if (item.video) { %>
|
26 |
+
:::: {.media-wrapper}
|
27 |
+
<video controls muted loop autoplay>
|
28 |
+
<source src="<%= item.video %>.mp4" type="video/mp4">
|
29 |
+
Your browser does not support the video tag.
|
30 |
+
</video>
|
31 |
+
:::
|
32 |
+
<% } else if (item.image) { %>
|
33 |
+
[![](<%= item.image %>){.media-wrapper}](<%= item.path %>)
|
34 |
+
<% } %>
|
35 |
+
|
36 |
+
:::: {.card-text .listing-description}
|
37 |
+
<%= item.description %>
|
38 |
+
:::
|
39 |
+
|
40 |
+
:::: {.card-attribution .card-text-small .justify}
|
41 |
+
:::: {.listing-author}
|
42 |
+
<%= item.author %>
|
43 |
+
:::
|
44 |
+
:::
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
:::: {.card-footer}
|
49 |
+
:::: {.listing-file-modified}
|
50 |
+
***Updated**: <%= item['file-modified'] %>*
|
51 |
+
:::
|
52 |
+
:::
|
53 |
+
|
54 |
+
:::
|
55 |
+
|
56 |
+
:::
|
57 |
+
|
58 |
+
<% } %>
|
59 |
+
|
60 |
+
:::
|
61 |
+
|
data/docs/filters.lua
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
local keywords = {"Float", "Int", "Vector", "Geometry", "Bool", "Matrix", "Rotation", "Material", "Color", "Collection", "String", "Name", "Object", "Input"}
|
2 |
+
local attributes = {"sec_struct", "res_id", "chain_id", "entity_id", "res_name", "atom_name", "atom_id", "occupancy", "bfactor", "atomic_number", "charge", "vdw_radii", "mass", "is_backbone", "is_side_chain", "is_alpha_carbon", "Position", "Index", "Normal", "ID"}
|
3 |
+
|
4 |
+
local combined = {}
|
5 |
+
for _, v in ipairs(keywords) do
|
6 |
+
table.insert(combined, v)
|
7 |
+
end
|
8 |
+
for _, v in ipairs(attributes) do
|
9 |
+
table.insert(combined, v)
|
10 |
+
end
|
11 |
+
|
12 |
+
function Code(el)
|
13 |
+
for _, keyword in ipairs(keywords) do
|
14 |
+
local pattern = "(.+)::" .. keyword
|
15 |
+
local name = el.text:match(pattern)
|
16 |
+
if name then
|
17 |
+
table.insert(el.classes, "custom-" .. keyword:lower())
|
18 |
+
el.text = name
|
19 |
+
return el
|
20 |
+
end
|
21 |
+
end
|
22 |
+
for _, attribute in ipairs(combined) do
|
23 |
+
if el.text == attribute then
|
24 |
+
-- el.text = "[".. el.text .. "](attributes.qmd#" .. attribute .. ")"
|
25 |
+
table.insert(el.classes, "custom-attribute")
|
26 |
+
return el
|
27 |
+
end
|
28 |
+
end
|
29 |
+
end
|
30 |
+
|
data/docs/generate.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import bpy
|
2 |
+
import pathlib
|
3 |
+
|
4 |
+
import molecularnodes as mn
|
5 |
+
import nodepad
|
6 |
+
|
7 |
+
DOCS_FOLDER = pathlib.Path(__file__).resolve().parent
|
8 |
+
|
9 |
+
# load the data file which contains all of the nodes to build docs for
|
10 |
+
bpy.ops.wm.open_mainfile(filepath=mn.utils.MN_DATA_FILE)
|
11 |
+
|
12 |
+
|
13 |
+
header = """---
|
14 |
+
toc: true
|
15 |
+
toc-depth: 2
|
16 |
+
fig-align: center
|
17 |
+
---
|
18 |
+
"""
|
19 |
+
|
20 |
+
# generate all of the node related docs
|
21 |
+
for submenu in mn.ui.node_menu.menu_items.submenus:
|
22 |
+
with open(DOCS_FOLDER / f"nodes/{submenu.name}.qmd", "w") as file:
|
23 |
+
file.write(header)
|
24 |
+
file.write(f"# {submenu.title}\n\n")
|
25 |
+
if submenu.description:
|
26 |
+
file.write(submenu.description)
|
27 |
+
file.write("\n\n")
|
28 |
+
for menu_item in submenu.items:
|
29 |
+
if menu_item.is_break:
|
30 |
+
continue
|
31 |
+
if menu_item.backup is not None:
|
32 |
+
name = menu_item.backup
|
33 |
+
else:
|
34 |
+
name = menu_item.name
|
35 |
+
doc = nodepad.Documenter(menu_item.tree)
|
36 |
+
try:
|
37 |
+
doc.lookup_info(menu_item.to_dict())
|
38 |
+
except AttributeError as e:
|
39 |
+
print(e)
|
40 |
+
|
41 |
+
if menu_item.description != "":
|
42 |
+
doc.description += "\n\n" + menu_item.description
|
43 |
+
|
44 |
+
file.write(doc.as_markdown())
|
45 |
+
file.write("\n\n")
|
46 |
+
|
47 |
+
|
48 |
+
# write the data table page
|
49 |
+
with open(DOCS_FOLDER / "data_table.qmd", "w") as file:
|
50 |
+
file.write(header)
|
51 |
+
file.write("# Data Tables\n\n")
|
52 |
+
file.write(
|
53 |
+
"The different lookup tables that are used to conver strings to integers in Molecular Nodes.\n\n"
|
54 |
+
"Code for this can be found on the [GitHub Page](https://github.com/BradyAJohnston/MolecularNodes/blob/main/molecularnodes/data.py)\n\n"
|
55 |
+
)
|
56 |
+
file.write(
|
57 |
+
"### Residue Names\n\n" "| Name | Integer |\n" "|----------:|:------------|\n"
|
58 |
+
)
|
59 |
+
for name, res in mn.data.residues.items():
|
60 |
+
file.write(f"| {name} | `{res['res_name_num']}::Int` |\n")
|
61 |
+
file.write("\n")
|
62 |
+
file.write("\n")
|
63 |
+
|
64 |
+
file.write(
|
65 |
+
"### Atom Names\n\n" "| Name | Integer |\n" "|----------:|:------------|\n"
|
66 |
+
)
|
67 |
+
for name, value in mn.data.atom_names.items():
|
68 |
+
file.write(f"| {name} | `{value}::Int` |\n")
|
69 |
+
file.write("\n")
|
data/docs/images/index/mn-cartoon-example.gif
ADDED
Git LFS Details
|
data/docs/images/index/mn-example-em.gif
ADDED
Git LFS Details
|
data/docs/images/index/mn-example-starfile.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:057a8591b3b7d3b3f3e3e404345518c814381a7bc7de3b6c32865bd32dc96a48
|
3 |
+
size 7646769
|
data/docs/images/index/mn-md-example-spike.gif
ADDED
Git LFS Details
|
data/docs/images/index/mn-md-example.gif
ADDED
Git LFS Details
|
data/docs/images/installation/download-blender.png
ADDED
Git LFS Details
|
data/docs/images/installation/download.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2f04029b15d34fc8885147f75e1e3afca9d56cc18ee81406b5248a9667d55977
|
3 |
+
size 1102937
|
data/docs/images/installation/preferences.png
ADDED
Git LFS Details
|
data/docs/images/installation/search_install.png
ADDED
Git LFS Details
|
data/docs/images/logo.png
ADDED
Git LFS Details
|
data/docs/images/nodes/linked_data_block.png
ADDED
Git LFS Details
|
data/docs/index.qmd
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: "About"
|
3 |
+
toc: false
|
4 |
+
page-layout: article
|
5 |
+
---
|
6 |
+
|
7 |
+
|
8 |
+
<img src="images/logo.png" align="right" style = "height:250px;"/>
|
9 |
+
|
10 |
+
|
11 |
+
![Documentation Building](https://github.com/bradyajohnston/molecularnodes/actions/workflows/docs.yml/badge.svg) ![Running Tests](https://github.com/bradyajohnston/molecularnodes/actions/workflows/tests.yml/badge.svg) [![codecov](https://codecov.io/gh/BradyAJohnston/MolecularNodes/branch/main/graph/badge.svg?token=ZB2SJFY8FU)](https://codecov.io/gh/BradyAJohnston/MolecularNodes)
|
12 |
+
|
13 |
+
|
14 |
+
<a href="https://www.github.com/bradyajohnston/MolecularNodes/releases"><img src="https://img.shields.io/github/v/release/bradyajohnston/molecularnodes" alt="Badge displaying license, which is MIT." style="height:20px"/></a> <a href="https://www.github.com/bradyajohnston/MolecularNodes/releases"><img src="https://img.shields.io/github/downloads/BradyAJohnston/MolecularNodes/total.svg" alt="Repo total downloads count." style="height:20px"/></a> <a href="https://www.buymeacoffee.com/bradyajohnston"><img src="https://img.shields.io/github/license/bradyajohnston/molecularnodes" alt="Badge displaying license, which is MIT." style="height:20px"/></a> <a href="https://www.buymeacoffee.com/bradyajohnston"><img src="https://img.shields.io/github/stars/bradyajohnston/molecularnodes?style=social" alt="Badge displaying count of GitHub stars." style="height:20px"/></a>
|
15 |
+
|
16 |
+
<a href="https://pypi.org/project/biotite"><img src="https://img.shields.io/badge/powered%20by-Biotite-orange.svg" alt="Badge showing usage of MDAnalysis as a python package powering the add-on" style="height:20px"/></a> <a href="https://pypi.org/project/MDAnalysis"><img src="https://img.shields.io/badge/powered%20by-MDAnalysis-orange.svg" alt="Badge showing usage of biotite as a python package powering the add-on" style="height:20px"/></a>
|
17 |
+
|
18 |
+
<a href="https://patreon.com/bradyajohnston"><img src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dbradyajohnston%26type%3Dpatrons&style=for-the-badge" alt="Support me on Patreon with ongoing donations" style="height:35px"/></a>
|
19 |
+
|
20 |
+
<a href="https://buymeacoffee.com/bradyajohnston"><img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black" alt="Support me by buying a couple of coffees as a one-off donation" style="height:35px"/></a>
|
21 |
+
|
22 |
+
|
23 |
+
<a href="https://discord.gg/fvw6vT3vY9"><img src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white" alt="Join the scientific visualisation in Blender discord." style="height:35px"/></a>
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
Molecular Nodes (MN) is an addon for the 3D modelling & animation program [Blender](https://blender.org).
|
28 |
+
MN enables easy import of molecular data such as `.pdb` & `.mmCIF`, along with a variety of molecular dynamics trajectories and topologies from a variety of simulation sources. Other data formats including electron microscopy (EM) `.map`, EM tomography files such as `.map` and `.star`, with the potential to support more data formats as well.
|
29 |
+
|
30 |
+
See the talk below at the 2022 Blender conference for an overview of the add-on it's capabilities.
|
31 |
+
|
32 |
+
::: center
|
33 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/adhTmwYwOiA?si=em6xRime7HZ8L44T" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
34 |
+
:::
|
35 |
+
|
36 |
+
Molecular Nodes provides the translation layer that allows importing of molecular data formats, while Blender provides the industry-leading animation and rendering tools to create visually stunning molecular graphics with ease.
|
37 |
+
|
38 |
+
The add-on runs on the [Geometry Nodes](https://docs.blender.org/manual/en/latest/modeling/geometry_nodes/introduction.html) procedural modelling and animation system inside of Blender, which gives the add-on speed and robustness with minimal user input required.
|
39 |
+
|
40 |
+
|
41 |
+
|Procedural Animations|Different Stylings|MD Trajectories|
|
42 |
+
|---|---| --- |
|
43 |
+
|![](images/index/mn-cartoon-example.gif){width="400px"}|![](images/index/mn-md-example-spike.gif)|![](images/index/mn-md-example.gif)|
|
44 |
+
|EM Density maps|`.star` mapbacks| |
|
45 |
+
|![](images/index/mn-example-em.gif) |![](images/index/mn-example-starfile.mp4)| |
|
46 |
+
|
47 |
+
|
48 |
+
## Getting Started
|
49 |
+
|
50 |
+
To get started, checkout the [installation page](#installation) for detailed instructions on how to install the add-on. Next check out some of the tutorials, such as [intro to blender](tutorials/00_interface.md), [basics of downloading](tutorials/01_importing.qmd) from the PDB or how to [customise selections](tutorials/02_selections.md).
|
51 |
+
|
52 |
+
There are some _outdated_ tutorials on YouTube about how to use the add-on also. MN has been developed further and improved since these videos, but the general workflow remains the same.
|
53 |
+
|
54 |
+
::: center
|
55 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/CvmFaRVmZRU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
|
56 |
+
|
57 |
+
</iframe>
|
58 |
+
:::
|
59 |
+
|
data/docs/installation.qmd
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: "Installation"
|
3 |
+
---
|
4 |
+
|
5 |
+
::: callout-warning
|
6 |
+
# Blender 4.2
|
7 |
+
For Blender 4.2, we no longer have to download anything externally. Molecular Nodes can be installed and updated from _within_ Blender, using the new [`extensions`](https://https://extensions.blender.org/) platform. The installation instructions below are now much simpler.
|
8 |
+
:::
|
9 |
+
|
10 |
+
## Downloading Blender
|
11 |
+
|
12 |
+
Molecular Nodes is an add-on for the 3D animation program Blender. It runs inside of Blender, so the first step for installation is to [download and install](https://www.blender.org/download/) the latest version of blender.
|
13 |
+
|
14 |
+
![The download page of Blender.](images/installation/download-blender.png){align="center" width="800px"}
|
15 |
+
|
16 |
+
|
17 |
+
## Installing the Addon
|
18 |
+
|
19 |
+
Follow the screenshots below to install the add-on. These steps should be the same across platforms.
|
20 |
+
|
21 |
+
Open the preferences window.
|
22 |
+
|
23 |
+
![](images/installation/preferences.png)
|
24 |
+
|
25 |
+
Select the `Get Extensions` panel and search for `Molecular Nodes`.
|
26 |
+
|
27 |
+
![](images/installation/search_install.png)
|
28 |
+
|
29 |
+
Clicking the `Install` button will download and install the add-on. The download is ~100 MB so may take some minutes depending on internet connection.
|
30 |
+
|
31 |
+
![](images/installation/download.mp4)
|
32 |
+
|
33 |
+
### That's it!
|
34 |
+
|
35 |
+
All of the additional python packages now come pre-installed. To update the add-on, use the same panel and Blender should automatically detect updates.
|
36 |
+
|
37 |
+
## Installing the Startup Template
|
38 |
+
|
39 |
+
There are a number of settings that are useful to have tweaked on startup. You can install the `Molecular Nodes` startup template in the add-on preferences or uninstall the template.
|
40 |
+
|
41 |
+
THis adds it as an option on the startup splash screen, or when starting a new file.
|
42 |
+
|
43 |
+
## Start Importing Structures!
|
44 |
+
|
45 |
+
Molecular nodes should be fully installed. See the [Getting Started](tutorials/01_importing.qmd) page on how to start importing into Blender!
|
46 |
+
|
47 |
+
## Troubleshooting
|
48 |
+
|
49 |
+
### Installation error: missing biotite module
|
50 |
+
|
51 |
+
In some Linux systems, trying to install `Molecular Nodes` through the `Get Extensions` panel in Blender may lead to the following error:
|
52 |
+
|
53 |
+
```bash
|
54 |
+
Report: Error
|
55 |
+
No module named 'biotite.structure.bonds'
|
56 |
+
```
|
57 |
+
This is likely due to a mismatch in the Python versions installed in your system and in what Blender expects (see issue [#629](https://github.com/BradyAJohnston/MolecularNodes/issues/629)).
|
58 |
+
|
59 |
+
To avoid this issue, try installing Blender through a self-contained package system such as Flatpack or Snap. These package managers usually need to be installed and/or activated in your system.
|
60 |
+
|
61 |
+
For example, after installing Snap in Fedora 40, you can install Blender through Snap with the command which solves the `biotite` dependency error.
|
62 |
+
|
63 |
+
```bash
|
64 |
+
sudo snap install blender --classic
|
65 |
+
```
|
66 |
+
|
67 |
+
|
data/docs/nodes/index.qmd
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Nodes
|
3 |
+
toc: true
|
4 |
+
toc-depth: 3
|
5 |
+
fig-align: center
|
6 |
+
---
|
7 |
+
|
8 |
+
The nodes that are included with Molecular Nodes, are all pre-built and included with the add-on.
|
9 |
+
They work the same as any of the other nodes inside of Geometry Nodes, and can, if used, also process the data from 3D models like a cube or a monkey.
|
10 |
+
They are designed with molecular data & use cases in mind, but they are not limited to usage with molecular data.
|
11 |
+
|
12 |
+
All of the nodes that are included are documented here, with descriptions, extra info about inputs and outputs, sometimes small demo videos showing the intended use cases of the nodes.
|
13 |
+
|
14 |
+
Experimentation is highly encouraged, combining these nodes with others to see what kind of results you can get.
|
15 |
+
Molecular Nodes came about through experimentation with nodes, and there is no better way to learn the systems then to keep plugging and unplugging different sockets, changing values and tinkering.
|
16 |
+
|
17 |
+
At any point you can view the internals of the node groups that are included with Molecular Nodes.
|
18 |
+
With a node selected, you can <kbd>Tab</kbd> to enter a selected node, and use <kbd>Ctrl</kbd> + <kbd>Tab</kbd> to exit the node group.
|
19 |
+
You can also do the same by right clicking.
|
20 |
+
Feel free to tweak the internals of node groups, but beware that changing one node group will change that node group for all othe uses of it.
|
21 |
+
Starting a new Blender session will ensure that the node groups are fresh and 'factor reset'.
|
data/docs/style.scss
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*-- scss:functions --*/
|
2 |
+
@function colorToRGB ($color) {
|
3 |
+
@return "rgb(" + red($color) + ", " + green($color) + ", " + blue($color)+ ")";
|
4 |
+
}
|
5 |
+
|
6 |
+
@function luminance($color) {
|
7 |
+
$r: red($color) / 255;
|
8 |
+
$g: green($color) / 255;
|
9 |
+
$b: blue($color) / 255;
|
10 |
+
|
11 |
+
$r: if($r < 0.03928, $r / 12.92, pow(($r + 0.055) / 1.055, 2.4));
|
12 |
+
$g: if($g < 0.03928, $g / 12.92, pow(($g + 0.055) / 1.055, 2.4));
|
13 |
+
$b: if($b < 0.03928, $b / 12.92, pow(($b + 0.055) / 1.055, 2.4));
|
14 |
+
|
15 |
+
@return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
|
16 |
+
}
|
17 |
+
|
18 |
+
@function contrast-color($background-color, $light-color: #d1d1d1, $dark-color: #2d2d2d) {
|
19 |
+
@if luminance($background-color) > 0.3 {
|
20 |
+
@return $dark-color;
|
21 |
+
} @else {
|
22 |
+
@return $light-color;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
/*-- scss:defaults --*/
|
27 |
+
$node-editor-text: #c7c7c7 !default;
|
28 |
+
$node-editor-grid: #1D1D1D !default;
|
29 |
+
$node-editor-backdrop: #303030 !default;
|
30 |
+
$node-type-color-converter: #246283 !default;
|
31 |
+
$node-type-color-color: #3B660A !default;
|
32 |
+
$node-type-color-group: #3B660A !default;
|
33 |
+
$node-type-color-group-socket: #0F0F0F !default;
|
34 |
+
$node-type-color-frame: #0F0F0F !default;
|
35 |
+
$node-type-color-matte: #973C3C !default;
|
36 |
+
$node-type-color-distor: #4C9797 !default;
|
37 |
+
$node-type-color-input: #83314A !default;
|
38 |
+
$node-type-color-output: #4D0017 !default;
|
39 |
+
$node-type-color-filter: #551A80 !default;
|
40 |
+
$node-type-color-vector: #3C3C83 !default;
|
41 |
+
$node-type-color-texture: #E66800 !default;
|
42 |
+
$node-type-color-shader: #24B524 !default;
|
43 |
+
$node-type-color-script: #084D4D !default;
|
44 |
+
$node-type-color-geometry: #1D715E !default;
|
45 |
+
$node-type-color-attribute: #1D2546 !default;
|
46 |
+
$node-type-color-simulation: #664162 !default;
|
47 |
+
$node-type-color-repeat: #76512F !default;
|
48 |
+
|
49 |
+
$node-socket-color-text: #ffffff !default;
|
50 |
+
$node-socket-color-geometry: #05D19F !default;
|
51 |
+
$code-socket-color-int: #027a2a !default;
|
52 |
+
$node-socket-color-vector: #6363C7 !default;
|
53 |
+
$node-socket-color-int: #598C5C !default;
|
54 |
+
$node-socket-color-float: #A1A1A1 !default;
|
55 |
+
$node-socket-color-matrix: #B83385 !default;
|
56 |
+
$node-socket-color-bool: #CCA6D6 !default;
|
57 |
+
$node-socket-color-rotation: #A663C7 !default;
|
58 |
+
$node-socket-color-material: #EB7582 !default;
|
59 |
+
$node-socket-color-color: #C6C629 !default;
|
60 |
+
$node-socket-color-collection: #f4f4f4 !default;
|
61 |
+
$node-socket-color-string: #70B2FF !default;
|
62 |
+
$node-socket-color-object: #ED9E5C !default;
|
63 |
+
|
64 |
+
$h2-font-size: 1.6rem !default;
|
65 |
+
$headings-font-weight: 500 !default;
|
66 |
+
$body-font-color: #d8d8d8 !default;
|
67 |
+
$primary: $node-type-color-geometry !default;
|
68 |
+
$text-dark-color: #2d2d2d;
|
69 |
+
|
70 |
+
/*-- scss:rules --*/
|
71 |
+
// h1, h2, h3, h4, h5, h6 {Avec
|
72 |
+
// text-shadow: -1px -1px 0 rgba(0, 0, 0, .3);
|
73 |
+
// }
|
74 |
+
|
75 |
+
body {
|
76 |
+
color: $node-editor-text;
|
77 |
+
background-color: $node-editor-grid;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
table {
|
82 |
+
border-collapse: collapse;
|
83 |
+
border-radius: 12px;
|
84 |
+
vertical-align: middle;
|
85 |
+
overflow: hidden; // Add this to ensure rounded corners are visible
|
86 |
+
|
87 |
+
th {
|
88 |
+
text-align: center;
|
89 |
+
}
|
90 |
+
|
91 |
+
th, td {
|
92 |
+
border: 1px solid $node-editor-grid;
|
93 |
+
|
94 |
+
padding: 10%;
|
95 |
+
background-color: $node-editor-text;
|
96 |
+
color: $node-socket-color-geometry;
|
97 |
+
}
|
98 |
+
|
99 |
+
tr {
|
100 |
+
background-color: $node-editor-backdrop;
|
101 |
+
color: darken($node-editor-text, 10%);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
navbar {
|
107 |
+
background-color: $body-font-color;
|
108 |
+
}
|
109 |
+
nav.sidebar.sidebar-navigation:not(.rollup) {
|
110 |
+
color: $body-font-color;
|
111 |
+
background-color: $node-editor-grid;
|
112 |
+
}
|
113 |
+
|
114 |
+
// Define the mixin
|
115 |
+
@mixin code-style($background-color) {
|
116 |
+
color: contrast-color($background-color, #c7c7c7, #1b1b1b);
|
117 |
+
// color: $text-dark-color;
|
118 |
+
// color: #d4d4d4;
|
119 |
+
// text-shadow: 1px 1px rgba(32, 32, 32, 0.8);
|
120 |
+
text-wrap-mode: nowrap;
|
121 |
+
background-color: rgba(darken($background-color, 0%), 0.7);
|
122 |
+
padding-left: .4em;
|
123 |
+
padding-right: .4em;
|
124 |
+
font-weight: bold;
|
125 |
+
}
|
126 |
+
|
127 |
+
body code:not(.sourceCode) {
|
128 |
+
padding: 0.1em;
|
129 |
+
background-color: rgb(198, 198, 198);
|
130 |
+
color: rgb(50, 59, 128);
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
$custom-classes: (
|
135 |
+
"float": $node-socket-color-float,
|
136 |
+
"int": $node-socket-color-int,
|
137 |
+
"vector": $node-socket-color-vector,
|
138 |
+
"geometry": $node-socket-color-geometry,
|
139 |
+
"matrix": $node-socket-color-matrix,
|
140 |
+
"bool": $node-socket-color-bool,
|
141 |
+
"rotation": $node-socket-color-rotation,
|
142 |
+
"material": $node-socket-color-material,
|
143 |
+
"color": $node-socket-color-color,
|
144 |
+
"collection": $node-socket-color-collection,
|
145 |
+
"string": $node-socket-color-string,
|
146 |
+
"object": $node-socket-color-object,
|
147 |
+
"name": $node-editor-backdrop,
|
148 |
+
"input": $node-type-color-input,
|
149 |
+
"attribute": $node-type-color-input
|
150 |
+
);
|
151 |
+
|
152 |
+
@each $keyword, $color in $custom-classes {
|
153 |
+
code:not(.sourceCode).custom-#{$keyword} {
|
154 |
+
@include code-style($color);
|
155 |
+
}
|
156 |
+
}
|
data/docs/tutorials/00_interface.md
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Blender's Interface
|
3 |
+
---
|
4 |
+
|
5 |
+
Blender has a _very_ overwhelming interface. There is no getting around this. Blender can do _practically anything_, and it is sometimes hard to do simple things.
|
6 |
+
|
7 |
+
### A New File
|
8 |
+
|
9 |
+
Starting a new file, you are greeted by the splash screen. You can click `General` to start a new session with a general-purpose setup.
|
10 |
+
|
11 |
+
This 3D viewport will seem familiar if you have used other programs such as PyMol, ChimeraX & VMD. You can move the camera around just like in those other programs.
|
12 |
+
|
13 |
+
In the 3D viewport, much like in real life, there are three (3) axes of possible movement and direction. Inside Blender are `X`, `Y`, and `Z`. The floor is made of `X` and `Y`, which form the flat grid you see in the viewport coloured red and green/yellow, while `Z` is the blue vertical axis. These are labelled and highlighted on the axis widget, which is present in the top right corner of the viewport. This will rotate as you rotate the view, so it can always be used as a reference point.
|
14 |
+
|
15 |
+
![The different widgets in the 3D viewport. Note the colouring of the different axes.](images/widgets.png)
|
16 |
+
|
17 |
+
You can rotate the camera view either using the middle mouse button <kbd>MMB</kbd> or using your touchpad if you are on a laptop. You can also click and drag the axis widget to rotate the camera.
|
18 |
+
|
19 |
+
You can pan the camera using <kbd>Shift</kbd> + <kbd>MMB</kbd>
|
20 |
+
|
21 |
+
![](https://imgur.com/i4kyvQX.mp4)
|
22 |
+
|
23 |
+
## Transforming Objects
|
24 |
+
|
25 |
+
The main difference is that you can also manipulate the 3D scene in front of you. You can select objects with a left click of the mouse <kbd>LMB</kbd>, and move them around by *Grabbing* them with the <kbd>G</kbd> key.
|
26 |
+
|
27 |
+
The main actions that you use the 3D Viewport for are:\
|
28 |
+
|
29 |
+
- <kbd>G</kbd> - **Grabbing:** Moving an object around in 3D space.
|
30 |
+
|
31 |
+
- <kbd>S</kbd> - **Scaling:** Changing the relative size of an object.
|
32 |
+
|
33 |
+
- <kbd>R</kbd> - **Rotating:** Rotating the object in 3D space.
|
34 |
+
|
35 |
+
![](https://imgur.com/QIqR2yB.mp4)
|
36 |
+
|
37 |
+
### Locking to an Axis
|
38 |
+
|
39 |
+
When transforming by grabbing, rotating or scaling, you can lock the transformation to a particular axis. Click <kbd>X</kbd> / <kbd>Y</kbd> / <kbd>Z</kbd> after starting the transformation to lock it to those axes, or <kbd>Shift</kbd> + <kbd>X</kbd> / <kbd>Y</kbd> / <kbd>Z</kbd> to lock the transformation to be *perpendicular* to that axis.
|
40 |
+
|
41 |
+
![](https://imgur.com/v1qKndu.mp4)
|
42 |
+
|
43 |
+
## Rendered View
|
44 |
+
|
45 |
+
By default you start in `3D View`, which is characterised by everything being gray and not rendered properly.
|
46 |
+
|
47 |
+
You can change to the different views via the render view buttons, or by holding <kbd>Z</kbd> and selecting one of the options.
|
48 |
+
|
49 |
+
Each of the views are useful in their own way. If you have a powerful enough computer, you can spend the majority of your time in either `Rendered` or `Material Preview` view which will ensure everything is shaded and lighting is calculated. If a scene is becoming complex and your computer is slow, you can switch back to `3D View` which should improve performance.
|
50 |
+
|
51 |
+
![](https://imgur.com/Uwakbpx.mp4)
|
52 |
+
|
53 |
+
## Rendering Engines
|
54 |
+
|
55 |
+
Already there are different ways to view the scene, through the 'rendered view' and the other methods. Even with the option of rendered view, there are multiple different rendering engines. Two rendering engines come pre-installed with Blender, with the possibility to use more. The two rendering engines that come pre-installed are Eevee and Cycles. By default Eevee is enabled, but you can change to Cycles in the `Render Properties` tab.
|
56 |
+
|
57 |
+
Eevee is much faster and more responsive than Cycles, but a lot of the time doesn't 'look as nice'. Eevee is a real-time rendering engine built for performance and interactivity, while Cycles is a path-traced rendering engine built for physically accurate light calculations. This is much slower to calculate but often results in 'nicer' lighting. Both rendering engines are excellent and are helpful in different scenarios depending on the desired outcomes.
|
58 |
+
|
59 |
+
The default style `Atoms Cycles` inside of Molecular Nodes is only visible inside of Cycles for performance reasons. All other styles are visible inside of both rendering engines. If your atoms seem to be invisible, check the rendering engine and style that you are using.
|
60 |
+
|
61 |
+
> If you have the option available, ensure to switch to `GPU Compute` instead of `CPU` when using the Cycles render engine. This will usually always be the better option, and the perforamnce will be much better.
|
62 |
+
|
63 |
+
![](https://imgur.com/eeLN5gG.mp4)
|
64 |
+
|
65 |
+
## Adding Objects
|
66 |
+
|
67 |
+
You can add new objects by <kbd>Shift</kbd> + <kbd>A</kbd> or by using the `Add` menu in the top left.
|
68 |
+
|
69 |
+
There are a number of different object types that can be added. The most common that you will use will be `Mesh` and `Light`. Try adding some new objects, _**G**rabbing_ them to move them around, _**R**otating_ them and _**S**caling_ them to different sizes. If you have just added a new object and it isn't immediately visible, it might be inside another object, or it could be *too big* or *too small* to be immediately visible. Try moving the camera or the object around to get a better view.
|
70 |
+
|
71 |
+
![The add menu. Also accesible through `Shift + A`](images/menu_add.png)
|
72 |
+
|
73 |
+
![](https://imgur.com/qk8SjW6.mp4)
|
74 |
+
|
75 |
+
## Rendering an Image
|
76 |
+
|
77 |
+
To render an image, you can click <kbd>F12</kbd> or use the `Render -> Render Image` menu. Blender will not render what you are immediately seeing. Instead, it will render whatever the **Camera**** is seeing. This can be frustrating at first, but it makes sense when you can have multiple cameras in a single scene.
|
78 |
+
|
79 |
+
To see what the camera sees, you can click the Camera widget in the top right, or click backtick (<kbd>`</kbd>) + <kbd>1</kbd>.
|
80 |
+
|
81 |
+
> The backtick is directly under the <kdb>Esc</kbd> key on most American / Enlgish keyboards. It can vary in other language layouts.
|
82 |
+
|
83 |
+
![](https://imgur.com/gMGHAsT.mp4)
|
84 |
+
|
85 |
+
Once you are happy with the camera framing, click render.
|
86 |
+
|
87 |
+
![The render menu.](images/menu_render.png)
|
88 |
+
|
89 |
+
A window should appear, showing the rendered image. Isn't it magnificent?
|
90 |
+
|
91 |
+
The rendered image is not saved. You have to manually save the image by clicking `Image` -> `Save As` and choose where to save the image.
|
92 |
+
|
93 |
+
![The rendered image window.](images/render_example_1.png)
|
94 |
+
|
95 |
+
## Add More Lights
|
96 |
+
|
97 |
+
We can make our 3D scene more interesting by adding more lights. When the light object is selected, the green `Light Settings` tab becomes available, appearing as a small green lightbulb. Under these settings, we can change the colour of our light, along with the `Power`. Try tweaking these settings to your liking. You can duplicate an object without adding a new one by clicking <kbd>Shift</kbd> + <kbd>D</kbd>.
|
98 |
+
|
99 |
+
![Adding more lights to the scene.](https://imgur.com/CYPV688.mp4)
|
100 |
+
|
101 |
+
## Materials
|
102 |
+
|
103 |
+
One of the hardest things to get used to while working in 3D is the idea of materials. What if we want to make the monkey head **Red**? In 3D we can't just _make things red_. Instead we have to assign it a _material_. This material can have the property that it is primarily red, but it is also metallic, has a sheen, reflects light, can be partially transparent as well as a whole range of other properties.
|
104 |
+
|
105 |
+
Complex shading is an entire career itself, so we won't get too much in to it. In this example we will just add a material to the monkey to make it red, and a different material to the cube to make it blue.
|
106 |
+
|
107 |
+
> If you can't see the colors changing, ensure you are in Rendered view.
|
108 |
+
|
109 |
+
In the example below, we create a _new material_ called `Material.001` for the monkey which we change to red. The cube already has a material called `Material`. We change the material being used to the monkey's material, before changing it back and editing the starting material so that it is blue.
|
110 |
+
|
111 |
+
Try playing around with some of the other material settings, to see what effects you can create.
|
112 |
+
|
113 |
+
![Assigning materials to objects.](https://imgur.com/UwwWnaY.mp4)
|
114 |
+
|
115 |
+
## Edit Mode
|
116 |
+
|
117 |
+
The last thing to be aware of when working inside of a 3D program like Blender, is that you can manually edit the 3D objects that are inside of the scene. In the top left hand corner of the 3D viewport. With an object selected, you can change between the different modes. You can edit the physical shape of a mesh, by moving individual or groups of vertices, by going into `Edit Mode`. You can also use the keyboard shortcut <kbd>Tab</kbd>
|
118 |
+
|
119 |
+
![The different modes are available when an object is selected.](images/edit_mode_selection.png)
|
120 |
+
|
121 |
+
With a mesh object selected, you can change in to edit mode. While in edit mode, different options are available to you, and you can phsyically edit the mesh. Try selecting some vertices of the mesh and moving them around individually.
|
122 |
+
|
123 |
+
![Example of entering edit mode.](https://imgur.com/buDdGvM.mp4)
|
124 |
+
|
125 |
+
You now know the _very basics_ of adding new objects, changing the materials, adding some lights and rendering an image. The same principles apply to everything that you you do in Blender, and often all of the different workspaces will contain similar keyboard shortcuts and ways of working. Try playing around some more inside of the 3D scene, rendering some different 3D images, before moving on to the section which includes actual proteins.
|
126 |
+
|
127 |
+
Most things are best learnt by doing, so load some proteins in and try to follow along with the other tutorials.
|
128 |
+
|
data/docs/tutorials/01_importing.qmd
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Fetch from the PDB
|
3 |
+
fig-align: center
|
4 |
+
---
|
5 |
+
|
6 |
+
Molecules, simulations and other file formats can all be imported via the `Molecular Nodes` subpanel. This panel can be found under the `Scene Properties` panel. This is the small cone and spheres icon on the right. This contains all of the different options for importing molecular data currently available inside of Molecular Nodes.
|
7 |
+
|
8 |
+
![The panel location.](images/panel-location.png)
|
9 |
+
|
10 |
+
You can download a structure directly from the PDB, just from the accession code. Molecular Nodes will download the file as a `.bcif` file and cache it locally on your computer, then open the file in to Blender. This is the quickest way to import structures that are already available via the wwPDB. Currently this downloads via the RCSB.
|
11 |
+
|
12 |
+
To download directly from the PDB, you can use the <kbd>PDB</kbd> tab.
|
13 |
+
|
14 |
+
## PDB Tab
|
15 |
+
|
16 |
+
In this tab you can input the PDB ID to be used for downloading the structure. You can also change where Molecular Nodes caches the downloaded structures. By default it will be in a hidden `.MolecularNodes` folder in your home directory.
|
17 |
+
|
18 |
+
![The PDB import tab.](images/tab-pdb.png)
|
19 |
+
|
20 |
+
Type in the code, choose your import options such as starting style, and click download. The new object will appear in the outliner. It will appear inside of the `MolecularNodes` collection and should have the name of the PDB ID used to fetch the structure. If an object already exists with that name, it will be appended with a `.001` or similar suffix.
|
21 |
+
|
22 |
+
The molecule may appear inside of the default cube, so you may have to delete it before the protein becomes visible.
|
23 |
+
|
24 |
+
![Downloading `4OZS` from the PDB](https://imgur.com/dnVJSuH.mp4)
|
25 |
+
|
26 |
+
## Edit Mode
|
27 |
+
|
28 |
+
The protein is imported as a 3D mesh, with a vertex for each atom and an edge for each bond. What you are seeing is the result of passing that data through a geometry-processing pipeline. The underlying data is still available, and you can even look at it (and edit it if you wish) by going using edit mode with <kbd>Tab</kbd>
|
29 |
+
|
30 |
+
You are editing the _underlying_ atomic data, not the cartoon itself. The cartoon is rebuilt on top of the edited atomic data, which is why part of it also moves with the atoms when they are moved.
|
31 |
+
|
32 |
+
It is probably ill-advised to manually edit the atomic data by hand, but it is important to understand the structure of the data inside of Blender & Molecular Nodes.
|
33 |
+
|
34 |
+
![](https://imgur.com/MFeB05p.mp4)
|
35 |
+
|
36 |
+
## Rendered Views
|
37 |
+
|
38 |
+
While the molecule is imported, we are in 3D view by default. We can change to a rendered view to view the molecule with more accurately calculated lighting effects.
|
39 |
+
|
40 |
+
![Changing to rendered views in different rendering engines.](https://imgur.com/oF05D7S.mp4)
|
41 |
+
|
42 |
+
## Changing Styles
|
43 |
+
|
44 |
+
The protein is now imported in the scene. To change the way the protein is displayed, we have to use the `Geometry Nodes` editor. This is where we change the nodes that are use to process the underlying atomic data, resulting in the final 3D object we can see in front of us.
|
45 |
+
|
46 |
+
To access `Geometry Nodes` panel, we can either select the `Geoemtry Nodes` workspace, or split the current viewport and change one of the workspaces into the node editor.
|
47 |
+
|
48 |
+
![Arranging workspaces.](https://imgur.com/0HaIgZp.mp4)
|
49 |
+
|
50 |
+
You can change the workspace through the tabs in the top of Blender. You can split workspaces by hovering over the corner of a workspace, and then clicking and dragging. You can merge to workspaces by clicking and dragging from one into another, while dragging into the same workspace will split it and create two workspaces.
|
51 |
+
|
52 |
+
![Opening the Geometry Nodes workspaces.](https://imgur.com/24urpXp.mp4)
|
53 |
+
|
54 |
+
Geometry node trees are explained more in the next section.
|
55 |
+
|
56 |
+
In short, the atomic data comes through the `Group Input` on the left, and the final 3D model goes out the `Group Output` to the right. Each node in between performs some actions on the data. The first node changes the colours of the atoms. The last node applies the given style. When importing we chose the `Cartoon` style default, so we have a cartoon node.
|
57 |
+
|
58 |
+
We can add a new node through the `Add` menu, or we can use <kbd>Shift</kbd> + <kbd>A</kbd> to add new nodes. We can click and drag on the noodle outputs and inputs to remove and create new connections. Notice how when the complete 'circuit' or 'flow diagram' goes through the ball and stick node, the style changes to ball and stick. When it flows through the cartoon node, the style changes to cartoon.
|
59 |
+
|
60 |
+
![Adding a new node to change the output style.](https://imgur.com/bghzMwj.mp4)
|
61 |
+
|
62 |
+
## Geometry Nodes Editor
|
63 |
+
|
64 |
+
This is where we edit the node graph for Molecular Nodes. The node graph is a geometry processing program you create, that is read and executed by Blender from left to right. Each node performs an action on the geometry that is passed into it, and the result of that action is passed out to the right. Think of it as creating a set of rules for the computer to follow. You define the rules, and the computer can follow those same rules, even if you start with a different data set.
|
65 |
+
|
66 |
+
The data flows like a river, along the green noodles of the node graph. There must be only 1 final output. If you are using the molecular data, then there must also be a single input.
|
67 |
+
|
68 |
+
![Example node tree, demonstrating the flow of information through the nodes.](images/gn_flow_information.png)
|
69 |
+
|
70 |
+
The data flows from left to right, like water through a river.
|
71 |
+
```{mermaid}
|
72 |
+
flowchart LR
|
73 |
+
A{Atomic\nData} --> B[Manipulation]
|
74 |
+
B --> D(Style)
|
75 |
+
D --> G{Geometry\nOutput}
|
76 |
+
```
|
77 |
+
|
78 |
+
![Screenshot of the Geometry Nodes workspace.](images/mn-gn-workspace.png)
|
79 |
+
|
80 |
+
The starting style `MOL_style_atoms_cycles` is only visible via inside of the Cycles render engine. You can add other styles manipulate the data through other nodes, by adding them with <kbd>Shift</kbd> + <kbd>A</kbd> and navigating to the MolecularNodes panel at the bottom. There are several categories of nodes for different animations and styles. You can add the `Ribbon Protein` node, which will create a ribbon representation based on the alpha carbons in the structure. If there is not colour in the structure, ensure that the node has a material `MOL_atomic_material` at the bottom of the node.
|
81 |
+
|
82 |
+
![](images/mn-gn-style-ribbon.png)
|
83 |
+
|
84 |
+
The data flows through the node graph from left to right. There should always be one input, which is the atomic data that is stored in the 3D mesh of the atoms and bonds. There should also be only one output, which is the final geometry that has been created throughout the node graph.
|
85 |
+
|
86 |
+
```{mermaid}
|
87 |
+
|
88 |
+
flowchart LR
|
89 |
+
A{Atomic\nData} --> B[Manipulation]
|
90 |
+
|
91 |
+
B --> D(Style 1)
|
92 |
+
B --> E(Style 2)
|
93 |
+
B --> S(Style 3)
|
94 |
+
|
95 |
+
sS[Selection] --> S
|
96 |
+
|
97 |
+
E --> F[Join\nGeometry]
|
98 |
+
D --> F
|
99 |
+
S --> F
|
100 |
+
|
101 |
+
F --> G{Geometry\nOutput}
|
102 |
+
```
|
103 |
+
|
104 |
+
As demonstrated in the diagram, the flow of the data can split across multiple different branches of the tree, with the result of each parallel computation being combined before being exported.
|
105 |
+
|
106 |
+
Each of these different branches can be a different style, in this example shown two different styles are applied, and the third style has a custom selection. All of the styles are the result of the same data manipulation.
|
107 |
+
|
108 |
+
The node graph in between can be as complex as you want to make it, as long as there is a continuous connection to the output of the geometry, it should produce a result.
|
109 |
+
|
110 |
+
![An example of a more complex node graph, with multiple branches that diverge and come back together.](images/gn_complex_graph.png){width="500px" width="300"}
|
111 |
+
|
112 |
+
Combining multiple different nodes you can create protein models and complex 3D scenes. In the example below, there is a node tree which should be present on every new structure imported via MolecularNodes. The atoms and bonds are passed in from the left, the atoms are given a colour based on their element and their `chain_id`, and then the atoms are styled as atoms, scaling the atom radii to `1.00`.
|
113 |
+
|
114 |
+
The data flows through the node tree from left to right, along the bright green lines. The atomic data comes in, goes through layers of manipulation, a style is applied, and the created geometry is then outputted from the node tree.
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
### Editing the Styles
|
119 |
+
|
120 |
+
To change how each style looks, you can edit the default values of the nodes. By changing the values, you change the numbers that are used in the creation of the 3D models. The style will only change if it is being output through the node tree. You can click and drag to change the values smoothly. You can hold <kbd>Shift</kbd> while dragging the values to change them more accurately.
|
121 |
+
|
122 |
+
![Tweaking the default values of the styles.](https://imgur.com/zgg6HZE.mp4)
|
123 |
+
|
124 |
+
## Combining Styles
|
125 |
+
|
126 |
+
To complete this tutorial, we will combine the use of `Selection` and `Join Geometry` to create a style which shows the side chains as *ball and stick* while also showing the cartoon style.
|
127 |
+
|
128 |
+
The style should usually be the last node that you apply to a model. You can't apply a style after another style, as the output of a style is 3D geometry and not 'atom-like' geometry. Instead, we can combine two styles with a `Join Geometry` node. That way, we create both styles in parallel and then join them together before outputting them all through the `Group Output` node.
|
129 |
+
|
130 |
+
The node can be found under `Geometry` or by going through the search for `Join Geometry`
|
131 |
+
|
132 |
+
![Adding a Join Geometry node.](https://imgur.com/U3pJo4v.mp4)
|
133 |
+
|
134 |
+
## Selections
|
135 |
+
|
136 |
+
Many nodes will have a `Selection` input, which you can't manually edit. This input is a `Boolean` attribute and says whether or not to apply an operation to atoms based on if the value is `True` or `False`.
|
137 |
+
|
138 |
+
You can use selections via the `Molecular Nodes` -\> `Selection` menu. In this example we use the `Backbone` node to select atoms based on if they are part of the backbone, the side chain, or just alpha carbons.
|
139 |
+
|
140 |
+
You can see as we connect different outputs from the `Backbone` node, we get different results in the final style.
|
141 |
+
|
142 |
+
![Changing selections for the Ball and Stick style.](https://imgur.com/ZOHK9CO.mp4)
|
data/docs/tutorials/02_selections.md
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Selections
|
3 |
+
author: Brady Johnston
|
4 |
+
---
|
5 |
+
|
6 |
+
Selections power every part of Molecular Visualisation.
|
7 |
+
You are probably used to using selections via manually pointing and clicking with your mouse, or typing long strings of complex selection algebra.
|
8 |
+
|
9 |
+
## A Simple Example
|
10 |
+
|
11 |
+
To create a selection of residues ALA, CYS and TRP, only inside of chain A, you would use the following code inside of PyMol:
|
12 |
+
|
13 |
+
``` python
|
14 |
+
select my_selection, chain A and (resn ALA+CYS+TRP)
|
15 |
+
```
|
16 |
+
|
17 |
+
Inside of Molecular Nodes, you combine different *selection* nodes.
|
18 |
+
The outputs of these are are a *boolean* `True / False` for each atom.
|
19 |
+
The logical test being performed depends on the node.
|
20 |
+
To recreate the selection above, we can use the `Select Chain` and `Select Res Name` nodes.
|
21 |
+
|
22 |
+
![Replicating the same selection in Molecular Nodes](images/02_selections_example.png)
|
23 |
+
|
24 |
+
This might initially seem quite verbose.
|
25 |
+
The good thing however is that these selections can always be updated and tweaked.
|
26 |
+
They can even be created procedurally based on the values of other selections or animations.
|
27 |
+
|
28 |
+
In the example video below we are using the selection to apply the `Atoms` style.
|
29 |
+
We can change the residues and chains that are selected by ticking and unticking the boxes.
|
30 |
+
Each of these selections also take a *field* input, so they can use the output of other selection nodes.
|
31 |
+
The selections from the two nodes are being combined with the `Boolean Math` node set to `And`.
|
32 |
+
Other boolean math operations are also available.
|
33 |
+
|
34 |
+
![](https://imgur.com/bo55ms2.mp4)
|
35 |
+
|
36 |
+
## Different Styles Combined
|
37 |
+
|
38 |
+
In this example, we apply the `Surface` style to one chain, and the `Atoms` style to another chain.
|
39 |
+
We can join the two styles together with the `Join Geometry` node.
|
40 |
+
|
41 |
+
![](https://imgur.com/d2Gj2Sh.mp4)
|
42 |
+
|
43 |
+
## Combining Selections
|
44 |
+
|
45 |
+
Selections can be combined not just through `Boolean Math` nodes, but also by connecting the output from one node to the input of another selection.
|
46 |
+
In this example we are selecting two chains for applying the `Atoms` style to.
|
47 |
+
|
48 |
+
The selection of `Chain A` we then control though the `Cube` selection node.
|
49 |
+
The addition of this node creates a new object called `Empty_Cube` which we can transform by Grabbing, Rotating and Scaling to change what is inside of the cube.
|
50 |
+
The style is then applied to the updated selection, which varies for `Cahin A` but not for `Chain F`.
|
51 |
+
|
52 |
+
![](https://imgur.com/toPse4T.mp4)
|
53 |
+
|
54 |
+
## More Examples
|
55 |
+
|
56 |
+
You can use these dynamic selections for any kind of boolean input.
|
57 |
+
It can be used to select the atoms to apply a style to or even to change different aspects of that style itself.
|
58 |
+
In this example, we first choose the atoms to apply the style to; then instead, we change whether or not we use cylinders for the cartoon style.
|
59 |
+
|
60 |
+
![](https://imgur.com/XoqrhX5.mp4)
|
61 |
+
|
62 |
+
Selecting based on the `entity_id`, to reveal the rotary axel of the protein complex underneath.
|
63 |
+
|
64 |
+
![](https://imgur.com/aUpiFYe.mp4)
|
65 |
+
|
66 |
+
## Open a Local File
|
67 |
+
|
68 |
+
To open a `.pdb`, `.mmCIF`, `.pdbx` or other similar files, use the <kbd>Local File</kbd> tab.
|
69 |
+
|
70 |
+
You can set the name for the molecule, which will become the object's name once imported.
|
71 |
+
Use the folder icon to select the file you would like to import.
|
72 |
+
|
73 |
+
![The 'Local File' tab.](images/panel-local.png)
|
74 |
+
|
75 |
+
The 'Default Style' was changed to 'Cartoon', but no other default import options were changed.
|
76 |
+
The Default Cube was deleted with <kbd>X</kbd> as the protein was imported *inside* of the cube.
|
77 |
+
|
78 |
+
![](images/down-example-local.png)
|
data/docs/tutorials/03_molecular_dynamics.md
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Molecular Dynamics
|
3 |
+
author: Brady Johnston
|
4 |
+
bibliography: references.bib
|
5 |
+
fig-align: center
|
6 |
+
---
|
7 |
+
|
8 |
+
::: {#fig-md-example-render}
|
9 |
+
![](https://imgur.com/S42CNVJ.mp4){autoplay="true" loop="true"}
|
10 |
+
|
11 |
+
The protein adenylate kinase (AdK) undergoes a structural change during its catalytic cycle between a closed and an open state that is captured in enhanced sampling simulations [@seyler2015].
|
12 |
+
The protein secondary structure is shown as a round ribbon with individual amino acid sidechains as ball-and-sticks.
|
13 |
+
The trajectory was rendered with Blender and the MolecularNodes plugin (Brady Johnston).
|
14 |
+
Trajectory files are available via [MDAnalysisData](https://www.mdanalysis.org/MDAnalysisData/adk_transitions.html#adk-dims-transitions-ensemble-dataset) Copyright CC-BY 2023 Brady Johnston.
|
15 |
+
:::
|
16 |
+
|
17 |
+
As well as importing static structures, the results from molecular dynamics simulations can be imported as models in to Blender.
|
18 |
+
This is enabled through the excellent package [`MDAnalysis`](https://www.mdanalysis.org/).
|
19 |
+
The imported structure will have an object created that will act as the topology file, and a connection is maintained the underlying `MDAnalysis.Universe` object that provides coordinates and allows for dynamic calculations to be performed during playback.
|
20 |
+
|
21 |
+
::: callout-warning
|
22 |
+
## Saving the File
|
23 |
+
|
24 |
+
When saving the `.blend` file, a corresponding `.MNSession` file will be saved next to your Blender file.
|
25 |
+
When reloading the file, the `MDAnalysis.Universe` will be reloaded from this file, so ensure you keep it next to the `.blend` file.
|
26 |
+
:::
|
27 |
+
|
28 |
+
## MD Trajectory Panel
|
29 |
+
|
30 |
+
To import trajectories, change the import method in the Molecular Nodes panel to the `MD` method.
|
31 |
+
To import a trajectory, select the topology and trajectory files.
|
32 |
+
You can choose the initial starting style, but this can easily be changed after import.
|
33 |
+
|
34 |
+
![](images/panel.png){width="500px"}
|
35 |
+
|
36 |
+
## Import the Trajectory
|
37 |
+
|
38 |
+
Click `Load` to import the selected trajectory with the chosen options.
|
39 |
+
The model will appear in the scene, and when the `Frame` changes inside of Blender, the corresponding frame will be displayed from the imported trajectory.
|
40 |
+
|
41 |
+
### Changing Style
|
42 |
+
|
43 |
+
To change which style is displayed, you have to interact with the *Geometry Nodes*,you use the same Geometry Nodes tree that you use for other structures.
|
44 |
+
Adding new style nodes and specifying their selections to limit limit the style to particular selections of atoms.
|
45 |
+
|
46 |
+
### Subframes
|
47 |
+
|
48 |
+
By default each frame on Blender's timeline corresponds to the frame in the imported trajectory.
|
49 |
+
You can increase the `Subframes` number for this trajectory, and the selected number of frames will be created in between the frames of the loaded trajectory.
|
50 |
+
If Interpolate is selected, the positions will be linearly interpolated between the frames of the trajectory.
|
51 |
+
If subframes are used, the frames of the trajectory will no longer directly correspond to the frames inside of Blender.
|
52 |
+
With 2 subframes, frame 9 inside of Blender will correspond frame 3 of the trajectory.
|
53 |
+
|
54 |
+
When linearly interpolating through subframes of a trajectory, we can correct for periodic boundary crossing with the `Correct` option enabled.
|
55 |
+
This is only available if your simulation box is cubic.
|
56 |
+
|
57 |
+
### Custom Selections
|
58 |
+
|
59 |
+
Creating selections through nodes is a very quick and powerful way of working.
|
60 |
+
It can be easier to create selections through text, and some niche selections are currently unable to created through the node system.
|
61 |
+
|
62 |
+
With `Trajectory` object selected, in the `Object` tab in the molecular nodes panel, we can create custom selections using the [MDAnalysis selection language](https://userguide.mdanalysis.org/stable/selections.html).
|
63 |
+
These selections will become available inside of the Geometry Nodes tree as a `Named Attribute`.
|
64 |
+
|
65 |
+
There are toggles for these selections to be updating and / or periodic in how they are calculated.
|
66 |
+
These options correspond directly to the options that are possible through the `MDAnalysis.Universe.select_atoms()` method for creating atom groups.
|
67 |
+
|
68 |
+
Use the `Named Attribute` or `Select Attribute` nodes to get access to these selections inside of Geometry Nodes, and use them to selectively apply styles, colors and animations to your trajectory.
|
69 |
+
|
70 |
+
![](images/panel_selection.png){width="500px"}
|
71 |
+
|
72 |
+
## Creating the Animation
|
73 |
+
|
74 |
+
To replicate the animation which we see at the top of the tutorial, we can use some of the example datasets which are provided alongside `MDAnalysis` with the `MDAnalysisData` package.
|
75 |
+
To download one of the datasets, use the code below:
|
76 |
+
|
77 |
+
``` python
|
78 |
+
# pip install MDAnalysisData
|
79 |
+
from MDAnalysisData import datasets
|
80 |
+
datasets.fetch_adk_transitions_FRODA()
|
81 |
+
```
|
82 |
+
|
83 |
+
### Loading the Trajectory
|
84 |
+
|
85 |
+
We will load the trajectory, and load all of the frame sin to memory to ensure we can make a smoother trajectory.
|
86 |
+
|
87 |
+
In the video below we have imported the trajectory, and we can adjust the number of frames in the scene, as well as the number of frames the trajectory will play back over.
|
88 |
+
We also enabled `EEVEE` atoms to display in the EEVEE render engine.
|
89 |
+
|
90 |
+
![](https://imgur.com/jKTYWp9.mp4)
|
91 |
+
|
92 |
+
#### Changing Styles
|
93 |
+
|
94 |
+
We can change the style of the imported trajectory, by adding a new style node.
|
95 |
+
We can combine styles with the `Join Geometry`.
|
96 |
+
For more details on adding styles, see the (importing)\[01_importing.qmd\] tutorial.
|
97 |
+
|
98 |
+
![](https://imgur.com/nhau0r9.mp4)
|
99 |
+
|
100 |
+
We can apply the atoms style, only to the side chains of the protein, by using the `Backbone` selection node, and using the `is_side_chain` output.
|
101 |
+
This selectively applies the style to only those atoms in the selection.
|
102 |
+
The combined styles now contain only the atoms for the side chains and a continuous ribbon for the protein.
|
103 |
+
|
104 |
+
![](https://imgur.com/1m3pHKM.mp4)
|
105 |
+
|
106 |
+
### Setting the Scene
|
107 |
+
|
108 |
+
We can set up the scene a bit nicer with a backdrop.
|
109 |
+
In this case we create a plane using <kbd>Shift</kbd> + <Kbd>A</kbd> to add a plane, go in to [edit mode](#01-introduction-edit-mode) and extrude the backbdrop up with the <kbd>E</kbd> key.
|
110 |
+
We can create a slightly curved corner by bevelling the corner.
|
111 |
+
Select the two vertices of the edge and click <kbd>Ctrl</kbd> + <kbd>B</kbd>.
|
112 |
+
Move the mouse and use the scroll wheel to adjust the settings, then left click to apply.
|
113 |
+
|
114 |
+
![](https://imgur.com/6LUQEnz.mp4)
|
115 |
+
|
116 |
+
### Rendering the Animation
|
117 |
+
|
118 |
+
We can change some final settings of the style, do a test `Render Image`, change the export settings for where the frames of the animation are going to be saved, then we can click `Render Animation` to render all of the frames of the animation.
|
119 |
+
|
120 |
+
![](https://imgur.com/IBKUQSr.mp4)
|
data/docs/tutorials/04_cryoem.qmd
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: CryoEM Maps
|
3 |
+
author: Brady Johnston
|
4 |
+
---
|
5 |
+
|
6 |
+
![](https://imgur.com/4W1dxyJ)
|
7 |
+
|
8 |
+
We can import CryoEM maps, which are imported into Blender as a 'volume' object. As Blender is designed to work with data for movies and TV shows, this is implemented in a way to emulate smoke or gas. We aren't looking to annimate these volumes, but when we import the volume we can create a surface based on a cutoff for the density, the same as you do with ChimeraX.
|
9 |
+
|
10 |
+
## Importing Panel
|
11 |
+
|
12 |
+
![](https://imgur.com/EcrtE3N)
|
13 |
+
|
14 |
+
- **Name** The name that will be given to the newly created object inside of Blender.
|
15 |
+
- **File** The `.map` or `.map.gz` file to be imported to Blender.
|
16 |
+
|
17 |
+
- **Style** The initial style to apply to the volume object when imported into Blender.
|
18 |
+
- **Invert Data** Whether to invert the data when importing (usually used for CryoET data)
|
19 |
+
- **Centre Density** Translates the data so that the world origin is in the middle, rather than the corner of the density.
|
20 |
+
|
21 |
+
::: {.callout-warning}
|
22 |
+
Blender _currently_ can't directly import the `.map` files. Instead we convert the file to a `.vdb` volume file, then import that to Blender. This intermediate file will be saved next to the `.map` file. If you move or delete this intermediate file, then it will break the volume inside of Blender, so be careful moving files around after import.
|
23 |
+
:::
|
24 |
+
|
25 |
+
|
26 |
+
## Example Data
|
27 |
+
|
28 |
+
As an example, we are going to use the structure and the map correlating to `8E3Z` as an example. You can import the structure using the PDB import in Molecular Nodes, and the map you can download from the [EMDB page](https://www.ebi.ac.uk/emdb/EMD-27874). Ensure you download the `.map.gz` file.
|
29 |
+
|
30 |
+
## Importing
|
31 |
+
Select the file and import to Blender.
|
32 |
+
|
33 |
+
There should be a surface that has appeared, which has a goemetry nodes modifier with a single node applied.
|
34 |
+
|
35 |
+
![](https://imgur.com/ABiq2rI)
|
36 |
+
|
37 |
+
You can adjust the threshold which is the cutoff at which Blender will create a surface mesh.
|
38 |
+
|
39 |
+
## Importing Structure
|
40 |
+
|
41 |
+
When we import a structure, both the density and the structure should align perfectly, as long as neither were imported with the 'centre' option selected.
|
42 |
+
|
43 |
+
We can import the structure `8E3Z` via the PDB tab with `Ribbon` styling, and see how it overlaps with the surface from the density.
|
44 |
+
|
45 |
+
![](https://imgur.com/oPv556p)
|
46 |
+
|
47 |
+
## Sampling Colors
|
48 |
+
|
49 |
+
Currently all of the colors on the mesh are uniform. There is the field input `Color`, so we can _sample_ the color from the atoms of a structure, and use that information to color the surface.
|
50 |
+
|
51 |
+
We will use the `Sample Nearest Attribute` node from the `Molecular Nodes -> Density` menu. This node will take the atoms of a structure and can transfer the information from that structure onto the surface created for that volume.
|
52 |
+
|
53 |
+
The structure which we have currently imported however isn't showing the atoms - it is displaying the ribbon style. We can duplicate the structure with <kbd>Shift</kbd> + <kbd>D</kbd> in the 3D viewport, and change the node group used so that it displays the atoms rather than applying a style.
|
54 |
+
|
55 |
+
![](https://imgur.com/6nyPZRw.mp4)
|
56 |
+
|
57 |
+
In the demo video, we duplicate the object. When duplicating, both objects are using the same node tree, so we then also duplicate the node tree. Now we can remove the style from the new node tree, and use this object to sample colors for our surface. The original structure object remains unchanged and still contains a node tree which applies the ribbon style.
|
58 |
+
|
59 |
+
If you want to change the colors which are applied to the surface, we change the node tree of the object which contains the atoms. Changing thesse nodes will change the colors that are applied, and thus change the colors which are sampled to the surface for coloring.
|
60 |
+
|
61 |
+
![](https://imgur.com/eUslUNV.mp4)
|
data/docs/tutorials/images/02_selections_example.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/down-example-local.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/down-example-pdb.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/edit_mode_selection.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/gn_complex_graph.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/gn_flow_information.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/menu_add.png
ADDED
Git LFS Details
|
data/docs/tutorials/images/menu_render.png
ADDED
Git LFS Details
|