User guide
Julia
To calculate the IBZ, simply provide the lattice and atomic basis to calc_ibz
. The IBZ will be returned as polyhedron from Polyhedra.jl.
import SymmetryReduceBZ.Lattices: genlat_CUB
import SymmetryReduceBZ.Symmetry: calc_ibz
a = 2.0
real_latvecs = genlat_CUB(a)
atom_types = [0,0]
atom_pos = Array([0 0 0; 0.5 0.5 0.5]')
coordinates = "Cartesian"
makeprim = false
convention = "ordinary"
ibz = calc_ibz(real_latvecs,atom_types,atom_pos,coordinates,
makeprim,convention)
Polyhedron CDDLib.Polyhedron{Float64}:
136-element iterator of Polyhedra.HalfSpace{Float64, Vector{Float64}}:
HalfSpace([-1.0, -1.0, -1.0], 1.5)
HalfSpace([-1.0, -1.0, -0.5], 1.125)
HalfSpace([-1.0, -1.0, 0.0], 1.0)
HalfSpace([-1.0, -1.0, 0.5], 1.125)
HalfSpace([-1.0, -1.0, 1.0], 1.5)
HalfSpace([-1.0, -0.5, -1.0], 1.125)
HalfSpace([-1.0, -0.5, -0.5], 0.75)
HalfSpace([-1.0, -0.5, 0.0], 0.625)
HalfSpace([-1.0, -0.5, 0.5], 0.75)
HalfSpace([-1.0, -0.5, 1.0], 1.125)
HalfSpace([-1.0, 0.0, -1.0], 1.0)
HalfSpace([-1.0, 0.0, -0.5], 0.625)
HalfSpace([-1.0, 0.0, 0.0], 0.5)
HalfSpace([-1.0, 0.0, 0.5], 0.625)
HalfSpace([-1.0, 0.0, 1.0], 1.0)
HalfSpace([-1.0, 0.5, -1.0], 1.125)
HalfSpace([-1.0, 0.5, -0.5], 0.75)
HalfSpace([-1.0, 0.5, 0.0], 0.625)
HalfSpace([-1.0, 0.5, 0.5], 0.75)
HalfSpace([-1.0, 0.5, 1.0], 1.125)
⋮:
6-element iterator of Vector{Float64}:
[0.25, 0.0, 0.0]
[0.0, 0.0, 0.0]
[0.25, 0.25, 0.25]
[0.25, -0.25, 0.0]
[0.0, -0.25, 0.0]
[0.25, -0.25, 0.25]
The columns of real_latvecs
are the lattice generating vectors, the columns of atom_pos
are the positions of the atoms in Cartesian coordinates (in this case), coordinates
are the coordinates of the atom positions, and convention
gives the convention for going from real to reciprocal space (whether or not to multiply by 2π). There is a simple function for visualizing the IBZ along with the Brillouin zone (BZ).
ENV["MPLBACKEND"]="qt5agg"
using PyPlot
import SymmetryReduceBZ.Plotting: plot_convexhulls
import SymmetryReduceBZ.Lattices: genlat_CUB
a = 2.0
real_latvecs = genlat_CUB(a)
atom_types = [0,0]
atom_pos = Array([0 0 0; 0.5 0.5 0.5]')
coordinates = "Cartesian"
makeprim = false
convention = "ordinary"
ax=plot_convexhulls(real_latvecs,atom_types,atom_pos,coordinates,
makeprim,convention)
PyObject <Axes3D: >
Python
It is possible to call SymmetryReduceBZ
from Python using PyJulia. In a Jupyter notebook, IPython magic can be used to directly evaluate Julia commands in notebook cells.
from julia import Julia
jl = Julia(runtime="/usr/local/bin/julia")
%%julia
ENV["PYTHON"]="" # this lets conda manage installation
ENV["MPLBACKEND"]="qt5agg"
using Pkg
Pkg.add(["SymmetryReduceBZ", "PyPlot"])
using PyPlot
import SymmetryReduceBZ.Plotting: plot_convexhulls
import SymmetryReduceBZ.Lattices: genlat_CUB
a = 1.0
real_latvecs = genlat_CUB(a)
atom_types = [0,1]
atom_pos = Array([0 0 0; 0.5 0.5 0.5]')
coordinates = "Cartesian"
primitive = true
makeprim = false
convention = "ordinary"
ax=plot_convexhulls(real_latvecs,atom_types,atom_pos,coordinates,makeprim,
convention)
Without IPython magic, Julia commands can be called with the eval
method of PyJulia
.
from julia import Julia
jl = Julia(runtime="/usr/local/bin/julia")
jl.eval("""
ENV["PYTHON"]="" # this lets conda manage installation
ENV["MPLBACKEND"]="qt5agg"
using Pkg
Pkg.add([\"SymmetryReduceBZ\", \"PyPlot\"])
using PyPlot
import SymmetryReduceBZ.Plotting: plot_convexhulls
import SymmetryReduceBZ.Lattices: genlat_CUB
a = 1.0
real_latvecs = genlat_CUB(a)
atom_types = [0,1]
atom_pos = Array([0 0 0; 0.5 0.5 0.5]')
coordinates = "Cartesian"
makeprim = true
convention = "ordinary"
ax=plot_convexhulls(real_latvecs,atom_types,atom_pos,coordinates,makeprim,
convention)
""")