# Boolean expression based region creation in LAMMPS?

​I guess so far we can only create the region with existing shape options. Any geometry beyond those options have to be created externally and read in via data file? For example, a sine / cosine wave-like boundary for a cube.

Thank you.

The create_atoms command has a “var” option to define

an atom-style variable that is used to choose yes/no whether

an atom is added. An example of using it to create a sinusoidal

(bumpy) surface is illustrated on the create_atoms doc page.

Steve

A little confused about the following example

``````
> 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

``````

In the expression, if “xx” and “yy” were to represent the real position of atoms in the expression, why they were first set equal to 0.0?

A little confused about the following example

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

In the expression, if "xx" and "yy" were to represent the real position of
atoms in the expression, why they were first set equal to 0.0?

​because they need to be defined as variables. the create atoms command
cannot use variables that don't exist, it will then override their value
with the corresponding lattice position. please re-read the section of the
documentation. if you think it through, it will make sense.

axel.​

Totally got it now. Thanks!