Jump to content

Mod:Hunt Research Group/Python scripts for cube files

From ChemWiki

Getting Started

The latest version of CubePy, along with a test cube file can be found here.

CubePy is under CC BY-NC-SA license

CubePy encompasses six modules that can be used to read, save, manipulate and visualise data from cube files:


If you want to save data from cube files

  • for saving the values from the cube files, use the functions from SaveCube.py
  • for saving histogram data, use the function PlotHistogram from PlotCube.py with save=True
  • for saving a short summary file of the minimum, maximum and lowest curvature points on the van der Waals surface, use save=True when running PlotSurface from PlotCube_mayavi.py


If you want to plot surfaces, isosurfaces, slices

If you want to generate static figures you can also consider using the 3D plotting functions from PlotCube.py. These are especially recommended when wanting to display atoms as they look better than their PlotCube_mayavi.py equivalents. However, keep in mind that Matplotlib sometimes fails at 3D rendering, which generates "incorrect" plots (i.e. elements that should be behind the rest of the plot appear at the front). Therefore, plots created using function from PlotCube.py should be double-checked (by comparing them with plots from PlotCube_mayavi.py, by example).


If you want to plot histograms and KDEs

  • use PlotHistogram from PlotCube.py to plot a histogram and/or KDE directly from cube files
  • use OverlapKDEs and PlotHistogram from AdditionalFunctions.py to plot histograms and KDEs from files written by PlotHistogram from PlotCube.py when save=True