How to create a arbitrary shaped region

Dear LAMMPS users,

I wonder if it is possible to define a region with arbitrary shape imported from outside. I need a complex shaped geometry, generated from other software in stl format, to be full filled with particles. Reading geometry can be achieved by using "fix smd/wall_surface" to import a STL file. But how could I make it as a region that I can for example create atoms inside that geometry (like using create_atoms in box region)?

Maybe need to modify the region styles in region class? Having a new e.g Region_sphere.cpp and region_sphere.h files? I saw this from Modifying & extending LAMMPS.

Btw, I am using lammps on win7.

Could you offer me some hint? If modifying the code is the right direction, how shall I write the new one or just simply modify the existing one?

Thanks in advance

Vincent

Dear LAMMPS users,

I wonder if it is possible to define a region with arbitrary shape imported from outside. I need a complex shaped geometry, generated from other software in stl format, to be full filled with particles. Reading geometry can be achieved by using "fix smd/wall_surface" to import a STL file. But how could I make it as a region that I can for example create atoms inside that geometry (like using create_atoms in box region)?

those two things are no relation. it is irrelevant for a region, if
you can read an STL file for an SMD wall.

Maybe need to modify the region styles in region class? Having a new e.g Region_sphere.cpp and region_sphere.h files? I saw this from Modifying & extending LAMMPS.

a sphere region style does exist.

Btw, I am using lammps on win7.

are you compiling LAMMPS yourself?

Could you offer me some hint? If modifying the code is the right direction, how shall I write the new one or just simply modify the existing one?

if this is only about creating atom positions, why not write a simple
script or program that generates a suitable coordinate file and then
convert that to a data file (or create the data file directly)? or you
can use a software like packmol to generate position data for quite
complex geometries.

creating a region style for an arbitrary region based on a mesh is not
exactly trivial. how are you going to *reliably* determine, which side
of a mesh is "inside" and which "outside", e.g. if you have a "Klein
bottle" shape?

axel.

As Axel indicated, if all you want the STL region for is
to define where particles are created, you’d be better
off doing that outside of LAMMPS (pre-processing step).

If you want the region for something else, like a boundary
condition, then it would be a lot more complicated than
region sphere to implement all the necessary capabilities
for a new STL-based region class.

Steve

Dear Steve and Axel,

Really thanks for your reply! I think pre-processing is the right direction. And I do need to generate atoms position for complex geometries.

As Axel suggested, I am now looking at packmol for more information.

Also, it is better to have a piece of a simple script or program instead of using external other software. Any suggestion about what algorithm to be used? (e.g. 2D circular packing. Obviously it is not the right one, but at least it gives some basic idea.)

Cheers

Vincent

Dear Steve and Axel,

Really thanks for your reply! I think pre-processing is the right direction.
And I do need to generate atoms position for complex geometries.

As Axel suggested, I am now looking at packmol for more information.

Also, it is better to have a piece of a simple script or program instead of
using external other software. Any suggestion about what algorithm to be
used? (e.g. 2D circular packing. Obviously it is not the right one, but at
least it gives some basic idea.)

this is a question about your research and outside of the scope of
this mailing list. you need to discuss this with your adviser or
collaborators or whoever else is involved.

axel.