densities / blob

blob: plot densities directly in your browser.
https://densities.github.io/blob/
GNU Affero General Public License v3.0
7 stars 0 forks source link

Inconsistency with paraview #23

Open stigrj opened 4 years ago

stigrj commented 4 years ago

It seems Blob plots the function skewed compared to paraview.

I was able to get a symmetric plot of a He density with Blob using this cube header, step length computed as h = L/(n + 1) = 8.0/26 = 3.076923e-01

Cube file format
Generated by MRChem
    1  -4.000000e+00  -4.000000e+00  -4.000000e+00
   25   3.076923e-01   0.000000e+00   0.000000e+00
   25   0.000000e+00   3.076923e-01   0.000000e+00
   25   0.000000e+00   0.000000e+00   3.076923e-01
    2   2.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
  3.9415e-11  7.8768e-11  1.5008e-10  2.7374e-10  4.7477e-10  7.7984e-10
  1.2114e-09  1.7688e-09  2.4268e-09  3.1159e-09  3.7333e-09  4.1676e-09
  4.3225e-09  4.1676e-09  3.7333e-09  3.1159e-09  2.4268e-09  1.7688e-09
...

but this gives a non-symmetric plot in paraview (atomic coordinate is not at the center of the density). With paraview, on the other hand, the following cube plot becomes symmetric, step length computed as h = L/(n - 1) = 8.0/24 = 3.333333e-01

Cube file format
Generated by MRChem
    1  -4.000000e+00  -4.000000e+00  -4.000000e+00
   25   3.333333e-01   0.000000e+00   0.000000e+00
   25   0.000000e+00   3.333333e-01   0.000000e+00
   25   0.000000e+00   0.000000e+00   3.333333e-01
    2   2.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
  3.9415e-11  7.8768e-11  1.5008e-10  2.7374e-10  4.7477e-10  7.7984e-10
  1.2114e-09  1.7688e-09  2.4268e-09  3.1159e-09  3.7333e-09  4.1676e-09
  4.3225e-09  4.1676e-09  3.7333e-09  3.1159e-09  2.4268e-09  1.7688e-09
...
bast commented 4 years ago

Thanks for reporting! Can you please attach the cubes to the issue or link them from the issue? Then I will have a look into the code ...

stigrj commented 4 years ago

Thanks, this is a He density plotted on [-4,4]^3, first point (-4, -4, -4) last point (4, 4, 4). Paraview places this density symmetrically around the atom, but blob places it slightly askew: rho.txt

I think perhaps blob interprets the first point to be -4 + h instead of -4. I originally thought this was how the cube file should be interpreted, so I implemented the MRChem plotter to make a grid with n+2 points in each direction, and then excluded all boundary points, e.i. first point at -4 + h and last point 4-h, but it turns out to be inconsistent with paraview.