I use a Lammps fix that gives me a chargedensity.cube file, which I then need to read using pyiron.
If the cube file of shape nx,ny,nz has nx or ny or nz not divisible by 6, I get an error when trying to read the file using read_cube_file() function.
The reason for this is that since nx/ny/nz is not divisible by 6, I get in the cube file a row containing a number of columns different than 6, giving me the error :
Some errors were detected !
Line #38 (got 2 columns instead of 6)
Note:
If the cube file is written by pyiron, then it is also read by pyiron without errors. The problem here comes from the fact that my cube file comes from Lammps.
Expected Behavior
The read_cube_file() function should be able to read all types of cube files.
Actual Behavior
Usually cube files have rows with 6 columns, but if one row has a different number of columns, this gives out an error.
Steps to Reproduce
from pyiron.atomistics.volumetric.generic import VolumetricData
cube = VolumetricData()
cube.read_cube_file(path+"/"+filename)
Use read_cube_file() to read chargedensity_error.cube (nx%6 !=0) to give out error.
Summary
I use a Lammps fix that gives me a chargedensity.cube file, which I then need to read using pyiron. If the cube file of shape nx,ny,nz has nx or ny or nz not divisible by 6, I get an error when trying to read the file using read_cube_file() function.
The reason for this is that since nx/ny/nz is not divisible by 6, I get in the cube file a row containing a number of columns different than 6, giving me the error :
Some errors were detected ! Line #38 (got 2 columns instead of 6)
To go around this, I am using a read_cube function I got from cubetools.py: https://gist.github.com/aditya95sriram/8d1fccbb91dae93c4edf31cd6a22510f
Note: If the cube file is written by pyiron, then it is also read by pyiron without errors. The problem here comes from the fact that my cube file comes from Lammps.
Expected Behavior The read_cube_file() function should be able to read all types of cube files.
Actual Behavior Usually cube files have rows with 6 columns, but if one row has a different number of columns, this gives out an error.
Steps to Reproduce
from pyiron.atomistics.volumetric.generic import VolumetricData cube = VolumetricData() cube.read_cube_file(path+"/"+filename)
Use read_cube_file() to read chargedensity_error.cube (nx%6 !=0) to give out error.
Further Information, Files, and Links I provide the relevant cube file. chargedensity_error.cube.zip