Reference
ChemfilesViewer.add_label!
ChemfilesViewer.clear_labels!
ChemfilesViewer.generate_dict_molecule
ChemfilesViewer.get_current_chemviewer_id
ChemfilesViewer.render_dict_molecule
ChemfilesViewer.render_dict_molecule!
ChemfilesViewer.render_molecule
ChemfilesViewer.render_molecule!
ChemfilesViewer.save_image
ChemfilesViewer.save_image_labels
ChemfilesViewer.save_overlay
ChemfilesViewer.set_camera_position!
ChemfilesViewer.set_options!
ChemfilesViewer.add_label!
— Methodfunction add_label!(label::AbstractDict{String,<:Any}; chemviewer_id::String="")
Adds a labels. Examples:
add_label!(Dict(
"label" => "label text",
"location" => [0,0,2],
"color" => "#f00000"
))
add_label!(Dict(
"label" => "some other text",
"location" => [2,5,5],
"style" => "font-weight:bold;color:blue;"
))
If the chemviewer_id
is not specified, the most recent instance is used.
ChemfilesViewer.clear_labels!
— Methodfunction clear_labels!(; chemviewer_id::String="")
Removes all labels (except for the atom-labels) from the render.
If the chemviewer_id
is not specified, the most recent instance is used.
ChemfilesViewer.generate_dict_molecule
— Methodfunction generate_dict_molecule(molecule::Chemfiles.Frame; atom_labels=false)
Generate a dictionary for the molecule
specifying the atoms, bonds and unit cell. If atom_labels
is true, then labels will be generated for each atom.
ChemfilesViewer.get_current_chemviewer_id
— Methodget_current_chemviewer_id()
Returns the id of the current chemviewer instance. This can be passed to the chemviewer_id
parameters in the functions render_molecule
, render_dict_molecule
, set_options!
, set_camera_position!
.
ChemfilesViewer.render_dict_molecule!
— Methodrender_dict_molecule!(dict_molecule::AbstractDict{String,<:Any}; options::AbstractDict{String,<:Any}=Dict{String,Any}(), output::String="")
Call render_dict_molecule
for the last used output plot.
ChemfilesViewer.render_dict_molecule
— Methodrender_dict_molecule(dict_molecule::AbstractDict{String,<:Any}; chemviewer_id::String="", options::AbstractDict{String,<:Any}=Dict{String,Any}(), output::String="")
Render the molecule from a dictionary containing the atoms, bonds and unit cell. If chemviewer_id
is not given, a new electron window will be created. Additional options
for rendering can be provided.
The parameter output
specfies whether to display the render in an external window (when set to external
) or inline within Jupyter or Pluto (when set to inline
). Leaving output
empty will autodetect the output medium.
ChemfilesViewer.render_molecule!
— Methodfunction render_molecule!(molecule::Chemfiles.Frame; options::AbstractDict{String,<:Any}=Dict{String,Any}(), output::String="")
Call render_molecule
for the last used output plot.
ChemfilesViewer.render_molecule
— Methodfunction render_molecule(molecule::Chemfiles.Frame; chemviewer_id::String="", options::AbstractDict{String,<:Any}=Dict{String,Any}(), atom_labels=false, output::String="")
Render the molecule
(a Chemfiles frame). If chemviewer_id
is not given, a new electron window will be created. Additional options
for rendering can be provided.
If atom_labels
is true, then labels will be generated for each atom.
The parameter output
specfies whether to display the render in an external window (when set to external
) or inline within Jupyter or Pluto (when set to inline
). Leaving output
empty will autodetect the output medium.
ChemfilesViewer.save_image
— Methodfunction save_image(filename::AbstractString; chemviewer_id::String="")
Save a png image of the render to filename
. The image size is specified by the parameters renderWidth
and renderHeight
, which can be set by set_options!
.
Note that labels are not saved. To save the labels use save_image_labels
.
If the chemviewer_id
is not specified, the most recent instance is used.
ChemfilesViewer.save_image_labels
— Methodfunction save_image_labels(filename::AbstractString; chemviewer_id::String="")
Save a png image of the labels in the render to filename
. The image size is specified by the parameters renderWidth
and renderHeight
, which can be set by set_options!
.
Note that this is an experimental feature. The resulting image might deviate from what is rendered in the output.
If the chemviewer_id
is not specified, the most recent instance is used.
ChemfilesViewer.save_overlay
— Methodfunction save_overlay(filename::AbstractString, filename_input1::AbstractString, filename_input2::AbstractString)
Saves an image to filename
that is constructed from overlaying filename_input2
over filename_input1
.
ChemfilesViewer.set_camera_position!
— Functionfunction set_camera_position!(axis::String="z", direction::String="+"; chemviewer_id::String="")
Set the camera position to be along one of the axis x
, y
, z
or the unit cell vectors a
, b
, c
. The direction of +
or -
specifies in which direction the camera is moved. If the chemviewer_id
is not specified, the most recent instance is used.
ChemfilesViewer.set_options!
— Methodfunction set_options!(options::AbstractDict{String,<:Any}; chemviewer_id::String="")
Set options for the render. Available options are:
shader
:basic
,phong
,lambert
(default)drawingType
:ball and stick
(default),space filling
,wireframe
cameraType
:perspective
(default),orthographic
quality
:high
(default),low
showUnitCell
:true
(default),false
showLabels
:true
,false
(default)styles
: dictionary of element styles, e.g.Dict("Au" => Dict("color" => "#f0f0c0", "radius" => 2.6))
cameraFov
: field of view of the perspective camera, default is40
cameraDistance
: distance of the perspective camera, will be automaticcameraZoom
: camera zoom, default is1
cameraAxis
: set the camera view along this axis (x
,y
,z
(default) or the unit cell vectorsa
,b
,c
), see alsoset_camera_position!
cameraAxisDirection
: direction of the camera alongcameraAxis
:+
(default),-
hemisphereLightIntensity
: light intensity of hemiphere light, defaults to1.0
directionalLightIntensity
: light intensity of directional light, defaults to0.05
center
: center of the render, will be automatically calculated if not givenrotateSpeed
: speed of rotation via mouse control, defaults to2
renderWidth
: width of the saved image, default is1600
renderHeight
: height of the saved image, default is1600
If the chemviewer_id
is not specified, the most recent instance is used.