Gaussian cube file reader is buggy/incomplete
Based on my tests from within ParaView, it seems that the reader for Gaussian cube files is currently not working correctly.
For one, the reader does not follow the complete format specification (as given e.g. at https://h5cube-spec.readthedocs.io/en/latest/cubeformat.html). In particular there exists a potentially optional parameter (called NVAL
in the linked documentation) that is listed after the coordinates of the origin. If this value is explicitly given, the current reader implementation is thrown off and reads in the atom positions wrongly and doesn't read the grid data at all.
Example (the 1
is the problematic entry):
Density
46 -13.023065 -13.075597 -15.482631 1
Furthermore, it appears as if a wrong unit of measurement is incorrect or at least inconsistent as the Compute Molecule Bonds
filter (in ParaView) is unable to find any bonds. Presumably, this is due to the atoms being spaced out way too far. If I load the same molecular structure as an XYZ file, the atoms are placed significantly closer together.
It appears as if the atomic coordinates are specified in terms of their position within the used grid, which is (as far as I can tell) not really desirable. Instead, every point should be represented at a proper length-scale such that the same cube file but at different resolution will remain at the same size. The natural choice for such a length-scale would be to convert all coordinates into Bohr as that's what cube files use, but a more common choice (in terms of what other file formats use) would probably be angstrom.
As I see it, there are currently two different cube file readers:
- https://gitlab.kitware.com/vtk/vtk/-/blob/master/IO/Chemistry/vtkGaussianCubeReader2.cxx
- https://gitlab.kitware.com/vtk/vtk/-/blob/master/IO/Chemistry/vtkGaussianCubeReader.cxx
what's up with those? Why are there two different readers for the same file format?