A few years ago1, Sebastian contacted me to help with simulations. Great, I like simulation studies, so we start discussing the details. The idea: use an established method, the Lees-Edwards boundary condition, to study colloids under shear. In principle, we should be able to use an existing implementation and I would help setting everything up. Simple, right? It is only about computer simulations anyway.
Is this new at all?
Let's go back in time. 1972. Lees and Edwards find a way to modify the rules at the boundary of an otherwise fully periodic simulation cell that lead to a shear in the system. The article is well cited, and the method is used in plenty of articles.
In principle, we should find the method available in established simulation packages. In practice there was no such resource. Worse, the principle on which the method is based is questioned: the simulated system should display nothing unusual close to the boundary but an author claims that one needs to turn off thermostatting in that region of space. Judging such results without availability of the source code is difficult. 2
The novelty of our work did not lie in the method but in making it available. This was a good reason to use an existing package, EPResSo, so that our code could be re-used by others in combination with useful features (polymer models, parallel execution, input-output routines, etc).
What did we do?
There had been a first attempt to implement Lees-Edwards in ESPResSo, which was advertised and influenced our choice of software. We soon realized that the best way forward was to rewrite an implementation from scratch, litterally removing everything that was related to Lees-Edwards. So we 3 start working on the method with the ESPResSo simulation package developed in Stuttgart.
Changing the nature of the boundary conditions has consequences in many parts of the simulation code:
- The computation of the distances, and importantly of the relative velocities between particles, must take into account the crossing of the shear plane boundary.
- Building of neighbor lists is fundamentally different if the simulations cells move with respect to each other.
- The time-stepping of the particles' positions must include the detection of jumps across the boundary.
While working on these modifications of the code, in an iterative process to try to decouple as much as possible the Lees-Edwards code from the established codebase, we also realized that we could track the physical trajectories of the particles by recording the position jumps as they occur. This is an unexpected bonus of our work and a nice way to verify the physics of diffusion under shear flow.
Our article also shows the convergence of the Green-Kubo integrals in some situations, which is sometimes dismissed as trivial in other works. Nothing is hidden!
Our work is now published by Physics of Fluids. We were not sure were to submit so I am glad that the article ended up in a journal where the readers might pick up our "methods section" or download our source code. Of course, all of the code used to produce the results is in the Zenodo supplementary data!
We measured the viscosity of the DPD fluid with two methods, the Green-Kubo formulas and the direct measure of stress under shear, which is not often done in the literature. Finding authoritative work on the viscosity of DPD fluids is not as easy as I would have expected. Sometimes the details matter also: the availability of routines to compute separately the components of the stress is not guaranteed in all codes. Indeed, computing the stress due to the DPD force relies on random numbers so that you want to get that right!
All in all, I hope that our work enables others to use the method and will have as much "impact" 4 as a paper reporting on a new physical effect. The reason I put the story on my blog is that, often, the simulation study that is requested to support a theory or experiment is considered either easy or quick to do. In practice, numerical simulations form a dedicated part of scientific research and should be valued as such. The same holds for the development of scientific software in general.5
- The article in Physics of Fluids.
- The preprint "Lees-Edwards boundary conditions for translation invariant shear flow: implementation and transport properties" arXiv:2104.12857
- The parameter files and analysis code on Zenodo Companion data for the Lees Edwards Implementation for Espresso.
- Sebastian's homepage
- ESPResSo's homepage
- The implementation we wrote still resides in a separate branch based on ESPResSo 4. We archived the GitHub repository on Zenodo.
- Four years almost day to day actually ↩
- Spoiler: the method does not generate spurious effects. ↩
- Mostly Sebastian, with the help of our collaborators from Stuttgart. ↩
- Whatever impact means. ↩
- On the topic of open-source scientific software, make sure to check out the Journal of Open Source Software. ↩