A script for Running Sequential Models in Lammps

Dear Lammps User
How can I write a script in order to Run multiple model one after another in different folders in Ubuntu? I mean sequentially?


Mehdi Eftekhari Lecturer of Islamic Azad University, Rasht Branch, Iran
PhD Student of Structural Engineering School of Civil Engineering Islamic Azad University, Science and Research Branch
Tehran, IRAN
Email: [email protected]... , [email protected]...

Hi Mehdi

This is a unix/linux question, but that's okay.
A simple loop bash loop would probably work:
If you have a list of directories (folder1 folder2 folder3 folder4
...), and each of them contains a file named "in.nvt", then you could
run lammps sequentially this way:

for dir in */; do
    lmp_ubuntu -i in.nvt
    # or try something like this:
    # mpirun -np 4 lmp_ubuntu -i in.nvt

Unfortunately, if you are running this on a cluster/super-computer,
then they might not let you do this.

You can also do this from within a LAMMPS input
script with the option of using your parallel processors
to run multiple different jobs at the same time. See
Section 6.4 of the manual.


Actually, Steve's suggestion is much better than mine. My brief
experience using a supercomputer is that the computer administrator
probably won't allow you to run a bash-script on the head-node of a
cluster with a queuing system.

So do everything from within the lammps script, if you can. I have to
run now, but if I can think of an example I will.

  --- writing files in different folders: ---

At different iterations in the loop you will have to change the name
of the dump files and other files that your simulation creates (to
avoid overwriting the old files). You can do this using variables.
The file name can include path information (I think), so that you
could specify writing to files in different folders this way (I

You can learn about loops in lammps from these web pages:
jump -> http://lammps.sandia.gov/doc/jump.html
label -> http://lammps.sandia.gov/doc/label.html
next -> http://lammps.sandia.gov/doc/next.html
variable -> http://lammps.sandia.gov/doc/variable.html
(from Mathias' post)

(If you are not running lammps on a cluster, then the bash script I
suggested should work fine.)

Must go now.