# How is Julia used in matter modeling?

What are the main uses and applications of Julia in matter modeling?

Python for example is used in many codes, not to mention workflow automation and data processing.

Are there any available codes or publications out there that are based mainly on the Julia programming language?

• James Whitfield, a Professor at Dartmouth, wrote a Julia code to do the Bravyi-Kitaev transformation on the electronic structure Hamiltonian, but I'm not sure how much further it got developed after he sent it to me in 2017. – Nike Dattani May 11 '20 at 14:14

(Disclaimer: As one of the main authors of a Julia-based DFT code, DFTK, my opinion is definitely biased)

The community of people employing Julia for materials modelling is still small, but a couple of programs exist. Probably a good overview gives https://github.com/svaksha/Julia.jl/blob/master/Chemistry.md. Many projects have only started within the last year, but still show a sizeable set of features, indicating the great potential of Julia for this field. Regarding the workflow, there are not that many packages, but you can just use from python what you need. I'll try to summarise:

# Uses of Julia and its design

Julia solves very elegantly what is commonly known as the two-language problem. In computational science one wants to be fast when crunching the numbers (traditionally calling for a language like Fortran, C and C++) and flexible when building models or simulation workflows (calling traditionally for something like python).

This by itself has the trouble that people (read: PhD students) need to actually learn two languages to be able to develop the code, but let's argue this is not a problem in practice. Still, we are faced with making the decision at which point to make the cut between the languages. Where this cut point should be placed is less obvious than it might sound if you keep in mind that materials science is an interdisciplinary field with people from maths, physics, chemistry, computer science, ... working on the same sort of problems, but at very different levels. While for a practitioner all the hairy details SCF algorithm, say, are not so important and can be easily shuffled under the carpet of heavy C or Fortran code, mathematicians actually want to modify exactly those to improve mixing schemes or preconditioning and so on. So for a mathematician this should be high-level python to productively do research, but if one does this, it has too much of a performance impact for large-scale practical calculations to be feasible.

Here Julia is for the rescue, since as commonly quoted it looks like Python, feels like Lisp, runs like Fortran. What this is supposed to mean is that writing Julia code is very similar to Python including hairy parts such as linear algebra. It has stronger type systems and structures similar to functional languages like Lisp and in the end really is as fast as Fortran or C. The reason is that even though it is a high-level language it has "close to the metal" constructs that allow you to directly influence aspects such as vectorisation, parallelisation and so on. The advantage over a two language solution is, however, that you can introduce them step by step once the first version of the code has been written without rewriting it in another language. So first you get things done, then you get them done fast. For any new project in materials modeling, whether you right now think it is performance-critical or not, I think Julia is therefore the perfect language.

# Materials-related Julia projects

• JuliaMolSim: Github organisation for molecular simulation in Julia, packages such as:
• ASE.jl: (Incomplete) Julia bindings for ASE.
• DFTK.jl: Flexible Julia code for plane-wave density-functional theory (DFT) and related models. LDA and GGA functionals are supported. Ground-state calculations only for now. Less than 5k lines of code and very hackable. Designed also for mathematical work in the field. Can be used directly from ASE as a calculator using asedftk. Still experimental, but any feedback welcome!
• JuLIP.jl: Julia Library for Interatomic Potentials. Can be used to rapidly build and test interatomic potentials for defects etc.
• Molly.jl: Proof of concept molecular-dynamics package in Julia.
• PorousMaterials.jl: Julia package for modelling adsorption on porous crystals using Monte Carlo methods.
• Quantica.jl: Julia package for building generic tight-binding models and computing various properties from it.
• QSimlator.jl: Package for Unitary and Lindbladian evolution in Julia.
• QuantumLab.jl: Experimental package for more molecular quantum chemistry (roadmap is similar to pyscf)

# Workflow

• For managing a scientific project DrWatson.jl is extremely helpful.
• The pandas equivalent of Julia is DataFrames.jl. You can also directly use HDF5.jl.
• Plotting can be done in Plots.jl or matplotlib via PyPlot.jl.
• Actually you can integrate any python or R package into a Julia script using packages such as PyCall.jl or RCall.jl. For python this integration is two-way, so calling Julia from python is a piece of cake. You can even pip install julia. This is what we use in DFTK to do our lattice and Brillouin zone setup using spglib and pymatgen or import ase.Atoms into our datastructures.

# Publications

Not that many I am aware of. We have recently published a few things with DFTK, but they are not so much related to modelling.

In 2019, "A fresh computational approach to atomic structures, processes and cascades" was published in Computer Physics Communications, which presents a fresh concept and implementation of (relativistic) atomic structure theory that supports the computation of interaction amplitudes, properties, etc., which are implemented in JAC.jl.

Recently,(May 2020) "PWDFT.jl: A Julia package for electronic structure calculation using density functional theory and plane wave basis" was published in Computer Physics Communications based on the PWDFT.jl package.

Also in 2020, the paper "A New Kid on the Block: Application of Julia to Hartree–Fock Calculations" was published in the Journal of Chemical Theory and Computation decribing JuliaChem, a novel quantum chemistry software designed to take advantage of Julia as much as possible.

• Cory Simon's PorousMarerials.jl is a notable example missing from this list. – Andrew Rosen May 12 '20 at 6:01
• Came back here to share with you all that this was just published in Computer Physics Communications! "PWDFT.jl: A Julia package for electronic structure calculation using density functional theory and plane wave basis" doi.org/10.1016/j.cpc.2020.107372 – Etienne Palos May 22 '20 at 22:10
• There was a study comparing error estimates for different DFT software: paper1, paper2 , website, youtube video. How is your DFTK compares with other DFT codes if measured according to this metric? – Vladislav Gladkikh Jun 2 at 1:43
• I have not yet managed to do the full Delta-Test across the periodic table, but on the elements I tried we do very similar to more established codes given that an equivalent setup of pseudopotential / cutoff etc. is used. – Michael F. Herbst Jun 2 at 11:26

And of course, there is Lattices.jl, for defining lattices in Julia. Please note that this package is still in the very early stages of exploring a potential Julian interface for lattices, and should be used with discretion. https://juliaphysics.github.io/Lattices.jl/latest/