Hello, I am trying to implement a time-varying potential based on a grid, similar to the way that the PPPM algorithm uses a grid to calculate forces on particles.
I noticed that a lot of the times when there is a loop through particles, it includes the if statement
if( mask[i] )
Does the mask array tell if the particle is a ghost particle or if it belongs to the processor’s sub-domain?
Do I need to include the values of the grid that include the ghost particles in order to calculate forces on ghosts too, or can I just include the processor’s sub-domain?
If I do need to include the ghosts, can someone explain to me what the order, shift, and OFFSET parameters in the set_grid_local function of the PPPM class do?
Thanks so much, I hope to hear from you soon.
It would be even more useful to me if this has already been implemented by someone. In other words, is there an algorithm that can implement a time-varying potential that is stored as a grid, other than the PPPM algorithm (there is some extra complexity in that algorithm that is unnecessary for my purposes).
The mask operation is checking whether the atom is in the
“group”. E.g. almost all fixes operate on groups of atoms,
so the loop over local atoms is excluding atoms not in the group.
If your potential is long range, then you could use PPPM
as the starting point and either derive a new KSpace style
from it, or just make a copy and strip out the parts you
If your potential is short-range, you should make it a pair
style and define your own grid, which presumably is just
local to a processor. You could still use the GridComm class
that PPPM uses to exchange ghost cell info between
procs with the grid.