change_box and rebuilding neighbor list

Dear LAMMPS developers and users,

I copy-and-paste part of change_box.cpp into my own command, and atoms seem to be lost counted during continuous contraction/expansion process…

The only reason I can think of, for the missing atoms, is due to the bad neighbor list I created.

So, could you help to verify if my understanding to the logic to be correct? Many thanks to your time.

neighbor->decide(): returns 1 if (a) every many times of iteration (b) check_distance() returns 1
neighbor->check_distance(): returns 1 if (a) box size is changed (b) any atom moves further than a certain amount

In my case, boxcheck is not 1 since I do not invoke domain->box_change() but my own command, so I need to manually set boxcheck to be one as well…

Please advise if my interpretation is correct, and anything I overlooked…

Sorry for being so verbose, and thank you again for the help.

LC Liu

The neighbor->decide() method is meant to be called during a run,
so I am assuming you are writing a new fix. Unlike the change_box
command which executes once, between runs. There is already
a fix like this, fix deform. So you can look at its logic if you like.
If you are in a run, then the Verlet driver is worrying about neighbor lists,
so I'm not sure why your fix would need to.

Steve

Hi, Steve,

Thank you so much for the direction. Yes I am doing a fix, and it has similar function as fix deform. I checked fix deform and saw that it calls the following routines in FixDeform::end_of_step():

domain->set_global_box();
domain->set_local_box();

and finally,

if(kspace_flag) force->kspace->setup();

I suspect that I am missing the kspace setup part…In my fix, I only do the domain reset but handling the kspace. My program stops with the message “Out of range atoms - cannot compute PPPM”…I thought I corrected this by enforcing neighbor list rebuild each step, but clearly it is not the cure.

BTW, in void Verlet::setup(),

if (force->kspace) {
force->kspace->setup();
if (kspace_compute_flag) force->kspace->compute(eflag,vflag);
else force->kspace->compute_dummy(eflag,vflag);
}

Hence, do I need force->kspace->compute(eflag,vflag) in addition to force->kspace->setup() to build a new kspace grid, after I change box dimension?

Thank you so much for your patience and help.

LC Liu

no, Verlet will compute the KSpace forces - I don't see
why your fix would need to.

Steve

Hi, Steve,

Thanks for the comments. I am trying my implementation.

LC Liu