Perovskite to Pseudospin: A Julia Challenge
After a conference hosted by AFOSR (Air Force Office of Science and Research), I met with an interesting bloke who introduced me to this new language called Julia, that is as fast as FORTRAN/C and yet quick and easy to prototype as Python. Though it was tempting, I brushed off the idea that it could be really worthwhile trying until I met with a snag in one of my research projects.
Short Introduction to the Perovskite Problem
Here's the deal, we had this very intriguing idea that in Halide perovskites, the structures can be mapped to a pseudo classical spin vector. Halide perovskites are systems that have the formula where the atom is surrounded by 6 atoms giving it a local octahedral symmetry. We showed that the system undergoes a ferroelectric transition which pushes the central atom towards body diagonal reducing the local symmetry from "octahedral" to "tetrahedral" forming tetrahedron units.
The resulting effect is that the singular units of tetrahedrons now contain a cloud of electron density that sticks at the tail giving the tetrahedral unit a net dipole charge pointing in the body diagonal direction. We came up with a clever way of relating this structure to another polymorph structure that is in monoclinic structure. If one considers the orientation of the tetrahedron as a classical pseudo spin vector in real space, the Ferromagnetic arrangement of the system is the perovskite structure while the Antiferromagnetic arrangement is the monoclinic.
The Hamiltonian for this system turns out to be
where
For a generic spin orientation, remains almost the same (it's just the dipole-dipole classical interaction) but is more sophisticated. We approximate it: can be computed numerically as where is the nearest neighbor distance to the 6 atoms surrounding .
Getting Hands Dirty with Julia
We define types just like in C which then are stored as custom data types at machine level:
struct tetra
ge::Array{Float64,1}
cl1::Array{Float64,1}
cl2::Array{Float64,1}
cl3::Array{Float64,1}
endThen we write a function that takes a set of 3D coordinates and rotates it in 3D space anchored at a center by a given angle with respect to an axis. Computing 125 flips amounts to around , adding overhead for other calculations, this amounts to around 20,000 flips a second on a MacBook Pro.
Not bad for a quick 2 day foray into Julia. The full project code is available on GitHub.
Part 2 continued in the next post.