Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyiron read_cube_file() does not work for certain formats of cube files. #1425

Open
sam-mattoso opened this issue May 24, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@sam-mattoso
Copy link

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

@sam-mattoso sam-mattoso added the bug Something isn't working label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant