Reads an SDF file and extracts the 3D molecule model

generate_atom_scene(
  model,
  x = 0,
  y = 0,
  z = 0,
  scale = 1,
  center = TRUE,
  pathtrace = TRUE,
  material = rayrender::glossy,
  material_vertex = material_list(type = "phong")
)

Arguments

model

Model extracted from a PDB or SDF file.

x

Default `0`. X offset, applied after centering.

y

Default `0`. Y offset, applied after centering.

z

Default `0`. Z offset, applied after centering.

scale

Default `1`. Amount to scale the inter-atom spacing.

center

Default `TRUE`. Centers the bounding box of the model.

pathtrace

Default `TRUE`. If `FALSE`, the `rayvertex` package will be used to render the scene.

material

Default `rayrender::glossy`. Rayrender material to use when `pathtrace = TRUE`. Must be either `glossy`, `diffuse`, or `dielectric`.

material_vertex

Default `rayvertex::material_list()`. Material to use when `pathtrace = FALSE`. `diffuse`/`ambient` colors and `ambient_intensity` are determined automatically, but all other material properties can be changed.

Value

Rayrender/rayvertex scene containing only the atoms in a molecule/protein.

Examples

#Generate a scene with caffeine molecule with just the atoms
# \donttest{
get_example_molecule("caffeine") %>%
  read_sdf() %>%
  generate_atom_scene() %>%
  render_model(samples=256,sample_method="sobol_blue")


#Generate a rayvertex scene, using toon shading
shiny_toon_material = rayvertex::material_list(type="toon_phong",
                                               toon_levels=3,
                                               toon_outline_width=0.1)
get_example_molecule("caffeine") %>%
  read_sdf() %>%
  generate_atom_scene(pathtrace=FALSE, material_vertex = shiny_toon_material) %>%
  render_model(background="white")


#Generate a scene with caffeine, reducing the inter-atom spacing
get_example_molecule("caffeine") %>%
  read_sdf() %>%
  generate_atom_scene(scale=0.5) %>%
  render_model(samples=256,sample_method="sobol_blue")

# }