Hi Amine, 

Thanks a lot for your quick reply. Just to confirm what you suggested, could you please have a look at the following code and let me know whether or not I understood you correctly.

The problem that I am having now is when I am compiling the UDF it is giving me the error message: "Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).nnThe system cannot find the file specified.


Error Object: #f"

Due to this error I am unable to test the code to see for myself if it is doing the job. And I should mention that if I exclude this UDF the rest of my UDF's are compiling and running absolutely fine. 

I would rather test the code with DEFINE_ON_DEMAND, however that UDF offers no pointer to the tracked particle. Can you give me an idea how I could perhaps resolve that issue?
I really appreciate your help!