Rapamycin
Example 01
lets display Rapamycin
;; Blender Import and Basimol Import
import bpy)
(import IPython)
(require '[basimol.core :as bc])
(
;; setup the scene. we will save to a file.
"PNG")
(set! (.. bpy -context -scene -render -image_settings -file_format) "/tmp/output.png")
(set! (.. bpy -context -scene -render -filepath)
(bc/clear-objects)
;; define materials and selections and then put it all together
let [
(;; styles for materials. its Just data....
surface_params {"Emission Strength" 0.5
"Alpha" 0.25}
cartoon_params {"Emission Strength" 0.0
"Alpha" 0.5}
sticks_params {"Base Color" [0.15 1 0.15 1]
"Emission Strength" 3
"Emission Color" [0.15 1 0.15 1]}
;; styles for components
style_overrides :ball+stick
{"Quality" 2
{"As Mesh" true
"Sphere Radii" 0.4
"Bond Split" false
"Bond Find" false
"Bond Radius" 0.4
"Color Blur" false
"Shade Smooth" true}
:cartoon {
;"DSSP" true
"Loop Radius" 1.1}}
;; camera location/view.
;; from (bc/get-view)
view [0.28517988324165344 0.384846031665802 -0.877818763256073 -1.7708362340927124]
[0.958473801612854 0.11450467258691788 -0.2611822485923767 -0.5268866419792175]
[-7.748600978629838e-07 0.9158504009246826 0.4015194773674011 0.8099910020828247]
[-0.0 0.0 -0.0 1.0]]
[-
str (gensym)) (merge bc/bsdf-principled-defaults surface_params))
surface_material (bc/create-basic-material (str (gensym)) (merge bc/bsdf-principled-defaults cartoon_params))
cartoon_material (bc/create-basic-material (str (gensym)) (merge bc/bsdf-principled-defaults sticks_params))
sticks_material (bc/create-basic-material (
"1fap")
arr (bc/load-pdb "RAP")
ligand (bc/filter-resname arr aget arr ligand)]
struct_lig (
;; draw and position
:cartoon style_overrides cartoon_material)
(bc/draw! arr :ball+stick style_overrides sticks_material)
(bc/draw! struct_lig :surface {} surface_material)
(bc/draw! arr
(bc/set-view! view)
:write_still true))
(bpy.ops.render/render **
;; for ipython display
(IPython.display/display"/tmp/output.png")) (IPython.display/Image