Generating a spherical shell with an entry hole

Hey all, I have been trying to create a simulation setup in which particles can leave and enter from a spherical shell which has a circular hole. However I am unable to see the presence of the shell in the simulation. I would really like to hear your suggestions to improve my region commands.
These are my current region commands:
region spheAc sphere 0 0 10 6 side out
region spheB sphere 0 0 10 5.9 side in
region spheA sphere 0 0 10 6 side in
region spheBc sphere 0 0 10 5.9 side out
region cylA cylinder z 0 0 2 3 6 side in
region spheAcUB union 2 spheAc spheB
region AIBc intersect 2 spheA spheBc
region ABcylA intersect 2 AIBc cylA
region sphecavity union 2 spheAcUB ABcylA
fix wall all wall/region sphecavity lj93 4 1.0 1.22

Essentially I am creating a union of of a larger outer spherical region, smaller inner spherical region and the cylinder that connects them both.

However this isn’t working with the effect I had in mind where as the simulation runs out with errors(recognizing that particles are inside the defined region)

Your commands and your description don’t match well and it is not quite clear what geometry you are really envisioning, specifically where the particles would do.

A good way to debug complex regions is to fill them with atoms or use them to delete atoms and then visualize the result (or just write an image with dump image).

For example this input creates an image like is shown below:

lattice fcc 0.85
region box block 0 20 0 20 0 20
create_box 1 box

pair_style zero 1.0
pair_coeff * *
mass * 1.0

region outer sphere 10.0 10.0 10.0 8.0 side in
region inner sphere 10.0 10.0 10.0 6.0 side out
region hole  cylinder x 10.0 10.0 3.0 16.0 18.0 side out 
region shell intersect 3 outer inner hole

create_atoms 1 region shell

write_dump all image  shell.jpg type type ssao yes 32426 0.8
#write_dump all atom atoms.lammpstrj

1 Like

Thanks for your inputs! Thanks for pointing out the create_atoms command which is a very useful debugging tool.

I was actually looking for the exact opposite of this, that is particles should be free to roam outside the shell(outside the larger sphere), inside the shell(inside the smaller sphere) which is accessible through a hole, and not the region between the two spheres

I think at this point, you will become subject to the various limitations of fix wall/region.
It is going to be easier to simply build your wall from immobile particles. When using a pair potential like lj/cut, you can adjust the density or sigma or both to make it a smooth surface (LJ and most other pairwise potentials are quite “soft” potentials to begin with). When using granular potentials, you can adjust the particle size so there is sufficient overlap to minimize surface “roughness”. Here is an example demonstrating it for an ideal gas like LJ model based on my previous suggestion:

lattice fcc 0.85
region box block -40 40 -40 40 -40 40
create_box 2 box

pair_style lj/cut $(2^(1.0/6.0))
pair_coeff * * 1.0 1.0
mass * 1.0

# build custom shaped wall from particles
region outer sphere -20.0 0.0 0.0 16.0 side in
region inner sphere -20.0 0.0 0.0 12.0 side out
region hole  cylinder x 0.0 0.0 5.0 -8.1 -3.9 side out
region shell intersect 3 outer inner hole
create_atoms 1 region shell

# insert ideal gas like material into shell with hole
region small sphere -20.0 0.0 0.0 10.0
create_atoms 2 region small
group mobile type 2
velocity mobile create 3.0 5523465

# speed up calculation by removing inter-particle interactions in the shell
neigh_modify exclude type 1 1

# do time integration and temperature compute only for mobile particles
fix 1 mobile nve
compute mtemp mobile temp
thermo_modify temp mtemp

#dump 1 all atom 50 atoms.lammpstrj
dump 2 all movie 25 shell.mkv type type size 1024 1024 zoom 1.3

thermo 100
run 10000 post no

There is a point where constructing geometries from regions becomes cumbersome anyway and for that it would be better to implement a generic triangulated surface interaction from a surface mesh. This currently only exists for the MACHDYN package (fix smd/wall_surface command — LAMMPS documentation), but since it does it via parsing an STL triangle file to translate each triangle into a suitable particle, it would not be too difficult to adapt that code to be added to “create_atoms” (or as a special “create_atom_mesh” command).

Here is a short demo from an example of the MACHDYN package using an STL defined particle wall (created with VMD which can load the STL file for visualization). Fluid flow through complex surface from STL file - YouTube

Thanks again, I was able to pick up a lot of new lammps capabilities and limitations from your code!

I hope this message finds you well. I am an avid user of LAMMPS, and I have been following your valuable contributions to the Lammps discussion forum. Your insights and expertise have been truly instrumental in guiding other users, and I greatly appreciate the knowledge you share with the community.

I have encountered a challenge while working on a molecular dynamics simulation in LAMMPS, specifically regarding the import of crystallographic data into the simulation region. I would like to inquire about the appropriate procedure to import a crystal’s data file into the simulation region within LAMMPS. My crystallographic data file includes the atomic positions and types, as well as the lattice parameters. I am confident that your insights would help me establish a sound and precise initial configuration for my simulation.

Thank you for your time and consideration.

This is a new topic with a very different purpose than the post you are replying to.

Please see the comments in our forum guidelines about “necroposting”: Please Read This First: Guidelines and Suggestions for posting LAMMPS questions

Thus you should delete this reply and start a new topic with a suitable subject line. You also need to rethink what you write in your post, since it is too vague and unspecific and does not explain what exactly what kind of search you have done and ultimately what you have tried (and possibly failed) to do this far. Posting pre-emptively and deliberately vague questions in a forum are also frowned upon, specifically in a “technical” forum like this one and with people volunteering their time. You want to make certain that people do not feel they have to guess lots of information that you already possess but - for one reason or another - failed to provide.