generate_bond_scene: Build Scene (bonds only)

View source: R/generate_bond_scene.R

generate_bond_sceneR Documentation

Build Scene (bonds only)

Description

Reads an SDF file and extracts the 3D molecule model

Usage

generate_bond_scene(
  model,
  x = 0,
  y = 0,
  z = 0,
  scale = 1,
  center = TRUE,
  force_single_bonds = FALSE,
  pathtrace = TRUE,
  material = rayrender::glossy,
  material_vertex = material_list(diffuse = "grey33", ambient = "grey33", type =
    "phong", ambient_intensity = 0.3)
)

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 interatom spacing.

center

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

force_single_bonds

Default 'FALSE'. Whether to force all bonds to show as a single connection.

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 'material_list(diffuse="grey33",ambient="grey33",type="phong", ambient_intensity=0.3)'. Material to use for the bonds when 'pathtrace = FALSE'.

Value

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

Examples

#Generate a scene with benzene molecule with just the atoms

get_example_molecule("benzene") %>%
  read_sdf() %>%
  generate_bond_scene() %>%
  render_model(lights = "both", samples=256,sample_method="sobol_blue")

#Force single bonds to just show the shape of the molecule
get_example_molecule("benzene") %>%
  read_sdf() %>%
  generate_bond_scene(force_single_bonds = TRUE) %>%
  render_model(lights = "both", samples=256,sample_method="sobol_blue")

#Generate a scene with PFOA, reducing the inter-atom spacing
get_example_molecule("pfoa") %>%
  read_sdf() %>%
  generate_bond_scene(scale=0.3,force_single_bonds = TRUE) %>%
  render_model(lights = "both", samples=256,sample_method="sobol_blue")


raymolecule documentation built on March 22, 2022, 1:06 a.m.