script to make obstacle like a box

Dear users,
I am sorry if this question has already been asked previously (though I found no related thread) .

I want to simulate moving atoms with obstacle like a box in a simulation box.(by Lj units)

But I can not reflect on boundary of box.
What should I use any commands?
If you can do,please tell me the example of script.

I wrote this script↓

units lj
atom_style sphere
#dimension 2

lattice sc 0.001
region box block 0 5 0 5 0 5 side in
create_box 2 box
create_atoms 1 box

region maru sphere 25.0 25.0 25.0 10.0 side out
region box2 block 12.5 37.5 12.5 37.5 12.5 37.5 side out

group a1 region box
group a2 region maru
group a3 region box2

fix wall a2 wall/region maru lj126 3.0 3.0 1.0
#fix ref a2 wall/reflect xlo EDGE xhi EDGE
#fix plane a1 wall/gran/region hertz/history 100.0 200.0 200.0 100.0 0.0 0 region box2

set group all type/fraction 2 0.900 1000
set type 1 mass 9
set type 2 mass 1

velocity all create 1.44 87287 loop geom

#multi neighbor and comm for efficiency

neighbor 1 multi
neigh_modify delay 0
comm_modify mode multi

#colloid potential

pair_style colloid 12.5
pair_coeff 1 1 1.0 1.0 5.0 5.0 12.5
pair_coeff 1 2 5.0 1.0 5.0 0.0 7.0
pair_coeff 2 2 10.0 1.0 0.0 0.0 2.5

fix 3 all nvt temp 2.0 2.0 2.0
#fix wallhi all wall/lj93 xlo -1.0 1.0 1.0 2.5 units box
#fix 2 all enforce2d

dump 1 all atom 1000 box2re.colloid

#dump 2 all image 1000 image.*.jpg type type&

zoom 1.5 center d 0.5 0.5 0.5

#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5

#dump 3 all movie 1000 movie1.mpg type type&

zoom 1.5 center d 0.5 0.5 0.5

#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5

thermo_style custom step temp epair etotal press vol
thermo 1000

timestep 0.005

run 50000

Cheers

Ryota Yokokawa
ryota0730pad@…1125…

you have periodic boundaries (the default setting). for those you
cannot have reflecting walls, since there is no clean definition of
"inside" and "outside" (unlike with "f" boundaries).

axel.

I read “box” in your Q to mean embed an obstacle with a specific shape,
e.g. a sphere or in your case a rectangular box.

You can look at the example/obstacle/in.obstacle script
which does this for an embedded sphere using fix indent.
You can embed a region of a variety of shapes (see the region command),
by using the fix wall/region command in place of fix indent.

Steve

Thanks to your reply,Axel and Steve.

Axel, you mean not using ‘boundary’ command,right?
What should I do to define ‘inside’ and ‘outside’?

Steve, I looked example script.Thanks.
I used fix wall/region command but the place which I designated was not displayed.
Did I write incorrect script of point of region?

Ryota Yokokawa

2018年12月20日(木) 0:19 Steve Plimpton <sjplimp@…33…24…>:

You need to ask a more specific Q. The commands all
have doc pages. If you are using a command and it
gives an error, see the doc page first.

Steve

Dear users,

I want to simulate the moving atoms with obstacle(shape is cylinder).

I had done simulation with “sphere”. The atoms are reflected in specified region.
Next, I tried to simulate with “cylinder” ,but they weren’t reflected there.

this is the script that I writing now.
I think the problem is “fix indent command”.
Please tell me how to solve this problem.
I’m sorry my English is so bad.
And thanks all users.

-----script-----

boundary p p p
units lj
atom_style sphere
#dimension 2

lattice sc 0.0015
region box block 0 20 0 10 0 4 side in
create_box 2 box
create_atoms 1 box

region maru sphere 10.0 5.0 2.0 2 side in
region wing cylinder z 10.0 5.0 2.0 0.0 EDGE side in

group a1 region box
group a2 region maru
group a4 region wing

#delete_atoms region maru
delete_atoms region wing

indent command the problem is here??

#fix f1 a1 indent 100 sphere 10.0 5.0 2.0 2
#fix f4 a4 indent 100 cylinder z 10.0 5.0 2.0 side out units lattice

wall/region command

fix f5 a4 wall/region wing harmonic 1.0 1.0 2.0
#fix f7 a2 wall/region maru lj126 1.0 1.0 2.0

set group all type/fraction 2 0.900 1000
set type 1 mass 9
set type 2 mass 1
set group a1 image NULL 0 0

velocity command

#compute mobile a1 temp
velocity all create 1.44 87287 loop geom
#velocity a1 set 0.0 0.0 0.0
fix f2 a1 setforce NULL 0.0 0.0 region box

#multi neighbor and comm for efficiency

neighbor 1 multi
neigh_modify delay 0
comm_modify mode multi

#colloid potential

pair_style colloid 12.5
pair_coeff 1 1 1.0 1.0 5.0 5.0 12.5
pair_coeff 1 2 5.0 1.0 5.0 0.0 7.0
pair_coeff 2 2 10.0 1.0 0.0 0.0 2.5

fix 3 all nvt temp 2.0 2.0 2.0
#fix wallhi all wall/lj93 xlo -1.0 1.0 1.0 2.5 units box
#fix 2 all enforce2d

thermo_style custom step temp epair etotal press vol
thermo_modify lost ignore
thermo 1000

timestep 0.005

run 500000

2018年12月19日(水) 18:54 横川凌大 <ryota0730pad@…24…>:

you are applying the wall/region force to the atoms in group "a4",
which corresponds to atoms in region "wing", but you also delete all
atoms in region "wing" which means, that there are no more atoms left
on which the wall/region fix can act on.

BTW: it is a very bad idea to use "thermo_modify lost ignore" on
systems like this one. this system must not lose any atoms. if it
does, it is a sign that something very bad is happening and that needs
to be addressed, not ignored.

axel.

Thanks for reply and I’m sorry for replyng so late.

Now, I changed my script. And quit to use “wall/region command”.
According to the example/obstacle/in.obstacle script, “fix indent command” defines the obstacle.
I simulated using it by cylinder, but not acted.

The part of script of “in.obstacle” is this.

image.png

Thanks for reply and I’m sorry for replyng so late.

Now, I changed my script. And quit to use “wall/region command”.
According to the example/obstacle/in.obstacle script, “fix indent command” defines the obstacle.
I simulated using it by cylinder, but not acted.

it doesn’t have an effect because you are making the same mistake as before.

axel.

image.png

----- using fix wall/region -----
Personally, I admit that I find the “fix wall/region” commands to be confusing.
(I wrote down somewhere that I figured out how to use it by reading the source code.)

If it helps, I’m attaching a file containing a list of LAMMPS input script comands that I use to confine particles in a cylinder. The cylinder in this example is oriented along the Z axis (however the comments in the file should make it obvious how to change the orientation). Particles begin to feel an inward force starting at a distance of 60.0 away from the Z axis. This force increases linearly (energy increases quadratically) with increasing radius. You can control the rate of increase by adjusting the “k” parameter. You will have to choose appropriate temperature and k parameters sure that no particle is likely to exceed the maximum radius allowed (The maximum radius is “rc0” in the attached file, which you can also edit).
You can copy the lines from the file into your script, or simply included it using this command:

include confinement_cylinder_R=60.in

----- using discrete wall particles (creating a DATA file) -----

An alternative way to do create a wall is to use a LAMMPS DATA file containing the positions of atoms which belong to the walls of the obstacle box. Then you can omit this group of atoms when integrating the equations of motion (using fix nvt, or fix npt for example.) This will give you much more flexibility to define the geometry of the obstacle box, as well as their interactions with the mobile atoms in your system. There are many different ways to create a LAMMPS DATA file. The “run.in.nvt” and “run.in.npt” files for each of the examples below explain how to immobilize atoms in a simulation.

image1
https://github.com/jewettaij/moltemplate/tree/master/examples/coarse_grained/abstract_lennard_jones_tube

image2

http://moltemplate.org/visual_examples.html#translocation

image3
http://moltemplate.org/visual_examples.html#nanotube+water

image4
(this example is too messy to share, I’m afraid)

image5
https://sourceforge.net/p/lammps/mailman/message/36408810/
(This was a discussion we had with a user who wanted a “pentagon-shaped” cylindrical wall.)

Disclaimer: I wrote moltemplate so the examples I suggest above all use moltemplate. Please excuse the self promotion. I do promote it shamelessly. However you don’t have to use moltemplate to create a DATA file or to immobilize atoms. Hopefully these files give you an idea how to do this (regardless of how you decide to create the DATA file).

Cheers

Andrew

confinement_cylinder_R=60.in|attachment (2.36 KB)

Regardless of how complicated the options of the fix wall/region or other fix commands, it will have no effect, if the fix is applied to a group that has no more atoms in it. That is the problem here and that is a general fix property that applies to almost fixes except for some like fix print, that don’t apply any modification to atoms.

Axel.

Dear, users

Thanks for Andrew and Axel’s reply.
I found that the direction of cylinder was uncorrected.
I changed its axis from “z” to “x”.
So,“fix indent command” acted.

But, new problem generated.
The cylinder’s region I specified move with atoms.
I want to lock the position of cylinder.
I think “variable” command is key but I can’t understand explanatory text on web site.
please tell me how to lock the position of region(the name is “wing”)

My script is below.

Dear, users

Thanks for Andrew and Axel's reply.
I found that the direction of cylinder was uncorrected.
I changed its axis from "z" to "x".
So,"fix indent command" acted.

no, it didn't!
you *still* have the fix operate on the atoms of group a4 only, which
contains no atoms by the time you actually apply fix indent (due to
the run command). which means, you can put into that command whatever
you want, it will have no effect.

your whole input is just one giant chaos of things that do not make
(much) sense or are plain wrong:
- you choice of boundary makes no sense since you are not adding walls
to contain atoms in the system, so using "boundary p p p" should be
resulting in the simplest input
- your simulations, if set up correctly, should not lose atoms, hence
you must not use "thermo_modify lost ignore"
- your combination of adding velocities to all directions of all atoms
conflicts with your use of fix setforce. it will lead to atoms moving
at constant velocity and eventually overlapping in y and z directions
- your use of atom style sphere is pointless, there is nothing in your
input that requires atom radii, you should be using atomic, since in
the rest of the input you are treating all particles as if they are
point particles. you obviously are trying to work around the problem i
am adressing in the next point, but what you do is an ugly hack and
not really addressing the problem
- the way how you set the mass is incorrect. for a system where the
mass is per-ype, you should use the mass command. then you don't need
to use atom style sphere.

But, new problem generated.
The cylinder's region I specified move with atoms.
I want to lock the position of cylinder.
I think "variable" command is key but I can't understand explanatory text on web site.
please tell me how to lock the position of region(the name is "wing")

you are on the completely wrong track there. your conclusions are
wrong and you have using a reasoning that is in conflict with the
documentation.

my recommendation is to abandon this script completely and start from
scratch based on the obstacle example and change things in small
increments to slowly transform to what you want to simulation and
check at *every* step whether the change you make to the input is
actually reflected in the simulation. and for every command you
inherit from the obstacle example check very carefully from the
documentation what it does. you main problem is, that you don't
understand what you are doing well enough, and thus you are using
commands incorrectly and are drawing the wrong conclusions. the only
way to overcome this problem is to step back and learn (or re-learn)
and study every little detail with more care until you do understand
and draw the correct conclusions.

axel.