Quasi-static stretching simulation


I would like to perform a quasi-static stretching simulation of Al using EAM potential in LAMMPS. My goal is to just stretch the sample and relax (minimize) it using a loop inside LAMMPS. So after the first cycle LAMMPS will write a data file of the minimized structure which I would like to read as a input of the second cycle. I wonder how to do it inside of a LAMMPS input script. My input file is attached below. In every cycle it is reading the initial data file not the latest one.

In every cycle it is reading the initial data file not the latest one.

That’s b/c your read_data command uses the same filename
every pass thru the input script. If you give that file
a variable name, like relax_$y, then it can read a
different file each time. you probably need one variable
for x and another for

variable y equal x-1


Thanks Steve for your comment. But in order to make the data file name as a variable, I have to start the loop before read data comment. And if this is the case, it throws an error:

System init for write_data …
ERROR: Cannot read_data without add keyword after simulation box is defined (src/read_data.cpp:302)
Last command: read_data relax_${y}

New input script is below,

units metal
dimension 3
boundary p s p
atom_style atomic
variable disp equal 0.001

label loop
variable x loop 5
variable y equal ${x}-1

read_data relax_${y}

pair_style eam/alloy
pair_coeff * * Al99.eam.alloy Al

region 1 block INF INF 100 INF INF INF units box
group up region 1

timestep 0.001

thermo 100
thermo_style custom step temp press

variable stretch equal “v_disp*v_x”

displace_atoms up move 0.0 ${stretch} 0.0 units box

min_style cg
minimize 1e-3 1e-3 10000 100000

dump {x} all custom 10 dump.Al_* id type mass xs ys zs run 1 write_data relax_{x}
next x
jump in.simple loop

Thanks for your help.

read_data will create a new box. you can only create a new box, if you
first delete the *entire* system beforehand with the "clear" command.
so try starting each iteration with "clear" and then repeat all
settings (boundary, atom_style, units and more).
for more information, please study the documentation. there are
examples and explanations.