Unexpected wall/region behaviour

Hi LAMMPS community

I am experiencing strange behaviour when trying to simulate some particles in a box. I set up my system and apply regions and walls like this:

region sim_region block 10 115 10 115 200 400
lattice sc 40 origin 0.5 0.5 0.5
create_atoms 0 region sim_region mol rub ${mol_seed}
region bbox block 0 126 0 126 190 410 side in
fix walls all wall/region bbox harmonic 10 10 10

I have therefore (I think) left a small gap between the populated region and the wall itself. However, when I run this I instantly get:
“ERROR on proc 0: Particle outside surface of region used in fix wall/region (src/lammps-2Aug2023/src/fix_wall_region.cpp:307)”

I do not understand how this can be. I have tried playing with the “vacuum gap” and increasing/decreasing it. What I have found is that if my bounding box region is defined to stretch from 1 to 410 in z, i.e.

region bbox block 0 126 0 126 1 410 side in

the simulation runs OK. Any number higher than 5 instantly produces the same error I copied above. I have tried quite a few things but am at a loss for what to do to rectify this.

Any tips, ideas, commiserations gratefully received

Thanks in advance
all best
jack

You also have to make sure the wall potential is steep enough so that particles cannot pass through it. Keep in mind that you are discretizing the equations of motion an thus particles will move under the forces from the past (half) step for a full timestep. Without knowing the specifics of your system it is hard to tell, but a force constant of 10 seems rather small in any relevant units.

Thanks very much for your reply

Apologies, I should have been clearer, but I have tried different wall potentials also. The behaviour is the same for potentials of

... harmonic 100 10 10
... harmonic 1000 10 10
... harmonic 10000 10 10

and for timesteps of 50 ps, 1ps, 0.1 ps. 0.01 ps

Thanks for your reply

all best
jack

Unless you provide a minimal but complete input deck that allows to quickly(!) reproduce the issue on a single processor, there is not much more advice to be given but: you’ll have to debug this yourself.

There are a few things you can do:

  • define a group with the “side out” version of the region and count the atoms in it
  • output trajectory data frequently and visually check what is happening.
  • vary the other wall parameters and the wall style.

Thanks for your reply again. I have put together a minimal set of files (some of the input file might look a bit weird, but that is because this is a stripped down version of a more involved simulation. In my hands, the working runfile completes on one laptop core in about 3s and the broken one fails in the same time. I am unable to upload these however because I am a new user. I have put it on file.io here: https://file.io/t3nQ1U5UmAV4

Thank you also for your tips, I am trying these. When trying to watch visually and figure out what is going on, I have found out that the simulation fails before any calculation is done, i.e. even when writing the trajectory out at every step the trajectory file is empty. My guess is therefore that this is a definitional issue somehow rather than a simulation one

all best
jack

Sorry for the delay, but preparing the stable release for LAMMPS has consumed most of my energy and time over the last few days.

I followed the link today and it says the data was deleted.

I have bumped your trust level to “basic user”. You should be able to attach files now.

@JackShepherd please learn Markdown :

3 backticks to open code , then paste your file, 3 backticks to close code section

Repeat for multiple files

Extra advice: GitHub Gists are great for sharing LAMMPS run files while giving mobile-first users (me) easy text browsing capabilities.

They can be made “private”, so they won’t be found by search and will only be accessible through the Gist’s URL.

(If your file does not fit on Gists, or somehow contains sensitive information unsuitable for Gists, then … it’s not suitable for debugging by forum volunteers.)

Thanks very much Axel, and no need to apologise - I know you must be extremely busy. My files are attached. I have noticed an interesting other point - if I replace the box with two planes at different places in z, i.e. a plane defined by 0,0,1 at z=200 and 0,0,-1 at z=400 it breaks. But defining the first plane with 0.0.-1 at z=200 and 0,0,-1 at z=400 works OK. I must be doing something silly here I think. Thanks for taking the time to help me out.

@alphataubio Thanks for the advice, I did consider this but didn’t know if it is bad etiquette on this forum

@srtee Very good to know, thank you I will take a look at Gists. Nothing at all sensitive here :slight_smile:
Thanks all again

all best
jack
input_files.tar (20 KB)