In [1]:
import numpy as np
import h5py
from mayavi import mlab
from Loader3D import *
In [12]:
nx = 200
ny = 200
nz = 200
loc_data = "../../build/test.h5"
loc_init = "../../build/init.h5"
# Use the right energy level
n = 2
E = -1/2 * 1/n**2
In [22]:
l = CLoader3D(nx,ny,nz,loc_init)
psi_init = l.get_complex_data("/real","/imag")
t0 = 0
dt = 0.001
nt = 100
psi_init *= np.exp(-1j * E * nt * dt)
In [23]:
l = CLoader3D(nx,ny,nz,loc_data)
psi_num = l.get_complex_data("/real","/imag")
In [30]:
mlab.figure(1, fgcolor=(1,1,1), bgcolor=(0.9,0.9,0.9))
data = np.abs(psi_num)**2
src = mlab.pipeline.scalar_field(data)
mlab.pipeline.iso_surface(src,opacity=0.2, contours=20)
src2 = mlab.pipeline.image_plane_widget(src, plane_orientation='z_axes', slice_index=10)
mlab.pipeline.image_plane_widget(src, plane_orientation='x_axes', slice_index=10)
mlab.colorbar(src2, orientation='vertical', title='Probability density')
mlab.show()
In [32]:
data = np.abs(psi_init.real - psi_num.real) #/ np.max(np.abs(psi_init.real - psi_num.real))
src = mlab.pipeline.scalar_field(data)
mlab.pipeline.iso_surface(src,opacity=0.2, contours=20)
src2 = mlab.pipeline.image_plane_widget(src, plane_orientation='z_axes', slice_index=10)
mlab.pipeline.image_plane_widget(src, plane_orientation='x_axes', slice_index=10)
mlab.colorbar(src2, orientation='vertical', title='Probability density')
mlab.show()
In [29]:
data = np.abs(psi_init.imag - psi_num.imag)/np.max(np.abs(psi_init.imag - psi_num.imag))
src = mlab.pipeline.scalar_field(data)
mlab.pipeline.iso_surface(src,opacity=0.2, contours=20)
src2 = mlab.pipeline.image_plane_widget(src, plane_orientation='z_axes', slice_index=10)
mlab.pipeline.image_plane_widget(src, plane_orientation='x_axes', slice_index=10)
mlab.colorbar(src2, orientation='vertical', title='Probability density')
mlab.show()
In [ ]: