Title: | 'cry' and 'rgl' — Applications in Crystallography |
Version: | 0.1.1 |
Description: | Visualizing crystal structures and selected area electron diffraction (SAED) patterns. It provides functions cry_demo() and dp_demo() to load a file in 'CIF' (Crystallographic Information Framework) formats and display crystal structures and electron diffraction patterns. The function dp_demo() also performs simple simulation of powder X-ray diffraction (PXRD) patterns, and the results can be saved to a file in the working directory. The package has been tested on several platforms, including Linux on 'Crostini' with a Core™ m3-8100Y Chromebook, I found that even on this low-powered platform, the performance was acceptable. T. Hanashima (2001) https://www2.kek.jp/imss/pf/tools/sasaki/sinram/sinram.html Todd Helmenstine (2019) https://sciencenotes.org/molecule-atom-colors-cpk-colors/ Wikipedia contributors (2023) https://en.wikipedia.org/w/index.php?title=Atomic_radius&oldid=1179864711. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
Imports: | cry, pracma, rgl, utils |
Collate: | 'zzz.R' 'cry_demo.R' 'dp_demo.R' 'getCIF.R' 'align.R' 'select.R' 'rgl.cry-package.R' |
Suggests: | knitr, rmarkdown, spelling, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
URL: | https://github.com/SaitouToshihide/rgl.cry/, https://saitoutoshihide.github.io/rgl.cry/ |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2024-06-13 15:39:12 UTC; saitoutoshihide |
Author: | Toshihide Saitou [aut, cre, cph] |
Maintainer: | Toshihide Saitou <saitou.toshihide@gmail.com> |
Depends: | R (≥ 3.5.0) |
Repository: | CRAN |
Date/Publication: | 2024-06-13 15:50:05 UTC |
rgl.cry: 'cry' and 'rgl' — Applications in Crystallography
Description
Visualizing crystal structures and selected area electron diffraction (SAED) patterns. It provides functions cry_demo() and dp_demo() to load a file in 'CIF' (Crystallographic Information Framework) formats and display crystal structures and electron diffraction patterns. The function dp_demo() also performs simple simulation of powder X-ray diffraction (PXRD) patterns, and the results can be saved to a file in the working directory. The package has been tested on several platforms, including Linux on 'Crostini' with a Core™ m3-8100Y Chromebook, I found that even on this low-powered platform, the performance was acceptable. T. Hanashima (2001) https://www2.kek.jp/imss/pf/tools/sasaki/sinram/sinram.html Todd Helmenstine (2019) https://sciencenotes.org/molecule-atom-colors-cpk-colors/ Wikipedia contributors (2023) https://en.wikipedia.org/w/index.php?title=Atomic_radius&oldid=1179864711.
Author(s)
Maintainer: Toshihide Saitou saitou.toshihide@gmail.com [copyright holder]
See Also
Useful links:
Align crystal and diffraction pattern
Description
Align crystal and diffraction pattern and displayed.
Usage
align(ax, dev = NULL, verbose = TRUE)
Arguments
ax |
An axis to align |
dev |
RGL device to apply. Defaults to current device. |
verbose |
logical: Should the report be suppressed? |
Details
There is no z-axis alignment support because the visualization was created with the analogy of selected area electron diffraction (SAED) on transmission electron microscope (TEM) which typically have up to two axes. However you can rotate around the z-axis by the drag originates near the window edge.
Value
No return value, called for side effects.
Examples
if (interactive()) {
align("a")
align("rb")
align("1 1 0")
align("60 -30")
align(dev = 123, "a")
}
Examples of using the cry and rgl packages together.
Description
Read a file in CIF formats, set the parameters, calculates them, and draws the crystal structure with an axis widget.
Usage
cry_demo(file = NULL, rf = 1, type = "b", zoom = 1)
Arguments
file |
Optional file in CIF formats. The file can also be specified by URL. |
rf |
A positive value indicating the scale factor of atom radius. |
type |
A style of atom displaying such like ball, fill and ball-stick but ball-stick is not implemented. |
zoom |
A positive value indicating the current scene magnification. |
Details
If no file argument is provided, and dp_demo()
has been opened without
paired cry_demo()
, the CIF parameters of already opened dp_demo()
will be
used.
Value
An integer the device number of the currently window.
Examples
cry_demo()
cry_demo(system.file("orthorhombic_p.cif", package = "rgl.cry"))
if (interactive()) {
cry_demo(file, type = "fill", zoom = 0.5)
cry_demo("https://www.crystallography.net/cod/foo.cif")
}
Examples of using the cry and rgl packages together.
Description
Read a file in CIF formats, set and the parameters, calculates them, draws the reciprocal lattice map with a cell widget.
Usage
dp_demo(file = NULL, reso = 1.2, ews.r = 40, zoom = 0.5, xrd = FALSE)
Arguments
file |
Optional file in CIF formats. |
reso |
A real number. The highest data resolution, in angstroms. If the default value takes a long time to process displaying due to the large number of lattice points, you can expect to improve performance by increasing the value. |
ews.r |
Ewald sphere radius in angstrom^-1. |
zoom |
A positive value indicating the current scene magnification. |
xrd |
A logical value indicating whether to create an X-ray diffraction pattern simulation result file. |
Details
If no file argument is provided, and cry_demo()
has been opened without
paired dp_demo()
, the CIF parameters of already opened cry_demo()
will be
used.
Interactive rotation, zooming, and panning of structures are possible using
the 3D graphics library rgl
. When the drag originates near the window
edge (within 5%), perform a Z-axis rotation.
This function also performs powder diffraction simulation and saves the results to a file in the working directory. Currently, it doesn't account for atomic ionization and uses standard atomic scattering factors.
Value
An integer the device number of the currently window.
Examples
dp_demo()
dp_demo(system.file("orthorhombic_p.cif", package = "rgl.cry"))
dp_demo(system.file("orthorhombic_p.cif", package = "rgl.cry"), res = 2.0)
if (interactive()) {
dp_demo(file, zoom = 0.5)
dp_demo("https://www.crystallography.net/cod/foo.cif")
}
Examples of using the cry and rgl packages together.
Description
Output a lCIF.
Usage
getCIF(dev = NULL)
Arguments
dev |
The device that is used to extract the lCIF. The default is current device. |
Value
A named list, the same as that of 'cry::readCIF.'
Examples
getCIF()
Select atoms or reciprocal lattice points.
Description
Select one or more atoms or reciprocal lattice points in the window. The labels and Miller indices of the selected atoms or lattice points will be displayed.
Usage
select(dev = NULL, verbose = TRUE)
Arguments
dev |
RGL device to apply. Defaults to current device. |
verbose |
logical: Should the report be suppressed? |
Details
Selecting atoms or lattice points in the window will include all z-coordinates. If you do not want to include all z-coordinates, you will need to modify the code.
Value
List of Miller indices or element labels.
Examples
if (interactive()) {
select()
select(dev = 123)
}