I had an old blog post linking to a walkthrough of the code developed and used during my PhD on phase separation of polydisperse colloids. It’s now a little deprecated, partly because I’ve done further work on that topic since then, and because a link it contained had become dead.

Now, here is a short post to provide a quick-and-dirty runnable example of the latest code. I’ll provide a link to the repository, and then mention a new EXAMPLE folder which contains a minimal working simulation setup. Finally I’ll briefly overview what the code and analysis tools can do.

Repository: https://bitbucket.org/johnjosephwilliamson/phd-code-clone-bitbucket

EXAMPLE folder:

Screen Shot 2016-04-15 at 15.54.48

  • The README.txt contains instructions
  • preinit.txt controls the initialiser program, which is run in order to pack the simulation box with particles of the required volume fraction, polydispersity… This file is set to make a simple cubic box (XLATTICE 0 etc.), without the fancy crystal templating algorithm we used in some applications
  • simconfig.txt controls the main simulation, and in this case is set to simulate hard spheres (DEPTH and RANGE of square wells is set to 0)
  • The other files are binaries to be run from the command line, which I suppose might run as is if you have a mac configured similarly to mine. Else, they can be compiled from the source code in the repository. The appropriate source code folders are mentioned in the README. In the top-level-directory of the repository, there is another README which provides compilation flags (linking to “math” and “boost” libraries) which may be necessary, but for me on this computer were not
  • XYZ_converter allows converting the output to .xyz format for visualisation in OVITO
  • Profit…

Screen Shot 2016-04-15 at 16.04.19


Naturally, let me know if you have any trouble compiling or running the code. See my publications page for examples of what we have done with it. If you are interested in using or adapting the code, I am always happy to explain it in more detail. Briefly, the existing capabilities/purposes:

  • kinetic Monte Carlo simulation of noninteracting, hard-sphere or square-well colloidal particles
  • Gaussian or Schulz polydispersity, with two choices of how the square well polydispersity relates to the hard-core polydispersity
  • geared toward study phase-separation kinetics in polydisperse systems, local characterisation and structural information
  • isotropic simulation box, or a special cuboidal geometry in which a crystal is templated at one end (choice of two crystal faces), to study crystal growth kinetics
  • XYZ_converter to produce standard .xyz files, for OVITO visualisation
  • a wide suite of analysis programs: structure factors (including intermediate scattering functions and partial versions thereof for polydisperse cases), polydisperse fractionation measurement, coarse-grained-Voronoi local volume fraction analysis, crystal interface-tracking, kymographs…



I recently left Peter Olmsted’s group in Georgetown after a very enjoyable two years. We studied the phase separation kinetics of mixed lipid bilayers, specifically the effects of inter-leaflet coupling. The Institute for Soft Matter Synthesis and Metrology is a very pleasant and stimulating place to work, and I strongly recommend it.

In the past week I’ve moved to become a postdoc in the group of Guillaume Salbreux at London’s new Francis Crick Institute. The work will concern the mechanics of tissue development and homeostasis, in close collaboration with some excellent experimentalists. The move from a sort of “physical chemistry of lipid membranes” to a more explicitly biological “physics of living systems” seems a natural step to make, and I’m looking forward to the next few years of research.

In the meantime, check out the latest paper with Peter (a comment in PRL), and look out for an upcoming collaboration with Philip Fowler.

A new paper with Peter Olmsted has just appeared in Physical Review E. Like our recent Soft Matter article, it builds on our theoretical study of coupled lipid bilayer leaflets, investigating the underlying model via direct simulation. We also give a broader look at the use of “leaflet-leaflet” phase diagrams, introduced in previous theoretical works, which allow a more natural interpretation of symmetry and asymmetry in bilayers.

Next week is the annual ACS Colloid and Surface Science Symposium — last year’s was very good and this one looks like it will be too. Hopefully there is as much good ramen in Pittsburgh as there was in Philadelphia. I’ll be giving two talks, both on the Tuesday. The first concerns methods for predicting and characterising the influence of polydispersity on a phase-separating fluid (with Mike Evans):

Talk 1

The second is about some more recent work on lipid bilayers, specifically how domain formation couples to asymmetry between the leaflets (with Peter Olmsted):

Talk 2

A few of us from Georgetown’s Institute for Soft Matter will be there, and I’m also looking forward to catching up with Ian Williams (he of the amazing colloidal corral). See you there!

A couple of days ago, the April 21st 2015 issue of Biophysical Journal came out. My first paper with Peter Olmsted appears within and is featured on the cover! We studied the effects of inter-leaflet coupling in bilayers, and found fascinating kinetics driven by competing stable and metastable phase coexistences, involving registered (symmetric) and antiregistered lipid domains. I won’t go into more detail here, there is a blog post on the Biophysical Society Blog that tells you more.

Cover Image

I’ve recently been feeling more like an intern at Pixar than a scientist — yes, it’s time for some scientific imaging. In my field of simulation and theory, some form of imaging is important in a prosaic kind of way just to get a feel for what’s going on, and check for any disastrous bugs. But, more and more, it’s becoming a real mode of scientific communication. Journal covers commonly feature simulation renderings or even schematic artists’ impressions, as well as more traditional fare such as beautiful microscopy images. With the move towards online journal viewing (and sometimes, free colour printing), authors have more and more freedom to include beautiful renderings as a key, functional part of their scientific story.

I mostly use the incredibly versatile and intuitive OVITO package for the purpose. Recently I spent a while learning its intricacies (for example, the software Tachyon renderer for nice directional lighting). Here are a couple of images from the two main strands of my work. OVITO does a great job with both a typical 3D particle based simulation, and a quasi-3D rendering of a 2D lattice model with highly stylised cubic particles.


First up, phase separation in polydisperse colloids. My latest paper in this area focused on methods of characterising the highly complex phase compositions and kinetics involved. The colours are computed from our new approach to measuring local concentration when a large spread of particle sizes exist, which turns out to be quite a subtle problem. The picture really helps get across just how highly polydisperse the fluid is, and we can even see by eye the way that larger particles, in this case, end up in the denser (liquid, hot colours) regions. Of course, all of this is supplemented with quantitative measurement and graphs, and the message could be got across without this picture. But: it’s beautiful; and it gives the reader an instinctive feel for both the setting of the work, and one of its key findings. The image was shortlisted as a J. Chem. Phys. cover image.

Gas-liquid phase separation in a highly polydisperse simulated fluid. Novel characterisation methods are used to study which particles end up where.
Gas-liquid phase separation in a highly polydisperse simulated fluid. Novel characterisation methods are used to study which particles end up where.


Our manuscript in review [now accepted in Biophys. J.] provides a theory for how lipid bilayer domains do or don’t align between the leaflets. In fact, the theory began as a simulation — an idealised lattice model capturing a key physical feature, the thickness of the bilayer leaflets. It turned out to be idealised enough for pen-and-paper treatment, hence the resulting theory. But, directly simulating the model helps to corroborate the results and figure out what goes on over longer timescales that aren’t treated in the theory. Mapping membrane thickness as the z-coordinate allows the 2D simulation to be rendered in a quasi-3D manner, and the competing thicker and thinner phases can be seen nicely. OVITO allows cubic particles to be plotted. I used this to emphasise the underlying lattice nature of the model, but had the particles overlap in a ‘random-looking’ way partly for artistry, and partly to get across the fluctuating, messy nature of liquid phases in the bilayer at the molecular scale. The image was a finalist at the image contest of Biophysical Society’s annual meeting, and I came away with a nice big hard-back printed version to mount on the wall.

Rendering of an idealised lattice model for a lipid bilayer membrane. Separation into multiple metastable and equilibrium phases is possible due to the interaction between the bilayer's two leaflets. https://scholar.google.com/citations?view_op=view_citation&hl=en&user=6M4KATQAAAAJ&citation_for_view=6M4KATQAAAAJ:UeHWp8X0CEIC
Rendering of an idealised lattice model for a lipid bilayer membrane. Separation into multiple metastable and equilibrium phases is possible due to the interaction between the bilayer’s two leaflets.

Here’s a quick post about a couple of oddities and problems I encountered recently in Inkscape and Grace (on a Mac) in using them for preparing scientific plots. This kind of stuff isn’t especially well-documented online — it seems like people using these programs for this purpose often figure out a way that works for them and keep quiet about it. Also Grace in particular isn’t being developed at too fast a pace right now. Here we go:

  • Exporting an EPS (or PDF or SVG) from Grace and then importing the file into Inkscape results in the fonts being changed from Times (Grace’s default) to some horrible sans-serif font in Inkscape, and the spacing being all screwed up. As explained and solved here (in relation to Matlab) this happens because Inkscape can’t access the Times font used by Grace (although weirdly it knows `Times New Roman’ which looks the same). So when it looks for the font referred to in the PDF you imported from Grace, it can’t find it, and just fudges it. Using Fondu to create a version of Times that Inkscape can use solves the issue.
  • On Mac OS X Mavericks, installing Grace either via MacPorts or from source results in a couple of problems. 1) Thanks to updated Xcode tools, invalid arguments passed to the compiler generate an error not a warning and compile can fail. Apparently you can get around this by setting an environment variable, but it didn’t work for me. In Grace the problem is an `-m486′ flag which is passed to the compiler. I opened the configure script for Grace (or in MacPorts, the associated Portfile) and removed all mention of -m486 to stop this happening. 2) Once compiled, Grace on Mavericks seems to get a segmentation fault and crash on opening. This can be fixed in a hacky way by altering all mentions of the optimisation -O2 in the configure script to -O1. Or replacing a library helps to solve it properly, but I haven’t got round to that yet.
  • In Inkscape, copy and duplicate are different. If you create nice clean text or a nice clean line or circle etc, and then ctrl-c ctrl-v like usual, the pasted object no longer seems to be like a vector and will be fuzzy when you zoom in. I’ve no idea why this is but I’m sure there’s a good reason. Anyway, using ctrl-d to duplicate instead preserves the nice vectory sharpness of the original object. Given the amount of copying and pasting that goes on in making my scientific diagrams, this was quite important to find out. This seems to make it more difficult to copy an object between different files, since ctrl-c ctrl-v works (but looks crap) whereas I can’t currently find out how to `duplicate’ an object between files.
  • On opening an EPS or PDF you made with Inkscape at a later date in Inkscape, you may find that all the separate objects you had before behave as one object so it’s hard to remove or alter individual ones. You might end up using a nasty solution like a plain white box to block out bits you want to delete but can’t. This doesn’t seem to happen Inkscape’s native SVG format. If for whatever reason you don’t have the original SVG, sometimes it’s possible to select the single object in the imported EPS and then click `Object->Ungroup’. You can do this a few times to try and separate the different elements so they can be accessed one at a time. This is useful if e.g. you want to alter a figure somehow and don’t have the SVG.

I’m sure there will be experts who know more about these various issues — I’d be grateful for any more light shed. But hopefully someone who is experiencing any of these problems might find these quick and dirty solutions helpful sometime.

My old PhD supervisor, Mike Evans, is an occasional writer for the Sky At Night magazine and also blogs for physicsfocus. A quick look at his writing in either of these settings demonstrates that as well as being an expert in his field (which, broadly, is mine), he’s something of a philosopher with a very wide range of scientific interests.

However, this post finds Mike writing on the subject closest to his professional heart: statistical physics. This branch of physics is fundamental to our understanding of the world because it deals with situations where we have more than “just a few” of a particular entity. Considering that something as simple as a glass of water comprises billions and billions of mutually interacting and constantly moving water molecules, its clearly important to have an approach that is practical in these cases.

Further, statistical physics unifies things: a vast cloud of cosmic dust is quite different to a small tube of a colloidal suspension. But they’re similar in some ways. One of these ways is that on the tiniest length scales, they’re both made of protons, neutrons, and electrons. But, as Mike nicely points out, this misses the (thermodynamically) large picture: the two systems are also similar in that they both contain a very large number of their constituent particles, so that statistics governs their large-scale behaviour. In fact, this is arguably their most important similarity. Read the post to learn more about universality in statistical physics.


For anyone who wants some exceedingly clear and enjoyable insights into the life of a professional scientist, I can’t recommend Mike’s writing enough. Check out his personal blog too!