convert grid data in a gaussian type cube file (.cub) to four 3d matrices.
Syntax
[xGrid,yGrid,zGrid,data]=cub2mat(path)
[xGrid,yGrid,zGrid,data,atoms,coordinates,eff_charge]=cub2mat(path)
Description
[xGrid,yGrid,zGrid,data]=cub2mat(path) convert .cub file with file path path to four 3d matrices xGrid, yGrid, zGrid and data, which xGrid, yGrid and zGrid are generated by meshgrid().
[xGrid,yGrid,zGrid,data,atoms,coordinates,eff_charge]=cub2mat(path) not only output the data matrix but also atoms array (N-by-1), coordinates matrix (N-by-3) and effective charge eff_charge of each atoms (N-by-1).
Examples
convert movalue.cub to matrices and show its isosurface.
[xGrid,yGrid,zGrid,data,atoms,coordinates]=cub2mat('movalue.cub');
isovalue=0.07;
hold on
s1=isosurface(xGrid,yGrid,zGrid,data,isovalue);
p1 = patch(s1);
isonormals(xGrid,yGrid,zGrid,data,p1);
set(p1,'FaceColor','#9370DB','EdgeColor','none','FaceLighting','gouraud');
s2=isosurface(xGrid,yGrid,zGrid,data,-isovalue);
p2 = patch(s2);
isonormals(xGrid,yGrid,zGrid,data,p2);
set(p2,'FaceColor','#EEE9E9','EdgeColor','none','FaceLighting','gouraud');
showmol(atoms,coordinates);
hold off
view(3)
axis equal
axis off