Creating a water box using lammps perl script

Hi, could anybody suggest me in creating a water box only (no solute inside) with perl script of lammps of preferred dimension.

I don’t know why it has to be a perl script. I’ll show some moltemplate examples followed by some other options (including a perl script)

First of all, here’s an example of a box of water using moltemplate (python, bash):


Input files are located here:

It is explained in detail on pages 13-17 of the moltemplate manual located here:

More complicated examples to follow:

Here’s an example of SPC/E water mixed with sodium chloride ions:

Input files here:

Here is a more complex example including a carbon nanotube and water:

(Click below each image for the corresponding input file.)

Here is an example of water mixed with methane using the OPLSAA force field:

Here is an example of water mixed with another small molecule (isobutane) using the Amber GAFF force field:

Here are some non-moltemplate options:


a perl script from Laurent Joly:

Picture here:

Also see:




Thanks Andrew for valuable input.