boolean create_atoms command: variable for create_atoms command is invalid style

This is related to the questions addressed in this thread:

https://sourceforge.net/p/lammps/mailman/message/34556070/

I have been attempting to replicate the example in the create_atoms documentation page, in which atoms are generated terminating with a sinusoidal surface. My code is as follows:

This is related to the questions addressed in this thread:
https://sourceforge.net/p/lammps/mailman/message/34556070/

I have been attempting to replicate the example in the create_atoms
documentation page, in which atoms are generated terminating with a
sinusoidal surface. My code is as follows:

---
units metal
dimension 2
boundary p p p

atom_style atomic

variable x equal 100
variable y equal 25
lattice hex 0.8442
region box block 0 $x 0 $y -0.5 0.5
create_box 1 box

variable xx equal 0.0
variable yy equal 0.0
variable v equal "(0.2*v_y*ylat * cos(v_xx/xlat * 2.0*PI*4.0/v_x) +
0.5*v_y*ylat - v_yy) > 0.0"
create_atoms 1 box var v set x xx set y yy
---

Other than the first few lines, this copies the example verbatim. However,
when the create_atoms command is called, I get the error message "variable
for create_atoms command is invalid style". As far as I can tell, v, x, xx,
y, and yy are all defined as equal-style variables. I considered maybe xlat
and ylat were the culprit, but even if I remove them, the problem persists.
Am I missing something about the way these variables are described?

those variables have to be *atom-style* variables, as steve clearly
mentions in the archived e-mail conversation you are pointing out.

axel.

So is the example given in the documentation incorrect, or does it rely on a specific set of commands not given? Everything used by the create_atoms command appears to be defined within the supplied example code. What needs to be changed? Nowhere in the documentation page is any variable associated with the var and set commands referred to as being atom-style.

  • Spencer

So is the example given in the documentation incorrect, or does it rely on a
specific set of commands not given?

if you re-read the section documentation preceding the example
carefully, you will find, that the example is incorrect and not
consistent with the documentation.

Everything used by the create_atoms
command appears to be defined within the supplied example code. What needs
to be changed? Nowhere in the documentation page is any variable associated
with the var and set commands referred to as being atom-style.

you are correct. i mentioned atom-style because it was mentioned in
the e-mail thread you referred to by the great lord of the lammps
himself, and i didn't check the docs myself. after reading that
section of the variable docs and trying to reproduce the error, it
became apparent, that the variable type issue is not with the variable
v, but the variables xx and yy. they have to be of *internal* style.
please re-read the docs and you'll see. i'll submit a patch to correct
the example in the documentation.

https://github.com/lammps/lammps/pull/716/commits/f6658d10b78e10022089b1f52005f0f70ea27e65

axel.

I have modified my code accordingly and it works as intended. Thank you very much for your assistance.

  • Spencer