Some time ago Sree Hari P D posted a blog that introduced the magical package Packmol whose aim is to help with establishing initial configuration for Molecular Dynamics (MD). As a beginner in MD, reading his blog and using Packmol really saved me a lot of time creating fluids in different shapes composing different molecules. The package is easy to build, easy to code and easy to operate.
My PhD mainly focuses on fluctuating contact line. So after a few successful simulations with only fluid molecules, I decided that my next step would be to add some solid into my simulation. However, Packmol is not designed to generate solid objects such as walls and bricks. I need something else.
Chengxi, a hard-core scientific programmer and experienced MD user, suggested that I could write my own “wall-generating” script. But I am too lazy for that. I believe in the vast universe of scientific packages, a “wall-generator” must have already been produced by some researchers who are smarter and more dedicated than me. And I am right. I give you the Atomic Simulation Environment.
The Atomic Simulation Environment (ASE) is much more than just a “wall generator”. It is a set of tools and Python modules for setting up, manipulating, running, visualizing and analysing atomistic simulations. Since ASE is written in python, it is really easy to use. It also supports calculators such as CASTEP, LAMMPS and NWCHEM. So theoretically you can build initial configuration, run simulation and then analyse result all in one environment. Isn’t that the dream! However, there are certain areas that ASE has not yet reached. ASE is not good at generating liquid configurations, so we still need Packmol. ASE only supports very basic LAMMPS functionalities, so it is advisable to run MD simulations with LAMMPS outside ASE.
Just to show you how easy and satisfying it is to use ASE, I will attach my “water tank generator” code below. (Please bare with the style of my code and yes I like jupyter notebook.)
Now let’s take a look at the wall in Ovito.
The result looks good!