zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
201 stars 60 forks source link

Densities and grids are not converting correct units #854

Open zerothi opened 2 weeks ago

zerothi commented 2 weeks ago

Describe the issue

Reading RHO files from siesta converts the units from 1/Bohr^3 to 1/Ang^3.

However, when subsequently writing to a cube file it doesn't know that it is a density, and hence it doesn't change anything. So it just writes it in 1/Ang^3, which results in problems... :(

The current solution is to do:

sgrid siesta.RHO -S 0.14818471147216278 --out rho.cube

The scaling factor can be calculated using:

sisl.unit.units("Bohr", "Ang") ** 3

Ideally physical quantities could hold a unit specification.

The problem with the grids are that not all things are densities, e.g. potentials do not have a volume density, they are scalar values at grid-points.

zerothi commented 2 weeks ago

This issue got raised on the discord channel.