Add the script to Simulation Flow (Ctrl/Cmd + F2) > FramesPre.
The goes through a Dyverso domain's ("DY_Domain01") particles and shifts every 20th particle - based on their Ids - and its neighbours to a second domain ("DY_Domain"). By altering the "skip" variable you can, for example, choose every 5th, 50th, or 100th particle: