# Crack simulation

Dear users and developers,

I would like to perform a MODE-I crack simulation. In order to generate the crack I would like to apply a displacement field (K-field) which is a function of atom position. To accomplish this within LAMMPS, I defined a atom style variable and using fix move or displace_atoms commands in a loop to apply the displacement field in a incremental way followed by minimization. Here is the input script,

units metal
dimension 3
boundary s s p
atom_style atomic

pair_style eam/alloy
pair_coeff * * Zope-Ti-Al-2003.eam.alloy Ti Al

timestep 0.001

thermo 100
thermo_style custom step temp press pyy pxy pxz pyz

label loop
variable a loop 10

# uy =(k/2*mu)sqrt(r/2PI)*sin(theta/2)[k-1+2cos2(theta/2)]

variable r atom sqrt{(x[i]*x[i])+(y[i]*y[i])}
variable theta atom atan(y[i]/x[i])
variable k equal 0.90
variable delk equal v_k+(\${a}0.07)
variable mu equal 100
variable ux atom (v_delk/2
v_mu)sqrt(v_r/2PI)cos(v_theta/2)[v_delk-1+2(sin(v_theta/2)sin(v_theta/2))]
variable uy atom (v_delk/2
v_mu)sqrt(v_r/2PI)sin(v_theta/2)[v_delk+1-2(cos(v_theta/2)*cos(v_theta/2))]

fix 1 all move variable v_ux v_uy NULL NULL NULL NULL

# OR

#displace_atoms all move v_ux v_uy NULL units box

min_style cg
minimize 0.0 1e-3 10000 100000

run 5
next a
jump in.crack loop

In either case of fix move or displace_atoms, it throws an error, ERROR: Invalid thermo keyword in variable formula (…/variable.cpp:2038). I have attached the log file if it helps.
I wonder what’s wrong with the variables? Also, how to set per atom displacement in LAMMPS before run? I mean fix move or displace_atoms does this?

Any suggestion/comment is greatly appreciated.

log.lammps (1.69 KB)

the "invalid thermo keyword" error, was an error that old versions of
LAMMPS would throw, if there was some construct in a variable
definition, that LAMMPS could not recognize and it assumed, it was a
(new) thermo keyword, but then evaluating that led to an error and
thus the error message.

if you would update your outdated LAMMPS version to a current release,
you would get instead:

ERROR: Variable r: Invalid thermo keyword 'sqrt' in variable formula
(src/variable.cpp:2098)
Last command: run 5

which should point you right to the mistake, that you made when

axel.

Thanks Axel for your comment. I replaced the sqrt{x} with sqrt(x) and it has overcome the issue. But now it throws another error, ERROR: Non digit character between brackets in variable (…/variable.cpp:3189).
Could anybody please help me in this regard? The new input file is given below,

units metal
dimension 3
boundary s s p
atom_style atomic

pair_style eam/alloy
pair_coeff * * Zope-Ti-Al-2003.eam.alloy Ti Al

timestep 0.001

thermo 100
thermo_style custom step temp press pyy pxy pxz pyz

label loop
variable a loop 10

# uy =(k/2*mu)sqrt(r/2PI)*sin(theta/2)[k-1+2cos2(theta/2)]

variable r atom sqrt((x[i]*x[i])+(y[i]*y[i]))

variable theta atom atan(y[i]/x[i])
variable k equal 0.90
variable delk equal v_k+(\${a}0.07)
variable mu equal 100
variable ux atom (v_delk/2
v_mu)sqrt(v_r/2PI)cos(v_theta/2)[v_delk-1+2(sin(v_theta/2)sin(v_theta/2))]
variable uy atom (v_delk/2
v_mu)sqrt(v_r/2PI)sin(v_theta/2)[v_delk+1-2(cos(v_theta/2)*cos(v_theta/2))]

fix 1 all move variable v_ux v_uy NULL NULL NULL NULL

# OR

#displace_atoms all move v_ux v_uy NULL units box

min_style cg
minimize 0.0 1e-3 10000 100000

run 5
next a
jump in.crack loop

Thanks.

sorry, but i don't have the time to debug your input for you. i have
only responded to your first e-mail, because i wanted to point out the
benefits of using an up-to-date version of LAMMPS.

you need to do what everybody else has to do in such cases: start with
an empty input and put back the lines from the failing input
incrementally until you have found the offending line and then compare
it with the documentation (the documentation matching your outdated
version of LAMMPS, not the online version, which always tracks the
latest patch release and thus is now 2 1/2 years ahead of what you
are using).

axel.