pyvista.examples.downloads.download_m4_total_density

pyvista.examples.downloads.download_m4_total_density#

download_m4_total_density(load=True)[source]#

Download a total density dataset of the chemistry.

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.ImageData | str

DataSet or filename depending on load.

Examples

>>> import pyvista as pv
>>> from pyvista import examples
>>> filename = examples.download_m4_total_density(load=False)
>>> reader = pv.get_reader(filename)
>>> reader.hb_scale = 1.1
>>> reader.b_scale = 10.0
>>> grid = reader.read()
>>> poly = reader.read(grid=False)

Add the outline and volume to the plotter.

>>> pl = pv.Plotter()
>>> outline = pl.add_mesh(grid.outline(), color="black")
>>> volume = pl.add_volume(grid)

Add atoms and bonds to the plotter.

>>> atoms = pl.add_mesh(poly.glyph(geom=pv.Sphere()), color="red")
>>> bonds = pl.add_mesh(poly.tube(), color="white")
>>> pl.show(cpos="zx")
../../../_images/pyvista-examples-downloads-download_m4_total_density-1_00_00.png

See also

M4 Total Density Dataset

See this dataset in the Dataset Gallery for more info.