pyvista.examples.downloads.download_caffeine

pyvista.examples.downloads.download_caffeine#

download_caffeine(load=True)[source]#

Download the caffeine molecule.

Added in version 0.44.0.

Parameters:
loadbool, default: True

Load the dataset after downloading it when True. Set this to False and only the filename will be returned.

Returns:
pyvista.PolyData | str

DataSet or filename depending on load.

Examples

>>> import pyvista as pv
>>> from pyvista import examples
>>> filename = examples.download_caffeine(load=False)
>>> reader = pv.get_reader(filename)
>>> poly = reader.read()

Add atoms and bonds to the plotter.

>>> pl = pv.Plotter()
>>> atoms = pl.add_mesh(
...     poly.glyph(geom=pv.Sphere(radius=0.1)), color="red"
... )
>>> bonds = pl.add_mesh(poly.tube(radius=0.1), color="gray")
>>> pl.show(cpos="xy")
../../../_images/pyvista-examples-downloads-download_caffeine-1_00_00.png

See also

Caffeine Dataset

See this dataset in the Dataset Gallery for more info.